-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Test and document Span breaking changes #75079
Test and document Span breaking changes #75079
Conversation
@@ -0,0 +1,43 @@ | |||
# This document lists known breaking changes in Roslyn after .NET 8 all the way to .NET 9. |
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.
@@ -0,0 +1,43 @@ | |||
# This document lists known breaking changes in Roslyn after .NET 8 all the way to .NET 9. | |||
|
|||
## `Span` and `ReadOnlySpan` overloads are applicable in more scenarios in C# 14 and newer |
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.
Assert.Equal(y.AsSpan(), s); // workaround | ||
``` | ||
|
||
A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13, |
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.
Assert.Equal(y.AsSpan(), s); // workaround | ||
``` | ||
|
||
A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13, |
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.
might be raised because a new overload is applicable but there is no single best overload. | ||
|
||
The following example shows some ambiguities and possible workarounds. | ||
Note that another workaround is for API authors to use `OverloadResolutionPriorityAttribute`. |
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.
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.
Hm, that's true for the whole section, not just these ambiguity examples. It should be implied by "C# 14 introduces...". It feels weird to suggest this workaround explicitly, we want people to upgrade langversions, not stay on old versions.
``` | ||
|
||
A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13, | ||
and that can lead to `ArrayTypeMismatchException`s at runtime if you are using covariant arrays: |
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.
Test plan: #73445