Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: incorrect results when comparing result of FirstOrDefault of empty collection of ints to 0 #15864

Closed
maumar opened this issue May 30, 2019 · 0 comments · Fixed by #22282
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-3.0 type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented May 30, 2019

query:

ctx.Squads.Where(s => s.Name == "Kilo")
                    .Where(s => s.Members.Where(m => m.HasSoulPatch).Select(m => m.SquadId).FirstOrDefault() != 0).Select(s => s.Name)

we expect no results, but getting a result back. This is because the collection returns null and null semantics matches it as not 0.

For FirstOrDefault on non-nullable scalar we should probably wrap the call in a Coalesce(default)

@ajcvickers ajcvickers added this to the 3.0.0 milestone May 31, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, Backlog Jul 24, 2019
@smitpatel smitpatel removed the query label Sep 3, 2019
@smitpatel smitpatel self-assigned this Aug 28, 2020
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 28, 2020
@smitpatel smitpatel modified the milestones: Backlog, 5.0.0-rc1 Aug 28, 2020
smitpatel added a commit that referenced this issue Aug 28, 2020
Resolves #13669
Resolves #13680
Resolves #13787
Resolves #14901
Resolves #14902
Resolves #15864
Resolves #16104
@ghost ghost closed this as completed in #22282 Aug 28, 2020
ghost pushed a commit that referenced this issue Aug 28, 2020
Resolves #13669
Resolves #13680
Resolves #13787
Resolves #14901
Resolves #14902
Resolves #15864
Resolves #16104
@ajcvickers ajcvickers modified the milestones: 5.0.0-rc1, 5.0.0 Nov 7, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-3.0 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants