Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.
Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.
Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.
Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.
(follow up for https://bugzilla.xamarin.com/show_bug.cgi?id=58291) Tried this with commit 632c5e8e1cd3f5c977d370a6b7f1fcb3319d566e in the Mono repository (branch: 2017-08) If we try to iterate the fields (reflection) of a class that is using an enum compiled with Mono.CSharp.dll, we get an exception: System.TypeLoadException: Field 'MyEnumParameter' is an enum type with a bad underlying type at (wrapper managed-to-native) System.RuntimeType:GetFields_native (System.RuntimeType,intptr,System.Reflection.BindingFlags) at System.RuntimeType.GetFields_internal (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType reflectedType) [0x0001a] in <8bab4e9291ac48d3a5b37cf4064ebe75>:0 at System.RuntimeType.GetFieldCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean allowPrefixLookup) [0x0000f] in <8bab4e9291ac48d3a5b37cf4064ebe75>:0 at System.RuntimeType.GetFields (System.Reflection.BindingFlags bindingAttr) [0x00000] in <8bab4e9291ac48d3a5b37cf4064ebe75>:0
Michael, could you share a repro with me?
Created attachment 25069 [details] Repro I've attached Repro.cs, compiling and running it with Mono 5.4.0.199 (beta) results in this exception: System.TypeLoadException: Field 'test' is an enum type with a bad underlying type at (wrapper managed-to-native) System.RuntimeType:GetCorrespondingInflatedConstructor (System.RuntimeType,System.Reflection.ConstructorInfo) at System.RuntimeType.GetConstructor (System.Reflection.ConstructorInfo fromNoninstanciated) [0x00014] in <75ffaf6443f740858d084c45da3fa568>:0 at System.Reflection.Emit.ConstructorBuilder.RuntimeResolve () [0x0000b] in <75ffaf6443f740858d084c45da3fa568>:0 at System.Reflection.Emit.ModuleBuilder.RuntimeResolve (System.Object obj) [0x0001c] in <75ffaf6443f740858d084c45da3fa568>:0 at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x00038] in <ac7d30b6a6cd402fa5b7a6440c56ef0b>:0 at Mono.CSharp.Evaluator.Evaluate (System.String input) [0x00000] in <ac7d30b6a6cd402fa5b7a6440c56ef0b>:0 at ConsoleApplication.Program.Main (System.String[] args) [0x0003b] in <7d62945435874bf4878f06e4908c4604>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Field 'test' is an enum type with a bad underlying type at (wrapper managed-to-native) System.RuntimeType:GetCorrespondingInflatedConstructor (System.RuntimeType,System.Reflection.ConstructorInfo) at System.RuntimeType.GetConstructor (System.Reflection.ConstructorInfo fromNoninstanciated) [0x00014] in <75ffaf6443f740858d084c45da3fa568>:0 at System.Reflection.Emit.ConstructorBuilder.RuntimeResolve () [0x0000b] in <75ffaf6443f740858d084c45da3fa568>:0 at System.Reflection.Emit.ModuleBuilder.RuntimeResolve (System.Object obj) [0x0001c] in <75ffaf6443f740858d084c45da3fa568>:0 at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x00038] in <ac7d30b6a6cd402fa5b7a6440c56ef0b>:0 at Mono.CSharp.Evaluator.Evaluate (System.String input) [0x00000] in <ac7d30b6a6cd402fa5b7a6440c56ef0b>:0 at ConsoleApplication.Program.Main (System.String[] args) [0x0003b] in <7d62945435874bf4878f06e4908c4604>:0
https://github.com/mono/mono/pull/5754
Fixed in master