[Mono-bugs] [Bug 73543][Nor] New - infinite loop on TypeBuilder.GetEvents()

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 10 Mar 2005 04:17:38 -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 atsushi@ximian.com.

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

--- shadow/73543	2005-03-10 04:17:38.000000000 -0500
+++ shadow/73543.tmp.5390	2005-03-10 04:17:38.000000000 -0500
@@ -0,0 +1,72 @@
+Bug#: 73543
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: infinite loop on TypeBuilder.GetEvents()
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Once CreateType() is invoked, TypeBuilder.GetEvents() results in infinite
+loop. See example below:
+
+--------
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class Test
+{
+	public static void Main ()
+	{
+		AssemblyName an = new AssemblyName ();
+		an.Name = "hogeasm";
+		AssemblyBuilder ab = 
+			AppDomain.CurrentDomain.DefineDynamicAssembly (an,
+				AssemblyBuilderAccess.Save);
+		ModuleBuilder mb = ab.DefineDynamicModule ("hogeasm");
+		TypeBuilder tb = mb.DefineType ("MyInterface",
+			TypeAttributes.Interface |
+			TypeAttributes.Public |
+			TypeAttributes.Abstract);
+		tb.DefineEvent ("MyEvent", EventAttributes.None,
+			typeof (EventHandler));
+		tb.CreateType ();
+
+		BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic
+			| BindingFlags.Instance | BindingFlags.Static;
+
+		EventInfo [] events = tb.GetEvents (bf);
+		Console.WriteLine (events.Length);
+		if (events.Length > 0)
+			Console.WriteLine (events [0].Name);
+	}
+}
+
+
+Actual Results:
+
+mono silently breaks up (Try mono --trace too).
+
+Expected Results:
+
+Output following lines :
+1
+MyEvent
+
+How often does this happen? 
+
+Consistently.