From 8b4448329fe99941875484bafe4626adb85f6360 Mon Sep 17 00:00:00 2001 From: Ahson Khan Date: Mon, 20 May 2019 00:21:36 -0700 Subject: [PATCH] SkipValidation when using the writer internally within the serializer. (dotnet/corefx#37791) Commit migrated from https://github.com/dotnet/corefx/commit/e58b35cd0f8fe6caa194ca7e48388d8d59854fe0 --- .../src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs | 2 +- .../src/System/Text/Json/Serialization/JsonSerializerOptions.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs index afeeff5..d710800 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs @@ -2203,7 +2203,7 @@ namespace System.Text.Json if (marker != JsonConstants.Asterisk) { - ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfValueNotFound, marker); + ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfValueNotFound, JsonConstants.Slash); } return SkipMultiLineCommentMultiSegment(localBuffer.Slice(1), leftOver); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs index 27d2683..e78e2d3 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs @@ -294,7 +294,10 @@ namespace System.Text.Json.Serialization { return new JsonWriterOptions { - Indented = WriteIndented + Indented = WriteIndented, +#if !DEBUG + SkipValidation = true +#endif }; } -- 2.7.4