Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82777 --- shadow/82777 2007-09-10 05:33:15.000000000 -0400 +++ shadow/82777.tmp.26038 2007-09-10 05:33:15.000000000 -0400 @@ -0,0 +1,64 @@ +Bug#: 82777 +Product: Mono: Runtime +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: Unknown +Priority: Normal +Component: misc +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Summary: Dynamic Methods bodies are not verified properly + +Description of Problem: + +The verifier doesn't respect the rules of visibility verification for +dynamic methods. The rules are readable here: + +http://msdn2.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx + +Steps to reproduce the problem: +Compile the following code: +using System; +using System.Reflection; +using System.Reflection.Emit; + +class Host { + + static string Field = "fubar"; +} + +class Program { + + delegate string Getter (); + + public static void Main () + { + DynamicMethod method = new DynamicMethod ("GetField", + typeof (string), new Type [0], Type.GetType ("Host")); + + ILGenerator il = method.GetILGenerator (); + il.Emit (OpCodes.Ldsfld, typeof (Host).GetField ( + "Field", BindingFlags.Static | BindingFlags.NonPublic)); + il.Emit (OpCodes.Ret); + + Getter g = (Getter) method.CreateDelegate (typeof (Getter)); + + Console.WriteLine (g ()); + } +} + + +Actual Results: +FieldAccessException + +Expected Results: +print fubar + +Additional Information: +The test case is not complete wrt the number of rules for dynamic methods. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
