Query: Nested Where->Count query crashes when done in two operations #9751
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
My real-life scenario is a DB with users and teams, where users have a reference to the team they are in; I'd like to get all teams T where the number of users in T is less than a certain number.
A simplified (hopefully minimal) repro is below - as you can see, doing this in one operation (
.Where(...).Count()
) works fine, but doing aSelect
first (which is convenient so I can get the object itself and not just the count of related objects) and then aCount
fails. But only if it's in aWhere
, using aSelect
with the same condition works fine. Also, the in-memory and SQLite providers differ in their error messages for one case, but not for a very close query that also returns an error.Steps to reproduce
Full repro, including queries that do not crash even though they're pretty close:
Further technical details
EF Core version: 2.0.0
Database Provider: InMemory and SQLite (I haven't tested with others)
Operating system: Windows 10 (15063.540)
IDE: VS 2017 15.3.3
The text was updated successfully, but these errors were encountered: