Fix failures caused by ICU regression (#24190)
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Tue, 23 Apr 2019 20:58:54 +0000 (13:58 -0700)
committerGitHub <noreply@github.com>
Tue, 23 Apr 2019 20:58:54 +0000 (13:58 -0700)
commitcbc358d9617816d38109df5a40fb677ce69c840f
treebd3e7328b9ee5a58b3463db1108e487ca27c4b5d
parente7ecfecc3b8a35e645e9f2a5b5ebb10889ca956b
Fix failures caused by ICU regression (#24190)

Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558
src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs
src/System.Private.CoreLib/shared/System/Globalization/CalendarData.cs