-
Notifications
You must be signed in to change notification settings - Fork 89
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
Broken VariableLengthInlineArray<T>
after upgrade from 0.3.49-beta to 0.3.106
#1205
Comments
I can't repro the problem. Can you provide a minimal repro project? I couldn't repro even when targeting net5.0-windows as you mentioned. But FYI, we probably won't fix any bugs that are unique to that target framework, since the runtime itself is no longer supported by Microsoft. |
cswin32-issue1205-repro.zip |
Oh! In that case I suspect the issue is the .NET SDK version you're compiling with. Can you type |
MSBuild is using SDK version 6.0.203. |
Great. I got it by using the 6.0.423 SDK and C# lang version 9. Investigating further... |
The C# language version isn't what does it. It's just the compiler version. The compiler that ships in .NET SDK 6.0.x fails where .NET SDK 8's compiler works. I guess the older compiler didn't know how to respect the |
The internal ref T this[int index]
{
[UnscopedRef]
get => ref this.e0;
}
That is correct. The attribute was added in .NET 7 so the .NET 6 compiler doesn't attach any special meaning to it. From the perspective of .NET 6 compiler this method has no attribute and is a ref safety violation.
Think it would be better to look at the language version than compiler version. That is available through parse options on the source files. In this case the language version is 9.0 which doesn't support ref fields, Note: in November the .NET 6 SDK goes out of support and at that time all supported compilers will be able to use these attributes. This pattern might be tricky to emit in older compilers. |
With .NET Framework this also causes problems. If you don't include the latest
|
Actual behavior
Multiple build errors for
VariableLengthInlineArray<T>
:Expected behavior
The build succeeds.
Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Context
The text was updated successfully, but these errors were encountered: