Search Issue Tracker

By Design



Found in


Issue ID




[IL2CPP] ArgumentOutOfRangeException is thrown when using the .NET methods for formatting dates and attempting to format dates



To reproduce:

1. Download attached project "" and open in Unity
2. Open "SampleScene" scene
3. Build for iOS
4. Deploy the Xcode project to the iOS device
5. Observe that the following exception is thrown:

"ArgumentOutOfRangeException: Not a valid calendar for the given culture.
Parameter name: value"

- This issue appears on IL2CPP builds
- On Mono everything works fine

Tested with:
- iPhone 7s Plus iOS 12.0
- iPhone X iOS 12.1

Reproduced on Unity 2017.4.0f1, 2017.4.13f1, 2018.1.9f2, 2018.2.13f1, 2018.3.0b6 and 2019.1.0a6

  1. Resolution Note:

    Managed code stripping is removing the System.Globalization.UmAlQuraCalendar type from mscorlib. Sent a link.xml workaround to the user to preserve the affected calendar.

Comments (6)

  1. GameDevDavid

    Sep 08, 2020 19:26

    Fixed issue with this:

    <assembly fullname="mscorlib">
    <namespace fullname="System.Globalization" preserve="all"/>

    Probably this could be more aggressive and preserve only actual calendars. For my purpose it is fine.

    Types with "Calendar" in name before fix:
    - Calendar
    - CalendarData
    - CalendarId
    - GregorianCalendar
    - GregorianCalendarHelper
    - GregorianCalendarTypes
    - JapaneseCalendar
    - TaiwanCalendar

    Types with "Calendar" in name after fix:
    - PersianCalendar
    - Calendar
    - CalendarAlgorithmType
    - CalendarData
    - CalendarWeekRule
    - ChineseLunisolarCalendar
    - CalendarId
    - EastAsianLunisolarCalendar
    - GregorianCalendar
    - GregorianCalendarHelper
    - GregorianCalendarTypes
    - HebrewCalendar
    - HijriCalendar
    - JapaneseCalendar
    - JapaneseLunisolarCalendar
    - JulianCalendar
    - KoreanCalendar
    - KoreanLunisolarCalendar
    - TaiwanCalendar
    - TaiwanLunisolarCalendar
    - ThaiBuddhistCalendar
    - UmAlQuraCalendar

  2. planetfactory

    Sep 08, 2020 12:53

    We are also facing this issue in Unity 2018.4.26f1

  3. masak

    May 19, 2020 05:26

    same issue.
    I tried to use a wildcard *, maybe this includes all Calendar.

    <assembly fullname="System.Globalization.*Calendar" preserve="all"/>

  4. wizard3d

    Apr 16, 2020 20:24

    We have the same problem, and the linker solutions did not work for us, ideas?

  5. livingtarget

    Mar 17, 2020 13:03

    creating a link.xml file like this might do the trick

    <assembly fullname="System.Globalization.Calendars" preserve="all"/>

  6. NamdevKatkar

    Dec 03, 2019 12:35

    We are also facing this issue in Unity 2018.4.11f1. Can you please provide us the solution

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.