diff --git a/src/Common/src/CoreLib/System/Globalization/CalendarData.Unix.cs b/src/Common/src/CoreLib/System/Globalization/CalendarData.Unix.cs index 80e385376d05..a8c69f86e644 100644 --- a/src/Common/src/CoreLib/System/Globalization/CalendarData.Unix.cs +++ b/src/Common/src/CoreLib/System/Globalization/CalendarData.Unix.cs @@ -39,7 +39,11 @@ private bool LoadCalendarDataFromSystem(string localeName, CalendarId calendarId // TODO-NULLABLE: these can return null but are later replaced with String.Empty or other non-nullable value result &= GetCalendarInfo(localeName, calendarId, CalendarDataType.NativeName, out this.sNativeName!); result &= GetCalendarInfo(localeName, calendarId, CalendarDataType.MonthDay, out this.sMonthDay!); - this.sMonthDay = NormalizeDatePattern(this.sMonthDay); + + if (this.sMonthDay != null) + { + this.sMonthDay = NormalizeDatePattern(this.sMonthDay); + } result &= EnumDatePatterns(localeName, calendarId, CalendarDataType.ShortDates, out this.saShortDates!); result &= EnumDatePatterns(localeName, calendarId, CalendarDataType.LongDates, out this.saLongDates!); diff --git a/src/Common/src/CoreLib/System/Globalization/CalendarData.cs b/src/Common/src/CoreLib/System/Globalization/CalendarData.cs index 131dd6b31550..93ec643b6725 100644 --- a/src/Common/src/CoreLib/System/Globalization/CalendarData.cs +++ b/src/Common/src/CoreLib/System/Globalization/CalendarData.cs @@ -112,7 +112,8 @@ internal CalendarData(string localeName, CalendarId calendarId, bool bUseUserOve if (!LoadCalendarDataFromSystem(localeName, calendarId)) { - Debug.Fail("[CalendarData] LoadCalendarDataFromSystem call isn't expected to fail for calendar " + calendarId + " locale " + localeName); + // LoadCalendarDataFromSystem sometimes can fail on Linux if the installed ICU package is missing some resources. + // The ICU package can miss some resources in some cases like if someone compile and build the ICU package manually or ICU has a regression. // Something failed, try invariant for missing parts // This is really not good, but we don't want the callers to crash.