Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Nov 17, 2025

Fixes #37176 for EF 9.0 (see #37182 for 8.0 fix)

Description

C# 14 first-class spans causes MemoryExtensions.Contains instead of Enumerable.Contains to be resolved, forcing LINQ providers to identify the former in additional to the latter. In addition, .NET 10 introduced a 3-parameter overload to MemoryExtensions.Contains which accepts a comparer, that gets resolved in some situations. While we already backported support for MemoryExtensions.Contains to EF Core 8 and 9, to allow these versions to work with C# 14, we didn't backport a separate change to also support the new .NET 10 overload.

Customer impact

Customers upgrading to .NET 10 but staying on EF 8 or 9 start experiencing failures in some LINQ queries that use Contains. The common case is Contains over an enum array:

_ = await context.Blogs
    .Where(b => new SomeEnum[] { SomeEnum.One, SomeEnum.Too }.Contains(b.SomeEnum))
    .ToListAsync();

Customers upgrading to EF 10 are not affected.

How found

Multiple customers reported on 9.0

Regression

Partial: occurs only when upgrading to .NET 10 but keeping older EF 8 or 9.

Testing

Tested manually, as we don't have automated testing for .NET 10 on older EF versions.

Risk

Very low, targeted change that's very low-risk, and already well-tested in EF 10. Quirk added.

Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for me. (See questions in the 8.0 backport.)

@SamMonoRT SamMonoRT added this to the 9.0.x milestone Nov 17, 2025
@roji roji merged commit 51bd1bd into dotnet:release/9.0-staging Nov 19, 2025
7 checks passed
@roji roji deleted the FirstClassSpans9 branch November 19, 2025 06:01
@roji roji modified the milestones: 9.0.x, 9.0.12 Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants