Search Issue Tracker
Fixed in 2021.1.X
Fixed in 2019.4.X, 2020.3.X
Votes
1
Found in
2018.3.0a1
2018.3.14f1
2019.1.0a1
2019.2.0a1
2019.3.0a1
Issue ID
1158527
Regression
No
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.
Notes:
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.
Comments (1)
-
IvanHomichkovWannaplay
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
new System.Globalization.ThaiBuddhistCalendar();
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android][BiRP] Depth processing is handled incorrectly on certain Android devices when using 2 camera's
- [APV] Cancelling Display Dialog Error is thrown after Adaptive Probe Volumes tab is open in Lighting Window
- [APV] NullReferenceException is thrown when baking Adaptive Probe Volume for a Terrain with Non-GI Contributing Tree Prototypes and multiple APV objects with different LayerMasks are present on the scene
- Hands are not recognized when using Hololens 2
- "OnTriggerExit2D" is called before "OnTriggerEnter2D" when object is destroyed immediately
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:
<linker>
<assembly fullname="mscorlib">
<type fullname="System.Globalization.ThaiBuddhistCalendar" preserve="all"/>
</assembly>
</linker>
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