Bug 17649 - compile failed with Named parameters that is self-defined type(enum)
Summary: compile failed with Named parameters that is self-defined type(enum)
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-02-06 23:40 UTC by Nan Shi
Modified: 2014-02-17 04:12 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

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.

Related Links:
Status:
RESOLVED FIXED

Description Nan Shi 2014-02-06 23:40:05 UTC
Bug to report:
compile failed with Named parameters that is self-defined type(enum)

It failed on the second last parameter. And I notice, it is ok for the very last named parameter, which is string type.
codes below have passed with Visual Studio 10

redhat 6.1 x86_64bit/mono 3.2.6

My method Definition as:
 private TRS000Model ReadFromDatabaseTRS000(string ThisFuncs, string BackendRoutine, int BackendScreens, string RoutineFields, string RoutineData, string RoutineTable, string RoutineItem, SCREENSpecial SCREENSpecialParameter = SCREENSpecial.Default, string ParameterValue = "0")
        {}

My enum type as:
 public enum SCREENSpecial
    {
        Default = 0,
        ProvideOwner = 1,
        AttachedFiles = 2,
    }




Error track as 

/opt/mono/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
/opt/mono/lib/mono/4.0/System.Core.dll (Location of the symbol related to previous warning)
Internal compiler error at Controllers/TRS000Controller.cs(214,29):: exception caught while emitting MethodBuilder [TRS000Controller::ReadFromDatabaseTRS000]
Unhandled Exception:
System.ArgumentException: Constant does not match the defined type.
  at System.Reflection.Emit.ParameterBuilder.SetConstant (System.Object defaultValue) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Parameter.ApplyAttributes (System.Reflection.Emit.MethodBuilder mb, System.Reflection.Emit.ConstructorBuilder cb, Int32 index, Mono.CSharp.PredefinedAttributes pa) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ParametersCompiled.ApplyAttributes (IMemberContext mc, System.Reflection.MethodBase builder) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: Constant does not match the defined type.
  at System.Reflection.Emit.ParameterBuilder.SetConstant (System.Object defaultValue) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Parameter.ApplyAttributes (System.Reflection.Emit.MethodBuilder mb, System.Reflection.Emit.ConstructorBuilder cb, Int32 index, Mono.CSharp.PredefinedAttributes pa) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ParametersCompiled.ApplyAttributes (IMemberContext mc, System.Reflection.MethodBase builder) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
/opt/mono/lib/mono/4.0/Microsoft.CSharp.targets: error : Compiler crashed with code: 1.
Task "Csc" execution -- FAILED
Comment 1 Marek Safar 2014-02-17 04:12:33 UTC
I cannot reproduce the issue with mono 3.2.7