Skip to content

fix:linq collections contain in C# 14#4039

Merged
Hawxy merged 3 commits into
JasperFx:masterfrom
StellaAlexis:fix/linq-collections-C#14
Dec 7, 2025
Merged

fix:linq collections contain in C# 14#4039
Hawxy merged 3 commits into
JasperFx:masterfrom
StellaAlexis:fix/linq-collections-C#14

Conversation

@StellaAlexis

Copy link
Copy Markdown
Contributor

When updating my project to .Net 10 and C# 14 I noticed that the linq collection expressions around contains were broken.
References on the change in C#14 can be foundhere

To validate the issue I changed the TargetFramework and LangVersion of LinqTests.csproj. That resulted in a bunch of the existing tests failing right away.
Suggesting a fix similar to how EnumerableContains is written. After the change all Linq tests are passing again.

@StellaAlexis StellaAlexis changed the title fix:linq collections contain in C#14 fix:linq collections contain in C# 14 Nov 29, 2025
@jeremydmiller

Copy link
Copy Markdown
Member

@StellaAlexis Can you add tests for this?

@StellaAlexis

Copy link
Copy Markdown
Contributor Author

@StellaAlexis Can you add tests for this?

@jeremydmiller what kind of additional tests do you want to see?
I figured reusing the test suite in place would be sufficient as in the master branch there are already 44 failures on the LinqTests. They just weren't flagged by the update to .net 10 as the project was hardcoded to C# 13.
The PR fixes all of the following failures.
LinqTests failures

@StellaAlexis

Copy link
Copy Markdown
Contributor Author

Noticed the failing tests. Assume that is because of the hardcoded .net 10 framework. Managed to also run the tests without it so removed that part.

@1sabelle

1sabelle commented Dec 2, 2025

Copy link
Copy Markdown

We're also affected by this. Temporary solution for us is to pin language version to C# 13 just as seems to have been the prior solution here. Nice to see a fix.

@Hawxy Hawxy force-pushed the fix/linq-collections-C#14 branch from df1d517 to f48dee3 Compare December 6, 2025 11:47
@Hawxy

Hawxy commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

I've updated linqtests to test against each langversion we support, so we can catch any ongoing issues in this space. This should be good to go in.

@Hawxy Hawxy merged commit d60919a into JasperFx:master Dec 7, 2025
3 checks passed
@jeremydmiller

Copy link
Copy Markdown
Member

Thanks @Hawxy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants