diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormatInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormatInfo.cs index c91e7fa5c1435..a7b603ef859cb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormatInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormatInfo.cs @@ -2409,7 +2409,7 @@ internal bool Tokenize(TokenType TokenMask, out TokenType tokenType, out int tok if (isLetter) { ch = Culture.TextInfo.ToLower(ch); - if (IsHebrewChar(ch) && TokenMask == TokenType.RegularTokenMask) + if (!GlobalizationMode.Invariant && IsHebrewChar(ch) && TokenMask == TokenType.RegularTokenMask) { if (TryParseHebrewNumber(ref str, out bool badFormat, out tokenValue)) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs index e4b260885f825..ce6e23b8c8560 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs @@ -1050,6 +1050,12 @@ private static bool Lex(DS dps, ref __DTString str, ref DateTimeToken dtok, ref } break; case TokenType.JapaneseEraToken: + if (GlobalizationMode.Invariant) + { + Debug.Fail("Should never be reached"); + return false; + } + // Special case for Japanese. We allow Japanese era name to be used even if the calendar is not Japanese Calendar. result.calendar = JapaneseCalendar.GetDefaultInstance(); dtfi = DateTimeFormatInfo.GetJapaneseCalendarDTFI(); @@ -1066,6 +1072,12 @@ private static bool Lex(DS dps, ref __DTString str, ref DateTimeToken dtok, ref } break; case TokenType.TEraToken: + if (GlobalizationMode.Invariant) + { + Debug.Fail("Should never be reached"); + return false; + } + result.calendar = TaiwanCalendar.GetDefaultInstance(); dtfi = DateTimeFormatInfo.GetTaiwanCalendarDTFI(); if (result.era != -1)