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
Commit 1761c68
Browse filesBrowse the repository at this point in the historyBrowse files
.Net: [MEVD] Support MemoryExtensions.Contains in LINQ filters (#13263)
This makes the provider filters compatible with C# 14 (see #12504, and
dotnet/runtime#109757 on the runtime side).
Note that this changes the entire repo to build with dotnet SDK 10.0
(rc2) - that's probably a good idea regardless to test with the latest,
ensure compatibility etc. (but if this is problematic, let me know -
it's only truly necessary for test coverage and can be reverted).
I'm not happy to have the implementation duplicated across the
implementations: we have FilterTranslationPreprocessor for common LINQ
filter preprocessing, and that would be the ideal place for this.
However, rewriting MemoryExtensions.Contains to Enumerable.Contains
would require doing MethodInfo.MakeGenericMethod which is incompatible
with NativeAOT. I considered have a fake, non-invocable MethodInfo
implementation to represent the closed generic MethodInfo to
Enumerable.Contains (MethodInfo and Type are abstract, so we can create
custom implementations compatible with NativeAOT), but that's quite
involved/complicated. The better story here is probably to have a base
class implementation for the provider filter processors, which
recognizes specific patterns and dispatches to abstract handlers which
specific implementations override; it would take care of recognizing the
various Contains variants.
Note also that we already have duplication around Enumerable.Contains
and List.Contains (the instance method), so this just adds another
variant (for now). I'll think about cleaning this up.
Fixes #12504
0 commit comments