Search Issue Tracker
Fixed in 2021.1.X
Fixed in 2019.4.X, 2020.3.X
System.DateTime causes ArgumentOutOfRangeException in Windows Standalone Player with "Thai" Windows system language
How to reproduce:
1. Open the attached project
2. Build the project
3. Make sure your Windows system language is set to "Thai"
4. Run the build
Actual result: ArgumentOutOfRangeException gets thrown when trying to get the System.DateTime.
Reproducible with: 2019.3.0a5, 2019.2.0b5, 2019.1.5f1, 2018.3.14f1, 2018.2.21f1.
Reproducible only with IL2CPP backend.
2018.2 and 2018.3 sometimes show the wrong DateTime and no issues appear. (Date should be 543 years ahead of the Gregorian calendar).
But if Unity tries to show the right DateTime it crashes on C++ Runtime Error.
Apr 21, 2022 08:41
As an alternative to linker file (where you specify that u want all calendars in your build) u can somewhere in your code reference required calendars. That will prevent stripping.
For example call something easy as that
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [Android] Text input field doesn't disappear when pressing "Enter" on the keyboard connected to a device and HideMobileInput is disabled
- WebGL Player flickers and logs warnings when viewport is resized and "Linear" Color Space is used
- Rigidbody recalculates its center of mass when moving its child Trigger Collider
- Sprites with different indexes than indicated in Text field of Label Inspector are being rendered
- VFX rendering a sphere when using a custom mesh
Resolution Note (fix version 2021.1):
Fixed in 2021.1.0a1
For older releases:
In order to use the Thai locale, the System.Globalization.ThaiBuddhistCalendar type must be included in the build. This type is referenced in the class library code via reflection, so it will be removed by the managed code stripping process by default. (Not that managed code stripping is enabled for IL2CPP and disabled for Mono by default, hence the difference in behavior).
Use a link.xml file (in the Assets directory of the project) with the following content to correct this issue:
<type fullname="System.Globalization.ThaiBuddhistCalendar" preserve="all"/>
Note that this same issue could happen with System.Globalization.UmAlQuraCalendar and System.Globalization.HijriCalendar
More details about managed code stripping are available here: https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html.
Resolution Note (fix version 2020.3):
Fixed in 2020.3.26f1
Resolution Note (fix version 2019.4):
Fixed in 2019.4.35f1