You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Mono] FieldInfo.SetValue does not do an init check for readonly static fields #37903
The expected behavior is to throw a FieldAccessException (See #37849)
Note that Mono behavior here is different from CoreCLR - we can reset the field value multiple times.
(The two NoInlining methods are because we inline the value 0x123456789 when we JIT Test, so it's hard to observe that the second SetValue had an effect)
#97829 has better notes of what is going on with SetValue and a hint for how to fix it (using a check of the type initialization hash).
It looks like in this issue I thought there's work to be done in the JIT, too. But that needs to be verified (see the comment on 97829 about the stsfld outside a cctor
Activity
lambdageek commentedon Jun 22, 2020
Note we will have to do the work twice: once for mini and once for the interpreter.
SamMonoRT commentedon Jul 16, 2021
Moving to 7.0.0
lambdageek commentedon Feb 3, 2024
#97829 has better notes of what is going on with
SetValueand a hint for how to fix it (using a check of the type initialization hash).It looks like in this issue I thought there's work to be done in the JIT, too. But that needs to be verified (see the comment on 97829 about the
stsfldoutside a cctorlambdageek commentedon Jul 26, 2024
Closing in favor of #97829 which has better notes