JSON: Add support for Int128, UInt128 and Half (#88962)
authorDavid CantĂș <dacantu@microsoft.com>
Tue, 18 Jul 2023 19:29:40 +0000 (14:29 -0500)
committerGitHub <noreply@github.com>
Tue, 18 Jul 2023 19:29:40 +0000 (14:29 -0500)
commite2c04e07c9fb4132c52c9a2f676fdfeee209cd5b
tree4158891906e08e234cb59ea17309b3cd1cb1b81d
parent2f843a8fb289ae12574e30ed31098770c2537deb
JSON: Add support for Int128, UInt128 and Half (#88962)

* JSON: Add support for Int128, UInt128 and Half and add Number support for Utf8JsonReader.CopyString(...)

* Remove parsing limits on Read and move Number support of CopyString to an internal helper

* Fix AllowNamedFloatingPointLiterals on Write for Half

* Specify InvariantCulture on TryParse and TryFormat
Fix handling of floating-point literals on HalfConverter
Remove CopyString tests related to Number support

* Add test for invalid number input format

* Fix net6.0 build error about missing Half.TryParse overload

* Move rentedCharBuffer logic to TryParse helper

* Address feedback

* Disable test for OSX
20 files changed:
src/libraries/System.Text.Json/gen/Helpers/KnownTypeSymbols.cs
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
src/libraries/System.Text.Json/ref/System.Text.Json.netcoreapp.cs
src/libraries/System.Text.Json/src/Resources/Strings.resx
src/libraries/System.Text.Json/src/System.Text.Json.csproj
src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.cs
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/CharConverter.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/HalfConverter.cs [new file with mode: 0644]
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/Int128Converter.cs [new file with mode: 0644]
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UInt128Converter.cs [new file with mode: 0644]
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Converters.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.Dictionary.NonStringKey.cs
src/libraries/System.Text.Json/tests/Common/JsonNumberTestData.cs
src/libraries/System.Text.Json/tests/Common/JsonTestHelper.cs
src/libraries/System.Text.Json/tests/Common/NumberHandlingTests.cs
src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/NumberHandlingTests.cs