Skip to content
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

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

Open
ptasz3k opened this issue Jun 23, 2021 · 2 comments
Open
Labels

Comments

@ptasz3k
Copy link

ptasz3k commented Jun 23, 2021

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.
@jonsequitur
Copy link
Owner

This happens because what appears to be a local variable in C# scripting is implemented as a field.

@jonsequitur jonsequitur changed the title Creating variable of Span<> type results in CS8345 error [EXTERNAL] Creating variable of Span<> type results in CS8345 error Jun 24, 2021
@jonsequitur
Copy link
Owner

Here's the related issue in Roslyn: dotnet/roslyn#40213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants