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/9.0-staging] Transform Span-based overloads to Enumerable in funcletizer #35719

Merged
merged 1 commit into from
Mar 5, 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 9.0 to ensure these users aren't affected.

Customer impact

Some very basic query patterns will start failing when trying to use EF Core 9.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 9.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:25
@roji roji force-pushed the SpanOverloads9 branch from 05e11e2 to 1a2ea64 Compare March 3, 2025 22:38
@roji roji force-pushed the SpanOverloads9 branch from 1a2ea64 to 42d10b3 Compare March 4, 2025 19:22
@roji roji enabled auto-merge (squash) March 4, 2025 19:22
@roji
Copy link
Member Author

roji commented Mar 5, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@roji roji merged commit 67f52d8 into dotnet:release/9.0-staging Mar 5, 2025
7 checks passed
@roji roji deleted the SpanOverloads9 branch March 5, 2025 07:22
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