2 writes to MaxDepth
System.Text.Json (2)
System\Text\Json\Serialization\JsonSerializerOptions.cs (1)
1058MaxDepth = EffectiveMaxDepth,
System\Text\Json\Writer\Utf8JsonWriter.cs (1)
277_options.MaxDepth = JsonWriterOptions.DefaultMaxDepth; // If max depth is not set, revert to the default depth.
65 references to MaxDepth
System.Text.Json (65)
System\Text\Json\Writer\Utf8JsonWriter.cs (10)
275if (_options.MaxDepth == 0) 603if (CurrentDepth >= _options.MaxDepth) 604ThrowHelper.ThrowInvalidOperationException(ExceptionResource.DepthTooLarge, _currentDepth, _options.MaxDepth, token: default, tokenType: default); 666ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayWithoutProperty, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 677ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 685Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1090ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 1097ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 1106ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType); 1132Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (2)
283Debug.Assert(indent <= _indentLength * _options.MaxDepth); 333Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (2)
287Debug.Assert(indent <= _indentLength * _options.MaxDepth); 336Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (2)
286Debug.Assert(indent <= _indentLength * _options.MaxDepth); 335Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (2)
280Debug.Assert(indent <= _indentLength * _options.MaxDepth); 326Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (2)
284Debug.Assert(indent <= _indentLength * _options.MaxDepth); 330Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (2)
284Debug.Assert(indent <= _indentLength * _options.MaxDepth); 330Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (2)
288Debug.Assert(indent <= _indentLength * _options.MaxDepth); 338Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (10)
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); 45ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 61ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 98Debug.Assert(indent <= _indentLength * _options.MaxDepth); 170Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (2)
430Debug.Assert(indent <= _indentLength * _options.MaxDepth); 476Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (2)
356Debug.Assert(indent <= _indentLength * _options.MaxDepth); 402Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (6)
190Debug.Assert(indent <= _indentLength * _options.MaxDepth); 378Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1516Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1566Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1617Debug.Assert(indent <= _indentLength * _options.MaxDepth); 1668Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (2)
365Debug.Assert(indent <= _indentLength * _options.MaxDepth); 411Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Bytes.cs (1)
91Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Comment.cs (2)
115Debug.Assert(indent <= _indentLength * _options.MaxDepth); 222Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTime.cs (1)
69Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTimeOffset.cs (1)
70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Decimal.cs (1)
66Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Double.cs (1)
70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Float.cs (1)
70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.FormattedNumber.cs (1)
70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Guid.cs (1)
70Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Helpers.cs (3)
31ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteWithinString, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 50ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueWithinObject, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType); 60ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueAfterPrimitiveOrClose, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Literal.cs (1)
89Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.SignedNumber.cs (1)
79Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (2)
146Debug.Assert(indent <= _indentLength * _options.MaxDepth); 293Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (1)
381Debug.Assert(indent <= _indentLength * _options.MaxDepth);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.UnsignedNumber.cs (1)
81Debug.Assert(indent <= _indentLength * _options.MaxDepth);