-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
UnsafeAccessorAttribute fails to access volatile field #109665
Comments
Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices |
Additionally, this does work in both .NET 8 and .NET 9 with NativeAOT publishing. |
I can repro it on osx-arm64 with .NET 9.0.0 and .NET 10.0.0-alpha.1.24553.1 ( |
This is likely because of runtime/src/coreclr/vm/prestub.cpp Line 1501 in 35d2780
It might be the case we should always ignore custom modifiers for fields. |
Yep, setting |
Looks like there isn't any need to update the generated getters. See #109694. |
Description
When trying to access
volatile string
private field throughUnsafeAccessorAttribute
,MissingFieldException
is thrown.Reproduction Steps
Expected behavior
The program output is
Bar
.Actual behavior
Regression?
No response
Known Workarounds
No response
Configuration
This seems to be broken both in .NET 8 and .NET 9 with CoreCLR runtime. Tested on Windows and macOS.
Other information
The question of modreqs/modopts came up in the original feature proposal and this was the answer (#81741 (comment)):
This originally came up in KirillOsenkov/MSBuildStructuredLog#834.
The text was updated successfully, but these errors were encountered: