[Mono-bugs] [Bug 80253][Nor] New - TypeLoadException in Type.MakeGenericType

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Dec 13 13:34:43 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=80253

--- shadow/80253	2006-12-13 13:34:43.000000000 -0500
+++ shadow/80253.tmp.16457	2006-12-13 13:34:43.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 80253
+Product: Mono: Class Libraries
+Version: 1.0
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: rolfkvinge at ya.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: TypeLoadException in Type.MakeGenericType
+
+The following code throws a TypeLoadException in Mono, but it completes 
+successfully in MS:
+
+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 ("T");
+			TypeBuilder TDerived = module.DefineType("TDerived", 
+TypeAttributes.Class, T);
+			TypeBuilder List = module.DefineType ("List", 
+TypeAttributes.Class);
+			List.DefineGenericParameters("X");
+			List.SetParent 
+(typeof(List<>).MakeGenericType(List.GetGenericArguments ()));
+			TypeBuilder ListDerived = 
+module.DefineType("ListDerived", TypeAttributes.Class);
+			ListDerived.DefineGenericParameters ("X");
+			Type derivedList = 
+List.MakeGenericType(ListDerived.GetGenericArguments());
+			Console.WriteLine (derivedList.Name);
+		}
+	}
+}


More information about the mono-bugs mailing list