dotnet-repl
dotnet-repl copied to clipboard
[EXTERNAL] Creating variable of Span<> type results in CS8345 error
Steps to duplicate:
var bytes = new byte[10];
Span<byte> span = bytes;
result:
(1,1): error CS8345: Field or auto-implemented property cannot be of type 'Span<byte>' unless it is an instance member of a ref struct.
This happens because what appears to be a local variable in C# scripting is implemented as a field.
Here's the related issue in Roslyn: https://github.com/dotnet/roslyn/issues/40213