1 write to _options
System.Text.Json (1)
System\Text\Json\Writer\Utf8JsonWriter.cs (1)
150_options = options;
253 references to _options
System.Text.Json (253)
System\Text\Json\Writer\Utf8JsonWriter.cs (32)
85public JsonWriterOptions Options => _options; 151_indentByte = (byte)_options.IndentCharacter; 157if (_options.MaxDepth == 0) 159_options.MaxDepth = JsonWriterOptions.DefaultMaxDepth; // If max depth is not set, revert to the default depth. 482if (CurrentDepth >= _options.MaxDepth) 483ThrowHelper.ThrowInvalidOperationException(ExceptionResource.DepthTooLarge, _currentDepth, _options.MaxDepth, token: default, tokenType: default); 485if (_options.IndentedOrNotSkipValidation) 515Debug.Assert(_options.Indented || !_options.SkipValidation); 517if (_options.Indented) 519if (!_options.SkipValidation) 528Debug.Assert(!_options.SkipValidation); 542ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayWithoutProperty, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 553ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 561Debug.Assert(indent <= _indentLength * _options.MaxDepth); 680int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 698if (_options.Indented) 721JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 835int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 853if (_options.Indented) 876JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 912if (_options.IndentedOrNotSkipValidation) 942Debug.Assert(_options.Indented || !_options.SkipValidation); 944if (_options.Indented) 946if (!_options.SkipValidation) 954Debug.Assert(!_options.SkipValidation); 963ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 970ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 979ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 1005Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1006Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.None);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (10)
107int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 123int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 150JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 173JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 186if (_options.Indented) 199if (_options.Indented) 283Debug.Assert(indent <= _indentLength * _options.MaxDepth); 305Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 333Debug.Assert(indent <= _indentLength * _options.MaxDepth); 355Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (10)
114int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 130int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 157JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 180JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 193if (_options.Indented) 206if (_options.Indented) 287Debug.Assert(indent <= _indentLength * _options.MaxDepth); 307Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 336Debug.Assert(indent <= _indentLength * _options.MaxDepth); 355Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (10)
113int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 129int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 156JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 179JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 192if (_options.Indented) 205if (_options.Indented) 286Debug.Assert(indent <= _indentLength * _options.MaxDepth); 306Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 335Debug.Assert(indent <= _indentLength * _options.MaxDepth); 354Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (10)
113int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 129int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 156JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 179JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 192if (_options.Indented) 205if (_options.Indented) 280Debug.Assert(indent <= _indentLength * _options.MaxDepth); 300Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 326Debug.Assert(indent <= _indentLength * _options.MaxDepth); 345Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (10)
117int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 133int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 160JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 183JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 196if (_options.Indented) 209if (_options.Indented) 284Debug.Assert(indent <= _indentLength * _options.MaxDepth); 304Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 330Debug.Assert(indent <= _indentLength * _options.MaxDepth); 349Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (10)
117int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 133int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 160JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 183JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 196if (_options.Indented) 209if (_options.Indented) 284Debug.Assert(indent <= _indentLength * _options.MaxDepth); 304Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 330Debug.Assert(indent <= _indentLength * _options.MaxDepth); 349Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.FormattedNumber.cs (6)
84int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 100int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 127JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 150JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 163if (_options.Indented) 176if (_options.Indented)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (10)
113int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 129int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 156JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 179JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 192if (_options.Indented) 205if (_options.Indented) 288Debug.Assert(indent <= _indentLength * _options.MaxDepth); 308Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 338Debug.Assert(indent <= _indentLength * _options.MaxDepth); 357Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (14)
16if (propertyName.Length > JsonConstants.MaxCharacterTokenSize || CurrentDepth >= _options.MaxDepth) 17ThrowHelper.ThrowInvalidOperationOrArgumentException(propertyName, _currentDepth, _options.MaxDepth); 23if (utf8PropertyName.Length > JsonConstants.MaxUnescapedTokenSize || CurrentDepth >= _options.MaxDepth) 24ThrowHelper.ThrowInvalidOperationOrArgumentException(utf8PropertyName, _currentDepth, _options.MaxDepth); 30if (CurrentDepth >= _options.MaxDepth) 31ThrowHelper.ThrowInvalidOperationException(_currentDepth, _options.MaxDepth); 37if (!_options.SkipValidation) 42ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 50if (!_options.SkipValidation) 55ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 92Debug.Assert(indent <= _indentLength * _options.MaxDepth); 111Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 164Debug.Assert(indent <= _indentLength * _options.MaxDepth); 184Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (11)
28if (_options.Indented) 235int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 251int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 278JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 301JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 314if (_options.Indented) 327if (_options.Indented) 430Debug.Assert(indent <= _indentLength * _options.MaxDepth); 451Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 476Debug.Assert(indent <= _indentLength * _options.MaxDepth); 496Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (10)
189int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 205int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 232JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 255JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 268if (_options.Indented) 281if (_options.Indented) 356Debug.Assert(indent <= _indentLength * _options.MaxDepth); 376Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 402Debug.Assert(indent <= _indentLength * _options.MaxDepth); 421Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (46)
24if (_options.Indented) 96int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 134JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 149if (_options.Indented) 190Debug.Assert(indent <= _indentLength * _options.MaxDepth); 245int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 293JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 308if (_options.Indented) 378Debug.Assert(indent <= _indentLength * _options.MaxDepth); 398Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 608int valueIdx = JsonWriterHelper.NeedsEscaping(value, _options.Encoder); 698int valueIdx = JsonWriterHelper.NeedsEscaping(utf8Value, _options.Encoder); 788int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 860int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 922JsonWriterHelper.EscapeString(utf8Value, escapedValue, firstEscapeIndex, _options.Encoder, out int written); 945JsonWriterHelper.EscapeString(value, escapedValue, firstEscapeIndex, _options.Encoder, out int written); 968JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndex, _options.Encoder, out int written); 991JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndex, _options.Encoder, out int written); 1003int valueIdx = JsonWriterHelper.NeedsEscaping(value, _options.Encoder); 1004int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 1022int valueIdx = JsonWriterHelper.NeedsEscaping(utf8Value, _options.Encoder); 1023int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 1041int valueIdx = JsonWriterHelper.NeedsEscaping(utf8Value, _options.Encoder); 1042int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 1060int valueIdx = JsonWriterHelper.NeedsEscaping(value, _options.Encoder); 1061int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 1100JsonWriterHelper.EscapeString(value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written); 1120JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 1160JsonWriterHelper.EscapeString(utf8Value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written); 1180JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 1220JsonWriterHelper.EscapeString(utf8Value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written); 1240JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 1280JsonWriterHelper.EscapeString(value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written); 1300JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 1320if (_options.Indented) 1333if (_options.Indented) 1346if (_options.Indented) 1359if (_options.Indented) 1516Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1537Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 1566Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1586Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 1617Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1638Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 1668Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1689Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (10)
198int propertyIdx = JsonWriterHelper.NeedsEscaping(propertyName, _options.Encoder); 214int propertyIdx = JsonWriterHelper.NeedsEscaping(utf8PropertyName, _options.Encoder); 241JsonWriterHelper.EscapeString(propertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 264JsonWriterHelper.EscapeString(utf8PropertyName, escapedPropertyName, firstEscapeIndexProp, _options.Encoder, out int written); 277if (_options.Indented) 290if (_options.Indented) 365Debug.Assert(indent <= _indentLength * _options.MaxDepth); 385Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName); 411Debug.Assert(indent <= _indentLength * _options.MaxDepth); 430Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Bytes.cs (3)
34if (!_options.SkipValidation) 39if (_options.Indented) 91Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Comment.cs (4)
64if (_options.Indented) 108Debug.Assert(indent <= _indentLength * _options.MaxDepth); 179if (_options.Indented) 215Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTime.cs (3)
24if (!_options.SkipValidation) 29if (_options.Indented) 69Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTimeOffset.cs (3)
25if (!_options.SkipValidation) 30if (_options.Indented) 70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Decimal.cs (3)
24if (!_options.SkipValidation) 29if (_options.Indented) 66Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Double.cs (3)
28if (!_options.SkipValidation) 33if (_options.Indented) 70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Float.cs (3)
28if (!_options.SkipValidation) 33if (_options.Indented) 70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.FormattedNumber.cs (3)
29if (!_options.SkipValidation) 34if (_options.Indented) 70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Guid.cs (3)
24if (!_options.SkipValidation) 29if (_options.Indented) 70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Helpers.cs (3)
15Debug.Assert(!_options.SkipValidation); 22ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueWithinObject, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 32ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueAfterPrimitiveOrClose, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Literal.cs (3)
49if (!_options.SkipValidation) 54if (_options.Indented) 89Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (4)
36if (!_options.SkipValidation) 72if (!_options.SkipValidation) 103if (!_options.SkipValidation) 139if (!_options.SkipValidation)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.SignedNumber.cs (3)
37if (!_options.SkipValidation) 42if (_options.Indented) 79Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (10)
84int valueIdx = JsonWriterHelper.NeedsEscaping(value, _options.Encoder); 100if (!_options.SkipValidation) 105if (_options.Indented) 146Debug.Assert(indent <= _indentLength * _options.MaxDepth); 196JsonWriterHelper.EscapeString(value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written); 231int valueIdx = JsonWriterHelper.NeedsEscaping(utf8Value, _options.Encoder); 247if (!_options.SkipValidation) 252if (_options.Indented) 293Debug.Assert(indent <= _indentLength * _options.MaxDepth); 343JsonWriterHelper.EscapeString(utf8Value, escapedValue, firstEscapeIndexVal, _options.Encoder, out int written);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.UnsignedNumber.cs (3)
39if (!_options.SkipValidation) 44if (_options.Indented) 81Debug.Assert(indent <= _indentLength * _options.MaxDepth);