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
EF Core 11 rewrites RangeSet.Contains into Queryable.Contains over the range type and throws ArgumentException #287
RangeSet<TRange, T> is an IReadOnlyList<TRange>. EF Core 11 (dotnet/efcore#37081, PR 37390) normalizes every method named Contains on an IReadOnlyCollection<T> into Queryable.Contains<T>(AsQueryable(obj), arg) before any translator runs, with T the collection's element type, TRange. set.Contains(T value) and set.Contains(RangeSet) then fail inside EF Core:
System.ArgumentException: Expression of type 'System.DateOnly' cannot be used for parameter of type 'CodoMetis.ValueRanges.DateRange' of method 'Boolean Contains[DateRange](IQueryable`1[DateRange], DateRange)'
at Microsoft.EntityFrameworkCore.Query.Internal.QueryableMethodNormalizingExpressionVisitor.TryConvertCollectionContainsToQueryableContains
On net11.0 / EF Core 11 RC1 this fails QueryTranslationTests.RangeSet_Contains_*, ExecutedQueryTests.MultirangeComparisons_MatchInMemory, MultirangeCoverageTests, the InfinityDisabled extremes test and the NodaTime YearMonthRangeSet tests: every RangeSet.Contains in a query throws. Loud, not silent.
The same change was merged into release/10.0 on 2026-10-02 (dotnet/efcore#39114) and is not in EF Core 10.0.13; the 10.x line meets it with the first EF Core 10 patch that carries it (see the 10.x issue).
Change
The query interceptor rewrites the three instance overloads into static methods on RangeSetContains, whose declaring type is not a collection, and the method call translator translates that form to @> exactly as the instance call. Public API unchanged.
Activity
fix: keep RangeSet.Contains out of EF Core's rewrite of Contains on a…