[Mono-bugs] [Bug 71299][Min] New - EnumBuilder.GuidType should be set.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 14 Jan 2005 19:12:30 -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 miguel@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=71299
--- shadow/71299 2005-01-14 19:12:30.000000000 -0500
+++ shadow/71299.tmp.14234 2005-01-14 19:12:30.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 71299
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: miguel@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: EnumBuilder.GuidType should be set.
+
+The following program should display no output:
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class X {
+ private static string _assemblyName =
+"MonoTests.System.Reflection.Emit.EnumBuilder";
+ private static string _moduleName = "EmittedModule";
+ private static string _enumNamespace = "MyNameSpace";
+ private static string _enumName = "MyEnum";
+ private static Type _enumType = typeof(Int32);
+ private static string _fieldName = "MyField";
+ private static object _fieldValue = 1;
+ private static AssemblyName GetAssemblyName ()
+ {
+ AssemblyName assemblyName = new AssemblyName ();
+ assemblyName.Name = _assemblyName;
+ return assemblyName;
+ }
+ private static AssemblyBuilder GenerateAssembly ()
+ {
+ return AppDomain.CurrentDomain.DefineDynamicAssembly (GetAssemblyName
+(), AssemblyBuilderAccess.RunAndSave);
+ }
+
+ private static ModuleBuilder GenerateModule ()
+ {
+ AssemblyBuilder assemblyBuilder = GenerateAssembly ();
+ return assemblyBuilder.DefineDynamicModule (_moduleName);
+ }
+
+ private static ModuleBuilder GenerateModule (AssemblyBuilder assemblyBuilder)
+ {
+ return assemblyBuilder.DefineDynamicModule (_moduleName);
+ }
+
+ private static EnumBuilder GenerateEnum ()
+ {
+ ModuleBuilder modBuilder = GenerateModule ();
+ return modBuilder.DefineEnum (_enumNamespace + "." + _enumName,
+TypeAttributes.Public, _enumType);
+ }
+
+ static void Main ()
+ {
+ EnumBuilder enumBuilder = GenerateEnum ();
+ enumBuilder.CreateType ();
+ if (enumBuilder.GUID == Guid.Empty)
+ Console.WriteLine ("Fail");
+ }
+}