System\Text\Json\Writer\Utf8JsonWriter.cs (18)
89internal JsonTokenType TokenType => _tokenType;
539if (_tokenType != JsonTokenType.PropertyName)
541Debug.Assert(_tokenType != JsonTokenType.None && _tokenType != JsonTokenType.StartArray);
542ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayWithoutProperty, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType);
547Debug.Assert(_tokenType != JsonTokenType.PropertyName);
548Debug.Assert(_tokenType != JsonTokenType.StartObject);
551if (CurrentDepth == 0 && _tokenType != JsonTokenType.None)
553ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose, currentDepth: default, maxDepth: _options.MaxDepth, token: default, _tokenType);
578if (_tokenType is not JsonTokenType.PropertyName and not JsonTokenType.None || _commentAfterNoneOrPropertyName)
962if (_bitStack.CurrentDepth <= 0 || _tokenType == JsonTokenType.PropertyName)
963ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType);
969Debug.Assert(_tokenType != JsonTokenType.None);
970ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType);
979ThrowHelper.ThrowInvalidOperationException(ExceptionResource.MismatchedObjectArray, currentDepth: default, maxDepth: _options.MaxDepth, token, _tokenType);
989if (_tokenType == JsonTokenType.StartObject || _tokenType == JsonTokenType.StartArray)
1006Debug.Assert(_options.SkipValidation || _tokenType != JsonTokenType.None);