-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Regression from first-class spans with overload picking #76443
Comments
Forcing the call to use the |
If this is intended as a breaking change, that’s fine with me (I’ve already fixed the code). It just isn’t documented as one. |
This is an expected breaking change. ReadOnlySpan is now preferred over Span to avoid ArrayTypeMismatchExceptions that would occur at runtime if you used covariant arrays.
That PR doesn't fix it, it makes it broader in fact, per LDM discussion linked above.
I will open a PR to document the break, thanks. |
@jjonescz why is the rule applied to all arrays, and not just those that could possibly be covariant? Converting from |
That wasn't discussed but I suspect the LDT wouldn't be in favor of complicating the rules like that. |
Version Used: 9.0.200.preview
Steps to Reproduce:
MemoryMarshal.Cast
with an arraySpan<T>
overload, but getReadOnlySpan<T>
overloadhttps://sharplab.io/#v2:EYLgtghglgdgNAExAagD4AEBMBGAsAKHQAYACdbAOgCUBXGAFyjAFMKBJB5gJwHsAHAMrcAblADGzAM4BuAgXQBmMphIBhADYRJkggG8CJQ2SXoALCQCyzegAseCABQBKA0f34jnkgh41g65gBtAF0Segh/ZhIAXhIYGnV1AEJZDy9DAT4IGAAeBJ4YAHMAPm8pehjLZjAeLgBPCwguSRsIdQpVLXocnz8AuBJ8ouKHcMinVM8AXwIpoA===
Diagnostic Id:
Expected Behavior:
The
Span<T>
overload is used, as it was on .NET 8 and .NET 9 RC2.Actual Behavior:
The
ReadOnlySpan<T>
overload is used instead.The text was updated successfully, but these errors were encountered: