Ensure JsonException is thrown parsing invalid DateTime, DateTimeOffset, and Guid...
authorChristopher Watford <christopher.watford@ge.com>
Mon, 20 May 2019 19:11:17 +0000 (15:11 -0400)
committerAhson Khan <ahkha@microsoft.com>
Mon, 20 May 2019 19:11:17 +0000 (12:11 -0700)
commit02416b5012d13e6252a3381f35952ef97f76fed3
tree7ea240b9e805f937416d4578128b35532116097e
parent92ea6d760badeb1a2a01078e7df2bd1faeb13396
Ensure JsonException is thrown parsing invalid DateTime, DateTimeOffset, and Guid dotnet/corefx#37807 (dotnet/corefx#37809)

* Add tests to cover dotnet/corefx#36901 and dotnet/corefx#37807

* Ensure DateTime(Offset) and Guid throw JsonException dotnet/corefx#37807

- The original JsonValueConverterXXX code for these allowed an InvalidOperationException
to be raised from Utf8JsonReader.TryGetXXX, instead of returning false so a JsonException
could be thrown.

Commit migrated from https://github.com/dotnet/corefx/commit/3ff5c4a6eb6315c61cfb0078245c31b59f798290
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonValueConverterDateTime.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonValueConverterDateTimeOffset.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonValueConverterGuid.cs
src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.cs