Bug 4428 - Using new SqlDecimal(Decimal.MaxValue); causes Android application to crash.
Summary: Using new SqlDecimal(Decimal.MaxValue); causes Android application to crash.
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.1.x
Hardware: Macintosh Mac OS
: --- major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-13 14:10 UTC by Chris Hardy [MSFT]
Modified: 2012-04-24 10:18 UTC (History)
3 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 Developer Community or GitHub 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 NOT_ON_ROADMAP

Description Chris Hardy [MSFT] 2012-04-13 14:10:35 UTC
Application crashes when using: 

SqlDecimal MaxValue = new SqlDecimal(Decimal.MaxValue);
SqlDecimal MinValue = new SqlDecimal(Decimal.MinValue);

This works as expected in MonoTouch but crashes when using in Mono for Android (on Mono for Android 4.1).
Comment 1 Jonathan Pobst 2012-04-13 14:54:10 UTC
This does not crash for me.  Do you get any exceptions in the logcat?
Comment 4 Jonathan Pryor 2012-04-24 10:18:34 UTC
The actual reason is that the debug.mono.trace system property was set:

    # http://docs.xamarin.com/android/advanced_topics/diagnostics
    adb shell setprop debug.mono.trace all

When everything is traced, Mono generates the OverflowException when tracing the SqlDecimal static constructor. Disable tracing entirely, or only trace application-related namespaces, and the OverflowException is avoided.

In short, this is a JIT bug.

However, as per discussions with vargaz, because we have a Real Debugger™, and because the code is crummy, this bug is unlikely to be fixed anytime soon. In short, Don't Do That™.