-
Notifications
You must be signed in to change notification settings - Fork 3
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
Process Span<>
/ReadOnlySpan<>
/.Contains()
cases in LINQ Expression
#328
Conversation
ReadOnlySpan<>.Contains()
case in LINQ espressionReadOnlySpan<>.Contains()
case in LINQ Expression
ReadOnlySpan<>.Contains()
case in LINQ ExpressionSpan<>
/ReadOnlySpan<>
/.Contains()
cases in LINQ Expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this is the best way to solve the issue. I believe it will behave worse than before the aforementioned compiler optimization.
Have you tried to discover the options to opt-out of it in some other way?
Or maybe we can file an issue to the .NET team for it?
Can these issues be related? dotnet/docs#43949, dotnet/roslyn#73743 or is it something else?
There is a breaking change in C# v14 though, seems to be potentially related too: https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%2010.md#spant-and-readonlyspant-overloads-are-applicable-in-more-scenarios-in-c-14-and-newer
If it's the case, maybe we should convert these args to IEnumerable
instead of calling ToArray
?
I agree that the solution is sub-optimal. My aim is make to make DO compatible with the new C# compilers. Yes, the issue seems related to the mentioned Roslyn/.NET issues. But I have not much of time to analyze details. And Yes, we can opt-out the |
It doesn't seem to be a good solution, but a dirty hack :) Actually, I really don't like it. It really doesn't solve a problem but potentially leads us to other similar bugs later, e.g. when new overloads will be introduced or/and preferred resolution order will be changed.
AFAIK |
It is unreal for us to solve all DO problems. Only some hotspots require increased attention. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the option is to prohibit preview compiler for a while. Dotnet 9 support ends 12 may 2026. Are we continue bumping dotnet version to 10 ?
It is very desirable to detect problems on early stage. And it is much easier to work when we have the Application compatible with all contemporary versions of .NET/compilers |
Maybe we can wait at least until the next main release? My gut tells me it can be fixed by someone soon and there will be no need to implement this PR at all. |
What do you mean as main release? |
I mean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, looks like the impact is not really big. However we should revert it as soon as possible if something changes.
To lower amount of noise. |
.NET9 C# compiler in
Preview
mode sometime generatesSpan<>
orReadOnlySpan<>.Contains()
instead ofIEnumerable.Contains()
call.for example in such case:
We should correctly process it.
In this fix, we just apply
.ToArray()
toReadOnlySpan<>