Regression from first-class spans with overload picking #76443
Open
Description
opened on Dec 16, 2024
Version Used: 9.0.200.preview
Steps to Reproduce:
- Use
MemoryMarshal.Cast
with an array - Expect
Span<T>
overload, but getReadOnlySpan<T>
overload
using System;
using System.Runtime.InteropServices;
public class Class
{
public void Method()
{
double[] table = null!;
Span<ulong> dest = MemoryMarshal.Cast<double, ulong>(table);
}
}
Diagnostic Id:
error CS0029: Cannot implicitly convert type 'System.ReadOnlySpan' to 'System.Span'
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.
Activity