Bug 8276 - SIGABRT while building with bad default value for decimal parameter
Summary: SIGABRT while building with bad default value for decimal parameter
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-11-08 00:07 UTC by bobsson
Modified: 2012-11-08 08:38 UTC (History)
2 users (show)

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:

Description bobsson 2012-11-08 00:07:05 UTC
Description of Problem:

When you have a function in your solution which provides an improper default value for a decimal parameter, an error message stating "we can't encode valuetypes, we should have never reached this line" is generated during the build process, which then dumps out a full OSX stack trace and ends with:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Example function: public void Test(decimal t = 5) { }

Note that this function works perfectly:  public void Test(decimal t = 5m) { }

Steps to reproduce the problem:
1. Create a function which has a parameter of "decimal t = 5", such as the above function.
2. Build

Actual Results:

		Tool /Library/Frameworks/Mono.framework/Versions/2.10.9/bin/dmcs execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/x86/Debug/Scratchpad.exe Main.cs AssemblyInfo.cs SquareRoots.cs /target:exe /define:DEBUG /platform:x86 /reference:/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.dll /reference:/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Core.dll /warn:4
		we can't encode valuetypes, we should have never reached this line
		  at (wrapper managed-to-native) System.Reflection.Emit.TypeBuilder.create_runtime_class (System.Reflection.Emit.TypeBuilder,System.Reflection.Emit.TypeBuilder) <0xffffffff>
		  at System.Reflection.Emit.TypeBuilder.CreateType () <0x00417>
		  at Mono.CSharp.TypeContainer.CloseType () <0x0019b>
		  at Mono.CSharp.ModuleContainer.CloseType () <0x00080>
		  at Mono.CSharp.Driver.Compile () <0x0049e>
		  at Mono.CSharp.Driver.Main (string[]) <0x000af>
		  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Expected Results:

Either a build error (as I believe Visual Studio produces) or a successful build and run (as "t = 5;" works).

How often does this happen? 
Every build with the invalid value.

Additional Information:
Comment 1 Marek Safar 2012-11-08 08:38:50 UTC
Already fixed in Mono 3.0