Fix culture handling in legacy System.Json library (dotnet/corefx#34811)
authorStephen Toub <stoub@microsoft.com>
Fri, 25 Jan 2019 03:43:22 +0000 (22:43 -0500)
committerGitHub <noreply@github.com>
Fri, 25 Jan 2019 03:43:22 +0000 (22:43 -0500)
commit294ac9a70809892eb9ce5b5e0375d5085c6d180d
treeb507a1d122efec23bfaf7faa8b345993e0ae4151
parent1914cd17d198e4cb380688297a8179c681ff1e44
Fix culture handling in legacy System.Json library (dotnet/corefx#34811)

* Fix System.Json code using NumberFormatInfo.InvariantInfo

The intention here was obviously to use invariant culture, but NumberFormatInfo will be ignored for various primitive types that don't respect NFI, e.g. TimeSpan, which respects DateTimeFormatInfo.

* Fix handling of culture in System.Json tests

In particular, CultureInfo.CurrentCulture should not be modified in-process in tests, as on UWP it bleeds across threads.

Commit migrated from https://github.com/dotnet/corefx/commit/f398b6f7c3d08d8e437939cbd9ef29cb3beda1db
src/libraries/System.Json/src/System/Json/JsonPrimitive.cs
src/libraries/System.Json/src/System/Json/JsonValue.cs
src/libraries/System.Json/tests/JsonPrimitiveTests.cs
src/libraries/System.Json/tests/JsonValueTests.cs
src/libraries/System.Json/tests/System.Json.Tests.csproj