[Mono-bugs] [Bug 62237][Nor] New - NullReferenceException in System.Reflection.Emit.TypeBuilder:CreateType when creating Enums
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 1 Aug 2004 18:57:58 -0400 (EDT)
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 hotchica75893@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=62237
--- shadow/62237 2004-08-01 18:57:58.000000000 -0400
+++ shadow/62237.tmp.16514 2004-08-01 18:57:58.000000000 -0400
@@ -0,0 +1,83 @@
+Bug#: 62237
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: hotchica75893@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: NullReferenceException in System.Reflection.Emit.TypeBuilder:CreateType when creating Enums
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+NullReferenceException in System.Reflection.Emit.TypeBuilder:CreateType
+when creating Enums
+
+Steps to reproduce the problem:
+
+1. create testcase.cs:
+---------------------------------------------------
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Threading;
+
+class Testcase {
+ public static void Main() {
+ AssemblyName assemblyName = new AssemblyName();
+ assemblyName.Name = "MyAssembly";
+ AssemblyBuilder assemblyBuilder =
+Thread.GetDomain().DefineDynamicAssembly(assemblyName,
+AssemblyBuilderAccess.RunAndSave);
+ ModuleBuilder moduleBuilder =
+assemblyBuilder.DefineDynamicModule(assemblyName.Name + ".dll",
+assemblyName.Name + ".dll", false);
+ TypeBuilder typeBuilder = moduleBuilder.DefineType("MyClass",
+TypeAttributes.Public);
+ EnumBuilder enumBuilder = moduleBuilder.DefineEnum("MyEnum",
+TypeAttributes.Public, typeof(int));
+ typeBuilder.DefineField("myField", enumBuilder, FieldAttributes.Private);
+ typeBuilder.CreateType();
+ enumBuilder.CreateType();
+ assemblyBuilder.Save(assemblyName.Name + ".dll");
+ }
+}
+---------------------------------------------------
+2. mcs testcase.cs
+3. mono testcase.exe
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in (unmanaged) (wrapper managed-to-native)
+System.Reflection.Emit.TypeBuilder:create_runtime_class
+(System.Reflection.Emit.TypeBuilder)
+in <0x00004> (wrapper managed-to-native)
+System.Reflection.Emit.TypeBuilder:create_runtime_class
+(System.Reflection.Emit.TypeBuilder)
+in <0x00332> System.Reflection.Emit.TypeBuilder:CreateType ()
+in <0x00154> Testcase:Main ()
+
+
+Expected Results:
+
+No exception.
+
+How often does this happen?
+
+Always.
+
+Additional Information:
+
+Using latest Mono version from
+http://mono2.ximian.com/archive/1.0/fedora-2-i386/