Fix validation check within Utf8JsonWriter for writing a primitive value after anoth...
authorAhson Khan <ahson_ahmedk@yahoo.com>
Mon, 29 Jul 2019 04:06:03 +0000 (21:06 -0700)
committermsftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
Mon, 29 Jul 2019 04:06:03 +0000 (04:06 +0000)
commit351fb30982af4f2d967d2216b11268aa821a551b
tree1506b459a5e7f749ddde4fb4bb890ea3020295cb
parent13fc8895dbf548a79695a6306b2c98ceb81916fb
 Fix validation check within Utf8JsonWriter for writing a primitive value after another complete value has been written. (dotnet/corefx#39796)

* Fix validation check within Utf8JsonWriter for writing a primitive
value.

* Update the unit test to pass in JsonValueKind as an inlinedata option.

* Test cleanup.

* Remove use of _isNotPrimitive as that is redundant and unnecessary.

* Some more test clean up - validate bytespending moves.

* More test clean up - ensure bytespending remains as is when we throw.

* Invert check order to rely on short-circuiting.

* Address feedback and add comment related tests.

Commit migrated from https://github.com/dotnet/corefx/commit/47c35fe385c18d5f0a4ceacea381f790db472ba2
src/libraries/System.Text.Json/src/Resources/Strings.resx
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Helpers.cs
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
src/libraries/System.Text.Json/tests/Utf8JsonWriterTests.cs