You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
== null on a non-nullable collection property parses, then can fail in EF Core #211
== null and != null on a collection property parse with no error. When the collection is a projection of a navigation, EF Core cannot translate the comparison, and the query throws when it runs. In an API, the client gets a 500 for a filter that QueryKit accepted.
InvalidOperationException: "The LINQ expression 'DbSet() .ToList() == null)' could not be translated."
Permissions != null
The same
Permissions #== 0
SQL OK
Why not refuse it on every collection
== null on a collection is a supported behavior. FilterParser.cs:602-607 has its own branch for it. A collection that maps to a nullable column (a Postgres array, for example) translates == null, and the column can hold null. To refuse the comparison on every collection breaks those callers.
Proposal
Refuse == and != with null only when the collection property is not nullable. Read this with NullabilityInfoContext (.NET 6 and later):
List<string> Permissions (not nullable) refuses. It can never be null, so the comparison has no use. Throw a QueryKitParsingException, for example: "A collection property that is not nullable cannot compare with null. To find an empty collection, use #== 0."
List<string>? Tags (nullable) keeps the current behavior.
If the nullability is unknown (nullable reference types are off), keep the current behavior.
A downstream app now walks the parsed expression to find this comparison and returns a 400. Its operator sweep over each list finds the 500 when the check is off. The lists of that app use non-nullable collections, so this rule covers them.
changed the title [-]== null on a projected collection property parses, then fails in EF Core[/-][+]== null on a non-nullable collection property parses, then can fail in EF Core[/+]on Nov 1, 2026
Activity
[-]== null on a projected collection property parses, then fails in EF Core[/-][+]== null on a non-nullable collection property parses, then can fail in EF Core[/+]