[Mono-bugs] [Bug 75454][Nor] Changed - [GMCS] NullRef inside BindGenericParameters when using Type from CreateType ()

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jul 11 13:13:01 EDT 2005


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 nazgul at omega.pl.

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

--- shadow/75454	2005-07-11 12:25:31.000000000 -0400
+++ shadow/75454.tmp.28381	2005-07-11 13:13:01.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 75454
 Product: Mono: Runtime
 Version: 1.0
 OS: unknown
 OS Details: mono svn
-Status: RESOLVED   
-Resolution: FIXED
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: misc
 AssignedTo: martin at ximian.com                            
 ReportedBy: nazgul at omega.pl               
 QAContact: mono-bugs at ximian.com
@@ -97,6 +97,67 @@
 created type also working, since some MS.NET bugs are triggered when using
 original TypeBuilder. I hope there is no reason why
 GetGenericTypeDefinition or BindGenericParameters should not work...
 
 ------- Additional Comments From martin at ximian.com  2005-07-11 12:25 -------
 Fixed in SVN.
+
+------- Additional Comments From nazgul at omega.pl  2005-07-11 13:13 -------
+One more thing... When I change assembly attribute to Save only, it
+crashes again:
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class M {
+         static void Main () {
+            /// INITIAL ASSEMBLY CREATION
+            AssemblyName name = new AssemblyName();
+            name.Name = "o";
+            AssemblyBuilder builder =
+AppDomain.CurrentDomain.DefineDynamicAssembly(name,
+AssemblyBuilderAccess.Save);
+            ModuleBuilder mb = builder.DefineDynamicModule("out",
+"bla.dll");
+            ///////////
+
+           
+            /// abstract class Func ['a]
+            /// { public abstract apply () : 'a; }
+            TypeBuilder func = mb.DefineType("Func",
+TypeAttributes.Abstract);
+            GenericTypeParameterBuilder[] func_gp =
+func.DefineGenericParameters("'a");
+            func.SetParent(typeof (object));
+
+            MethodBuilder func_apply = func.DefineMethod("apply",
+MethodAttributes.Public | MethodAttributes.Abstract |
+MethodAttributes.Virtual,
+                 func_gp[0], new Type[] { });
+
+            Type func_c = func.CreateType();
+
+            /// class Prox : Func[string] {
+            /// } 
+
+            // this causes NullRef in BindGenericParameters
+            Type func_string = func_c.MakeGenericType(new Type [] {
+typeof(string)});
+
+            // and this causes InvalidOperation in
+GetGenericTypeDefinition()
+            //Type func_string = func_c.GetGenericTypeDefinition
+().MakeGenericType(new Type [] { typeof(string)});
+
+            TypeBuilder prox = mb.DefineType("Prox",
+TypeAttributes.Public);
+            prox.SetParent(func_string);
+
+            prox.CreateType();
+
+            builder.Save("bla.dll");
+         }
+}
+
+
+


More information about the mono-bugs mailing list