[Mono-bugs] [Bug 80269][Wis] New - TypeBuilder.GetMethod returns null (should throw NotSupportedException)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Dec 15 16:42:36 EST 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 rolfkvinge at ya.com.

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

--- shadow/80269	2006-12-15 16:42:36.000000000 -0500
+++ shadow/80269.tmp.31086	2006-12-15 16:42:36.000000000 -0500
@@ -0,0 +1,60 @@
+Bug#: 80269
+Product: Mono: Class Libraries
+Version: 1.0
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: rolfkvinge at ya.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: TypeBuilder.GetMethod returns null (should throw NotSupportedException)
+
+MS throws NotSupportedException for the following code (Mono returns null):
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Text;
+
+namespace vbnc_bugs
+{
+	class Program
+	{
+		static void Main (string [] args)
+		{
+			AssemblyBuilder assembly = 
+AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("test"), 
+AssemblyBuilderAccess.RunAndSave);
+			ModuleBuilder module = assembly.DefineDynamicModule 
+("module");
+			TypeBuilder T = module.DefineType ("BaseObject");
+			TypeBuilder TDerived = module.DefineType 
+("VariableDeclaration", TypeAttributes.Class, T);
+			TypeBuilder List = module.DefineType ("BaseList", 
+TypeAttributes.Class);
+			List.DefineGenericParameters ("X");
+			List.SetParent (typeof (List<>).MakeGenericType 
+(List.GetGenericArguments ()));
+			TypeBuilder ListDerived = module.DefineType 
+("Nameables", TypeAttributes.Class);
+			ListDerived.DefineGenericParameters ("T");
+			Type derivedList = ListDerived.MakeGenericType 
+(ListDerived.GetGenericArguments ());
+			
+			MethodInfo method;
+			
+			Type [] paramTypes = new Type [1];
+			paramTypes [0] = TDerived;
+			method = derivedList.GetMethod ("Add");
+                  Console.WriteLine ("FAILED");
+		}
+	}
+}


More information about the mono-bugs mailing list