[Mono-bugs] [Bug 80396][Nor] New - EnumBuilder.DefineLiteral does not set FieldAttributes.RTSpecialFlag
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Dec 29 10:27:25 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=80396
--- shadow/80396 2006-12-29 10:27:25.000000000 -0500
+++ shadow/80396.tmp.26342 2006-12-29 10:27:25.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 80396
+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: EnumBuilder.DefineLiteral does not set FieldAttributes.RTSpecialFlag
+
+Test case:
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Text;
+
+class vbnc_bugs
+{
+
+ static void Main (string [] args)
+ {
+ AssemblyBuilderAccess access =
+AssemblyBuilderAccess.RunAndSave;
+ TypeAttributes attribs = TypeAttributes.Public;
+
+ AppDomain domain = AppDomain.CurrentDomain;
+ AssemblyName name = new AssemblyName ("a");
+ AssemblyBuilder assembly = domain.DefineDynamicAssembly
+(name, access);
+ ModuleBuilder module = assembly.DefineDynamicModule ("m",
+"test.dll");
+ EnumBuilder E = module.DefineEnum ("AnEnum", attribs,
+typeof (int));
+ E.DefineLiteral ("first", 1);
+ E.CreateType ();
+ FieldInfo value = E.GetField ("value__",
+BindingFlags.Instance | BindingFlags.NonPublic);
+ if ((value.Attributes & FieldAttributes.RTSpecialName) ==
+0)
+ Console.WriteLine ("FAILED");
+ else
+ Console.WriteLine ("SUCCESS");
+ }
+}
+
+Proposed patch:
+Index: EnumBuilder.cs
+===================================================================
+--- EnumBuilder.cs (revision 69875)
++++ EnumBuilder.cs (working copy)
+@@ -161,7 +161,7 @@
+ {
+ FieldBuilder fieldBuilder = _tb.DefineField
+(literalName,
+ _underlyingType, (FieldAttributes.Literal |
+- (FieldAttributes.Static |
+FieldAttributes.Public)));
++ (FieldAttributes.Static |
+FieldAttributes.Public | FieldAttributes.RTSpecialName)));
+ fieldBuilder.SetConstant (literalValue);
+ return fieldBuilder;
+ }
More information about the mono-bugs
mailing list