[Mono-bugs] [Bug 75674][Maj] New - Iterators generated local access
to captured caught variables.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Jul 31 01:30:20 EDT 2005
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 miguel at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75674
--- shadow/75674 2005-07-31 01:30:20.000000000 -0400
+++ shadow/75674.tmp.7176 2005-07-31 01:30:20.000000000 -0400
@@ -0,0 +1,65 @@
+Bug#: 75674
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: martin at ximian.com
+ReportedBy: miguel at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Iterators generated local access to captured caught variables.
+
+The following program should display OK:
+
+using System;
+using System.Collections;
+
+class XX {
+ static void Metodo (Exception e)
+ {
+ if (e is NotImplementedException){
+ Console.WriteLine ("OK");
+ } else {
+ Console.WriteLine ("Fail");
+ }
+ }
+
+ static IEnumerable X ()
+ {
+ try {
+ throw new NotImplementedException ();
+ } catch (Exception e){
+ Metodo (e);
+ }
+ yield return 0;
+ }
+
+ static void Main ()
+ {
+ foreach (int a in X ()){
+ }
+ }
+}
+
+The problem is that the code generated for storing the Exception in the
+catch is:
+
+ catch [mscorlib]System.Exception { // 0
+ IL_0010: stloc.1
+ IL_0011: ldarg.0
+ IL_0012: ldfld class [mscorlib]System.Exception XX/'<X>__0'::e
+ IL_0017: call void class XX::Metodo(class
+[mscorlib]System.Exception)
+ IL_001c: leave IL_0022
+
+ } // end handler 0
+
+The `stloc' there is hardcoded somehwere, but it should store the data into
+the XX/<X>__0::e field instead of the local
More information about the mono-bugs
mailing list