Bug 55495 - Crash in DateTimeOffset constructor when LLVM optimizing compiler is enabled
Summary: Crash in DateTimeOffset constructor when LLVM optimizing compiler is enabled
Status: RESOLVED DUPLICATE of bug 52548
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 7.2 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2017-04-22 19:47 UTC by softlion
Modified: 2017-04-24 09:58 UTC (History)
2 users (show)

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


Attachments
Full Log (33.57 KB, text/plain)
2017-04-22 19:50 UTC, softlion
Details


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 DUPLICATE of bug 52548

Description softlion 2017-04-22 19:47:54 UTC
repro:
======
Create an android application.
Add this code to your main activity's oncreate, or anywhere you like:

    var epochTime = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);

Compile in release mode, enable AOT and LLVM compiler.
Deploy on an Android 7.1.1 device (also tryed on 5.0, 5.1 and 4.4 simulators with same exception)


Exception in android log:
04-22 21:43:17.821 23906 23906 I MonoDroid: UNHANDLED EXCEPTION:
04-22 21:43:17.838 23906 23906 I MonoDroid: System.TypeInitializationException: The type initializer for 'System.DateTimeOffset' threw an exception. ---> System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
04-22 21:43:17.838 23906 23906 I MonoDroid: Parameter name: offset
04-22 21:43:17.838 23906 23906 I MonoDroid:   at System.DateTimeOffset.ValidateDate (System.DateTime dateTime, System.TimeSpan offset) [0x00036] in <915e992818db4d4a8f1737584c99c3a4>:0
04-22 21:43:17.838 23906 23906 I MonoDroid:   at System.DateTimeOffset..cctor () <0x5714e2bc + 0x0009f> in <915e992818db4d4a8f1737584c99c3a4>:0


Full log:
(see attachment)



The same code works fine if the LLVM optimizing compiler is disabled:
==
LLVM optimizing compiler disabled
AOT enabled
Multidex enabled
Full link enabled
Bundle assemblies into native code enabled
==
04-22 20:14:12.312  4084  4098 I art     : Background sticky concurrent mark sweep GC freed 9899(435KB) AllocSpace objects, 7(556KB) LOS objects, 2% free, 9MB/9MB, paused 6.055ms total 54.812ms
04-22 20:14:12.335 17879 17879 I art     : Starting a blocking GC AddRemoveAppImageSpace
04-22 20:14:12.359 17879 17879 I MultiDex: VM with version 2.1.0 has multidex support
04-22 20:14:12.359 17879 17879 I MultiDex: install
04-22 20:14:12.359 17879 17879 I MultiDex: VM has multidex support, MultiDex support library is disabled.
04-22 20:14:12.369  4145  4145 W SearchService: Abort, client detached.
04-22 20:14:12.427 17879 17879 W monodroid: Trying to load sgen from: /data/app/xx.xxxxxx.xxxxx-1/lib/arm/libmonosgen-2.0.so
04-22 20:14:12.707 17879 17879 W monodroid-gc: GREF GC Threshold: 46080
04-22 20:14:12.719 17879 17879 W monodroid: Calling into managed runtime init
Comment 1 softlion 2017-04-22 19:50:24 UTC
Created attachment 21719 [details]
Full Log
Comment 2 Zoltan Varga 2017-04-24 09:58:40 UTC

*** This bug has been marked as a duplicate of bug 52548 ***
Comment 3 Zoltan Varga 2017-04-24 09:58:56 UTC
This will be fixed in 15.2.