@@ -11,18 +11,18 @@ namespace System.Text.Json
1111 /// this type can survive across async/await boundaries and hence this type is required to provide
1212 /// support for reading in more data asynchronously before continuing with a new instance of the <see cref="Utf8JsonReader"/>.
1313 /// </summary>
14- public struct JsonReaderState
14+ public readonly struct JsonReaderState
1515 {
16- internal long _lineNumber ;
17- internal long _bytePositionInLine ;
18- internal bool _inObject ;
19- internal bool _isNotPrimitive ;
20- internal bool _valueIsEscaped ;
21- internal bool _trailingCommaBeforeComment ;
22- internal JsonTokenType _tokenType ;
23- internal JsonTokenType _previousTokenType ;
24- internal JsonReaderOptions _readerOptions ;
25- internal BitStack _bitStack ;
16+ internal readonly long _lineNumber ;
17+ internal readonly long _bytePositionInLine ;
18+ internal readonly bool _inObject ;
19+ internal readonly bool _isNotPrimitive ;
20+ internal readonly bool _valueIsEscaped ;
21+ internal readonly bool _trailingCommaBeforeComment ;
22+ internal readonly JsonTokenType _tokenType ;
23+ internal readonly JsonTokenType _previousTokenType ;
24+ internal readonly JsonReaderOptions _readerOptions ;
25+ internal readonly BitStack _bitStack ;
2626
2727 /// <summary>
2828 /// Constructs a new <see cref="JsonReaderState"/> instance.
@@ -53,6 +53,30 @@ public JsonReaderState(JsonReaderOptions options = default)
5353 _bitStack = default ;
5454 }
5555
56+ internal JsonReaderState (
57+ long lineNumber ,
58+ long bytePositionInLine ,
59+ bool inObject ,
60+ bool isNotPrimitive ,
61+ bool valueIsEscaped ,
62+ bool trailingCommaBeforeComment ,
63+ JsonTokenType tokenType ,
64+ JsonTokenType previousTokenType ,
65+ JsonReaderOptions readerOptions ,
66+ BitStack bitStack )
67+ {
68+ _lineNumber = lineNumber ;
69+ _bytePositionInLine = bytePositionInLine ;
70+ _inObject = inObject ;
71+ _isNotPrimitive = isNotPrimitive ;
72+ _valueIsEscaped = valueIsEscaped ;
73+ _trailingCommaBeforeComment = trailingCommaBeforeComment ;
74+ _tokenType = tokenType ;
75+ _previousTokenType = previousTokenType ;
76+ _readerOptions = readerOptions ;
77+ _bitStack = bitStack ;
78+ }
79+
5680 /// <summary>
5781 /// Gets the custom behavior when reading JSON using
5882 /// the <see cref="Utf8JsonReader"/> that may deviate from strict adherence
0 commit comments