Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-staging] Transform Span-based overloads to Enumerable in funcletizer #35720

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

roji
Copy link
Member

@roji roji commented Mar 3, 2025

Backports part of #35339
Fixes #35100

Description

C# 14 (currently in preview) is introducing first-class spans, which changes the Roslyn overload resolution to prefer Span-based overloads in some cases. Unfortunately, the newly selected overloads, which have Span parameters, are unsupported in EF since the LINQ expression tree interpreter is used internally, and it does not support ref structs.

This problem already been fixed for EF 10 in #35339. However, users on older of EF Core who switch to .NET 10/C# 14 will still hit this issue. This PR proposes backporting the fix to EF Core 8.0 to ensure these users aren't affected.

Customer impact

Some very basic query patterns will start failing when trying to use EF Core 8.0 with C# 14, e.g.:

var data = new[] { "Foo", "Bar" };
_ = await context.Blogs.Where(b => data.Contains(b.Name)).ToListAsync();

How found

Reported by users on 10.

Regression

Yes, in the combination of EF Core 8.0 and C# 14.

Testing

Older versions of EF aren't tested with later versions of C#/NET; manual testing was performed.

Risk

Very low - very targeted expression tree transformation; added quirk.

@roji roji requested a review from a team March 3, 2025 22:36
@roji roji force-pushed the SpanOverloads8 branch from fd5ccaf to aec3890 Compare March 3, 2025 22:39
@roji roji merged commit eeab918 into dotnet:release/8.0-staging Mar 4, 2025
7 checks passed
@roji roji deleted the SpanOverloads8 branch March 4, 2025 08:34
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.

2 participants