Avoid re-scanning the whole input ROSequence when getting position in Utf8JsonReader...
authorAhson Khan <ahkha@microsoft.com>
Thu, 28 Feb 2019 03:41:48 +0000 (19:41 -0800)
committerGitHub <noreply@github.com>
Thu, 28 Feb 2019 03:41:48 +0000 (19:41 -0800)
commitb089ae0fa9cd238dfed3d1921ca744e03b0a0399
treee444735b41e3f11663e40af95ead76ec30b37976
parent4fed6ab8818fd33298f8ec1cfbe6ffe2387d4637
Avoid re-scanning the whole input ROSequence when getting position in Utf8JsonReader (dotnet/corefx#35310)

* Make sure SequencePosition is saved as part of JsonReaderState

* Avoid rescanning whole ROSequence when getting position.

* We don't guarantee the position for invalid JSON.

* Remove isSingleSegment check when getting position and add single
segment tests

* Address feedback: remove else block and add some comments.

Commit migrated from https://github.com/dotnet/corefx/commit/b85d017ecac090e6966822f159b48e7edfef37ce
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.MultiSegment.cs
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.MultiSegment.cs