DateTime crash with LLVM option enabled Xamarin Android

Since May 2017 after some updates to Mono framework or Xamarin.Android in release my application starts crashing on startup with exception:

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
[mono-rt] Parameter name: months
[mono-rt]   at System.DateTime.AddMonths (System.Int32 months) <0x9b1221bc + 0x00180> in <6ff49381e71f4f5aa1e7fc73c309a12a>:0 

Without LLVM options in release build settings, it works fine.

Seems like a problem with DateTime constructor: new DateTime(2010, 1, 1, 0,0,0);
it returns MaxDate. Offcourse after it any method like AddMonth will cause an exception.

We use core project as a library to work with dates, which connects to an android project as plain .dll.

Probably the problem occurs when android project passes the DateTime object to dll project method.

The Similiar bug here:
https://bugzilla.xamarin.com/show_bug.cgi?id=55495

Tagged:
Sign In or Register to comment.