1234 references to JsonConstants
System.Text.Json (1234)
src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (2)
41Span<char> destination = initialBufferLength <= JsonConstants.StackallocCharThreshold 42? stackalloc char[JsonConstants.StackallocCharThreshold]
System\Text\Json\Document\JsonDocument.cs (11)
314int length = checked(otherText.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); 315Span<byte> otherUtf8Text = length <= JsonConstants.StackallocByteThreshold ? 316stackalloc byte[JsonConstants.StackallocByteThreshold] : 363if (otherUtf8Text.Length < segment.Length / JsonConstants.MaxExpansionFactorWhileEscaping) 368int idx = segment.IndexOf(JsonConstants.BackSlash); 415Debug.Assert(segment.IndexOf(JsonConstants.BackSlash) == -1); 684Debug.Assert(segment.IndexOf(JsonConstants.BackSlash) == -1); 719Debug.Assert(segment.IndexOf(JsonConstants.BackSlash) == -1); 742if (segment.Length > JsonConstants.MaximumEscapedGuidLength) 754Debug.Assert(segment.IndexOf(JsonConstants.BackSlash) == -1); 756if (segment.Length == JsonConstants.MaximumFormatGuidLength
System\Text\Json\Document\JsonDocument.Parse.cs (7)
677s_falseLiteral ??= Create(JsonConstants.FalseValue.ToArray()); 680s_trueLiteral ??= Create(JsonConstants.TrueValue.ToArray()); 684s_nullLiteral ??= Create(JsonConstants.NullValue.ToArray()); 766ReadOnlySpan<byte> utf8Bom = JsonConstants.Utf8Bom; 851int utf8BomLength = JsonConstants.Utf8Bom.Length; 871Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length); 888JsonConstants.Utf8Bom.SequenceEqual(rented.AsSpan(0, utf8BomLength)))
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (4)
30if (maxBytes < JsonConstants.StackallocByteThreshold) 32Span<byte> utf8Name = stackalloc byte[JsonConstants.StackallocByteThreshold]; 142Span<byte> utf8UnescapedStack = stackalloc byte[JsonConstants.StackallocByteThreshold]; 174int idx = currentPropertyName.IndexOf(JsonConstants.BackSlash);
System\Text\Json\JsonEncodedText.cs (2)
86Span<byte> utf8Bytes = expectedByteCount <= JsonConstants.StackallocByteThreshold ? 87stackalloc byte[JsonConstants.StackallocByteThreshold] :
System\Text\Json\JsonHelpers.cs (2)
230Span<char> charBuffer = utf8Key.Length <= JsonConstants.StackallocCharThreshold ? 231stackalloc char[JsonConstants.StackallocCharThreshold] :
System\Text\Json\JsonHelpers.Date.cs (36)
25public bool OffsetNegative => OffsetToken == JsonConstants.Hyphen; 32return IsInRangeInclusive(length, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumEscapedDateTimeOffsetParseLength); 38return IsInRangeInclusive(length, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumDateTimeOffsetParseLength); 55if (parseData.OffsetToken == JsonConstants.UtcOffsetToken) 59else if (parseData.OffsetToken == JsonConstants.Plus || parseData.OffsetToken == JsonConstants.Hyphen) 88if (parseData.OffsetToken == JsonConstants.UtcOffsetToken || // Same as specifying an offset of "+00:00", except that DateTime's Kind gets set to UTC rather than Local 89parseData.OffsetToken == JsonConstants.Plus || parseData.OffsetToken == JsonConstants.Hyphen) 174if (source[4] != JsonConstants.Hyphen 176|| source[7] != JsonConstants.Hyphen 232if (source[10] != JsonConstants.TimePrefix || source[13] != JsonConstants.Colon 252case JsonConstants.UtcOffsetToken: 253parseData.OffsetToken = JsonConstants.UtcOffsetToken; 255case JsonConstants.Plus: 256case JsonConstants.Hyphen: 259case JsonConstants.Colon: 285case JsonConstants.UtcOffsetToken: 286parseData.OffsetToken = JsonConstants.UtcOffsetToken; 288case JsonConstants.Plus: 289case JsonConstants.Hyphen: 292case JsonConstants.Period: 308int fractionEnd = Math.Min(sourceIndex + JsonConstants.DateTimeParseNumFractionDigits, source.Length); 312if (numDigitsRead < JsonConstants.DateTimeNumFractionDigits) 323while (numDigitsRead < JsonConstants.DateTimeNumFractionDigits) 343case JsonConstants.UtcOffsetToken: 344parseData.OffsetToken = JsonConstants.UtcOffsetToken; 346case JsonConstants.Plus: 347case JsonConstants.Hyphen: 373|| offsetData[2] != JsonConstants.Colon 408if (((uint)parseData.OffsetHours) > JsonConstants.MaxDateTimeUtcOffsetHours) 420if (parseData.OffsetHours == JsonConstants.MaxDateTimeUtcOffsetHours && parseData.OffsetMinutes != 0) 539Debug.Assert(parseData.Fraction >= 0 && parseData.Fraction <= JsonConstants.MaxDateTimeFraction); // All of our callers to date parse the fraction from fixed 7-digit fields so this value is trusted.
System\Text\Json\JsonHelpers.Escaping.cs (9)
33Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 40Span<byte> escapedValue = length <= JsonConstants.StackallocByteThreshold ? 41stackalloc byte[JsonConstants.StackallocByteThreshold] : 61Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 68Span<byte> escapedValue = length <= JsonConstants.StackallocByteThreshold ? 69stackalloc byte[JsonConstants.StackallocByteThreshold] : 89propertySection[0] = JsonConstants.Quote; 91propertySection[++length] = JsonConstants.Quote; 92propertySection[++length] = JsonConstants.KeyValueSeparator;
System\Text\Json\Nodes\JsonArray.cs (1)
252Span<char> chars = stackalloc char[JsonConstants.MaximumFormatUInt32Length];
System\Text\Json\Nodes\JsonNode.cs (1)
143var path = new ValueStringBuilder(stackalloc char[JsonConstants.StackallocCharThreshold]);
System\Text\Json\Reader\JsonReaderHelper.cs (18)
27int lastLineFeedIndex = data.LastIndexOf(JsonConstants.LineFeed); 35newLines += data.Count(JsonConstants.LineFeed); 84Debug.Assert(source.Length <= JsonConstants.MaximumEscapedDateTimeOffsetParseLength); 85Span<byte> sourceUnescaped = stackalloc byte[JsonConstants.MaximumEscapedDateTimeOffsetParseLength]; 106Debug.Assert(source.Length <= JsonConstants.MaximumEscapedDateTimeOffsetParseLength); 107Span<byte> sourceUnescaped = stackalloc byte[JsonConstants.MaximumEscapedDateTimeOffsetParseLength]; 128Debug.Assert(source.Length <= JsonConstants.MaximumEscapedGuidLength); 130Span<byte> utf8Unescaped = stackalloc byte[JsonConstants.MaximumEscapedGuidLength]; 137if (utf8Unescaped.Length == JsonConstants.MaximumFormatGuidLength 153if (span.SequenceEqual(JsonConstants.NaNValue)) 161if (span.SequenceEqual(JsonConstants.PositiveInfinityValue)) 169if (span.SequenceEqual(JsonConstants.NegativeInfinityValue)) 185if (span.SequenceEqual(JsonConstants.NaNValue)) 193if (span.SequenceEqual(JsonConstants.PositiveInfinityValue)) 201if (span.SequenceEqual(JsonConstants.NegativeInfinityValue)) 216if (span.SequenceEqual(JsonConstants.NaNValue)) 224if (span.SequenceEqual(JsonConstants.PositiveInfinityValue)) 232if (span.SequenceEqual(JsonConstants.NegativeInfinityValue))
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (52)
18Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ? 19stackalloc byte[JsonConstants.StackallocByteThreshold] : 48Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ? 49stackalloc byte[JsonConstants.StackallocByteThreshold] : 75Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ? 76stackalloc byte[JsonConstants.StackallocByteThreshold] : 96Debug.Assert(utf8Source.Length >= other.Length && utf8Source.Length / JsonConstants.MaxExpansionFactorWhileEscaping <= other.Length); 100Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ? 101stackalloc byte[JsonConstants.StackallocByteThreshold] : 124Debug.Assert(utf8Source.Length >= other.Length && utf8Source.Length / JsonConstants.MaxExpansionFactorWhileEscaping <= other.Length); 131Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ? 132stackalloc byte[JsonConstants.StackallocByteThreshold] : 135Span<byte> utf8Escaped = length <= JsonConstants.StackallocByteThreshold ? 136stackalloc byte[JsonConstants.StackallocByteThreshold] : 164int index1 = utf8Source1.IndexOf(JsonConstants.BackSlash); 165int index2 = utf8Source2.IndexOf(JsonConstants.BackSlash); 173Span<byte> utf8Unescaped1 = utf8Source1.Length <= JsonConstants.StackallocByteThreshold ? 174stackalloc byte[JsonConstants.StackallocByteThreshold] : 177Span<byte> utf8Unescaped2 = utf8Source2.Length <= JsonConstants.StackallocByteThreshold ? 178stackalloc byte[JsonConstants.StackallocByteThreshold] : 222Span<byte> byteSpan = utf8Unescaped.Length <= JsonConstants.StackallocByteThreshold ? 223stackalloc byte[JsonConstants.StackallocByteThreshold] : 448int idx = source.IndexOf(JsonConstants.BackSlash); 458Debug.Assert(source[idx] == JsonConstants.BackSlash); 470int idx = source.IndexOf(JsonConstants.BackSlash); 482Debug.Assert(source[idx] == JsonConstants.BackSlash); 494Debug.Assert(source[idx] == JsonConstants.BackSlash); 503case JsonConstants.Quote: 504destination[written++] = JsonConstants.Quote; 507destination[written++] = JsonConstants.LineFeed; 510destination[written++] = JsonConstants.CarriageReturn; 512case JsonConstants.BackSlash: 513destination[written++] = JsonConstants.BackSlash; 515case JsonConstants.Slash: 516destination[written++] = JsonConstants.Slash; 519destination[written++] = JsonConstants.Tab; 522destination[written++] = JsonConstants.BackSpace; 525destination[written++] = JsonConstants.FormFeed; 539if (JsonHelpers.IsInRangeInclusive((uint)scalar, JsonConstants.HighSurrogateStartValue, JsonConstants.LowSurrogateEndValue)) 542if (scalar >= JsonConstants.LowSurrogateStartValue) 547Debug.Assert(JsonHelpers.IsInRangeInclusive((uint)scalar, JsonConstants.HighSurrogateStartValue, JsonConstants.HighSurrogateEndValue)); 563if (!JsonHelpers.IsInRangeInclusive((uint)lowSurrogate, JsonConstants.LowSurrogateStartValue, JsonConstants.LowSurrogateEndValue)) 570scalar = (JsonConstants.BitShiftBy10 * (scalar - JsonConstants.HighSurrogateStartValue)) 571+ (lowSurrogate - JsonConstants.LowSurrogateStartValue) 572+ JsonConstants.UnicodePlane01StartValue; 596if (source[idx] != JsonConstants.BackSlash) 599int nextUnescapedSegmentLength = remaining.IndexOf(JsonConstants.BackSlash); 632Debug.Assert(idx == source.Length || source[idx] == JsonConstants.BackSlash);
System\Text\Json\Reader\Utf8JsonReader.cs (103)
540int length = checked(text.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); 542if (length > JsonConstants.StackallocByteThreshold) 549otherUtf8Text = stackalloc byte[JsonConstants.StackallocByteThreshold]; 615if (localSpan.Length < other.Length || localSpan.Length / JsonConstants.MaxExpansionFactorWhileEscaping > other.Length) 620int idx = localSpan.IndexOf(JsonConstants.BackSlash); 641if (sequenceLength < other.Length || sequenceLength / JsonConstants.MaxExpansionFactorWhileEscaping > other.Length) 654int idx = span.IndexOf(JsonConstants.BackSlash); 719|| sourceLength / (ValueIsEscaped ? JsonConstants.MaxExpansionFactorWhileEscaping : JsonConstants.MaxExpansionFactorWhileTranscoding) > charTextLength) 732|| sourceLength / (ValueIsEscaped ? JsonConstants.MaxExpansionFactorWhileEscaping : JsonConstants.MaxExpansionFactorWhileTranscoding) > charTextLength) 756ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.MismatchedObjectArray, JsonConstants.CloseBrace); 790ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.MismatchedObjectArray, JsonConstants.CloseBracket); 832if (first <= JsonConstants.Space) 849if (first == JsonConstants.Slash) 857if (first == JsonConstants.CloseBrace) 863if (first != JsonConstants.Quote) 885if (first == JsonConstants.CloseBracket) 962if (first == JsonConstants.OpenBrace) 972else if (first == JsonConstants.OpenBracket) 1016if (val is not JsonConstants.Space and 1017not JsonConstants.CarriageReturn and 1018not JsonConstants.LineFeed and 1019not JsonConstants.Tab) 1024if (val == JsonConstants.LineFeed) 1045Debug.Assert((_trailingCommaBeforeComment && marker != JsonConstants.Slash) || !_trailingCommaBeforeComment); 1048if (marker == JsonConstants.Quote) 1052else if (marker == JsonConstants.OpenBrace) 1056else if (marker == JsonConstants.OpenBracket) 1066return ConsumeLiteral(JsonConstants.FalseValue, JsonTokenType.False); 1070return ConsumeLiteral(JsonConstants.TrueValue, JsonTokenType.True); 1074return ConsumeLiteral(JsonConstants.NullValue, JsonTokenType.Null); 1083if (marker == JsonConstants.Slash) 1090if (marker == JsonConstants.Slash) 1106if (marker <= JsonConstants.Space) 1232JsonConstants.Delimiters.IndexOf(_buffer[_consumed]) >= 0) 1257if (first <= JsonConstants.Space) 1268if (first != JsonConstants.KeyValueSeparator) 1282Debug.Assert(_buffer[_consumed] == JsonConstants.Quote); 1296if (foundByte == JsonConstants.Quote) 1327Debug.Assert(data[idx] != JsonConstants.Quote); 1328Debug.Assert(data[idx] == JsonConstants.BackSlash || data[idx] < JsonConstants.Space); 1339if (currentByte == JsonConstants.Quote) 1347else if (currentByte == JsonConstants.BackSlash) 1353int index = JsonConstants.EscapableChars.IndexOf(currentByte); 1377else if (currentByte < JsonConstants.Space) 1573if (JsonConstants.Delimiters.IndexOf(nextByte) >= 0) 1629if (JsonConstants.Delimiters.IndexOf(nextByte) >= 0) 1729if (marker == JsonConstants.Slash) 1755if (marker == JsonConstants.ListSeparator) 1773if (first <= JsonConstants.Space) 1786if (_readerOptions.CommentHandling == JsonCommentHandling.Allow && first == JsonConstants.Slash) 1794if (first != JsonConstants.Quote) 1796if (first == JsonConstants.CloseBrace) 1811if (first == JsonConstants.CloseBracket) 1823else if (marker == JsonConstants.CloseBrace) 1827else if (marker == JsonConstants.CloseBracket) 1862if (first <= JsonConstants.Space) 1882Debug.Assert(first != JsonConstants.Slash); 1886if (first == JsonConstants.ListSeparator) 1910if (first <= JsonConstants.Space) 1923if (first == JsonConstants.Slash) 1938if (first != JsonConstants.Quote) 1940if (first == JsonConstants.CloseBrace) 1963if (first == JsonConstants.CloseBracket) 1983else if (first == JsonConstants.CloseBrace) 1987else if (first == JsonConstants.CloseBracket) 2004Debug.Assert(first != JsonConstants.CloseBrace); 2005if (first != JsonConstants.Quote) 2026Debug.Assert(first != JsonConstants.CloseBracket); 2046Debug.Assert(first != JsonConstants.CloseBrace); 2047if (first != JsonConstants.Quote) 2063Debug.Assert(first != JsonConstants.CloseBracket); 2085while (marker == JsonConstants.Slash) 2097if (marker <= JsonConstants.Space) 2120while (marker == JsonConstants.Slash) 2133if (marker <= JsonConstants.Space) 2166if (marker == JsonConstants.CloseBrace) 2172if (marker != JsonConstants.Quote) 2194if (marker == JsonConstants.CloseBracket) 2224else if (marker == JsonConstants.ListSeparator) 2242if (marker <= JsonConstants.Space) 2262if (marker != JsonConstants.Quote) 2264if (marker == JsonConstants.CloseBrace) 2280if (marker == JsonConstants.CloseBracket) 2293else if (marker == JsonConstants.CloseBrace) 2297else if (marker == JsonConstants.CloseBracket) 2322if (marker == JsonConstants.Slash) 2326else if (marker == JsonConstants.Asterisk) 2332ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfValueNotFound, JsonConstants.Slash); 2338ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfValueNotFound, JsonConstants.Slash); 2350if (localBuffer[idx] == JsonConstants.LineFeed) 2356Debug.Assert(localBuffer[idx] == JsonConstants.CarriageReturn); 2360if (localBuffer[idx + 1] == JsonConstants.LineFeed) 2407int idx = localBuffer.IndexOfAny(JsonConstants.LineFeed, JsonConstants.CarriageReturn, JsonConstants.StartingByteOfNonStandardSeparator); 2416if (localBuffer[idx] != JsonConstants.StartingByteOfNonStandardSeparator) 2452int foundIdx = localBuffer.Slice(idx).IndexOf(JsonConstants.Slash); 2461if (foundIdx != 0 && localBuffer[foundIdx + idx - 1] == JsonConstants.Asterisk) 2499if (marker == JsonConstants.Slash) 2503else if (marker == JsonConstants.Asterisk)
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (97)
139if (first <= JsonConstants.Space) 156if (first == JsonConstants.Slash) 164if (first == JsonConstants.CloseBrace) 170if (first != JsonConstants.Quote) 196if (first == JsonConstants.CloseBracket) 337if (first == JsonConstants.OpenBrace) 347else if (first == JsonConstants.OpenBracket) 405Debug.Assert((_trailingCommaBeforeComment && marker != JsonConstants.Slash) || !_trailingCommaBeforeComment); 408if (marker == JsonConstants.Quote) 412else if (marker == JsonConstants.OpenBrace) 416else if (marker == JsonConstants.OpenBracket) 426return ConsumeLiteralMultiSegment(JsonConstants.FalseValue, JsonTokenType.False); 430return ConsumeLiteralMultiSegment(JsonConstants.TrueValue, JsonTokenType.True); 434return ConsumeLiteralMultiSegment(JsonConstants.NullValue, JsonTokenType.Null); 443if (marker == JsonConstants.Slash) 456if (marker == JsonConstants.Slash) 481if (marker <= JsonConstants.Space) 540Debug.Assert(span.Length > 0 && span[0] == literal[0] && literal.Length <= JsonConstants.MaximumLiteralLength); 542Span<byte> readSoFar = stackalloc byte[JsonConstants.MaximumLiteralLength]; 697JsonConstants.Delimiters.IndexOf(_buffer[_consumed]) >= 0) 722if (first <= JsonConstants.Space) 733if (first != JsonConstants.KeyValueSeparator) 747Debug.Assert(_buffer[_consumed] == JsonConstants.Quote); 761if (foundByte == JsonConstants.Quote) 816if (foundByte == JsonConstants.Quote) 837if (currentByte == JsonConstants.Quote) 845else if (currentByte == JsonConstants.BackSlash) 851int index = JsonConstants.EscapableChars.IndexOf(currentByte); 906else if (currentByte < JsonConstants.Space) 956Debug.Assert(data[idx] != JsonConstants.Quote); 957Debug.Assert(data[idx] == JsonConstants.BackSlash || data[idx] < JsonConstants.Space); 974if (currentByte == JsonConstants.Quote) 982else if (currentByte == JsonConstants.BackSlash) 988int index = JsonConstants.EscapableChars.IndexOf(currentByte); 1048else if (currentByte < JsonConstants.Space) 1302if (JsonConstants.Delimiters.IndexOf(nextByte) >= 0) 1331if (JsonConstants.Delimiters.IndexOf(nextByte) >= 0) 1418if (JsonConstants.Delimiters.IndexOf(nextByte) >= 0) 1561if (marker == JsonConstants.Slash) 1587if (marker == JsonConstants.ListSeparator) 1614if (first <= JsonConstants.Space) 1627if (_readerOptions.CommentHandling == JsonCommentHandling.Allow && first == JsonConstants.Slash) 1635if (first != JsonConstants.Quote) 1637if (first == JsonConstants.CloseBrace) 1652if (first == JsonConstants.CloseBracket) 1664else if (marker == JsonConstants.CloseBrace) 1668else if (marker == JsonConstants.CloseBracket) 1703if (first <= JsonConstants.Space) 1723Debug.Assert(first != JsonConstants.Slash); 1727if (first == JsonConstants.ListSeparator) 1760if (first <= JsonConstants.Space) 1773if (first == JsonConstants.Slash) 1788if (first != JsonConstants.Quote) 1790if (first == JsonConstants.CloseBrace) 1813if (first == JsonConstants.CloseBracket) 1833else if (first == JsonConstants.CloseBrace) 1837else if (first == JsonConstants.CloseBracket) 1854Debug.Assert(first != JsonConstants.CloseBrace); 1855if (first != JsonConstants.Quote) 1878Debug.Assert(first != JsonConstants.CloseBracket); 1898Debug.Assert(first != JsonConstants.CloseBrace); 1899if (first != JsonConstants.Quote) 1915Debug.Assert(first != JsonConstants.CloseBracket); 1937while (marker == JsonConstants.Slash) 1949if (marker <= JsonConstants.Space) 1972while (marker == JsonConstants.Slash) 1985if (marker <= JsonConstants.Space) 2018if (marker == JsonConstants.CloseBrace) 2024if (marker != JsonConstants.Quote) 2050if (marker == JsonConstants.CloseBracket) 2080else if (marker == JsonConstants.ListSeparator) 2107if (marker <= JsonConstants.Space) 2127if (marker != JsonConstants.Quote) 2129if (marker == JsonConstants.CloseBrace) 2145if (marker == JsonConstants.CloseBracket) 2157else if (marker == JsonConstants.CloseBrace) 2161else if (marker == JsonConstants.CloseBracket) 2260if (marker != JsonConstants.Slash && marker != JsonConstants.Asterisk) 2265bool multiLine = marker == JsonConstants.Asterisk; 2326if (localBuffer[0] == JsonConstants.LineFeed) 2344if (localBuffer[idx] == JsonConstants.LineFeed) 2350Debug.Assert(localBuffer[idx] == JsonConstants.CarriageReturn); 2354if (localBuffer[idx + 1] == JsonConstants.LineFeed) 2428int idx = localBuffer.IndexOfAny(JsonConstants.LineFeed, JsonConstants.CarriageReturn, JsonConstants.StartingByteOfNonStandardSeparator); 2436if (localBuffer[idx] != JsonConstants.StartingByteOfNonStandardSeparator) 2518if (localBuffer[0] == JsonConstants.Slash) 2530if (localBuffer[0] == JsonConstants.LineFeed) 2539int idx = localBuffer.IndexOfAny(JsonConstants.Asterisk, JsonConstants.LineFeed, JsonConstants.CarriageReturn); 2551case JsonConstants.Asterisk: 2555case JsonConstants.LineFeed: 2560Debug.Assert(marker == JsonConstants.CarriageReturn);
System\Text\Json\Reader\Utf8JsonReader.TryGet.cs (25)
46Debug.Assert(span.IndexOf(JsonConstants.BackSlash) == -1); 156Span<byte> unescapedBuffer = valueLength <= JsonConstants.StackallocByteThreshold ? 157stackalloc byte[JsonConstants.StackallocByteThreshold] : 171Span<byte> intermediate = valueLength <= JsonConstants.StackallocByteThreshold ? 172stackalloc byte[JsonConstants.StackallocByteThreshold] : 208Span<byte> intermediate = sequenceLength <= JsonConstants.StackallocByteThreshold ? 209stackalloc byte[JsonConstants.StackallocByteThreshold] : 841Debug.Assert(span.IndexOf(JsonConstants.BackSlash) == -1); 1251if (!JsonHelpers.IsInRangeInclusive(sequenceLength, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumEscapedDateTimeOffsetParseLength)) 1257Span<byte> stackSpan = stackalloc byte[JsonConstants.MaximumEscapedDateTimeOffsetParseLength]; 1263if (!JsonHelpers.IsInRangeInclusive(ValueSpan.Length, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumEscapedDateTimeOffsetParseLength)) 1277Debug.Assert(span.IndexOf(JsonConstants.BackSlash) == -1); 1316if (!JsonHelpers.IsInRangeInclusive(sequenceLength, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumEscapedDateTimeOffsetParseLength)) 1322Span<byte> stackSpan = stackalloc byte[JsonConstants.MaximumEscapedDateTimeOffsetParseLength]; 1328if (!JsonHelpers.IsInRangeInclusive(ValueSpan.Length, JsonConstants.MinimumDateTimeParseLength, JsonConstants.MaximumEscapedDateTimeOffsetParseLength)) 1342Debug.Assert(span.IndexOf(JsonConstants.BackSlash) == -1); 1382if (sequenceLength > JsonConstants.MaximumEscapedGuidLength) 1388Span<byte> stackSpan = stackalloc byte[JsonConstants.MaximumEscapedGuidLength]; 1394if (ValueSpan.Length > JsonConstants.MaximumEscapedGuidLength) 1408Debug.Assert(span.IndexOf(JsonConstants.BackSlash) == -1); 1410if (span.Length == JsonConstants.MaximumFormatGuidLength
System\Text\Json\Serialization\Converters\Object\ObjectConverterFactory.cs (3)
68if (parameterCount <= JsonConstants.UnboxedParameterCountThreshold) 71Type[] typeArguments = new Type[JsonConstants.UnboxedParameterCountThreshold + 1]; 74for (int i = 0; i < JsonConstants.UnboxedParameterCountThreshold; i++)
System\Text\Json\Serialization\Converters\Value\CharConverter.cs (1)
11private const int MaxEscapedCharacterLength = JsonConstants.MaxExpansionFactorWhileEscaping;
System\Text\Json\Serialization\Converters\Value\DateOnlyConverter.cs (1)
13public const int MaxEscapedFormatLength = FormatLength * JsonConstants.MaxExpansionFactorWhileEscaping;
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (3)
244Span<char> charBuffer = bufferLength <= JsonConstants.StackallocCharThreshold 245? stackalloc char[JsonConstants.StackallocCharThreshold] 413using ValueStringBuilder sb = new(stackalloc char[JsonConstants.StackallocCharThreshold]);
System\Text\Json\Serialization\Converters\Value\HalfConverter.cs (9)
43Span<byte> byteBuffer = bufferLength <= JsonConstants.StackallocByteThreshold 44? stackalloc byte[JsonConstants.StackallocByteThreshold] 116const byte Quote = JsonConstants.Quote; 150writer.WriteNumberValueAsStringUnescaped(JsonConstants.NaNValue); 154writer.WriteNumberValueAsStringUnescaped(JsonConstants.PositiveInfinityValue); 158writer.WriteNumberValueAsStringUnescaped(JsonConstants.NegativeInfinityValue); 173(!Half.IsNaN(result) || buffer.SequenceEqual(JsonConstants.NaNValue)) && 174(!Half.IsPositiveInfinity(result) || buffer.SequenceEqual(JsonConstants.PositiveInfinityValue)) && 175(!Half.IsNegativeInfinity(result) || buffer.SequenceEqual(JsonConstants.NegativeInfinityValue));
System\Text\Json\Serialization\Converters\Value\Int128Converter.cs (3)
41Span<byte> buffer = bufferLength <= JsonConstants.StackallocByteThreshold 42? stackalloc byte[JsonConstants.StackallocByteThreshold] 94const byte Quote = JsonConstants.Quote;
System\Text\Json\Serialization\Converters\Value\TimeOnlyConverter.cs (1)
15private const int MaximumEscapedTimeOnlyFormatLength = JsonConstants.MaxExpansionFactorWhileEscaping * MaximumTimeOnlyFormatLength;
System\Text\Json\Serialization\Converters\Value\TimeSpanConverter.cs (1)
15private const int MaximumEscapedTimeSpanFormatLength = JsonConstants.MaxExpansionFactorWhileEscaping * MaximumTimeSpanFormatLength;
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (3)
41Span<byte> buffer = bufferLength <= JsonConstants.StackallocByteThreshold 42? stackalloc byte[JsonConstants.StackallocByteThreshold] 94const byte Quote = JsonConstants.Quote;
System\Text\Json\Serialization\Converters\Value\VersionConverter.cs (1)
17private const int MaximumEscapedVersionLength = JsonConstants.MaxExpansionFactorWhileEscaping * MaximumVersionLength;
System\Text\Json\Serialization\JsonSerializer.Read.String.cs (12)
434json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 436json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 465json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 467json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) :
System\Text\Json\Serialization\JsonSerializerOptions.cs (2)
98private char _indentCharacter = JsonConstants.DefaultIndentCharacter; 99private int _indentSize = JsonConstants.DefaultIndentSize;
System\Text\Json\Serialization\Metadata\ReflectionEmitMemberAccessor.cs (1)
137Debug.Assert(index <= JsonConstants.UnboxedParameterCountThreshold);
System\Text\Json\Serialization\Metadata\ReflectionMemberAccessor.cs (1)
83Debug.Assert(parameterCount <= JsonConstants.UnboxedParameterCountThreshold);
System\Text\Json\Serialization\ReadBufferState.cs (5)
46_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length)); 175Debug.Assert(_buffer.Length >= JsonConstants.Utf8Bom.Length); 176if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom)) 178_offset = (byte)JsonConstants.Utf8Bom.Length; 179_count -= JsonConstants.Utf8Bom.Length;
System\Text\Json\ThrowHelper.cs (17)
141if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 147Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize); 155if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 161Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize); 169if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 175Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize); 183if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 189Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize); 197currentDepth &= JsonConstants.RemoveFlagsBitMask; 204Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize); 212currentDepth &= JsonConstants.RemoveFlagsBitMask; 236currentDepth &= JsonConstants.RemoveFlagsBitMask; 250currentDepth &= JsonConstants.RemoveFlagsBitMask; 257Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize); 594Debug.Assert(token == JsonConstants.CloseBracket || token == JsonConstants.CloseBrace); 600message = SR.Format(SR.DepthTooLarge, currentDepth & JsonConstants.RemoveFlagsBitMask, maxDepth);
System\Text\Json\Writer\JsonWriterHelper.cs (22)
45if (value is not JsonConstants.NewLineLineFeed and not JsonConstants.NewLineCarriageReturnLineFeed) 52if (value is not JsonConstants.DefaultIndentCharacter and not JsonConstants.TabIndentCharacter) 59if (value is < JsonConstants.MinimumIndentSize or > JsonConstants.MaximumIndentSize) 60ThrowHelper.ThrowArgumentOutOfRangeException_IndentSize(nameof(value), JsonConstants.MinimumIndentSize, JsonConstants.MaximumIndentSize); 66if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 73if (value.Length > JsonConstants.MaxUnescapedTokenSize) 98if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 105if (value.Length > JsonConstants.MaxCharacterTokenSize) 112if (propertyName.Length > JsonConstants.MaxCharacterTokenSize || value.Length > JsonConstants.MaxUnescapedTokenSize) 119if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize || value.Length > JsonConstants.MaxCharacterTokenSize) 126if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize || value.Length > JsonConstants.MaxUnescapedTokenSize) 133if (propertyName.Length > JsonConstants.MaxCharacterTokenSize || value.Length > JsonConstants.MaxCharacterTokenSize) 140if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 147if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize)
System\Text\Json\Writer\JsonWriterHelper.Date.cs (5)
17Span<byte> tempSpan = stackalloc byte[JsonConstants.MaximumFormatDateTimeOffsetLength]; 26Span<byte> tempSpan = stackalloc byte[JsonConstants.MaximumFormatDateTimeOffsetLength]; 45const int maxDateTimeLength = JsonConstants.MaximumFormatDateTimeLength; 53buffer.Length == JsonConstants.MaximumFormatDateTimeOffsetLength); 88else if (buffer.Length == JsonConstants.MaximumFormatDateTimeOffsetLength)
System\Text\Json\Writer\JsonWriterHelper.Escaping.cs (15)
79return firstIndexToEscape + JsonConstants.MaxExpansionFactorWhileEscaping * (textLength - firstIndexToEscape); 152case JsonConstants.Quote: 160case JsonConstants.LineFeed: 163case JsonConstants.CarriageReturn: 166case JsonConstants.Tab: 169case JsonConstants.BackSlash: 172case JsonConstants.BackSpace: 175case JsonConstants.FormFeed: 265case JsonConstants.Quote: 273case JsonConstants.LineFeed: 276case JsonConstants.CarriageReturn: 279case JsonConstants.Tab: 282case JsonConstants.BackSlash: 285case JsonConstants.BackSpace: 288case JsonConstants.FormFeed:
System\Text\Json\Writer\JsonWriterOptions.cs (8)
16private static readonly string s_alternateNewLine = Environment.NewLine.Length == 2 ? JsonConstants.NewLineLineFeed : JsonConstants.NewLineCarriageReturnLineFeed; 55readonly get => (_optionsMask & IndentCharacterBit) != 0 ? JsonConstants.TabIndentCharacter : JsonConstants.DefaultIndentCharacter; 59if (value is not JsonConstants.DefaultIndentCharacter) 850 => JsonConstants.DefaultIndentSize, 86JsonConstants.DefaultIndentSize => 0, 170private const int IndentSizeMask = JsonConstants.MaximumIndentSize << OptionsBitCount;
System\Text\Json\Writer\Utf8JsonWriter.cs (32)
95public int CurrentDepth => _currentDepth & JsonConstants.RemoveFlagsBitMask; 463WriteStart(JsonConstants.OpenBracket); 476WriteStart(JsonConstants.OpenBrace); 494_currentDepth &= JsonConstants.RemoveFlagsBitMask; 508output[BytesPending++] = JsonConstants.ListSeparator; 575output[BytesPending++] = JsonConstants.ListSeparator; 598WriteStartHelper(propertyName.EncodedUtf8Bytes, JsonConstants.OpenBracket); 612WriteStartHelper(propertyName.EncodedUtf8Bytes, JsonConstants.OpenBrace); 618Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 624_currentDepth &= JsonConstants.RemoveFlagsBitMask; 646WriteStartEscape(utf8PropertyName, JsonConstants.OpenBracket); 648_currentDepth &= JsonConstants.RemoveFlagsBitMask; 671WriteStartEscape(utf8PropertyName, JsonConstants.OpenBrace); 673_currentDepth &= JsonConstants.RemoveFlagsBitMask; 710Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 717Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 718stackalloc byte[JsonConstants.StackallocByteThreshold] : 801WriteStartEscape(propertyName, JsonConstants.OpenBracket); 803_currentDepth &= JsonConstants.RemoveFlagsBitMask; 826WriteStartEscape(propertyName, JsonConstants.OpenBrace); 828_currentDepth &= JsonConstants.RemoveFlagsBitMask; 865Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 872Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 873stackalloc char[JsonConstants.StackallocCharThreshold] : 894WriteEnd(JsonConstants.CloseBracket); 906WriteEnd(JsonConstants.CloseBrace); 965if (token == JsonConstants.CloseBracket) 975Debug.Assert(token == JsonConstants.CloseBrace); 1033output[BytesPending++] = JsonConstants.CarriageReturn; 1035output[BytesPending++] = JsonConstants.LineFeed; 1046if (token == JsonConstants.OpenBracket) 1053Debug.Assert(token == JsonConstants.OpenBrace);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (37)
23Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 139Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 146Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 147stackalloc char[JsonConstants.StackallocCharThreshold] : 162Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 169Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 170stackalloc byte[JsonConstants.StackallocByteThreshold] : 213Debug.Assert(escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding < int.MaxValue - encodedLength - 6); 217int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + encodedLength + 6; 228output[BytesPending++] = JsonConstants.ListSeparator; 230output[BytesPending++] = JsonConstants.Quote; 234output[BytesPending++] = JsonConstants.Quote; 235output[BytesPending++] = JsonConstants.KeyValueSeparator; 237output[BytesPending++] = JsonConstants.Quote; 241output[BytesPending++] = JsonConstants.Quote; 263output[BytesPending++] = JsonConstants.ListSeparator; 265output[BytesPending++] = JsonConstants.Quote; 270output[BytesPending++] = JsonConstants.Quote; 271output[BytesPending++] = JsonConstants.KeyValueSeparator; 273output[BytesPending++] = JsonConstants.Quote; 277output[BytesPending++] = JsonConstants.Quote; 287Debug.Assert(escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding < int.MaxValue - indent - encodedLength - 7 - _newLineLength); 291int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + encodedLength + 7 + _newLineLength; 302output[BytesPending++] = JsonConstants.ListSeparator; 315output[BytesPending++] = JsonConstants.Quote; 319output[BytesPending++] = JsonConstants.Quote; 320output[BytesPending++] = JsonConstants.KeyValueSeparator; 321output[BytesPending++] = JsonConstants.Space; 323output[BytesPending++] = JsonConstants.Quote; 327output[BytesPending++] = JsonConstants.Quote; 352output[BytesPending++] = JsonConstants.ListSeparator; 365output[BytesPending++] = JsonConstants.Quote; 370output[BytesPending++] = JsonConstants.Quote; 371output[BytesPending++] = JsonConstants.KeyValueSeparator; 372output[BytesPending++] = JsonConstants.Space; 374output[BytesPending++] = JsonConstants.Quote; 378output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (46)
27Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 146Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 153Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 154stackalloc char[JsonConstants.StackallocCharThreshold] : 169Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 176Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 177stackalloc byte[JsonConstants.StackallocByteThreshold] : 218Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 222int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; 233output[BytesPending++] = JsonConstants.ListSeparator; 235output[BytesPending++] = JsonConstants.Quote; 239output[BytesPending++] = JsonConstants.Quote; 240output[BytesPending++] = JsonConstants.KeyValueSeparator; 242output[BytesPending++] = JsonConstants.Quote; 247output[BytesPending++] = JsonConstants.Quote; 252Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 254int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 266output[BytesPending++] = JsonConstants.ListSeparator; 268output[BytesPending++] = JsonConstants.Quote; 273output[BytesPending++] = JsonConstants.Quote; 274output[BytesPending++] = JsonConstants.KeyValueSeparator; 276output[BytesPending++] = JsonConstants.Quote; 281output[BytesPending++] = JsonConstants.Quote; 289Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 293int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 7 + _newLineLength; 304output[BytesPending++] = JsonConstants.ListSeparator; 317output[BytesPending++] = JsonConstants.Quote; 321output[BytesPending++] = JsonConstants.Quote; 322output[BytesPending++] = JsonConstants.KeyValueSeparator; 323output[BytesPending++] = JsonConstants.Space; 325output[BytesPending++] = JsonConstants.Quote; 330output[BytesPending++] = JsonConstants.Quote; 338Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 340int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 352output[BytesPending++] = JsonConstants.ListSeparator; 365output[BytesPending++] = JsonConstants.Quote; 370output[BytesPending++] = JsonConstants.Quote; 371output[BytesPending++] = JsonConstants.KeyValueSeparator; 372output[BytesPending++] = JsonConstants.Space; 374output[BytesPending++] = JsonConstants.Quote; 379output[BytesPending++] = JsonConstants.Quote; 384Span<byte> buffer = stackalloc byte[JsonConstants.MaximumFormatDateTimeOffsetLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (46)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 145Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 152Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 153stackalloc char[JsonConstants.StackallocCharThreshold] : 168Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 175Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 176stackalloc byte[JsonConstants.StackallocByteThreshold] : 217Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 221int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; 232output[BytesPending++] = JsonConstants.ListSeparator; 234output[BytesPending++] = JsonConstants.Quote; 238output[BytesPending++] = JsonConstants.Quote; 239output[BytesPending++] = JsonConstants.KeyValueSeparator; 241output[BytesPending++] = JsonConstants.Quote; 246output[BytesPending++] = JsonConstants.Quote; 251Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 253int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 265output[BytesPending++] = JsonConstants.ListSeparator; 267output[BytesPending++] = JsonConstants.Quote; 272output[BytesPending++] = JsonConstants.Quote; 273output[BytesPending++] = JsonConstants.KeyValueSeparator; 275output[BytesPending++] = JsonConstants.Quote; 280output[BytesPending++] = JsonConstants.Quote; 288Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 292int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 7 + _newLineLength; 303output[BytesPending++] = JsonConstants.ListSeparator; 316output[BytesPending++] = JsonConstants.Quote; 320output[BytesPending++] = JsonConstants.Quote; 321output[BytesPending++] = JsonConstants.KeyValueSeparator; 322output[BytesPending++] = JsonConstants.Space; 324output[BytesPending++] = JsonConstants.Quote; 329output[BytesPending++] = JsonConstants.Quote; 337Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 339int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 351output[BytesPending++] = JsonConstants.ListSeparator; 364output[BytesPending++] = JsonConstants.Quote; 369output[BytesPending++] = JsonConstants.Quote; 370output[BytesPending++] = JsonConstants.KeyValueSeparator; 371output[BytesPending++] = JsonConstants.Space; 373output[BytesPending++] = JsonConstants.Quote; 378output[BytesPending++] = JsonConstants.Quote; 383Span<byte> buffer = stackalloc byte[JsonConstants.MaximumFormatDateTimeOffsetLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (38)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 145Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 152Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 153stackalloc char[JsonConstants.StackallocCharThreshold] : 168Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 175Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 176stackalloc byte[JsonConstants.StackallocByteThreshold] : 217Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDecimalLength - 4); 221int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDecimalLength + 4; 232output[BytesPending++] = JsonConstants.ListSeparator; 234output[BytesPending++] = JsonConstants.Quote; 238output[BytesPending++] = JsonConstants.Quote; 239output[BytesPending++] = JsonConstants.KeyValueSeparator; 248Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDecimalLength - 4); 250int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDecimalLength + 3; // 2 quotes for property name, and 1 colon 262output[BytesPending++] = JsonConstants.ListSeparator; 264output[BytesPending++] = JsonConstants.Quote; 269output[BytesPending++] = JsonConstants.Quote; 270output[BytesPending++] = JsonConstants.KeyValueSeparator; 282Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDecimalLength - 5 - _newLineLength); 286int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDecimalLength + 5 + _newLineLength; 297output[BytesPending++] = JsonConstants.ListSeparator; 310output[BytesPending++] = JsonConstants.Quote; 314output[BytesPending++] = JsonConstants.Quote; 315output[BytesPending++] = JsonConstants.KeyValueSeparator; 316output[BytesPending++] = JsonConstants.Space; 328Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDecimalLength - 5 - _newLineLength); 330int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDecimalLength + 4; // 2 quotes for property name, 1 colon, and 1 space 342output[BytesPending++] = JsonConstants.ListSeparator; 355output[BytesPending++] = JsonConstants.Quote; 360output[BytesPending++] = JsonConstants.Quote; 361output[BytesPending++] = JsonConstants.KeyValueSeparator; 362output[BytesPending++] = JsonConstants.Space; 371Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatDecimalLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (38)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 149Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 156Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 157stackalloc char[JsonConstants.StackallocCharThreshold] : 172Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 179Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 180stackalloc byte[JsonConstants.StackallocByteThreshold] : 221Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDoubleLength - 4); 225int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDoubleLength + 4; 236output[BytesPending++] = JsonConstants.ListSeparator; 238output[BytesPending++] = JsonConstants.Quote; 242output[BytesPending++] = JsonConstants.Quote; 243output[BytesPending++] = JsonConstants.KeyValueSeparator; 252Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDoubleLength - 4); 254int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDoubleLength + 3; // 2 quotes for property name, and 1 colon 266output[BytesPending++] = JsonConstants.ListSeparator; 268output[BytesPending++] = JsonConstants.Quote; 273output[BytesPending++] = JsonConstants.Quote; 274output[BytesPending++] = JsonConstants.KeyValueSeparator; 286Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDoubleLength - 5 - _newLineLength); 290int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDoubleLength + 5 + _newLineLength; 301output[BytesPending++] = JsonConstants.ListSeparator; 314output[BytesPending++] = JsonConstants.Quote; 318output[BytesPending++] = JsonConstants.Quote; 319output[BytesPending++] = JsonConstants.KeyValueSeparator; 320output[BytesPending++] = JsonConstants.Space; 332Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDoubleLength - 5 - _newLineLength); 334int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDoubleLength + 4; // 2 quotes for property name, 1 colon, and 1 space 346output[BytesPending++] = JsonConstants.ListSeparator; 359output[BytesPending++] = JsonConstants.Quote; 364output[BytesPending++] = JsonConstants.Quote; 365output[BytesPending++] = JsonConstants.KeyValueSeparator; 366output[BytesPending++] = JsonConstants.Space; 376Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatDoubleLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (38)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 149Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 156Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 157stackalloc char[JsonConstants.StackallocCharThreshold] : 172Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 179Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 180stackalloc byte[JsonConstants.StackallocByteThreshold] : 221Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatSingleLength - 4); 225int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatSingleLength + 4; 236output[BytesPending++] = JsonConstants.ListSeparator; 238output[BytesPending++] = JsonConstants.Quote; 242output[BytesPending++] = JsonConstants.Quote; 243output[BytesPending++] = JsonConstants.KeyValueSeparator; 252Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatSingleLength - 4); 254int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatSingleLength + 3; // 2 quotes for property name, and 1 colon 266output[BytesPending++] = JsonConstants.ListSeparator; 268output[BytesPending++] = JsonConstants.Quote; 273output[BytesPending++] = JsonConstants.Quote; 274output[BytesPending++] = JsonConstants.KeyValueSeparator; 286Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatSingleLength - 5 - _newLineLength); 290int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatSingleLength + 5 + _newLineLength; 301output[BytesPending++] = JsonConstants.ListSeparator; 314output[BytesPending++] = JsonConstants.Quote; 318output[BytesPending++] = JsonConstants.Quote; 319output[BytesPending++] = JsonConstants.KeyValueSeparator; 320output[BytesPending++] = JsonConstants.Space; 332Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatSingleLength - 5 - _newLineLength); 334int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatSingleLength + 4; // 2 quotes for property name, 1 colon, and 1 space 346output[BytesPending++] = JsonConstants.ListSeparator; 359output[BytesPending++] = JsonConstants.Quote; 364output[BytesPending++] = JsonConstants.Quote; 365output[BytesPending++] = JsonConstants.KeyValueSeparator; 366output[BytesPending++] = JsonConstants.Space; 375Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatSingleLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.FormattedNumber.cs (6)
116Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 123Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 124stackalloc char[JsonConstants.StackallocCharThreshold] : 139Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 146Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 147stackalloc byte[JsonConstants.StackallocByteThreshold] :
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (46)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 145Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 152Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 153stackalloc char[JsonConstants.StackallocCharThreshold] : 168Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 175Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 176stackalloc byte[JsonConstants.StackallocByteThreshold] : 217Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatGuidLength - 6); 221int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatGuidLength + 6; 232output[BytesPending++] = JsonConstants.ListSeparator; 234output[BytesPending++] = JsonConstants.Quote; 238output[BytesPending++] = JsonConstants.Quote; 239output[BytesPending++] = JsonConstants.KeyValueSeparator; 241output[BytesPending++] = JsonConstants.Quote; 247output[BytesPending++] = JsonConstants.Quote; 252Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatGuidLength - 6); 254int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatGuidLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 266output[BytesPending++] = JsonConstants.ListSeparator; 268output[BytesPending++] = JsonConstants.Quote; 273output[BytesPending++] = JsonConstants.Quote; 274output[BytesPending++] = JsonConstants.KeyValueSeparator; 276output[BytesPending++] = JsonConstants.Quote; 282output[BytesPending++] = JsonConstants.Quote; 290Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatGuidLength - 7 - _newLineLength); 294int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatGuidLength + 7 + _newLineLength; 305output[BytesPending++] = JsonConstants.ListSeparator; 318output[BytesPending++] = JsonConstants.Quote; 322output[BytesPending++] = JsonConstants.Quote; 323output[BytesPending++] = JsonConstants.KeyValueSeparator; 324output[BytesPending++] = JsonConstants.Space; 326output[BytesPending++] = JsonConstants.Quote; 332output[BytesPending++] = JsonConstants.Quote; 340Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatGuidLength - 7 - _newLineLength); 342int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatGuidLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 354output[BytesPending++] = JsonConstants.ListSeparator; 367output[BytesPending++] = JsonConstants.Quote; 372output[BytesPending++] = JsonConstants.Quote; 373output[BytesPending++] = JsonConstants.KeyValueSeparator; 374output[BytesPending++] = JsonConstants.Space; 376output[BytesPending++] = JsonConstants.Quote; 382output[BytesPending++] = JsonConstants.Quote; 387Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatGuidLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (24)
16if (propertyName.Length > JsonConstants.MaxCharacterTokenSize || CurrentDepth >= _options.MaxDepth) 23if (utf8PropertyName.Length > JsonConstants.MaxUnescapedTokenSize || CurrentDepth >= _options.MaxDepth) 77output[BytesPending++] = JsonConstants.ListSeparator; 79output[BytesPending++] = JsonConstants.Quote; 84output[BytesPending++] = JsonConstants.Quote; 85output[BytesPending++] = JsonConstants.KeyValueSeparator; 108output[BytesPending++] = JsonConstants.ListSeparator; 121output[BytesPending++] = JsonConstants.Quote; 126output[BytesPending++] = JsonConstants.Quote; 128output[BytesPending++] = JsonConstants.KeyValueSeparator; 129output[BytesPending++] = JsonConstants.Space; 135Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - 5); 139int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 5; 150output[BytesPending++] = JsonConstants.ListSeparator; 152output[BytesPending++] = JsonConstants.Quote; 156output[BytesPending++] = JsonConstants.Quote; 157output[BytesPending++] = JsonConstants.KeyValueSeparator; 166Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - 6 - _newLineLength); 170int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 6 + _newLineLength; 181output[BytesPending++] = JsonConstants.ListSeparator; 194output[BytesPending++] = JsonConstants.Quote; 198output[BytesPending++] = JsonConstants.Quote; 200output[BytesPending++] = JsonConstants.KeyValueSeparator; 201output[BytesPending++] = JsonConstants.Space;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (48)
22WriteLiteralHelper(propertyName.EncodedUtf8Bytes, JsonConstants.NullValue); 33WriteLiteralHelper(escapedName, JsonConstants.NullValue); 38Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxUnescapedTokenSize - 3); 40ReadOnlySpan<byte> span = JsonConstants.NullValue; 51Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 100ReadOnlySpan<byte> span = JsonConstants.NullValue; 125ReadOnlySpan<byte> span = JsonConstants.NullValue; 145WriteLiteralHelper(propertyName.EncodedUtf8Bytes, JsonConstants.TrueValue); 150WriteLiteralHelper(propertyName.EncodedUtf8Bytes, JsonConstants.FalseValue); 199ReadOnlySpan<byte> span = value ? JsonConstants.TrueValue : JsonConstants.FalseValue; 225ReadOnlySpan<byte> span = value ? JsonConstants.TrueValue : JsonConstants.FalseValue; 267Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 274Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 275stackalloc char[JsonConstants.StackallocCharThreshold] : 290Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 297Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 298stackalloc byte[JsonConstants.StackallocByteThreshold] : 339Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 340Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - value.Length - 4); 344int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + value.Length + 4; 355output[BytesPending++] = JsonConstants.ListSeparator; 357output[BytesPending++] = JsonConstants.Quote; 361output[BytesPending++] = JsonConstants.Quote; 362output[BytesPending++] = JsonConstants.KeyValueSeparator; 370Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 385output[BytesPending++] = JsonConstants.ListSeparator; 387output[BytesPending++] = JsonConstants.Quote; 392output[BytesPending++] = JsonConstants.Quote; 393output[BytesPending++] = JsonConstants.KeyValueSeparator; 403Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 417output[BytesPending++] = JsonConstants.ListSeparator; 432Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 433Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - value.Length - 5 - _newLineLength); 437int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + value.Length + 5 + _newLineLength; 448output[BytesPending++] = JsonConstants.ListSeparator; 461output[BytesPending++] = JsonConstants.Quote; 465output[BytesPending++] = JsonConstants.Quote; 466output[BytesPending++] = JsonConstants.KeyValueSeparator; 467output[BytesPending++] = JsonConstants.Space; 478Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 493output[BytesPending++] = JsonConstants.ListSeparator; 506output[BytesPending++] = JsonConstants.Quote; 511output[BytesPending++] = JsonConstants.Quote; 512output[BytesPending++] = JsonConstants.KeyValueSeparator; 513output[BytesPending++] = JsonConstants.Space; 521Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatBooleanLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (38)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 221Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 228Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 229stackalloc char[JsonConstants.StackallocCharThreshold] : 244Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 251Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 252stackalloc byte[JsonConstants.StackallocByteThreshold] : 293Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatInt64Length - 4); 297int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatInt64Length + 4; 308output[BytesPending++] = JsonConstants.ListSeparator; 310output[BytesPending++] = JsonConstants.Quote; 314output[BytesPending++] = JsonConstants.Quote; 315output[BytesPending++] = JsonConstants.KeyValueSeparator; 324Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatInt64Length - 4); 326int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatInt64Length + 3; // 2 quotes for property name, and 1 colon 338output[BytesPending++] = JsonConstants.ListSeparator; 340output[BytesPending++] = JsonConstants.Quote; 345output[BytesPending++] = JsonConstants.Quote; 346output[BytesPending++] = JsonConstants.KeyValueSeparator; 358Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatInt64Length - 5 - _newLineLength); 362int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatInt64Length + 5 + _newLineLength; 373output[BytesPending++] = JsonConstants.ListSeparator; 386output[BytesPending++] = JsonConstants.Quote; 390output[BytesPending++] = JsonConstants.Quote; 391output[BytesPending++] = JsonConstants.KeyValueSeparator; 392output[BytesPending++] = JsonConstants.Space; 404Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatInt64Length - 5 - _newLineLength); 406int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatInt64Length + 4; // 2 quotes for property name, 1 colon, and 1 space 418output[BytesPending++] = JsonConstants.ListSeparator; 431output[BytesPending++] = JsonConstants.Quote; 436output[BytesPending++] = JsonConstants.Quote; 437output[BytesPending++] = JsonConstants.KeyValueSeparator; 438output[BytesPending++] = JsonConstants.Space; 450Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatInt64Length];
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (155)
33Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxUnescapedTokenSize - 3); 37_currentDepth &= JsonConstants.RemoveFlagsBitMask; 45Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 49_currentDepth &= JsonConstants.RemoveFlagsBitMask; 108_currentDepth &= JsonConstants.RemoveFlagsBitMask; 115Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 124if (length > JsonConstants.StackallocCharThreshold) 131escapedPropertyName = stackalloc char[JsonConstants.StackallocCharThreshold]; 161Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 162Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 4) / JsonConstants.MaxExpansionFactorWhileTranscoding); 166int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4; 177output[BytesPending++] = JsonConstants.ListSeparator; 179output[BytesPending++] = JsonConstants.Quote; 183output[BytesPending++] = JsonConstants.Quote; 184output[BytesPending++] = JsonConstants.KeyValueSeparator; 192Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 193Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 5 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding); 197int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 5 + _newLineLength; 208output[BytesPending++] = JsonConstants.ListSeparator; 219output[BytesPending++] = JsonConstants.Quote; 223output[BytesPending++] = JsonConstants.Quote; 224output[BytesPending++] = JsonConstants.KeyValueSeparator; 225output[BytesPending++] = JsonConstants.Space; 257_currentDepth &= JsonConstants.RemoveFlagsBitMask; 267_currentDepth &= JsonConstants.RemoveFlagsBitMask; 274Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 283if (length > JsonConstants.StackallocByteThreshold) 290escapedPropertyName = stackalloc byte[JsonConstants.StackallocByteThreshold]; 322Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 337output[BytesPending++] = JsonConstants.ListSeparator; 339output[BytesPending++] = JsonConstants.Quote; 344output[BytesPending++] = JsonConstants.Quote; 345output[BytesPending++] = JsonConstants.KeyValueSeparator; 352Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxEscapedTokenSize - 3); 366output[BytesPending++] = JsonConstants.ListSeparator; 380Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 395output[BytesPending++] = JsonConstants.ListSeparator; 408output[BytesPending++] = JsonConstants.Quote; 413output[BytesPending++] = JsonConstants.Quote; 414output[BytesPending++] = JsonConstants.KeyValueSeparator; 415output[BytesPending++] = JsonConstants.Space; 431Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize && utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 604Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 694Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 784Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 856Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 911Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 918Span<byte> escapedValue = length <= JsonConstants.StackallocByteThreshold ? 919stackalloc byte[JsonConstants.StackallocByteThreshold] : 934Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 941Span<char> escapedValue = length <= JsonConstants.StackallocCharThreshold ? 942stackalloc char[JsonConstants.StackallocCharThreshold] : 957Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 964Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 965stackalloc char[JsonConstants.StackallocCharThreshold] : 980Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 987Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 988stackalloc byte[JsonConstants.StackallocByteThreshold] : 1079Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 1080Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 1090if (length > JsonConstants.StackallocCharThreshold) 1097escapedValue = stackalloc char[JsonConstants.StackallocCharThreshold]; 1110if (length > JsonConstants.StackallocCharThreshold) 1117escapedPropertyName = stackalloc char[JsonConstants.StackallocCharThreshold]; 1139Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 1140Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 1150if (length > JsonConstants.StackallocByteThreshold) 1157escapedValue = stackalloc byte[JsonConstants.StackallocByteThreshold]; 1170if (length > JsonConstants.StackallocByteThreshold) 1177escapedPropertyName = stackalloc byte[JsonConstants.StackallocByteThreshold]; 1199Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 1200Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 1210if (length > JsonConstants.StackallocByteThreshold) 1217escapedValue = stackalloc byte[JsonConstants.StackallocByteThreshold]; 1230if (length > JsonConstants.StackallocCharThreshold) 1237escapedPropertyName = stackalloc char[JsonConstants.StackallocCharThreshold]; 1259Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 1260Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 1270if (length > JsonConstants.StackallocCharThreshold) 1277escapedValue = stackalloc char[JsonConstants.StackallocCharThreshold]; 1290if (length > JsonConstants.StackallocByteThreshold) 1297escapedPropertyName = stackalloc byte[JsonConstants.StackallocByteThreshold]; 1372Debug.Assert(escapedValue.Length <= JsonConstants.MaxUnescapedTokenSize); 1373Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 6) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length); 1377int maxRequired = ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 6; 1388output[BytesPending++] = JsonConstants.ListSeparator; 1390output[BytesPending++] = JsonConstants.Quote; 1394output[BytesPending++] = JsonConstants.Quote; 1395output[BytesPending++] = JsonConstants.KeyValueSeparator; 1397output[BytesPending++] = JsonConstants.Quote; 1401output[BytesPending++] = JsonConstants.Quote; 1407Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1422output[BytesPending++] = JsonConstants.ListSeparator; 1424output[BytesPending++] = JsonConstants.Quote; 1429output[BytesPending++] = JsonConstants.Quote; 1430output[BytesPending++] = JsonConstants.KeyValueSeparator; 1432output[BytesPending++] = JsonConstants.Quote; 1437output[BytesPending++] = JsonConstants.Quote; 1443Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1444Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6); 1448int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 6; 1459output[BytesPending++] = JsonConstants.ListSeparator; 1461output[BytesPending++] = JsonConstants.Quote; 1465output[BytesPending++] = JsonConstants.Quote; 1466output[BytesPending++] = JsonConstants.KeyValueSeparator; 1468output[BytesPending++] = JsonConstants.Quote; 1473output[BytesPending++] = JsonConstants.Quote; 1479Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1480Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6); 1484int maxRequired = (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 6; 1495output[BytesPending++] = JsonConstants.ListSeparator; 1497output[BytesPending++] = JsonConstants.Quote; 1502output[BytesPending++] = JsonConstants.Quote; 1503output[BytesPending++] = JsonConstants.KeyValueSeparator; 1505output[BytesPending++] = JsonConstants.Quote; 1509output[BytesPending++] = JsonConstants.Quote; 1518Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1519Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 7 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length); 1523int maxRequired = indent + ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 7 + _newLineLength; 1534output[BytesPending++] = JsonConstants.ListSeparator; 1547output[BytesPending++] = JsonConstants.Quote; 1551output[BytesPending++] = JsonConstants.Quote; 1552output[BytesPending++] = JsonConstants.KeyValueSeparator; 1553output[BytesPending++] = JsonConstants.Space; 1555output[BytesPending++] = JsonConstants.Quote; 1559output[BytesPending++] = JsonConstants.Quote; 1568Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1583output[BytesPending++] = JsonConstants.ListSeparator; 1596output[BytesPending++] = JsonConstants.Quote; 1601output[BytesPending++] = JsonConstants.Quote; 1602output[BytesPending++] = JsonConstants.KeyValueSeparator; 1603output[BytesPending++] = JsonConstants.Space; 1605output[BytesPending++] = JsonConstants.Quote; 1610output[BytesPending++] = JsonConstants.Quote; 1619Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1620Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength); 1624int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 7 + _newLineLength; 1635output[BytesPending++] = JsonConstants.ListSeparator; 1648output[BytesPending++] = JsonConstants.Quote; 1652output[BytesPending++] = JsonConstants.Quote; 1653output[BytesPending++] = JsonConstants.KeyValueSeparator; 1654output[BytesPending++] = JsonConstants.Space; 1656output[BytesPending++] = JsonConstants.Quote; 1661output[BytesPending++] = JsonConstants.Quote; 1670Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1671Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength); 1675int maxRequired = indent + (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 7 + _newLineLength; 1686output[BytesPending++] = JsonConstants.ListSeparator; 1699output[BytesPending++] = JsonConstants.Quote; 1704output[BytesPending++] = JsonConstants.Quote; 1705output[BytesPending++] = JsonConstants.KeyValueSeparator; 1706output[BytesPending++] = JsonConstants.Space; 1708output[BytesPending++] = JsonConstants.Quote; 1712output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (38)
27Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 230Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 237Span<char> escapedPropertyName = length <= JsonConstants.StackallocCharThreshold ? 238stackalloc char[JsonConstants.StackallocCharThreshold] : 253Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 260Span<byte> escapedPropertyName = length <= JsonConstants.StackallocByteThreshold ? 261stackalloc byte[JsonConstants.StackallocByteThreshold] : 302Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatUInt64Length - 4); 306int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatUInt64Length + 4; 317output[BytesPending++] = JsonConstants.ListSeparator; 319output[BytesPending++] = JsonConstants.Quote; 323output[BytesPending++] = JsonConstants.Quote; 324output[BytesPending++] = JsonConstants.KeyValueSeparator; 333Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatUInt64Length - 4); 335int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatUInt64Length + 3; // 2 quotes for property name, and 1 colon 347output[BytesPending++] = JsonConstants.ListSeparator; 349output[BytesPending++] = JsonConstants.Quote; 354output[BytesPending++] = JsonConstants.Quote; 355output[BytesPending++] = JsonConstants.KeyValueSeparator; 367Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatUInt64Length - 5 - _newLineLength); 371int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatUInt64Length + 5 + _newLineLength; 382output[BytesPending++] = JsonConstants.ListSeparator; 395output[BytesPending++] = JsonConstants.Quote; 399output[BytesPending++] = JsonConstants.Quote; 400output[BytesPending++] = JsonConstants.KeyValueSeparator; 401output[BytesPending++] = JsonConstants.Space; 413Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatUInt64Length - 5 - _newLineLength); 415int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatUInt64Length + 4; // 2 quotes for property name, 1 colon, and 1 space 427output[BytesPending++] = JsonConstants.ListSeparator; 440output[BytesPending++] = JsonConstants.Quote; 445output[BytesPending++] = JsonConstants.Quote; 446output[BytesPending++] = JsonConstants.KeyValueSeparator; 447output[BytesPending++] = JsonConstants.Space; 459Span<byte> utf8PropertyName = stackalloc byte[JsonConstants.MaximumFormatUInt64Length];
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Bytes.cs (6)
78output[BytesPending++] = JsonConstants.ListSeparator; 80output[BytesPending++] = JsonConstants.Quote; 84output[BytesPending++] = JsonConstants.Quote; 118output[BytesPending++] = JsonConstants.ListSeparator; 131output[BytesPending++] = JsonConstants.Quote; 135output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Comment.cs (20)
76Debug.Assert(value.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - 4); 80int maxRequired = (value.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4; 89output[BytesPending++] = JsonConstants.Slash; 90output[BytesPending++] = JsonConstants.Asterisk; 101output[BytesPending++] = JsonConstants.Asterisk; 102output[BytesPending++] = JsonConstants.Slash; 110Debug.Assert(value.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - 4 - _newLineLength); 114int maxRequired = indent + (value.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4 + _newLineLength; 130output[BytesPending++] = JsonConstants.Slash; 131output[BytesPending++] = JsonConstants.Asterisk; 142output[BytesPending++] = JsonConstants.Asterisk; 143output[BytesPending++] = JsonConstants.Slash; 202output[BytesPending++] = JsonConstants.Slash; 203output[BytesPending++] = JsonConstants.Asterisk; 208output[BytesPending++] = JsonConstants.Asterisk; 209output[BytesPending++] = JsonConstants.Slash; 237output[BytesPending++] = JsonConstants.Slash; 238output[BytesPending++] = JsonConstants.Asterisk; 243output[BytesPending++] = JsonConstants.Asterisk; 244output[BytesPending++] = JsonConstants.Slash;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTime.cs (8)
44int maxRequired = JsonConstants.MaximumFormatDateTimeOffsetLength + 3; // 2 quotes, and optionally, 1 list separator 55output[BytesPending++] = JsonConstants.ListSeparator; 58output[BytesPending++] = JsonConstants.Quote; 63output[BytesPending++] = JsonConstants.Quote; 72int maxRequired = indent + JsonConstants.MaximumFormatDateTimeOffsetLength + 3 + _newLineLength; 83output[BytesPending++] = JsonConstants.ListSeparator; 96output[BytesPending++] = JsonConstants.Quote; 101output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTimeOffset.cs (8)
45int maxRequired = JsonConstants.MaximumFormatDateTimeOffsetLength + 3; // 2 quotes, and optionally, 1 list separator 56output[BytesPending++] = JsonConstants.ListSeparator; 59output[BytesPending++] = JsonConstants.Quote; 64output[BytesPending++] = JsonConstants.Quote; 73int maxRequired = indent + JsonConstants.MaximumFormatDateTimeOffsetLength + 3 + _newLineLength; 84output[BytesPending++] = JsonConstants.ListSeparator; 97output[BytesPending++] = JsonConstants.Quote; 102output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Decimal.cs (5)
44int maxRequired = JsonConstants.MaximumFormatDecimalLength + 1; // Optionally, 1 list separator 55output[BytesPending++] = JsonConstants.ListSeparator; 68int maxRequired = indent + JsonConstants.MaximumFormatDecimalLength + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 79output[BytesPending++] = JsonConstants.ListSeparator; 99Span<byte> utf8Number = stackalloc byte[JsonConstants.MaximumFormatDecimalLength];
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Double.cs (8)
48int maxRequired = JsonConstants.MaximumFormatDoubleLength + 1; // Optionally, 1 list separator 59output[BytesPending++] = JsonConstants.ListSeparator; 72int maxRequired = indent + JsonConstants.MaximumFormatDoubleLength + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 83output[BytesPending++] = JsonConstants.ListSeparator; 147Span<byte> utf8Number = stackalloc byte[JsonConstants.MaximumFormatDoubleLength]; 157WriteNumberValueAsStringUnescaped(JsonConstants.NaNValue); 161WriteNumberValueAsStringUnescaped(JsonConstants.PositiveInfinityValue); 165WriteNumberValueAsStringUnescaped(JsonConstants.NegativeInfinityValue);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Float.cs (8)
48int maxRequired = JsonConstants.MaximumFormatSingleLength + 1; // Optionally, 1 list separator 59output[BytesPending++] = JsonConstants.ListSeparator; 72int maxRequired = indent + JsonConstants.MaximumFormatSingleLength + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 83output[BytesPending++] = JsonConstants.ListSeparator; 147Span<byte> utf8Number = stackalloc byte[JsonConstants.MaximumFormatSingleLength]; 157WriteNumberValueAsStringUnescaped(JsonConstants.NaNValue); 161WriteNumberValueAsStringUnescaped(JsonConstants.PositiveInfinityValue); 165WriteNumberValueAsStringUnescaped(JsonConstants.NegativeInfinityValue);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.FormattedNumber.cs (2)
60output[BytesPending++] = JsonConstants.ListSeparator; 85output[BytesPending++] = JsonConstants.ListSeparator;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Guid.cs (8)
44int maxRequired = JsonConstants.MaximumFormatGuidLength + 3; // 2 quotes, and optionally, 1 list separator 55output[BytesPending++] = JsonConstants.ListSeparator; 58output[BytesPending++] = JsonConstants.Quote; 64output[BytesPending++] = JsonConstants.Quote; 73int maxRequired = indent + JsonConstants.MaximumFormatGuidLength + 3 + _newLineLength; 84output[BytesPending++] = JsonConstants.ListSeparator; 97output[BytesPending++] = JsonConstants.Quote; 103output[BytesPending++] = JsonConstants.Quote;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Literal.cs (5)
18WriteLiteralByOptions(JsonConstants.NullValue); 35WriteLiteralByOptions(JsonConstants.TrueValue); 40WriteLiteralByOptions(JsonConstants.FalseValue); 79output[BytesPending++] = JsonConstants.ListSeparator; 103output[BytesPending++] = JsonConstants.ListSeparator;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (9)
187output[BytesPending++] = JsonConstants.ListSeparator; 198if (json.Length > JsonConstants.MaxUtf16RawValueLength) 208json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 210json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 275output[BytesPending++] = JsonConstants.ListSeparator;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.SignedNumber.cs (5)
57int maxRequired = JsonConstants.MaximumFormatInt64Length + 1; // Optionally, 1 list separator 68output[BytesPending++] = JsonConstants.ListSeparator; 81int maxRequired = indent + JsonConstants.MaximumFormatInt64Length + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 92output[BytesPending++] = JsonConstants.ListSeparator; 112Span<byte> utf8Number = stackalloc byte[JsonConstants.MaximumFormatInt64Length];
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (23)
21Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 118Debug.Assert(escapedValue.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - 3); 122int maxRequired = (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 3; 133output[BytesPending++] = JsonConstants.ListSeparator; 135output[BytesPending++] = JsonConstants.Quote; 139output[BytesPending++] = JsonConstants.Quote; 148Debug.Assert(escapedValue.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - 3 - _newLineLength); 152int maxRequired = indent + (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 3 + _newLineLength; 163output[BytesPending++] = JsonConstants.ListSeparator; 176output[BytesPending++] = JsonConstants.Quote; 180output[BytesPending++] = JsonConstants.Quote; 185Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 192Span<char> escapedValue = length <= JsonConstants.StackallocCharThreshold ? 193stackalloc char[JsonConstants.StackallocCharThreshold] : 279output[BytesPending++] = JsonConstants.ListSeparator; 281output[BytesPending++] = JsonConstants.Quote; 286output[BytesPending++] = JsonConstants.Quote; 309output[BytesPending++] = JsonConstants.ListSeparator; 322output[BytesPending++] = JsonConstants.Quote; 327output[BytesPending++] = JsonConstants.Quote; 332Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 339Span<byte> escapedValue = length <= JsonConstants.StackallocByteThreshold ? 340stackalloc byte[JsonConstants.StackallocByteThreshold] :
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.UnsignedNumber.cs (5)
59int maxRequired = JsonConstants.MaximumFormatUInt64Length + 1; // Optionally, 1 list separator 70output[BytesPending++] = JsonConstants.ListSeparator; 83int maxRequired = indent + JsonConstants.MaximumFormatUInt64Length + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 94output[BytesPending++] = JsonConstants.ListSeparator; 114Span<byte> utf8Number = stackalloc byte[JsonConstants.MaximumFormatUInt64Length];