[Mono-bugs] [Bug 430804] Static readonly field optimization doesn' t account for changes via reflection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 30 15:14:11 EDT 2008


User jonbnews at hotmail.com added comment

--- Comment #4 from Jon Burgoyne <jonbnews at hotmail.com>  2008-09-30 13:14:11 MDT ---
I disagree.  readonly fields can indeed be updated outside of the ctor/cctor as
shown in the test.  Using reflection to do the update is legitimate and is not
"working around" the system.  The .NET runtime will run the tests above with
the expected output.  I don't believe that the spec says anything about the
runtime behavior of readonly fields.  It only states the compile-time behavior.
 I believe the JIT is making the assumption that the field can't change once
it's initialized, which is an invalid assumption.  If the intent is to not
allow readonly fields to be changed after they're initialized, then I would
expect that trying to set them via reflection should fail.  Since setting them
via reflection succeeds, it's reasonable to assume that the update is picked up
by future references to that value.

I ask that you re-consider the validity of this issue.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list