[Mono-bugs] [Bug 78104][Cri] New - yield in 'using' statement cause gmcs compiler crashed

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Apr 14 05:52:28 EDT 2006


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 redforks at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78104

--- shadow/78104	2006-04-14 05:52:28.000000000 -0400
+++ shadow/78104.tmp.10592	2006-04-14 05:52:28.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 78104
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: windows xp, GNU/Linux (gentoo)
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: redforks at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: yield in 'using' statement cause gmcs compiler crashed
+
+Description of Problem:
+  When gmcs compile following c# code, gmcs will encounded Unhandled 
+Exception: 
+  Unhandled Exception: System.Exception: Trying to emit a local from a 
+different ILGenerator.
+  
+  mono versions: 1.1.13.4, 1.1.14.0
+
+
+Steps to reproduce the problem:
+1. save the t.cs to disk
+2. run gmcs t.cs
+
+
+Actual Results:
+Unhandled Exception
+
+Expected Results:
+Success
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+
+
+using System;
+using System.Collections;
+
+class NeedDispose: IDisposable
+{
+  public void Dispose() { }
+}
+
+public class IterTest : IEnumerable<string>
+{
+  public IEnumerator GetEnumerator()
+  {
+    using (new NeedDispose()) {
+      yield return "a";
+      yield return "b";
+    }
+  }
+  
+  public static void Main()
+  {
+    foreach (string s in new IterTest())
+      Console.WriteLine(s);
+  }
+}


More information about the mono-bugs mailing list