Stop throwing exception in TimeZoneInfo POSIX parsing (#458)
authorEric Erhardt <eric.erhardt@microsoft.com>
Tue, 3 Dec 2019 05:01:59 +0000 (23:01 -0600)
committerGitHub <noreply@github.com>
Tue, 3 Dec 2019 05:01:59 +0000 (23:01 -0600)
commit42394ce6c616c8e449f9c280451d2bf59fe86468
tree4ded00b122cbc359a3e32cd3530226521df21ba7
parent1bf3be8037bcd7dfdad4d158db23db86a1c2bae2
Stop throwing exception in TimeZoneInfo POSIX parsing (#458)

IsDaylightSavingTime_CasablancaMultiYearDaylightSavings fails on rhel.8

When parsing the tzdata POSIX string that contains an 'n' Julian date, we are currently throwing an exception, and then falling back to a TimeZoneInfo without DST enabled. However, this is a mistake because there are other DST transitions that were read from the tzdata file that are valid and usable. We shouldn't be throwing that information away.

So instead, we now skip the POSIX string if we detect an unsupported 'n' Julian date, and just use the last transition as the AdjustmentRule for all the DateTimes in the future. This way we can still make DST determinations correctly for some DateTimes.

Fix https://github.com/dotnet/corefx/issues/42192
src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs