From eb63745bbe1d37c687e2d2250ae0f896e247a691 Mon Sep 17 00:00:00 2001 From: Alexis Christoforides Date: Tue, 18 Feb 2020 14:58:08 -0500 Subject: [PATCH] [mono] Improve how EnumBuilder handles type attributes 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/System/Reflection/Emit/EnumBuilder.Mono.cs | 2 +- .../src/System/Reflection/Emit/FieldBuilder.Mono.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs index 961ea6ad69c38..a8702782ff19d 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs @@ -57,7 +57,7 @@ internal EnumBuilder (ModuleBuilder mb, string name, TypeAttributes visibility, 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); } diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs index a16592e68a76b..2e9143f2e2c26 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs @@ -64,7 +64,7 @@ internal FieldBuilder (TypeBuilder tb, string fieldName, Type type, FieldAttribu if (type == null) throw new ArgumentNullException ("type"); - attrs = attributes; + attrs = attributes & ~FieldAttributes.ReservedMask; name = fieldName; this.type = type; this.modReq = modReq;