http://bugzilla.novell.com/show_bug.cgi?id=569405
http://bugzilla.novell.com/show_bug.cgi?id=569405#c0 Summary: Reflection isn't able to change static readonly fields. .NET difference Classification: Mono Product: Mono: Class Libraries Version: 1.2.0 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: CORLIB AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.3; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) I have a field: private static readonly MyClass s_class = new MyClass(1); I then do: var fieldInfo = this.GetType().GetField("s_class", BindingFlags.Static | BindingFlags.NonPublic); fieldInfo.SetValue(this, new MyClass(2)); On .Net s_class now refs the MyClass(2) instance while on mono it still refs the MyClass(1). I know this is horrible thing to do but I thought I would report the differnce. Attached sample program showing difference. Reproducible: Always Steps to Reproduce: 1. Compile and run attached program 2. 3. Actual Results: 1 1 Expected Results: 2 3 -- Configure bugmail: http://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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
