[Mono-bugs] [Bug 54814][Wis] New - Mono dies on mcs-generated try blocks inside iterators

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 24 Feb 2004 18:20:29 -0500 (EST)


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 jonpryor@vt.edu.

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

--- shadow/54814	2004-02-24 18:20:29.000000000 -0500
+++ shadow/54814.tmp.3456	2004-02-24 18:20:29.000000000 -0500
@@ -0,0 +1,82 @@
+Bug#: 54814
+Product: Mono/Compilers
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jonpryor@vt.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono dies on mcs-generated try blocks inside iterators
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Mono generates an error when executing code generated by mcs, which
+consists of an iterator function (something using "yield") containing a try
+block.
+
+Steps to reproduce the problem:
+
+1. Save the following code:
+
+	// File: yt.cs
+	using System;
+	using System.Collections;
+
+	public class Iterable {
+		public IEnumerator GetEnumerator ()
+		{
+			try {
+				yield return "foo";
+			}
+			catch {
+			}
+		}
+	}
+
+	public class R {
+		public static void Main (string[] args)
+		{
+			Iterable it = new Iterable ();
+			foreach (object o in it)
+				Console.WriteLine (o);
+		}
+	}
+
+2. Compile it:
+
+	$ mcs -v2 yt.cs
+
+3. Execute it:
+
+	$ mono yt.exe
+
+Actual Results:
+
+	** ERROR **: Invalid IL code at IL0024 in 
+		.__Proxy_0:System.IEnumerator.MoveNext (): IL_0024: ret
+ 
+ 
+	aborting...
+	Aborted
+
+Expected Results:
+
+	foo
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+Originally reported by Alan Jenkins on mono-devel-list on 2004-02-24.