[mono] Improve how EnumBuilder handles type attributes (#33389)
authorAlexis Christoforides <alexis@thenull.net>
Thu, 12 Mar 2020 10:53:47 +0000 (06:53 -0400)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 10:53:47 +0000 (06:53 -0400)
Literally copy set of attributes from https://github.com/dotnet/runtime/blob/dc62dd61071c239401ef6397a4d7ae29161d10a7/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs#L330

src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs
src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs

index 961ea6ad69c380be03e4b6c669949ff8a18bd384..a8702782ff19d877fde5405571dd9135bd1c2c4e 100644 (file)
@@ -57,7 +57,7 @@ namespace System.Reflection.Emit {
                                typeof(Enum), null, PackingSize.Unspecified, 0, null);
                        _underlyingType = underlyingType;
                        _underlyingField = _tb.DefineField ("value__", underlyingType,
-                               (FieldAttributes.SpecialName | FieldAttributes.Private | FieldAttributes.RTSpecialName));
+                               FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
                        setup_enum_type (_tb);
                }
 
index a16592e68a76b3fe256aa154ec1fe8b10c30d9fa..2e9143f2e2c26591b90f2c16aa988130eb763452 100644 (file)
@@ -64,7 +64,7 @@ namespace System.Reflection.Emit {
                        if (type == null)
                                throw new ArgumentNullException ("type");
 
-                       attrs = attributes;
+                       attrs = attributes & ~FieldAttributes.ReservedMask;
                        name = fieldName;
                        this.type = type;
                        this.modReq = modReq;