[Mono-bugs] [Bug 75649][Maj] New - Iterators do not capture event
fields.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jul 27 15:06:03 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=75649
--- shadow/75649 2005-07-27 15:06:03.000000000 -0400
+++ shadow/75649.tmp.26825 2005-07-27 15:06:03.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 75649
+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 do not capture event fields.
+
+The following program should display"
+
+"Hook invoked"
+
+Instead it displays:
+
+Unhandled Exception: System.Exception: error
+
+using System;
+using System.Collections;
+
+class X {
+ public event EventHandler Hook;
+
+ public IEnumerator Pipeline ()
+ {
+ if (Hook == null)
+ throw new Exception ("error");
+
+ Hook (this, EventArgs.Empty);
+
+ yield return 0;
+ }
+
+ static void M (object sender, EventArgs args)
+ {
+ Console.WriteLine ("Hook invoked");
+ }
+
+ static void Main ()
+ {
+ X x = new X ();
+ x.Hook += M;
+ IEnumerator y = x.Pipeline ();
+ y.MoveNext ();
+ }
+}
+
+It works with MS compiler.
More information about the mono-bugs
mailing list