jonsequitur / dotnet-repl

A polyglot REPL built on .NET Interactive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[EXTERNAL] Creating variable of Span<> type results in CS8345 error

ptasz3k opened this issue · comments

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: dotnet/roslyn#40213