11219 references to Length
aspire (34)
Commands\GroupedHelpWriter.cs (2)
222while (remaining.Length > 0) 236if (remaining.Length <= descriptionWidth)
Mcp\Docs\DocsIndexService.cs (1)
551var endOk = endIndex >= text.Length || !char.IsLetterOrDigit(text[endIndex]);
Mcp\Docs\LlmsTxtParser.cs (23)
130while (position < span.Length) 140if (position < span.Length && IsH1Start(span[position..])) 158if (trimmed.Length < 2) 165&& (trimmed[1] is ' ' || trimmed.Length is 1); 184if (title.Length is 0) 220while (hashCount < trimmed.Length && trimmed[hashCount] is '#') 232if (textStart < trimmed.Length && trimmed[textStart] is ' ') 247while (position < content.Length) 251while (lineStart < content.Length && content[lineStart] is ' ' or '\t') 257if (lineStart < content.Length && content[lineStart] is '>') 267if (quoteText.Length > 0) 283if (position < content.Length && content[position] is '#') 312var endIndex = docSpan.Length; 343while (position < content.Length - 2) 356if (searchStart >= content.Length) 365regions.Add((absoluteOpen, content.Length)); 429while (position < docSpan.Length) 484while (whitespaceSkipped < remaining.Length && remaining[whitespaceSkipped] is ' ' or '\t') 498while (level < trimmed.Length && trimmed[level] is '#') 504if (level >= trimmed.Length || trimmed[level] is not ' ') 549var end = headingSpan.Length; 575while (position < span.Length - 2) 586if (absoluteIndex + 2 < span.Length && span[absoluteIndex + 2] is '#')
src\Shared\ConsoleLogs\AnsiParser.cs (7)
84for (var i = 0; i < span.Length; i++) 273if (span.Length <= 2 || (span[0] != EscapeChar || span[1] != '[')) 337if (span.Length <= 2 || (span[0] != EscapeChar || span[1] != ']')) 388if (span.Length <= 5 || (span[0] != EscapeChar || span[1] != ']')) 401if (urlEndEscapePosition < 0 || span.Length < urlEndEscapePosition + 1 || span[urlEndEscapePosition + 1] != '\\') 409while (linkEndEscapePosition != -1 && span.Length > (linkEndEscapePosition + 2) && span[linkEndEscapePosition + 1] != ']') 415if (linkEndEscapePosition < 0 || span.Length < linkEndEscapePosition + 2 || span[linkEndEscapePosition + 2] != '8')
src\Shared\ConsoleLogs\TimestampParser.cs (1)
22if (match.Index + match.Length >= span.Length)
Aspire.Cli.Tests (1)
Utils\CliTestHelper.cs (1)
647while (remaining.Length > 0)
Aspire.Dashboard (12)
Extensions\StringExtensions.cs (1)
46if (s.Length == 0)
Model\Assistant\Markdown\AspireEnrichmentParser.cs (1)
147if (input.Length >= (marker.Length * 2) && input.StartsWith(marker) && input.EndsWith(marker))
Model\TextVisualizerViewModel.cs (1)
231|| span.Length > 1 && char.IsLetter(span[1]); // element name
Otlp\Model\OtlpHelpers.cs (1)
82for (var pos = 0; pos < data.Length; pos++)
src\Shared\ConsoleLogs\AnsiParser.cs (7)
84for (var i = 0; i < span.Length; i++) 273if (span.Length <= 2 || (span[0] != EscapeChar || span[1] != '[')) 337if (span.Length <= 2 || (span[0] != EscapeChar || span[1] != ']')) 388if (span.Length <= 5 || (span[0] != EscapeChar || span[1] != ']')) 401if (urlEndEscapePosition < 0 || span.Length < urlEndEscapePosition + 1 || span[urlEndEscapePosition + 1] != '\\') 409while (linkEndEscapePosition != -1 && span.Length > (linkEndEscapePosition + 2) && span[linkEndEscapePosition + 1] != ']') 415if (linkEndEscapePosition < 0 || span.Length < linkEndEscapePosition + 2 || span[linkEndEscapePosition + 2] != '8')
src\Shared\ConsoleLogs\TimestampParser.cs (1)
22if (match.Index + match.Length >= span.Length)
Aspire.Hosting (3)
Dcp\DcpLogParser.cs (1)
64if (line.Length > 0 && line[^1] == '\r')
src\Shared\ConsoleLogs\TimestampParser.cs (1)
22if (match.Index + match.Length >= span.Length)
VolumeNameGenerator.cs (1)
44for (var i = 0; i < nameSpan.Length; i++)
Aspire.Hosting.Docker (14)
EnvVarEscaper.cs (14)
35if (input.Length > MaxInputLength) 68for (var i = firstUnescaped; i < input.Length;) 85for (var i = 0; i < input.Length; i++) 101if (input.Length == 1) 123while (varLength < remaining.Length && (char.IsLetterOrDigit(remaining[varLength]) || remaining[varLength] == '_' || remaining[varLength] == '-')) 168for (var i = 0; i < remaining.Length; i++) 171if (remaining[i] == '$' && i + 1 < remaining.Length && remaining[i + 1] == '{') 194return input.Length; 206if (content.Length > MaxContentLength) 212var stripped = new char[Math.Min(content.Length, MaxContentLength)]; 271if (content.Length > MaxContentLength) 299for (var i = 0; i < content.Length - 1; i++) 301if (content[i] == '$' && i + 1 < content.Length && content[i + 1] == '{') 316else if (depth == 0 && content[i] == ':' && i + 1 < content.Length && content[i + 1] == '-')
cdac-build-tool (7)
_generated\0\RegexGenerator.g.cs (7)
94base.runtextpos != inputSpan.Length) 112if (pos <= inputSpan.Length - 5) 125base.runtextpos = inputSpan.Length; 157iteration = slice.Length; 236base.runtextpos != inputSpan.Length) 254if ((uint)pos < (uint)inputSpan.Length) 267base.runtextpos = inputSpan.Length;
ConfigurationSchemaGenerator (2)
RuntimeSource\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
dotnet (17)
_generated\187\RegexGenerator.g.cs (16)
108base.runtextpos = inputSpan.Length; 120if (pos <= inputSpan.Length - 7) 130base.runtextpos = inputSpan.Length; 190iteration = slice.Length; 214(charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, Math.Min(inputSpan.Length, charloop_ending_pos + 3) - charloop_starting_pos).LastIndexOf(" in ")) < 0) 255iteration1 = slice.Length; 279(charloop_ending_pos1 = inputSpan.Slice(charloop_starting_pos1, Math.Min(inputSpan.Length, charloop_ending_pos1 + 5) - charloop_starting_pos1).LastIndexOf(":line ")) < 0) 316while ((uint)iteration2 < (uint)slice.Length && char.IsDigit(slice[iteration2])) 357iteration3 = slice.Length; 425if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 485base.runtextpos != inputSpan.Length) 503if ((uint)pos < (uint)inputSpan.Length) 516base.runtextpos = inputSpan.Length; 543if ((uint)slice.Length < 2 || slice[1] != '\\') 570if ((uint)slice.Length < 2 || slice[1] != '"')
Commands\Run\VirtualProjectBuildingCommand.cs (1)
297LogTaskInputs = binaryLoggers.Length != 0,
dotnet-aot (5)
_generated\91\RegexGenerator.g.cs (5)
73base.runtextpos != inputSpan.Length) 91if ((uint)pos < (uint)inputSpan.Length) 104base.runtextpos = inputSpan.Length; 131if ((uint)slice.Length < 2 || slice[1] != '\\') 158if ((uint)slice.Length < 2 || slice[1] != '"')
dotnet-dev-certs (22)
_generated\10\RegexGenerator.g.cs (22)
120base.runtextpos != inputSpan.Length) 138if (pos <= inputSpan.Length - 14) 151base.runtextpos = inputSpan.Length; 175while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 202iteration1 = slice.Length; 280base.runtextpos = inputSpan.Length; 292if (pos <= inputSpan.Length - 3) 302base.runtextpos = inputSpan.Length; 326iteration = slice.Length; 349iteration1 = slice.Length - 1; 362if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 412base.runtextpos != inputSpan.Length) 430if (pos <= inputSpan.Length - 4) 433if (pos < inputSpan.Length - 5) 435base.runtextpos = inputSpan.Length - 5; 441base.runtextpos = inputSpan.Length; 506if ((uint)slice.Length < 2) 516if ((uint)slice.Length < 3 || slice[2] != 't') 528if ((uint)slice.Length < 3 || slice[2] != 'r') 577if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
EventSourceGenerator (2)
EventSourceGenerator.Parser.cs (2)
177byte[] combinedBytes = new byte[namespaceBytes.Length + bytes.Length]; 179bytes.CopyTo(combinedBytes, namespaceBytes.Length);
GenerateDocumentationAndConfigFiles (48)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
ILAssembler (23)
GrammarVisitor.cs (18)
2507SerializationTypeCode.Boolean => valueBytes.Length >= 1 && valueBytes[0] != 0, 2508SerializationTypeCode.Char => valueBytes.Length >= 2 ? BitConverter.ToChar(valueBytes) : '\0', 2509SerializationTypeCode.SByte => valueBytes.Length >= 1 ? (sbyte)valueBytes[0] : (sbyte)0, 2510SerializationTypeCode.Byte => valueBytes.Length >= 1 ? valueBytes[0] : (byte)0, 2511SerializationTypeCode.Int16 => valueBytes.Length >= 2 ? BitConverter.ToInt16(valueBytes) : (short)0, 2512SerializationTypeCode.UInt16 => valueBytes.Length >= 2 ? BitConverter.ToUInt16(valueBytes) : (ushort)0, 2513SerializationTypeCode.Int32 => valueBytes.Length >= 4 ? BitConverter.ToInt32(valueBytes) : 0, 2514SerializationTypeCode.UInt32 => valueBytes.Length >= 4 ? BitConverter.ToUInt32(valueBytes) : 0u, 2515SerializationTypeCode.Int64 => valueBytes.Length >= 8 ? BitConverter.ToInt64(valueBytes) : 0L, 2516SerializationTypeCode.UInt64 => valueBytes.Length >= 8 ? BitConverter.ToUInt64(valueBytes) : 0uL, 2517SerializationTypeCode.Single => valueBytes.Length >= 4 ? BitConverter.ToSingle(valueBytes) : 0f, 2518SerializationTypeCode.Double => valueBytes.Length >= 8 ? BitConverter.ToDouble(valueBytes) : 0d, 2540if (bytes.Length == 0) 2561if (bytes.Length < 2) return null; 2568if (bytes.Length < 4) return null; 2572if (bytes.Length < bytesRead + length) 3105for (int i = 0; i < bytesAsChars.Length; i++) 3315for (int i = 0; i < value.Length; i++, result *= 8)
StringHelpers.cs (5)
41StringBuilder result = new(content.Length); 44while (i < content.Length) 48if (c == '\\' && i + 1 < content.Length) 102if (i + 3 < content.Length && 128while (i < content.Length && char.IsWhiteSpace(content[i]))
ilc (1)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (1)
126@namespace.Length > 0 ? string.Concat(Encoding.UTF8.GetString(@namespace), ".", Encoding.UTF8.GetString(name)) : Encoding.UTF8.GetString(name),
ILCompiler.Compiler (79)
Compiler\TypePreinit.cs (2)
3505+ (value.Length * sizeof(char)) /* bytes */ 3511bool success = new FieldAccessor(bytes).TrySetField(lengthField, ValueTypeValue.FromInt32(value.Length));
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\TypeExtensions.cs (4)
30if (metadataTypeName.Length + 1 > name.Length) 33if (!name.Slice(name.Length - metadataTypeName.Length).Equals(metadataTypeName.AsSpan(), StringComparison.Ordinal)) 36if (name[name.Length - metadataTypeName.Length - 1] != '.') 39return name.Slice(0, name.Length - metadataTypeName.Length - 1).Equals(metadataType.GetNamespace(), StringComparison.Ordinal);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_Wasm\WasmTypes.cs (2)
189public int SignatureLength => _params.Types.Length + _returns.Types.Length;
src\runtime\src\coreclr\tools\Common\Compiler\NativeAotNameMangler.cs (4)
48for (int i = 0; i < s.Length; i++) 63sb ??= new Utf8StringBuilder(s.Length + 2); 72sb = new Utf8StringBuilder(s.Length); 84while ((i + 1 < s.Length) && ((s[i + 1] & 0b1100_0000) == 0b1000_0000))
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ElfObjectWriter.cs (2)
945Magic.Length + 973Magic.CopyTo(buffer.Slice(0, Magic.Length));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (1)
725Debug.Assert(DosHeader.Length == DosHeaderSize);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionData.cs (4)
143if (currentBuffer.Length >= buffer.Length) 153buffer = buffer.Slice(currentBuffer.Length); 154bytesRead += currentBuffer.Length; 155_position += currentBuffer.Length;
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionWriter.cs (2)
98value.CopyTo(bufferWriter.GetSpan(value.Length)); 99bufferWriter.Advance(value.Length);
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8String.cs (34)
111var result = new byte[s1.Length + s2.Length]; 113s2.CopyTo(result.AsSpan(s1.Length)); 119var result = new byte[s1.Length + s2.Length + s3.Length]; 121s2.CopyTo(result.AsSpan(s1.Length)); 122s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 128var result = new byte[s1.Length + s2.Length + s3.Length + s4.Length]; 130s2.CopyTo(result.AsSpan(s1.Length)); 131s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 132s4.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length)); 138var result = new byte[s1.Length + s2.Length + s3.Length + s4.Length + s5.Length]; 140s2.CopyTo(result.AsSpan(s1.Length)); 141s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 142s4.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length)); 143s5.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length + s4.Length));
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (4)
53Ensure(value.Length); 55_length += value.Length; 70Ensure(value.Length); 73for (int i = 0; i < value.Length; i++)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (1)
126@namespace.Length > 0 ? string.Concat(Encoding.UTF8.GetString(@namespace), ".", Encoding.UTF8.GetString(name)) : Encoding.UTF8.GetString(name),
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (4)
20public readonly int Size => _ilBytes.Length; 22public readonly bool HasNext => _currentOffset < _ilBytes.Length; 36if (_currentOffset + 1 > _ilBytes.Length) 108if (_currentOffset + 2 > _ilBytes.Length)
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (7)
33if (src.Length == 0) 43for (int i = startIndex; i < src.Length; i += 2) 46if (i + 1 < src.Length) 56_numCharactersHashed += src.Length; 77if (src.Length == 0) 85for (int i = 0; i < src.Length; i += 2) 88if (i + 1 < src.Length)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (5)
18return memberName.Length > 0 && memberName[0] == '<'; 66return typeName.Length > i + 1 && typeName[i + 1] == 'd'; 92return fieldName.Length > i + 1 && fieldName[i + 1] == '2'; 130return methodName.Length > i + 1 && methodName[i + 1] == 'b'; 161return methodName.Length > i + 1 && methodName[i + 1] == 'g';
ILCompiler.ReadyToRun (81)
Compiler\DependencyAnalysis\ReadyToRun\WasmImportThunk.cs (1)
264int portableEntrypointLocalIndex = _typeNode.Type.Params.Types.Length - 1;
Compiler\DependencyAnalysis\ReadyToRun\WasmInterpreterToR2RThunkNode.cs (2)
111bool hasWasmReturn = targetFuncType.Returns.Types.Length > 0; 233Debug.Assert(targetFuncType.Returns.Types.Length == 1, "Expected exactly one wasm return type");
Compiler\DependencyAnalysis\ReadyToRun\WasmR2RToInterpreterThunkNode.cs (4)
131bool hasWasmReturn = _typeNode.Type.Returns.Types.Length > 0; 273int portableEntrypointLocalIndex = _typeNode.Type.Params.Types.Length - 1; 301int savedSpLocalIndex = _typeNode.Type.Params.Types.Length; 322Debug.Assert(_typeNode.Type.Returns.Types.Length == 1, "Expected exactly one wasm return type");
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\TypeExtensions.cs (4)
30if (metadataTypeName.Length + 1 > name.Length) 33if (!name.Slice(name.Length - metadataTypeName.Length).Equals(metadataTypeName.AsSpan(), StringComparison.Ordinal)) 36if (name[name.Length - metadataTypeName.Length - 1] != '.') 39return name.Slice(0, name.Length - metadataTypeName.Length - 1).Equals(metadataType.GetNamespace(), StringComparison.Ordinal);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_Wasm\WasmTypes.cs (2)
189public int SignatureLength => _params.Types.Length + _returns.Types.Length;
src\runtime\src\coreclr\tools\Common\Compiler\NativeAotNameMangler.cs (4)
48for (int i = 0; i < s.Length; i++) 63sb ??= new Utf8StringBuilder(s.Length + 2); 72sb = new Utf8StringBuilder(s.Length); 84while ((i + 1 < s.Length) && ((s[i + 1] & 0b1100_0000) == 0b1000_0000))
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ElfObjectWriter.cs (2)
945Magic.Length + 973Magic.CopyTo(buffer.Slice(0, Magic.Length));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (1)
725Debug.Assert(DosHeader.Length == DosHeaderSize);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionData.cs (4)
143if (currentBuffer.Length >= buffer.Length) 153buffer = buffer.Slice(currentBuffer.Length); 154bytesRead += currentBuffer.Length; 155_position += currentBuffer.Length;
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionWriter.cs (2)
98value.CopyTo(bufferWriter.GetSpan(value.Length)); 99bufferWriter.Advance(value.Length);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmInstructions.cs (1)
64_locals = new byte[DwarfHelper.SizeOfULEB128(localChunks) + localWriter.WrittenSpan.Length];
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (1)
242writer.WriteULEB128((ulong)functionIndices.Length);
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8String.cs (34)
111var result = new byte[s1.Length + s2.Length]; 113s2.CopyTo(result.AsSpan(s1.Length)); 119var result = new byte[s1.Length + s2.Length + s3.Length]; 121s2.CopyTo(result.AsSpan(s1.Length)); 122s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 128var result = new byte[s1.Length + s2.Length + s3.Length + s4.Length]; 130s2.CopyTo(result.AsSpan(s1.Length)); 131s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 132s4.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length)); 138var result = new byte[s1.Length + s2.Length + s3.Length + s4.Length + s5.Length]; 140s2.CopyTo(result.AsSpan(s1.Length)); 141s3.CopyTo(result.AsSpan(s1.Length + s2.Length)); 142s4.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length)); 143s5.CopyTo(result.AsSpan(s1.Length + s2.Length + s3.Length + s4.Length));
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (4)
53Ensure(value.Length); 55_length += value.Length; 70Ensure(value.Length); 73for (int i = 0; i < value.Length; i++)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (3)
3682for (int i = 0; i < bools.Length; i++) 4947if (rvaData.Length >= bufferSize && valueOffset <= rvaData.Length - bufferSize)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (1)
126@namespace.Length > 0 ? string.Concat(Encoding.UTF8.GetString(@namespace), ".", Encoding.UTF8.GetString(name)) : Encoding.UTF8.GetString(name),
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (4)
20public readonly int Size => _ilBytes.Length; 22public readonly bool HasNext => _currentOffset < _ilBytes.Length; 36if (_currentOffset + 1 > _ilBytes.Length) 108if (_currentOffset + 2 > _ilBytes.Length)
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (7)
33if (src.Length == 0) 43for (int i = startIndex; i < src.Length; i += 2) 46if (i + 1 < src.Length) 56_numCharactersHashed += src.Length; 77if (src.Length == 0) 85for (int i = 0; i < src.Length; i += 2) 88if (i + 1 < src.Length)
ILCompiler.RyuJit (9)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmInstructions.cs (1)
64_locals = new byte[DwarfHelper.SizeOfULEB128(localChunks) + localWriter.WrittenSpan.Length];
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (3)
3682for (int i = 0; i < bools.Length; i++) 4947if (rvaData.Length >= bufferSize && valueOffset <= rvaData.Length - bufferSize)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (1)
126@namespace.Length > 0 ? string.Concat(Encoding.UTF8.GetString(@namespace), ".", Encoding.UTF8.GetString(name)) : Encoding.UTF8.GetString(name),
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (4)
20public readonly int Size => _ilBytes.Length; 22public readonly bool HasNext => _currentOffset < _ilBytes.Length; 36if (_currentOffset + 1 > _ilBytes.Length) 108if (_currentOffset + 2 > _ilBytes.Length)
ILCompiler.TypeSystem (36)
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8Span.cs (3)
17public int Length => _value.Length; 33if (_value.Length < value.Length) 47return _value.Length == value.Length; // All char ANSI, all matching
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemHelpers.cs (14)
448Span<byte> buffer = new byte[s1.Length + s2.Length]; 451s2.AsSpan().CopyTo(buffer.Slice(s1.Length)); 458Span<T> buffer = new T[s1.Length + s2.Length + s3.Length]; 461s2.CopyTo(buffer.Slice(s1.Length)); 462s3.CopyTo(buffer.Slice(s1.Length + s2.Length)); 472Span<byte> buffer = new byte[s1Span.Length + s2Span.Length + s3Span.Length]; 475s2Span.CopyTo(buffer.Slice(s1Span.Length)); 476s3Span.CopyTo(buffer.Slice(s1Span.Length + s2Span.Length));
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaField.cs (1)
267_nameLength = MetadataReader.GetStringBytes(handle).Length;
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaMethod.cs (1)
405_nameLength = MetadataReader.GetStringBytes(handle).Length;
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaType.cs (2)
253_nameLength = MetadataReader.GetStringBytes(handle).Length; 274_namespaceLength = MetadataReader.GetStringBytes(handle).Length;
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (1)
126@namespace.Length > 0 ? string.Concat(Encoding.UTF8.GetString(@namespace), ".", Encoding.UTF8.GetString(name)) : Encoding.UTF8.GetString(name),
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (4)
20public readonly int Size => _ilBytes.Length; 22public readonly bool HasNext => _currentOffset < _ilBytes.Length; 36if (_currentOffset + 1 > _ilBytes.Length) 108if (_currentOffset + 2 > _ilBytes.Length)
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (7)
33if (src.Length == 0) 43for (int i = startIndex; i < src.Length; i += 2) 46if (i + 1 < src.Length) 56_numCharactersHashed += src.Length; 77if (src.Length == 0) 85for (int i = 0; i < src.Length; i += 2) 88if (i + 1 < src.Length)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
illink (25)
ILLink.RoslynAnalyzer (36)
CompilationExtensions.cs (2)
150switch (span.Length) 158var builder = ImmutableArray.CreateBuilder<T>(span.Length);
INamedTypeSymbolExtensions.cs (1)
19while (roSpan.Length > 0)
src\runtime\src\libraries\Common\src\System\Buffers\SearchValuesPolyfills.cs (2)
100for (int i = 0; i < span.Length; i++) 113for (int i = 0; i < span.Length; i++)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (12)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 228Span<char> result = (bytes.Length > 16) ? 229new char[bytes.Length * 2].AsSpan() : 230stackalloc char[bytes.Length * 2]; 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (1)
108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (2)
66Debug.Assert(input.Length > 0); 347if (_index < _input.Length)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParser.cs (3)
57int errorIndex = typeName.Length - parser._inputString.Length; 255_inputString = _inputString.Slice(candidate.Length);
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (5)
40return input.Length; // no type name end chars were found, the whole input is the type name 48isNestedType = offset > 0 && offset < input.Length && input[offset] == '+'; 54for (; offset < input.Length; offset++) 61if (offset == input.Length || // invalid name that ends with escape character 146for (; offset < input.Length; offset++)
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (5)
18return memberName.Length > 0 && memberName[0] == '<'; 66return typeName.Length > i + 1 && typeName[i + 1] == 'd'; 92return fieldName.Length > i + 1 && fieldName[i + 1] == '2'; 130return methodName.Length > i + 1 && methodName[i + 1] == 'b'; 161return methodName.Length > i + 1 && methodName[i + 1] == 'g';
libmscordaccore_universal (8)
Entrypoints.cs (8)
69return writeThreadContext(threadId, (uint)context.Length, contextPtr, delegateContext); 72byte* alignedBuffer = (byte*)NativeMemory.AlignedAlloc((nuint)context.Length, RequiredAlignment); 75context.CopyTo(new Span<byte>(alignedBuffer, context.Length)); 76return writeThreadContext(threadId, (uint)context.Length, alignedBuffer, delegateContext); 430return dataTarget.SetThreadContext(threadId, (uint)context.Length, contextPtr); 433byte* alignedBuffer = (byte*)NativeMemory.AlignedAlloc((nuint)context.Length, RequiredAlignment); 436context.CopyTo(new Span<byte>(alignedBuffer, context.Length)); 437return dataTarget.SetThreadContext(threadId, (uint)context.Length, alignedBuffer);
Microsoft.AspNetCore.Antiforgery (6)
Internal\DefaultAntiforgeryTokenSerializer.cs (4)
110if (tokenBytes.Length < minCookieTokenLength) 140if (tokenBytes.Length < minRequestTokenPayloadLength) 153if (tokenBytes.Length < claimUidByteLength + 1) // +1 for additionalData prefix 178if (tokenBytes.Length != 0)
src\aspnetcore\src\Shared\Encoding\Int7BitEncodingUtils.cs (2)
72if (shift == 35 || index >= source.Length) 151if (bytes.Length < consumed + length)
Microsoft.AspNetCore.Authentication.Cookies (1)
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
85for (var i = 0; i < readOnlySpan.Length; i++)
Microsoft.AspNetCore.Authentication.Negotiate (5)
_generated\1\RegexGenerator.g.cs (5)
71base.runtextpos != inputSpan.Length) 89if ((uint)pos < (uint)inputSpan.Length) 102base.runtextpos = inputSpan.Length; 128if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] != '\\') 135if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] == '\\')
Microsoft.AspNetCore.Authorization (2)
src\aspnetcore\src\Shared\Debugger\DebuggerHelpers.cs (2)
30if (values.Length == 0) 42for (var i = 0; i < values.Length; i++)
Microsoft.AspNetCore.Components (23)
_generated\1\RegexGenerator.g.cs (5)
71base.runtextpos = inputSpan.Length; 89base.runtextpos = inputSpan.Length; 113iteration = slice.Length; 121if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
NavigationManager.cs (1)
207var pathOnlyLength = queryOrFragmentIndex >= 0 ? queryOrFragmentIndex : currentUri.Length;
NavigationManagerExtensions.cs (2)
116_builder = new(uriWithoutQueryStringAndHash.Length + additionalCapacity); 761newQueryStringBuilder = new(uriWithoutQueryStringAndHash, query.Length + hash.Length);
PersistentState\PersistentStateValueProviderKeyResolver.cs (1)
103GrowBuffer(ref pool, ref keyBuffer, keySpan.Length * 4 + preKey.Length);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (2)
89var requiredCapacity = _itemsInUse + source.Length; 103_itemsInUse += source.Length;
src\aspnetcore\src\Http\Routing\src\Constraints\FileNameRouteConstraint.cs (2)
124if (value.Length == 0) 143for (var i = dotIndex + 1; i < value.Length; i++)
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (4)
342var lastIndex = requestSegment.Length; 404if (part is RoutePatternLiteralPart literal && ((indexOfLiteral + literal.Content.Length) != requestSegment.Length)) 408else if (part is RoutePatternSeparatorPart separator && ((indexOfLiteral + separator.Content.Length) != requestSegment.Length)) 464if (parameterValueSpan.Length == 0)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
102var buffer = new char[source.Length];
src\aspnetcore\src\Shared\UrlDecoder\UrlDecoder.cs (5)
20if (destination.Length < source.Length) 29return DecodeInPlace(destination.Slice(0, source.Length), isFormEncoding); 363return DecodeInPlace(destination.Slice(0, source.Length)); 591if ((uint)tempIdx >= (uint)buffer.Length) 603return (uint)c >= (uint)CharToHexLookup.Length ? -1 : CharToHexLookup[c];
Microsoft.AspNetCore.Components.Endpoints (5)
FormMapping\FormDataReader.cs (5)
168if (CurrentPrefix.Span.Length == 0) 196var keyLength = key.Length; 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length)); 232var startingPoint = _currentPrefixBuffer.Length + separator.Length; 233_currentPrefixBuffer = _prefixBuffer.Slice(0, startingPoint + key.Length);
Microsoft.AspNetCore.Components.Forms (2)
src\aspnetcore\src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
40var startIndex = _nextEndIndex - span.Length; 65newEndIndex -= span.Length;
Microsoft.AspNetCore.Components.QuickGrid (1)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
102var buffer = new char[source.Length];
Microsoft.AspNetCore.Components.Server (30)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (2)
89var requiredCapacity = _itemsInUse + source.Length; 103_itemsInUse += source.Length;
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (3)
162if (_span.Length >= source.Length) 165Advance(source.Length); 231int bytesLeftToCopy = source.Length;
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (3)
779if (this.reader.CurrentSpanIndex + length <= this.reader.CurrentSpan.Length) 814if (unreadSpan.Length >= byteLength) 1153int bytesRead = Math.Min(remainingByteLength, this.reader.UnreadSpan.Length);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (4)
744int length = (int)src.Length; 856var length = utf8stringBytes.Length; 946ref byte buffer = ref this.WriteString_PrepareSpan(value.Length, out int bufferSize, out int useOffset); 950int byteCount = StringEncoding.UTF8.GetBytes(pValue, value.Length, pBuffer + useOffset, bufferSize);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (12)
69this.nextPosition = sequence.GetPosition(first.Length); 71this.moreData = first.Length > 0; 216if (this.CurrentSpanIndex >= this.CurrentSpan.Length) 337if ((count & TooBigOrNegative) == 0 && this.CurrentSpan.Length - this.CurrentSpanIndex > (int)count) 347else if (this.CurrentSpan.Length - this.CurrentSpanIndex == (int)count) 369if (this.usingSequence && this.CurrentSpanIndex >= this.CurrentSpan.Length) 387Debug.Assert(this.CurrentSpanIndex < this.CurrentSpan.Length, "this.CurrentSpanIndex < this.CurrentSpan.Length"); 417int remaining = this.CurrentSpan.Length - this.CurrentSpanIndex; 457if (firstSpan.Length >= destination.Length) 474Debug.Assert(firstSpan.Length < destination.Length, "firstSpan.Length < destination.Length"); 476int copied = firstSpan.Length; 484int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (2)
35if (span.Length < sizeof(T)) 72Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)");
Microsoft.AspNetCore.Components.Web (6)
Routing\NavLink.cs (4)
209if (currentUriAbsolute.Length == hrefAbsolute.Length - 1) 219if (hrefAbsolute[hrefAbsolute.Length - 1] == '/' && 220currentUriAbsolute.SequenceEqual(hrefAbsolute.Slice(0, hrefAbsolute.Length - 1), CaseInsensitiveComparer))
src\aspnetcore\src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
40var startIndex = _nextEndIndex - span.Length; 65newEndIndex -= span.Length;
Microsoft.AspNetCore.Components.WebAssembly (2)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (2)
89var requiredCapacity = _itemsInUse + source.Length; 103_itemsInUse += source.Length;
Microsoft.AspNetCore.Components.WebView (2)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (2)
89var requiredCapacity = _itemsInUse + source.Length; 103_itemsInUse += source.Length;
Microsoft.AspNetCore.CookiePolicy (1)
ResponseCookiesWrapper.cs (1)
142var nonSuppressedValues = new List<KeyValuePair<string, string>>(keyValuePairs.Length);
Microsoft.AspNetCore.Cors (2)
src\aspnetcore\src\Shared\Debugger\DebuggerHelpers.cs (2)
30if (values.Length == 0) 42for (var i = 0; i < values.Length; i++)
Microsoft.AspNetCore.Cryptography.Internal (2)
CryptoUtil.cs (2)
114Assert(bufA.Length == bufB.Length, "countA == countB");
Microsoft.AspNetCore.DataProtection (34)
Cng\CbcAuthenticatedEncryptor.cs (6)
79if (ciphertext.Length < checked(KEY_MODIFIER_SIZE_IN_BYTES + _symmetricAlgorithmBlockSizeInBytes + _hmacAlgorithmDigestLengthInBytes)) 84var cbEncryptedDataLength = checked(ciphertext.Length - (int)(KEY_MODIFIER_SIZE_IN_BYTES + _symmetricAlgorithmBlockSizeInBytes + _hmacAlgorithmDigestLengthInBytes)); 104cbLabel: (uint)additionalAuthenticatedData.Length, 288cbLabel: (uint)additionalAuthenticatedData.Length, 312cbInput: (uint)plaintext.Length, 347cbInput: (uint)plaintext.Length,
Cng\CngGcmAuthenticatedEncryptor.cs (7)
74if (ciphertext.Length < KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + TAG_SIZE_IN_BYTES) 79var plaintextLength = checked(ciphertext.Length - (int)(KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + TAG_SIZE_IN_BYTES)); 98cbLabel: (uint)additionalAuthenticatedData.Length, 237var totalRequiredSize = checked((int)(KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + plaintext.Length + TAG_SIZE_IN_BYTES)); 248byte* pbAuthTag = &pbEncryptedData[plaintext.Length]; 262cbLabel: (uint)additionalAuthenticatedData.Length, 281cbPlaintextData: (uint)plaintext.Length,
KeyManagement\KeyRingBasedSpanDataProtector.cs (1)
94if (protectedData.Length < _magicHeaderKeyIdSize)
Managed\AesGcmAuthenticatedEncryptor.cs (6)
84if (ciphertext.Length < KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + TAG_SIZE_IN_BYTES) 89var plaintextBytes = ciphertext.Length - (KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + TAG_SIZE_IN_BYTES); 214CryptoUtil.Assert(refPooledBuffer.WrittenSpan.Length == outputSize, "writtenSpan length should equal calculated outputSize"); 234var totalRequiredSize = checked(KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + plaintext.Length + TAG_SIZE_IN_BYTES); 276var encrypted = buffer.Slice(KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES, plaintext.Length); 277var tag = buffer.Slice(KEY_MODIFIER_SIZE_IN_BYTES + NONCE_SIZE_IN_BYTES + plaintext.Length, TAG_SIZE_IN_BYTES);
Managed\ManagedAuthenticatedEncryptor.cs (5)
92if (ciphertext.Length < checked(KEY_MODIFIER_SIZE_IN_BYTES + _symmetricAlgorithmBlockSizeInBytes + _validationAlgorithmDigestLengthInBytes)) 98var estimatedDecryptedSize = ciphertext.Length - (KEY_MODIFIER_SIZE_IN_BYTES + _symmetricAlgorithmBlockSizeInBytes + _validationAlgorithmDigestLengthInBytes); 107var macOffset = ciphertext.Length - _validationAlgorithmDigestLengthInBytes; 189var cipherTextLength = symmetricAlgorithmForSizing.GetCiphertextLengthCbc(plaintext.Length); 310CryptoUtil.Assert(refPooledBuffer.WrittenSpan.Length == outputSize, "bytesWritten == size");
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (7)
48if (kdk.Length < FipsMinimumKeyLengthInBytes) 96var prfInputLength = checked(sizeof(uint) /* [i]_2 */ + label.Length + 1 /* 0x00 */ + (contextHeader.Length + contextData.Length) + sizeof(uint) /* [K]_2 */); 119contextHeader.CopyTo(prfInput.Slice(sizeof(uint) + label.Length + 1)); 120contextData.CopyTo(prfInput.Slice(sizeof(uint) + label.Length + 1 + contextHeader.Length));
src\aspnetcore\src\Shared\Encoding\Int7BitEncodingUtils.cs (2)
72if (shift == 35 || index >= source.Length) 151if (bytes.Length < consumed + length)
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (4)
Benchmarks\SpanDataProtectorComparison.cs (4)
104return protectedSpan.Length + unProtectedSpan.Length; 126return protectedSpan.Length + unProtectedSpan.Length;
Microsoft.AspNetCore.DeveloperCertificates.XPlat (22)
_generated\0\RegexGenerator.g.cs (22)
120base.runtextpos != inputSpan.Length) 138if (pos <= inputSpan.Length - 14) 151base.runtextpos = inputSpan.Length; 175while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 202iteration1 = slice.Length; 280base.runtextpos = inputSpan.Length; 292if (pos <= inputSpan.Length - 3) 302base.runtextpos = inputSpan.Length; 326iteration = slice.Length; 349iteration1 = slice.Length - 1; 362if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 412base.runtextpos != inputSpan.Length) 430if (pos <= inputSpan.Length - 4) 433if (pos < inputSpan.Length - 5) 435base.runtextpos = inputSpan.Length - 5; 441base.runtextpos = inputSpan.Length; 506if ((uint)slice.Length < 2) 516if ((uint)slice.Length < 3 || slice[2] != 't') 528if ((uint)slice.Length < 3 || slice[2] != 'r') 577if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Microsoft.AspNetCore.Diagnostics.Middleware.PerformanceTests (13)
RedactionBenchmark.cs (13)
79for (int i = 0; i <= span.Length; i++) 81if (i == span.Length || span[i] == '/') 104if (i < span.Length) 142for (int i = 0; i <= span.Length; i++) 144if (i == span.Length || span[i] == '/') 157if (i < span.Length) 187while (startIndex < span.Length) 194endIndex = span.Length - 1; 198if (segment.Length > 0) 235return destination.Slice(0, source.Length); 241for (var i = 0; i < httpPath.Length; i++) 251for (var i = 0; i < httpPath.Length; i++) 260routeSegments[numSegments] = httpPath.Length + 1;
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (1)
Latency\AcceptanceTests.cs (1)
86for (int i = 0; i < span.Length; i++)
Microsoft.AspNetCore.Http (2)
Internal\ResponseCookies.cs (1)
91var cookies = new string[keyValuePairs.Length];
src\aspnetcore\src\Shared\HttpRuleParser.cs (1)
68return (firstNonTokenCharIdx == -1) ? subspan.Length : firstNonTokenCharIdx;
Microsoft.AspNetCore.Http.Abstractions (7)
src\aspnetcore\src\Shared\Debugger\DebuggerHelpers.cs (2)
30if (values.Length == 0) 42for (var i = 0; i < values.Length; i++)
src\aspnetcore\src\Shared\UrlDecoder\UrlDecoder.cs (5)
20if (destination.Length < source.Length) 29return DecodeInPlace(destination.Slice(0, source.Length), isFormEncoding); 363return DecodeInPlace(destination.Slice(0, source.Length)); 591if ((uint)tempIdx >= (uint)buffer.Length) 603return (uint)c >= (uint)CharToHexLookup.Length ? -1 : CharToHexLookup[c];
Microsoft.AspNetCore.Http.Connections (4)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
Microsoft.AspNetCore.Http.Connections.Client (1)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
102var buffer = new char[source.Length];
Microsoft.AspNetCore.Http.Connections.Common (1)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
175while (buffer.Length > 0)
Microsoft.AspNetCore.Http.Extensions (11)
src\aspnetcore\src\Components\Endpoints\src\FormMapping\FormDataReader.cs (5)
168if (CurrentPrefix.Span.Length == 0) 196var keyLength = key.Length; 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length)); 232var startingPoint = _currentPrefixBuffer.Length + separator.Length; 233_currentPrefixBuffer = _prefixBuffer.Slice(0, startingPoint + key.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (3)
249if (pos > _chars.Length - value.Length) 251Grow(value.Length); 255_pos += value.Length;
UriHelper.cs (3)
219text.CopyTo(buffer.Slice(index, text.Length)); 220return index + text.Length; 234if (uriParts.path.Length > 0 && pathBaseSpan.Length > 0 && pathBaseSpan[^1] == '/')
Microsoft.AspNetCore.Http.Results (1)
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
85for (var i = 0; i < readOnlySpan.Length; i++)
Microsoft.AspNetCore.HttpLogging (6)
RequestBufferingStream.cs (2)
85if (span.Length == 0) 95var innerCount = Math.Min(remaining, span.Length);
ResponseBufferingStream.cs (1)
130var innerCount = Math.Min(remaining, span.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (3)
249if (pos > _chars.Length - value.Length) 251Grow(value.Length); 255_pos += value.Length;
Microsoft.AspNetCore.HttpOverrides (1)
ForwardedHeadersMiddleware.cs (1)
455if ((uint)hostEndIdx >= (uint)host.Length || // No ']'. The uint cast is there to eliminate the
Microsoft.AspNetCore.Identity (5)
Passkeys\BufferSourceJsonConverter.cs (5)
47Span<byte> byteSpan = utf8Unescaped.Length <= StackallocByteThreshold ? 49(pooledArray = ArrayPool<byte>.Shared.Rent(utf8Unescaped.Length)); 63Debug.Assert(bytesConsumed == utf8Unescaped.Length); 79var encodedLength = Base64Url.GetEncodedLength(bytes.Length); 86Debug.Assert(bytesConsumed == bytes.Length);
Microsoft.AspNetCore.Mvc.Core (2)
src\aspnetcore\src\Shared\HttpRuleParser.cs (1)
68return (firstNonTokenCharIdx == -1) ? subspan.Length : firstNonTokenCharIdx;
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
85for (var i = 0; i < readOnlySpan.Length; i++)
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Rendering\TagBuilder.cs (1)
183while (remainingName.Length > 0)
Microsoft.AspNetCore.OpenApi (6)
Services\Schemas\OpenApiSchemaService.cs (1)
673while (currentPath.Length > 0)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
175while (buffer.Length > 0)
Microsoft.AspNetCore.OutputCaching (8)
FormatterBinaryWriter.cs (3)
182else if ((offset + value.Length) <= length) 185offset += value.Length; 200var toWrite = Math.Min(value.Length, available.Length);
OutputCacheEntryFormatter.cs (1)
174writer.Write7BitEncodedInt(span.Length);
RecyclableSequenceBuilder.cs (3)
92if (available.Length >= buffer.Length) 95Advance(buffer.Length); 100var toWrite = Math.Min(buffer.Length, available.Length);
Streams\OutputCacheStream.cs (1)
145if (_segmentWriteStream.Length + buffer.Length > _maxBufferSize)
Microsoft.AspNetCore.Razor.Utilities.Shared (29)
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\ImmutableArrayExtensions.cs (3)
35if (items.Length == 0) 47else if (items.Length == 1) 1240var length = items.Length;
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\MemoryBuilder`1.cs (4)
101if (source.Length == 1 && (uint)index < (uint)memory.Length) 125if ((uint)(_length + source.Length) > (uint)_memory.Length) 127Grow(_memory.Length - _length + source.Length); 131_length += source.Length;
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledArrayBuilder.cs (1)
12var pooledArray = new PooledArrayBuilder<T>(source.Length);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledArrayBuilder`1.cs (3)
275else if (_inlineCount + items.Length <= InlineCapacity) 430else if (_inlineCount + items.Length <= InlineCapacity) 435ShiftInlineItemsByOffset(index, offset: items.Length);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\SpanExtensions.cs (2)
105private int _index = span.Length - 1; 124_index = _span.Length - 1;
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\Utilities\SortHelper`1.cs (2)
84for (var i = 1; i < items.Length; i++) 113for (var i = 1; i < items.Length; i++)
Utilities\Checksum.cs (1)
46ArgHelper.ThrowIfLessThan(bytes.Length, HashSize);
Utilities\Hashing\XxHash128.cs (1)
133uint length = (uint)source.Length;
Utilities\Hashing\XxHashShared.cs (12)
252state.TotalLength += (uint)source.Length; 257if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 259source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 260state.BufferedCount += (uint)source.Length; 280Debug.Assert(sourceIndex < source.Length); 283if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 285ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 309Debug.Assert(sourceIndex < source.Length); // at least some bytes left 315else if (source.Length - sourceIndex > InternalBufferLengthBytes) 323while (source.Length - sourceIndex > InternalBufferLengthBytes); 330Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 331Debug.Assert(sourceIndex < source.Length);
Microsoft.AspNetCore.ResponseCaching (1)
src\aspnetcore\src\Shared\SegmentWriteStream.cs (1)
143var bytesWritten = Math.Min(buffer.Length, _segmentSize - (int)_bufferStream.Length);
Microsoft.AspNetCore.Routing (23)
_generated\1\RegexGenerator.g.cs (5)
71base.runtextpos = inputSpan.Length; 89base.runtextpos = inputSpan.Length; 113iteration = slice.Length; 121if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Constraints\FileNameRouteConstraint.cs (2)
124if (value.Length == 0) 143for (var i = dotIndex + 1; i < value.Length; i++)
Matching\DfaMatcher.cs (3)
218for (var i = 0; i < segments.Length; i++) 244if ((uint)segmentIndex < (uint)segments.Length) 266if ((uint)segmentIndex < (uint)segments.Length)
Matching\FastPathTokenizer.cs (1)
35var length = span.Length;
Matching\HostMatcherPolicy.cs (2)
105if (host.Length == 0 || MemoryExtensions.Equals(host, WildcardHost, StringComparison.OrdinalIgnoreCase)) 140else if (port.Length > 0 && (!int.TryParse(port, out var parsed) || parsed != requestPort))
Matching\SingleEntryAsciiJumpTable.cs (3)
47Debug.Assert(a.Length == b.Length && b.Length == length);
Patterns\RoutePatternMatcher.cs (4)
342var lastIndex = requestSegment.Length; 404if (part is RoutePatternLiteralPart literal && ((indexOfLiteral + literal.Content.Length) != requestSegment.Length)) 408else if (part is RoutePatternSeparatorPart separator && ((indexOfLiteral + separator.Content.Length) != requestSegment.Length)) 464if (parameterValueSpan.Length == 0)
src\aspnetcore\src\Shared\Debugger\DebuggerHelpers.cs (2)
30if (values.Length == 0) 42for (var i = 0; i < values.Length; i++)
src\aspnetcore\src\Shared\HttpRuleParser.cs (1)
68return (firstNonTokenCharIdx == -1) ? subspan.Length : firstNonTokenCharIdx;
Microsoft.AspNetCore.Server.HttpSys (20)
_generated\30\Windows.Win32.HTTP_KNOWN_HEADER.InlineArrays.g.cs (2)
53 int initLength = value.Length; 93 int initLength = value.Length;
_generated\4\Windows.Win32.byte.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\6\Windows.Win32.char.InlineArrays.g.cs (4)
55 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 78 int initLength = value.Length; 117 int initLength = value.Length; 157 int initLength = value.Length;
_generated\78\Windows.Win32.PInvoke.HTTPAPI.dll.g.cs (4)
641 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, BytesSentLocal, default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null); 671 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, default(uint* ), default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null); 744 uint __result = PInvoke.HttpSetRequestQueueProperty(RequestQueueHandleLocal, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length, default, default); 790 uint __result = PInvoke.HttpSetUrlGroupProperty(UrlGroupId, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length);
_generated\90\Windows.Win32.ushort.InlineArrays.g.cs (1)
60 int initLength = value.Length;
RequestProcessing\RequestContext.cs (1)
348qualifierSize: (uint)qualifier.Length,
RequestProcessing\ResponseBody.cs (1)
289chunk.Anonymous.FromMemory.BufferLength = (uint)bytes.Length;
RequestProcessing\ResponseStreamAsyncResult.cs (1)
175chunk.Anonymous.FromMemory.BufferLength = (uint)bytes.Length;
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
197if (index < timestamps.Length && timestamps[index] > 0)
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (2)
281for (int i = 0; i < HeaderKeys.Length; i++) 295for (int i = 0; i < HeaderKeys.Length; i++)
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
26var resultString = string.Create(span.Length, span, static (destination, source) => 56return string.Create(span.Length, span, static (destination, source) =>
Microsoft.AspNetCore.Server.IIS (16)
_generated\15\Windows.Win32.HTTP_KNOWN_HEADER.InlineArrays.g.cs (1)
53 int initLength = value.Length;
_generated\3\Windows.Win32.byte.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\49\Windows.Win32.ushort.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\5\Windows.Win32.char.InlineArrays.g.cs (4)
55 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 78 int initLength = value.Length; 117 int initLength = value.Length; 157 int initLength = value.Length;
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
197if (index < timestamps.Length && timestamps[index] > 0)
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (2)
281for (int i = 0; i < HeaderKeys.Length; i++) 295for (int i = 0; i < HeaderKeys.Length; i++)
src\aspnetcore\src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 96Advance(source.Length); 138while (source.Length > 0) 145var writable = Math.Min(source.Length, _span.Length);
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
26var resultString = string.Create(span.Length, span, static (destination, source) => 56return string.Create(span.Length, span, static (destination, source) =>
Microsoft.AspNetCore.Server.Kestrel.Core (172)
_generated\1\RegexGenerator.g.cs (22)
121base.runtextpos != inputSpan.Length) 139if (pos <= inputSpan.Length - 14) 152base.runtextpos = inputSpan.Length; 176while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 203iteration1 = slice.Length; 282base.runtextpos = inputSpan.Length; 294if (pos <= inputSpan.Length - 3) 304base.runtextpos = inputSpan.Length; 328iteration = slice.Length; 351iteration1 = slice.Length - 1; 364if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 415base.runtextpos != inputSpan.Length) 433if (pos <= inputSpan.Length - 4) 436if (pos < inputSpan.Length - 5) 438base.runtextpos = inputSpan.Length - 5; 444base.runtextpos = inputSpan.Length; 509if ((uint)slice.Length < 2) 519if ((uint)slice.Length < 3 || slice[2] != 't') 531if ((uint)slice.Length < 3 || slice[2] != 'r') 580if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Internal\Http\DateHeaderValueManager.cs (2)
47var dateBytes = new byte[DatePreambleBytes.Length + dateValue.Length]; 49Encoding.ASCII.GetBytes(dateValue, dateBytes.AsSpan(DatePreambleBytes.Length));
Internal\Http\Http1OutputProducer.cs (4)
308if (_advancedBytesForChunk > 0 || buffer.Length > 0) 326if (buffer.Length > 0) 328writer.WriteBeginChunkBytes(buffer.Length); 589if (buffer.Length > 0)
Internal\Http\HttpHeaders.cs (17)
355while (value.Length > 0) 360for (offset = 0; offset < value.Length; offset++) 371if ((uint)offset > (uint)value.Length) 386if (c == 'k' && byteValue.Length >= (2 * sizeof(ulong) + sizeof(ushort))) 406else if (c == 'u' && byteValue.Length >= (sizeof(ulong) + sizeof(uint))) 420else if (c == 'c' && byteValue.Length >= sizeof(ulong)) 429if ((uint)offset >= (uint)value.Length) 440for (offset = 0; offset < value.Length; offset++) 454if ((uint)offset >= (uint)value.Length) 466if ((uint)offset >= (uint)value.Length) 542while (values.Length > 0) 547for (offset = 0; offset < values.Length; offset++) 558if ((uint)offset > (uint)values.Length) 591if ((uint)offset >= (uint)values.Length) 601for (offset = 0; offset < values.Length; offset++) 615if ((uint)offset >= (uint)values.Length) 624if ((uint)offset >= (uint)values.Length)
Internal\Http\HttpHeaders.Generated.cs (4)
7522switch (name.Length) 7891if (previousValue.Length == value.Length && 8107if (previousValue.Length == value.Length && 8310if (previousValue.Length == value.Length &&
Internal\Http\HttpParser.cs (26)
112var array = new byte[span.Length + (lineFeedOnly ? 1 : 2)]; 270if ((uint)nameEnd >= (uint)headerLine.Length) 293if ((uint)valueStart < (uint)headerLine.Length) 302if ((uint)valueStart < (uint)headerLine.Length) 310for (; valueStart < headerLine.Length; valueStart++) 324var valueEnd = headerLine.Length - 1; 361return (requestLine.Length >= MinTlsRequestSize && requestLine[0] == SslRecordTypeHandshake); 424if (next == 0 || requestLine.Length == 0) 446if ((uint)offset >= (uint)requestLine.Length) 487for (; (uint)offset < (uint)requestLine.Length; offset++) 501while ((uint)offset < (uint)requestLine.Length && requestLine[offset] == ByteSpace) 510if ((uint)offset + 9 != (uint)requestLine.Length || requestLine[offset + 8] != ByteCR) 515var lineFeedTerminated = (uint)offset + 8 == (uint)requestLine.Length; 538var versionLength = remaining.Length > 0 && remaining[^1] == ByteCR ? remaining.Length - 1 : remaining.Length; 560return HttpParseResult.Error(reason, baseOffset, span.Length); 572return HttpParseResult.Error(reason, baseOffset, requestLine.Length); 578reader.Rewind(requestLine.Length + 1); 579reader.TryReadExact(requestLine.Length + 1, out var requestLineSequence); 584return HttpParseResult.Error(reason, baseOffset, fullLine.Length); 598if (span.Length >= 2 && span[0] == ByteCR && span[1] == ByteLF) 622if ((uint)span.Length > (uint)(crIndex + 1) && span[crIndex + 1] == ByteLF) 630span = span.Slice(0, span.Length - 1); 679if (span.Length == 0) 713var headerLineLength = span.Length + terminatorSize;
Internal\Http\HttpRequestHeaders.cs (1)
109consumed != value.Length)
Internal\Http2\Http2Connection.cs (9)
568if (readableBuffer.Length >= ClientPreface.Length) 645if (requestLine.Length > 10 && requestLine[requestLine.Length - 1] == (byte)'\r') 647httpVersion = HttpUtilities.GetKnownVersion(requestLine.Slice(requestLine.Length - 9, 8)); 667Debug.Assert(buffer.Length >= ClientPreface.Length, "Not enough content to match preface."); 669var preface = buffer.Slice(0, ClientPreface.Length); 1613_totalParsedHeaderSize += name.Length + value.Length; 1704for (var i = 0; i < name.Length; i++)
Internal\Http2\Http2FrameWriter.cs (4)
509_outgoingFrame.PayloadLength = ContinueBytes.Length; 610while (dataToFrame.Length > 0) 619var currentSize = Math.Min(dataToFrame.Length, _maxFrameSize); 621if (endOfHeaders && dataToFrame.Length == currentSize)
Internal\Http2\Http2OutputProducer.cs (4)
398if (_completeScheduled || data.Length == 0) 407EnqueueDataWrite(data.Length); 534if (_completeScheduled || data.Length == 0) 543EnqueueDataWrite(data.Length);
Internal\Http2\Http2Stream.cs (4)
433Span<byte> pathBuffer = pathSegment.Length <= MaxPathBufferStackAllocSize 436? stackalloc byte[MaxPathBufferStackAllocSize].Slice(0, pathSegment.Length) 439: new byte[pathSegment.Length]; 441for (var i = 0; i < pathSegment.Length; i++)
Internal\Http3\Http3FrameWriter.cs (1)
272_outgoingFrame.RemainingLength = ContinueBytes.Length;
Internal\Http3\Http3OutputProducer.cs (2)
339if (_streamCompleted || data.Length == 0) 364if (_streamCompleted || data.Length == 0)
Internal\Http3\Http3Stream.cs (7)
306_totalParsedHeaderSize += name.Length + value.Length; 388for (var i = 0; i < name.Length; i++) 1211Span<byte> pathBuffer = pathSegment.Length <= MaxPathBufferStackAllocSize 1214? stackalloc byte[MaxPathBufferStackAllocSize].Slice(0, pathSegment.Length) 1217: new byte[pathSegment.Length]; 1219for (var i = 0; i < pathSegment.Length; i++)
Internal\Http3\QPack\DecoderStreamReader.cs (1)
58for (var i = 0; i < span.Length; i++)
Internal\Http3\QPack\EncoderStreamReader.cs (1)
105for (var i = 0; i < span.Length; i++)
Internal\Http3\QPackHeaderWriter.cs (2)
126buffer[2] = (byte)statusBytes.Length; 129return 3 + statusBytes.Length;
Internal\Infrastructure\HttpUtilities.cs (10)
78Debug.Assert(bytes.Length == 8, "Mask must be exactly 8 bytes long."); 92var str = string.Create(span.Length, span, static (destination, source) => 181for (var i = 0; i < Math.Min(span.Length, maxChars); i++) 187if (span.Length > maxChars) 217if (sizeof(uint) <= span.Length) 224else if (sizeof(ulong) <= span.Length) 281Debug.Assert(WordListForPerfectHashOfMethods.Length == (MaxHashValue + 1) && methodsLookup.Length == (MaxHashValue + 1)); 287&& index < (uint)methodsLookup.Length) 332return (uint)str.Length + associatedValues[c]; 383if (span.Length > sizeof(ulong) && span[sizeof(ulong)] == (byte)'\r')
Middleware\Internal\LoggingStream.cs (5)
160builder.Append(buffer.Length); 163if (buffer.Length > 0) 174for (int i = 0; i < buffer.Length; i++) 193if (i != buffer.Length - 1) 208var numBytesInLastLine = buffer.Length % 16;
src\aspnetcore\src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
60int entryLength = HeaderField.GetLength(name.Length, value.Length);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HeaderField.cs (1)
20Debug.Assert(name.Length > 0);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (7)
188while (currentIndex < data.Length); 215if (currentIndex < data.Length) 287if (currentIndex < data.Length) 313if (currentIndex < data.Length) 425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 646for (; currentIndex < data.Length; currentIndex++)
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (8)
424if (IntegerEncoder.Encode(value.Length, 7, destination, out int integerLength)) 429if (value.Length <= destination.Length) 434bytesWritten = integerLength + value.Length; 517if (values.Length == 0) 521else if (values.Length == 1) 530int valueLength = checked((values.Length - 1) * separator.Length); 561for (int i = 1; i < values.Length; i++) 576for (int i = 1; i < values.Length; i++)
src\aspnetcore\src\Shared\runtime\Http2\Hpack\Huffman.cs (1)
692while (i < src.Length)
src\aspnetcore\src\Shared\runtime\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
42if (buffer.Length != 0)
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackDecoder.cs (8)
239while (currentIndex < data.Length); 287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 342if (currentIndex < data.Length) 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 426if (currentIndex < data.Length) 534if (currentIndex < data.Length) 563if (currentIndex < data.Length) 695for (; currentIndex < data.Length; currentIndex++)
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackEncoder.cs (5)
222if (values.Length == 1) 227if (values.Length == 0) 237int valueLength = separator.Length * (values.Length - 1); 266for (int i = 1; i < values.Length; i++) 281for (int i = 1; i < values.Length; i++)
src\aspnetcore\src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 96Advance(source.Length); 138while (source.Length > 0) 145var writable = Math.Min(source.Length, _span.Length);
src\aspnetcore\src\Shared\ServerInfrastructure\Http2\Http2FrameReader.cs (2)
229Debug.Assert(data.Length % SettingSize == 0, "Invalid settings payload length"); 230var settingsCount = data.Length / SettingSize;
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
26var resultString = string.Create(span.Length, span, static (destination, source) => 56return string.Create(span.Length, span, static (destination, source) =>
src\aspnetcore\src\Shared\UrlDecoder\UrlDecoder.cs (5)
20if (destination.Length < source.Length) 29return DecodeInPlace(destination.Slice(0, source.Length), isFormEncoding); 363return DecodeInPlace(destination.Slice(0, source.Length)); 591if ((uint)tempIdx >= (uint)buffer.Length) 603return (uint)c >= (uint)CharToHexLookup.Length ? -1 : CharToHexLookup[c];
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
26var resultString = string.Create(span.Length, span, static (destination, source) => 56return string.Create(span.Length, span, static (destination, source) =>
Microsoft.AspNetCore.SignalR.Common (5)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
175while (buffer.Length > 0)
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
175while (buffer.Length > 0)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (4)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (5)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
175while (buffer.Length > 0)
Microsoft.AspNetCore.SignalR.Specification.Tests (4)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
Microsoft.AspNetCore.SignalR.StackExchangeRedis (4)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (4)
237totalWritten += segment.Span.Length; 266totalWritten += segment.Span.Length; 319_position += span.Length; 320_bytesWritten += span.Length;
Microsoft.AspNetCore.Watch.BrowserRefresh (6)
src\sdk\src\Dotnet.Watch\Web.Middleware\ScriptInjectingStream.cs (6)
211var minLength = Math.Min(buffer.Length, remainingBodyTagBytes.Length); 220var bufferLength = buffer.Length; 238if (buffer.Length < partialTagLength) 322public int Length => Span.Length; 324public Range RangeInOriginal => new(_offsetFromOriginal, _offsetFromOriginal + Span.Length);
Microsoft.AspNetCore.WebSockets (6)
HandshakeHelpers.cs (3)
97if (value.Length == 0) 222if (value.Length == 0) 230if (value[0] == '"' && value.EndsWith("\"".AsSpan()) && value.Length > 1)
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (3)
249if (pos > _chars.Length - value.Length) 251Grow(value.Length); 255_pos += value.Length;
Microsoft.AspNetCore.WebUtilities (29)
FormPipeReader.cs (14)
164while (span.Length > 0) 175span = span.Slice(keyValuePair.Length + andDelimiter.Length); 176consumed += keyValuePair.Length + andDelimiter.Length; 185if ((uint)span.Length > (uint)KeyLengthLimit + (uint)ValueLengthLimit) 194consumed += keyValuePair.Length; 202if (keyValuePair.Length > KeyLengthLimit) 214if (key.Length > KeyLengthLimit) 219value = keyValuePair.Slice(equals + equalsDelimiter.Length); 220if (value.Length > ValueLengthLimit) 269Debug.Assert(segmentConsumed == keyValuePair.FirstSpan.Length); 388if (readOnlySpan.Length == 0) 398var span = MemoryMarshal.CreateSpan(ref MemoryMarshal.GetReference(readOnlySpan), readOnlySpan.Length);
HttpResponseStreamWriter.cs (2)
145var remaining = value.Length; 660var remaining = Math.Min(_charBufferSize - _charBufferCount, value.Length);
MultipartBoundary.cs (1)
20FinalBoundaryLength = BoundaryBytes.Length + 2; // Include the final '--' terminator.
MultipartReaderStream.cs (6)
194var length = _boundary.BoundaryBytes.Length; 211var length = _boundary.BoundaryBytes.Length; 279var length = _boundary.BoundaryBytes.Length; 301var length = _boundary.BoundaryBytes.Length; 343matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length); 351for (matchCount = 0; matchCount < matchBytes.Length && matchCount < countLimit; matchCount++)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
102var buffer = new char[source.Length];
src\aspnetcore\src\Shared\UrlDecoder\UrlDecoder.cs (5)
20if (destination.Length < source.Length) 29return DecodeInPlace(destination.Slice(0, source.Length), isFormEncoding); 363return DecodeInPlace(destination.Slice(0, source.Length)); 591if ((uint)tempIdx >= (uint)buffer.Length) 603return (uint)c >= (uint)CharToHexLookup.Length ? -1 : CharToHexLookup[c];
Microsoft.Build (224)
_generated\0\RegexGenerator.g.cs (199)
881base.runtextpos = inputSpan.Length; 893if (pos <= inputSpan.Length - 6) 903base.runtextpos = inputSpan.Length; 964while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 1046while ((uint)iteration1 < (uint)slice.Length && char.IsDigit(slice[iteration1])) 1113iteration2 = slice.Length - 1; 1145iteration3 = slice.Length; 1323if ((uint)lazyloop_pos >= (uint)slice.Length || slice[lazyloop_pos] == ':') 1413if ((uint)slice.Length < 5 || 1425if ((uint)slice.Length < 7 || 1472while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 1514iteration5 = slice.Length; 1605while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 1633iteration7 = slice.Length; 1672if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 1734base.runtextpos = inputSpan.Length; 1746if (pos <= inputSpan.Length - 10) 1756base.runtextpos = inputSpan.Length; 1792while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 1838iteration1 = slice.Length; 1899iteration2 = slice.Length; 1926iteration3 = slice.Length; 1969if ((uint)slice.Length < 2) 1978if ((uint)slice.Length < 6 || 1990if ((uint)slice.Length < 8 || 2025iteration4 = slice.Length; 2092base.runtextpos = inputSpan.Length; 2104if (pos <= inputSpan.Length - 2) 2114base.runtextpos = inputSpan.Length; 2158while ((uint)iteration < (uint)slice.Length && char.IsDigit(slice[iteration])) 2216iteration1 = slice.Length; 2273iteration2 = slice.Length; 2296while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 2327if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2389base.runtextpos = inputSpan.Length; 2407base.runtextpos = inputSpan.Length; 2437iteration = slice.Length; 2448if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2511base.runtextpos = inputSpan.Length; 2523if ((uint)pos < (uint)inputSpan.Length) 2533base.runtextpos = inputSpan.Length; 2564iteration = slice.Length; 2592iteration1 = slice.Length; 2603if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2666base.runtextpos = inputSpan.Length; 2678if ((uint)pos < (uint)inputSpan.Length) 2688base.runtextpos = inputSpan.Length; 2719iteration = slice.Length; 2747iteration1 = slice.Length; 2758if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2821base.runtextpos = inputSpan.Length; 2833if (pos <= inputSpan.Length - 2) 2843base.runtextpos = inputSpan.Length; 2875iteration = slice.Length; 2903iteration1 = slice.Length; 2931iteration2 = slice.Length; 2942if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 3005base.runtextpos = inputSpan.Length; 3017if (pos <= inputSpan.Length - 3) 3027base.runtextpos = inputSpan.Length; 3060iteration = slice.Length; 3088iteration1 = slice.Length; 3116iteration2 = slice.Length; 3144iteration3 = slice.Length; 3155if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 3216base.runtextpos = inputSpan.Length; 3228if (pos <= inputSpan.Length - 3) 3238base.runtextpos = inputSpan.Length; 3269while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 3330if ((uint)slice.Length < 2 || 3436while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 3494iteration2 = slice.Length; 3571if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 3631base.runtextpos = inputSpan.Length; 3643if (pos <= inputSpan.Length - 2) 3653base.runtextpos = inputSpan.Length; 3694while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 3734while ((uint)iteration1 < (uint)slice.Length && ((ch = slice[iteration1]) < 128 ? ("\0\0怀Ͽ\ufffe蟿\ufffe߿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\0\u0004\n-/_`\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0"))) 3783while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 3805while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 3880while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 3938iteration5 = slice.Length; 4015if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 4077base.runtextpos != inputSpan.Length) 4095if (pos <= inputSpan.Length - 6) 4108base.runtextpos = inputSpan.Length; 4190if ((uint)slice.Length < 2) 4204if ((uint)slice.Length < 14 || 4244if ((uint)slice.Length < 2) 4259if ((uint)slice.Length < 3 || 4280if ((uint)slice.Length < 4 || 4292if ((uint)slice.Length < 5 || 4304if ((uint)slice.Length < 4 || 4379base.runtextpos != inputSpan.Length) 4397if (pos <= inputSpan.Length - 4) 4410base.runtextpos = inputSpan.Length; 4505if ((uint)slice.Length < 8 || 4550while ((uint)iteration < (uint)slice.Length && Utilities.IsWordChar(slice[iteration])) 4624base.runtextpos != inputSpan.Length) 4642if (pos <= inputSpan.Length - 6) 4655base.runtextpos = inputSpan.Length; 4737if ((uint)slice.Length < 2) 4747if ((uint)slice.Length < 3 || ((slice[2] | 0x20) != 'p')) 4758if ((uint)slice.Length < 24 || 4790iteration = slice.Length; 4862base.runtextpos != inputSpan.Length) 4880if (pos <= inputSpan.Length - 6) 4893base.runtextpos = inputSpan.Length; 4975if ((uint)slice.Length < 2) 4985if ((uint)slice.Length < 3 || ((slice[2] | 0x20) != 'p')) 4996if ((uint)slice.Length < 23 || 5028iteration = slice.Length; 5100base.runtextpos != inputSpan.Length) 5118if (pos <= inputSpan.Length - 8) 5131base.runtextpos = inputSpan.Length; 5169while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 5201iteration1 = slice.Length; 5251while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 5269while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 5296iteration4 = slice.Length - 1; 5304if ((uint)slice.Length < 2 || slice[1] != '\'') 5333while ((uint)iteration5 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration5])) 5351while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 5371iteration7 = slice.Length - 1; 5379if ((uint)slice.Length < 2 || slice[1] != '\'') 5417while ((uint)iteration8 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration8])) 5492base.runtextpos != inputSpan.Length) 5510if (pos <= inputSpan.Length - 8) 5523base.runtextpos = inputSpan.Length; 5549while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 5573iteration1 = slice.Length; 5602while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 5620while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 5640iteration4 = slice.Length - 1; 5648if ((uint)slice.Length < 2 || slice[1] != '\'') 5667while ((uint)iteration5 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration5])) 5685while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 5705iteration7 = slice.Length - 1; 5713if ((uint)slice.Length < 2 || slice[1] != '\'') 5743while ((uint)iteration8 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration8])) 5804base.runtextpos = inputSpan.Length; 5816if (pos <= inputSpan.Length - 7) 5826base.runtextpos = inputSpan.Length; 5850while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 5868while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 5892iteration2 = slice.Length; 5909(charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, Math.Min(inputSpan.Length, charloop_ending_pos + 1) - charloop_starting_pos).LastIndexOf("?>")) < 0) 5933while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 5962if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 6014base.runtextpos = inputSpan.Length; 6026if (pos <= inputSpan.Length - 20) 6036base.runtextpos = inputSpan.Length; 6088iteration = slice.Length; 6106(charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, Math.Min(inputSpan.Length, charloop_ending_pos + 1) - charloop_starting_pos).LastIndexOf("\")")) < 0) 6138while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 6156while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 6184iteration3 = slice.Length; 6233while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 6251while ((uint)iteration5 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration5])) 6279iteration6 = slice.Length; 6328while ((uint)iteration7 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration7])) 6346while ((uint)iteration8 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration8])) 6374iteration9 = slice.Length; 6421if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 6484base.runtextpos = inputSpan.Length; 6496if ((uint)pos < (uint)inputSpan.Length) 6506base.runtextpos = inputSpan.Length; 6545iteration = slice.Length; 6587while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 6609while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 6650iteration3 = slice.Length; 6689if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 6749base.runtextpos = inputSpan.Length; 6761if (pos <= inputSpan.Length - 65) 6771base.runtextpos = inputSpan.Length; 6793if ((uint)slice.Length < 62 || 6813while ((uint)iteration < (uint)slice.Length && char.IsDigit(slice[iteration])) 6840while ((uint)iteration1 < (uint)slice.Length && char.IsDigit(slice[iteration1])) 6859if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 6920base.runtextpos != inputSpan.Length) 6938if (pos <= inputSpan.Length - 8) 6951base.runtextpos = inputSpan.Length; 6975iteration = slice.Length - 7; 6983if ((uint)slice.Length < 8 || slice[7] != '"') 6991while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 7027return (uint)chDiv8 < (uint)ascii.Length ?
BackEnd\Components\Logging\BuildErrorTelemetryTracker.cs (1)
251if (codeSpan.Length < 7 || !TryParseErrorNumber(codeSpan, out int errorNumber))
BuildCheck\Checks\ExecCliBuildCheck.cs (5)
72while (start < commandSpan.Length) 74var nextSeparatorIndex = commandSpan.Slice(start, commandSpan.Length - start).IndexOfAny(s_knownCommandSeparators); 116Span<char> normalizedBuildCommand = command.Length <= maxStackLimit ? stackalloc char[command.Length] : new char[command.Length];
Evaluation\ConditionEvaluator.cs (1)
112if (input.Length < beginning + 3 ||
Evaluation\Expander.cs (1)
493int length = expression.Length;
Evaluation\Expander.Function.cs (2)
251if (expressionRoot.Length > methodStartIndex + 2 && expressionRoot[methodStartIndex] == ':' && expressionRoot[methodStartIndex + 1] == ':') 972ProjectErrorUtilities.VerifyThrowInvalidProject(netPropertyName.Length > 0, elementLocation, "InvalidFunctionPropertyExpression", expressionFunction, String.Empty);
Logging\OptimizedStringIndenter.cs (2)
124for (int i = 0; i < input.Length; i++) 149segments[i] = new StringSegment(start, input.Length);
Logging\TerminalLogger\Terminal.cs (1)
173ReadOnlySpan<char> truncatedText = text.Slice(0, Math.Min(text.Length, Width - 1));
Logging\TerminalLogger\TerminalLogger.cs (10)
955if (outputPathSpan.Length > workingDirectorySpan.Length 956&& (outputPathSpan[workingDirectorySpan.Length] == Path.DirectorySeparatorChar 957|| outputPathSpan[workingDirectorySpan.Length] == Path.AltDirectorySeparatorChar)) 959projectDisplayPathSpan = outputPathSpan.Slice(workingDirectorySpan.Length + 1); 968if (outputPathSpan.Length > sourceRootSpan.Length 970&& (outputPathSpan[sourceRootSpan.Length - 1] == Path.DirectorySeparatorChar 971|| outputPathSpan[sourceRootSpan.Length - 1] == Path.AltDirectorySeparatorChar)) 974projectDisplayPathSpan = Path.Combine(relativePathFromWorkingDirToSourceRoot.ToString(), outputPathSpan.Slice(sourceRootSpan.Length).ToString()).AsSpan();
src\9f0d3f3da306d8cf\ImmutableArrayExtensions.cs (1)
1325int high = array.Length - 1;
Utilities\SimpleVersion.cs (1)
134if (span.Length > 0 && (span[0] is 'v' or 'V'))
Microsoft.Build.Framework (31)
_generated\1\RegexGenerator.g.cs (7)
87base.runtextpos != inputSpan.Length) 105if (pos <= inputSpan.Length - 11) 118base.runtextpos = inputSpan.Length; 132if ((uint)slice.Length < 10 || 150iteration = slice.Length; 190if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Collections\RefArrayBuilder.cs (11)
158if (source.Length == 1 && (uint)count < (uint)span.Length) 175if ((uint)(count + source.Length) > (uint)span.Length) 177Grow(size: source.Length); 184_count = count + source.Length; 243if ((uint)(count + source.Length) <= (uint)span.Length) 247span.Slice(index, toCopy).CopyTo(span.Slice(index + source.Length, toCopy)); 250_count = count + source.Length; 265if ((uint)(count + source.Length) > (uint)span.Length) 267Grow(size: source.Length, startIndex: index); 273source.CopyTo(span.Slice(index, source.Length)); 274_count = count + source.Length;
Coordinator\CoordinatorSettings.cs (2)
172span = span[prefix.Length..]; 174for (int i = 0; i < hash.Length; i++)
EscapingUtilities.cs (2)
231int length = value.Length + (specialCharIndices.Length * 2); 259if (sourceIndex < source.Length)
FileUtilities.cs (1)
850bool shouldCheckFileOrDirectory = !shouldCheckDirectory && value.Length > 0 && value[0] == '/';
Utilities\FileMatcher.cs (1)
1702int inputLength = input.Length;
Utilities\HexConverter.cs (1)
16=> c >= CharToHexLookup.Length ? 0xFF : CharToHexLookup[c];
Utilities\ProcessExtensions.cs (3)
165using BufferScope<char> charBuffer = new(data.Length); 521=> sysctl(name, (uint)name.Length, oldp, ref oldlenp, ReadOnlySpan<byte>.Empty, 0); 558if (data.Length < sizeof(int))
Utilities\ValueStringBuilder.cs (3)
371if (pos > _chars.Length - value.Length) 373Grow(value.Length); 377_length += value.Length;
Microsoft.Build.Tasks.CodeAnalysis (6)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CommandLineUtilities.cs (6)
67while (i < commandLine.Length) 69while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i])) 74if (i == commandLine.Length) 86while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0))) 99} while (i < commandLine.Length && commandLine[i] == '\\'); 102if (i >= commandLine.Length || commandLine[i] != '"')
Microsoft.Build.Tasks.Core (111)
_generated\0\RegexGenerator.g.cs (111)
499base.runtextpos = inputSpan.Length; 511if (pos <= inputSpan.Length - 6) 521base.runtextpos = inputSpan.Length; 582while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 664while ((uint)iteration1 < (uint)slice.Length && char.IsDigit(slice[iteration1])) 731iteration2 = slice.Length - 1; 763iteration3 = slice.Length; 941if ((uint)lazyloop_pos >= (uint)slice.Length || slice[lazyloop_pos] == ':') 1031if ((uint)slice.Length < 5 || 1043if ((uint)slice.Length < 7 || 1090while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 1132iteration5 = slice.Length; 1223while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 1251iteration7 = slice.Length; 1290if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 1352base.runtextpos = inputSpan.Length; 1364if (pos <= inputSpan.Length - 10) 1374base.runtextpos = inputSpan.Length; 1410while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 1456iteration1 = slice.Length; 1517iteration2 = slice.Length; 1544iteration3 = slice.Length; 1587if ((uint)slice.Length < 2) 1596if ((uint)slice.Length < 6 || 1608if ((uint)slice.Length < 8 || 1643iteration4 = slice.Length; 1710base.runtextpos = inputSpan.Length; 1722if (pos <= inputSpan.Length - 2) 1732base.runtextpos = inputSpan.Length; 1776while ((uint)iteration < (uint)slice.Length && char.IsDigit(slice[iteration])) 1834iteration1 = slice.Length; 1891iteration2 = slice.Length; 1914while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 1945if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2007base.runtextpos = inputSpan.Length; 2025base.runtextpos = inputSpan.Length; 2055iteration = slice.Length; 2066if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2129base.runtextpos = inputSpan.Length; 2141if ((uint)pos < (uint)inputSpan.Length) 2151base.runtextpos = inputSpan.Length; 2182iteration = slice.Length; 2210iteration1 = slice.Length; 2221if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2284base.runtextpos = inputSpan.Length; 2296if ((uint)pos < (uint)inputSpan.Length) 2306base.runtextpos = inputSpan.Length; 2337iteration = slice.Length; 2365iteration1 = slice.Length; 2376if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2439base.runtextpos = inputSpan.Length; 2451if (pos <= inputSpan.Length - 2) 2461base.runtextpos = inputSpan.Length; 2493iteration = slice.Length; 2521iteration1 = slice.Length; 2549iteration2 = slice.Length; 2560if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2623base.runtextpos = inputSpan.Length; 2635if (pos <= inputSpan.Length - 3) 2645base.runtextpos = inputSpan.Length; 2678iteration = slice.Length; 2706iteration1 = slice.Length; 2734iteration2 = slice.Length; 2762iteration3 = slice.Length; 2773if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2834base.runtextpos != inputSpan.Length) 2852if ((uint)pos < (uint)inputSpan.Length) 2865base.runtextpos = inputSpan.Length; 2881while ((uint)iteration < (uint)slice.Length && char.IsDigit(slice[iteration])) 2902if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2954base.runtextpos = inputSpan.Length; 2966if (pos <= inputSpan.Length - 9) 2976base.runtextpos = inputSpan.Length; 3007iteration = slice.Length; 3027while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 3036if ((uint)slice.Length < 8 || 3055iteration2 = slice.Length; 3122base.runtextpos = inputSpan.Length; 3140base.runtextpos = inputSpan.Length; 3185iteration = slice.Length; 3256iteration1 = slice.Length; 3376iteration2 = slice.Length; 3496iteration3 = slice.Length; 3616iteration4 = slice.Length; 3735iteration5 = slice.Length; 3825base.runtextpos = inputSpan.Length; 3837if (pos <= inputSpan.Length - 19) 3847base.runtextpos = inputSpan.Length; 3878while ((uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < 128 ? ("\0\0䀀Ͽ\0\0\0\0"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\0\u0002\u0001./\t"))) 3914iteration1 = slice.Length; 3939if ((uint)slice.Length < 16) 3946for (int i = 0; i < repeaterSlice.Length; i++) 3962if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 4025base.runtextpos = inputSpan.Length; 4037if (pos <= inputSpan.Length - 9) 4047base.runtextpos = inputSpan.Length; 4078iteration = slice.Length; 4098while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 4107if ((uint)slice.Length < 8 || 4126iteration2 = slice.Length; 4171if ((uint)i < (uint)span.Length) 4186while ((uint)i < (uint)span.Length);
Microsoft.Build.Tasks.Git (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.Build.Utilities.Core (72)
_generated\0\RegexGenerator.g.cs (72)
340base.runtextpos = inputSpan.Length; 352if (pos <= inputSpan.Length - 6) 362base.runtextpos = inputSpan.Length; 423while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 505while ((uint)iteration1 < (uint)slice.Length && char.IsDigit(slice[iteration1])) 572iteration2 = slice.Length - 1; 604iteration3 = slice.Length; 782if ((uint)lazyloop_pos >= (uint)slice.Length || slice[lazyloop_pos] == ':') 872if ((uint)slice.Length < 5 || 884if ((uint)slice.Length < 7 || 931while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 973iteration5 = slice.Length; 1064while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 1092iteration7 = slice.Length; 1131if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 1193base.runtextpos = inputSpan.Length; 1205if (pos <= inputSpan.Length - 10) 1215base.runtextpos = inputSpan.Length; 1251while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 1297iteration1 = slice.Length; 1358iteration2 = slice.Length; 1385iteration3 = slice.Length; 1428if ((uint)slice.Length < 2) 1437if ((uint)slice.Length < 6 || 1449if ((uint)slice.Length < 8 || 1484iteration4 = slice.Length; 1551base.runtextpos = inputSpan.Length; 1563if (pos <= inputSpan.Length - 2) 1573base.runtextpos = inputSpan.Length; 1617while ((uint)iteration < (uint)slice.Length && char.IsDigit(slice[iteration])) 1675iteration1 = slice.Length; 1732iteration2 = slice.Length; 1755while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 1786if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 1848base.runtextpos = inputSpan.Length; 1866base.runtextpos = inputSpan.Length; 1896iteration = slice.Length; 1907if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 1970base.runtextpos = inputSpan.Length; 1982if ((uint)pos < (uint)inputSpan.Length) 1992base.runtextpos = inputSpan.Length; 2023iteration = slice.Length; 2051iteration1 = slice.Length; 2062if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2125base.runtextpos = inputSpan.Length; 2137if ((uint)pos < (uint)inputSpan.Length) 2147base.runtextpos = inputSpan.Length; 2178iteration = slice.Length; 2206iteration1 = slice.Length; 2217if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2280base.runtextpos = inputSpan.Length; 2292if (pos <= inputSpan.Length - 2) 2302base.runtextpos = inputSpan.Length; 2334iteration = slice.Length; 2362iteration1 = slice.Length; 2390iteration2 = slice.Length; 2401if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 2464base.runtextpos = inputSpan.Length; 2476if (pos <= inputSpan.Length - 3) 2486base.runtextpos = inputSpan.Length; 2519iteration = slice.Length; 2547iteration1 = slice.Length; 2575iteration2 = slice.Length; 2603iteration3 = slice.Length; 2614if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Microsoft.CodeAnalysis (106)
_generated\0\RegexGenerator.g.cs (20)
117base.runtextpos = inputSpan.Length; 129if (pos <= inputSpan.Length - 3) 139base.runtextpos = inputSpan.Length; 170while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 231if ((uint)slice.Length < 2 || 337while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 395iteration2 = slice.Length; 472if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 532base.runtextpos = inputSpan.Length; 544if (pos <= inputSpan.Length - 2) 554base.runtextpos = inputSpan.Length; 595while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 635while ((uint)iteration1 < (uint)slice.Length && ((ch = slice[iteration1]) < 128 ? ("\0\0怀Ͽ\ufffe蟿\ufffe߿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\0\u0004\n-/_`\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0"))) 684while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 706while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 781while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 839iteration5 = slice.Length; 916if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
CaseInsensitiveComparison.cs (7)
127int len = Math.Min(str1.Length, str2.Length); 138return str1.Length - str2.Length; 176if (str1.Length != str2.Length) 181for (int i = 0; i < str1.Length; i++)
CodeGen\PrivateImplementationDetails.cs (1)
542return string.Create(hash.Length * 2, hash, (destination, hash) => toHex(hash, destination));
CommandLine\CommandLineParser.cs (7)
104if (optionName.Length != value.Length) 141arg.Length > 0 && (arg[0] == '/' || arg[0] == '-'); 957while (i < arg.Length) 982Debug.Assert(i < arg.Length); 985while (i < arg.Length && arg[i] == '\\') 991if (i < arg.Length && arg[i] == '"') 1091for (int i = 0; i < span.Length; i++)
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (6)
172if (algorithmId != default(Guid) && checksum.Length > 0) 180documentWriter.SetCheckSum(algorithmId, (uint)checksum.Length, bytes); 198documentWriter.SetSource((uint)source.Length, bytes); 489if (yieldOffsets.Length != resumeOffsets.Length) 496int count = yieldOffsets.Length;
FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
InternalUtilities\CommandLineUtilities.cs (6)
67while (i < commandLine.Length) 69while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i])) 74if (i == commandLine.Length) 86while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0))) 99} while (i < commandLine.Length && commandLine[i] == '\\'); 102if (i >= commandLine.Length || commandLine[i] != '"')
InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
MemoryExtensions.cs (4)
15for (int i = startIndex; i < span.Length; i++) 28for (int i = 0; i < span.Length; i++) 96if (span.Length > 1 && span[0] == '"' && span[span.Length - 1] == '"')
MetadataReader\MetadataHelpers.cs (2)
512int emittedTypeNameLength = emittedTypeName.Length; 545if (aritySpan is { Length: >= 1 and <= 5 } and not ['0', ..])
Operations\ControlFlowGraphBuilder.cs (1)
7860ArrayBuilder<IOperation> statementsBuilder = ArrayBuilder<IOperation>.GetInstance(statements.Length);
PEWriter\MetadataWriter.cs (1)
464_pseudoSymbolTokenToTokenMap = new EntityHandle[referencesInIL.Length];
SourceGeneration\CompilationCache.cs (1)
163for (int i = 0; i < aSpan.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
StrongName\CryptoBlobParser.cs (3)
162var w = new BlobWriter(3 * sizeof(uint) + s_offsetToKeyData + pubKeyData.Length); 165w.WriteUInt32((uint)(s_offsetToKeyData + pubKeyData.Length)); 182w.WriteBytes(bytes, pubKeyData.Length);
Symbols\WellKnownGeneratedNameParser.cs (1)
32for (int i = metadataNameSuffix.Length - 1; i >= -1; i--)
Syntax\SeparatedSyntaxList.cs (4)
22if (nodes.Length == 0) 25if (nodes.Length == 1) 28var builder = new CodeAnalysis.Syntax.SeparatedSyntaxListBuilder<TNode>(nodes.Length); 34for (int i = 1, n = nodes.Length; i < n; i++)
Syntax\SyntaxList`1.cs (4)
23if (nodes.Length == 0) 30switch (nodes.Length) 37var copy = new ArrayElement<GreenNode>[nodes.Length]; 38for (int i = 0, n = nodes.Length; i < n; i++)
Syntax\SyntaxNodeOrTokenList.cs (4)
71if (nodesAndTokens.Length == 0) 82switch (nodesAndTokens.Length) 93var copy = new ArrayElement<GreenNode>[nodesAndTokens.Length]; 94for (int i = 0, n = nodesAndTokens.Length; i < n; i++)
Syntax\SyntaxTokenList.cs (4)
67if (tokens.Length == 0) 75switch (tokens.Length) 84var copy = new ArrayElement<GreenNode>[tokens.Length]; 85for (int i = 0, n = tokens.Length; i < n; i++)
Syntax\SyntaxTriviaList.cs (4)
73if (trivias.Length == 0) 81switch (trivias.Length) 90var copy = new ArrayElement<GreenNode>[trivias.Length]; 91for (int i = 0, n = trivias.Length; i < n; i++)
Syntax\SyntaxTriviaListBuilder.cs (1)
88this.Add(items, 0, items.Length);
Microsoft.CodeAnalysis.Analyzers (49)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
125if (remaining[index] == '\r' && remaining.Length > index + 1 && remaining[index + 1] == '\n')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Microsoft.CodeAnalysis.AnalyzerUtilities (49)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
125if (remaining[index] == '\r' && remaining.Length > index + 1 && remaining[index + 1] == '\n')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Microsoft.CodeAnalysis.CodeStyle (52)
src\roslyn\src\Analyzers\Core\Analyzers\DiagnosticCustomTags.cs (2)
64Debug.Assert(customTags.Length == tags.Length); 66for (var i = 0; i < tags.Length; i++)
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (2)
359_formatArguments = new string[formatArguments.Length]; 360for (var i = 0; i < formatArguments.Length; i++)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Microsoft.CodeAnalysis.CSharp (24)
CommandLine\CSharpCommandLineParser.cs (2)
1802while (index < valueSpan.Length) 1812if (nextIndex < valueSpan.Length)
CSharpParseOptions.cs (1)
222while (currentIndex < @namespace.Length && @namespace.IndexOf('.', currentIndex) is not -1 and var dotIndex)
Lowering\ExtensionMethodBodyRewriter.cs (1)
56Debug.Assert(symbol.Parameters.Length == rewrittenParameters.Length);
Parser\LanguageParser_InterpolatedString.cs (9)
283while (currentIndex < text.Length) 301var isBlankLine = (currentIndex == text.Length && isLast) || (currentIndex < text.Length && SyntaxFacts.IsNewLine(text[currentIndex])); 328currentIndex = Math.Min(currentIndex, lineStartPosition + indentationWhitespace.Length); 425for (int i = 0, n = Math.Min(currentLineWhitespace.Length, indentationLineWhitespace.Length); i < n; i++) 452while (currentIndex < text.Length && SyntaxFacts.IsWhitespace(text[currentIndex])) 460while (currentIndex < text.Length) 469currentIndex += SlidingTextWindow.GetNewLineWidth(ch, currentIndex + 1 < text.Length ? text[currentIndex + 1] : '\0');
Parser\Lexer.cs (1)
1336if (currentIndex == textWindowCharSpan.Length)
Parser\QuickScanner.cs (3)
200textWindowCharSpan = textWindowCharSpan[..Math.Min(MaxCachedTokenSize, textWindowCharSpan.Length)]; 205var charPropLength = CharProperties.Length; 209for (; currentIndex < textWindowCharSpan.Length; currentIndex++)
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (3)
560if (parameterTypes.Length > 0) 562var paramsBuilder = ArrayBuilder<FunctionPointerParameterSymbol>.GetInstance(parameterTypes.Length); 564for (int i = 0; i < parameterTypes.Length; i++)
Symbols\MemberSignatureComparer.cs (3)
740Debug.Assert(params1.Length == params2.Length); 742var numParams = params1.Length;
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1154Span<short> shortSpan = stackalloc short[charSpan.Length];
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
310for (var i = 0; i < names.Length; i++)
Microsoft.CodeAnalysis.CSharp.Features (4)
Completion\CompletionProviders\FileBasedPrograms\AbstractAppDirectiveCompletionProvider.cs (2)
93for (var i = 0; i < span.Length; i++) 99return span.Length;
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (2)
324if (Patterns.DisallowedNameCharacters.Match(context.DirectiveText, beginning: 0, length: firstPart.Length).Success) 338Debug.Assert(secondPart.Length == 0,
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (1)
Microsoft.NetCore.Analyzers\Usage\CSharpMissingShebangInFileBasedProgram.cs (1)
77(content.Length == directiveName.Length || char.IsWhiteSpace(content[directiveName.Length]));
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Classification\Worker_Preprocesser.cs (6)
360while (nameStart < contentText.Length && (contentText[nameStart] == ' ' || contentText[nameStart] == '\t')) 365if (nameStart < contentText.Length) 385AddClassification(new TextSpan(node.Content.SpanStart + nameStart, contentText.Length - nameStart), ClassificationTypeNames.StringLiteral); 398ClassifyDottedName(contentStart, contentText, nameStart, contentText.Length); 414if (valueIndex < contentText.Length) 418AddClassification(new TextSpan(contentStart + valueIndex, contentText.Length - valueIndex), ClassificationTypeNames.StringLiteral);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
310for (var i = 0; i < names.Length; i++)
Microsoft.CodeAnalysis.Extensions.Package (4)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
Microsoft.CodeAnalysis.Features (13)
Common\GlyphExtensions.cs (1)
21using var _ = ArrayBuilder<Glyph>.GetInstance(tags.Length, out var builder);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (3)
104while (current < operations.Length && 116if (operations.Length == 0) 130if (current < operations.Length)
EmbeddedLanguages\RegularExpressions\RegexCharClass.cs (1)
202if ((uint)chDiv8 < (uint)asciiLookup.Length)
MetadataAsSource\AbstractMetadataAsSourceService.DocCommentFormatter.cs (4)
176while (span.Length > 0) 180if (span.Length == 0) 197end = span.Length; 227source = source.Slice(index + separator.Length);
src\roslyn\src\Analyzers\Core\Analyzers\DiagnosticCustomTags.cs (2)
64Debug.Assert(customTags.Length == tags.Length); 66for (var i = 0; i < tags.Length; i++)
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (2)
359_formatArguments = new string[formatArguments.Length]; 360for (var i = 0; i < formatArguments.Length; i++)
Microsoft.CodeAnalysis.NetAnalyzers (1)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
127if (remaining[index] == '\r' && remaining.Length > index + 1 && remaining[index + 1] == '\n')
Microsoft.CodeAnalysis.Razor.Compiler (77)
CSharp\RequiredAttributeParser.cs (2)
239valueEndIndex = _span.Length; 315nameEndIndex = _span.Length;
CSharp\SymbolExtensions.cs (2)
110fullNameSpan = fullNameSpan[..^symbolNameSpan.Length]; 112if (fullNameSpan.Length == 0)
Language\CodeGeneration\CodeWriter.cs (8)
252_absoluteIndex += span.Length; 275if (newLineIndex < span.Length && 285_currentLineCharacterIndex += span.Length; 442if (source.Length > destination.Length) 445charIndex += source.Length; 459destination = destination[source.Length..]; 461charsWritten += source.Length; 530destination = destination[source.Length..];
Language\Components\ComponentChildContentDiagnosticPass.cs (1)
62for (var i = 1; i < ancestors.Length - 1; i++)
Language\Components\TypeNameHelper.cs (2)
114if (typeNameSpan.Length < 3 || typeNameSpan.Length > 7)
Language\CSharpIdentifier.cs (7)
17if (span.Length == 0) 34if (inputName.Length == 0) 46if (inputName.Length == 0) 54builder.SetCapacityIfLarger(builder.Length + inputName.Length + 1); 59builder.SetCapacityIfLarger(builder.Length + inputName.Length); 62for (int i = 0; i < inputName.Length; i++) 78if (char.IsHighSurrogate(ch) && i + 1 < inputName.Length && char.IsLowSurrogate(inputName[i + 1]))
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (1)
2082public string Text => field ??= (Span.Length < original.Length ? Span.ToString() : original);
Language\DefaultRazorProjectFileSystem.cs (2)
142span = span[rootSpan.Length..]; 152Debug.Assert(span.Length == pathSpan.Length, "The span should be the same length as the path.");
Language\DefaultRazorTagHelperContextDiscoveryPhase.cs (1)
608if (typeNamespace.Length > @namespace.Length && typeNamespace[@namespace.Length] != '.')
Language\HtmlConventions.cs (1)
110(i + 1 < input.Length) && char.IsLower(input[i + 1]))
Language\Intermediate\ComponentAttributeIntermediateNode.cs (2)
233if (candidate.Length <= eventCallbackName.Length + "<>".Length || 240var afterCallbackName = candidate[eventCallbackName.Length..];
Language\Legacy\ParserHelpers.cs (1)
74for (var i = 1; i < span.Length; i++)
Language\Legacy\SourceLocationTracker.cs (2)
19for (var i = 0; i < text.Length; i++) 22if (i < text.Length - 1)
Language\Legacy\TagHelperParseTreeRewriter.cs (2)
580var whitespace = content[..^trimmedStart.Length]; 582var length = trimmedStart.TrimEnd().Length;
Language\NamespaceComputer.cs (3)
47if (sourceFilePath.Length > directiveDirectorySpan.Length && 52var suffix = sourceFilePath[directiveDirectorySpan.Length..];
Language\RequiredAttributeDescriptorBuilder.cs (1)
71Debug.Assert(nameSpan.Length > 0, "Name should not be empty at this point.");
Language\StringTokenizer.cs (2)
61if (_span.Length == 0) 90_span = nextIndex < _span.Length
Language\Syntax\GreenNode.cs (2)
217if (content.Length > 0) 220span = span[content.Length..];
Language\Syntax\InternalSyntax\SyntaxList.cs (4)
28return nodes.Length switch 40return nodes.Length switch 77var count = nodes.Length; 91var count = nodes.Length;
Language\Syntax\SyntaxList.cs (4)
15if (nodes.Length == 0) 20using var builder = new PooledArrayBuilder<TNode>(nodes.Length); 37if (tokens.Length == 0) 42using var builder = new PooledArrayBuilder<SyntaxToken>(tokens.Length);
Language\Syntax\SyntaxList`1.cs (7)
43if (nodes.Length == 0) 48using var builder = new PooledArrayBuilder<TNode>(nodes.Length); 169if (tokens.Length == 0) 174using var builder = new PooledArrayBuilder<TNode>(count + tokens.Length); 185Debug.Assert(builder.Count == count + tokens.Length); 321if (nodes.Length == 0) 329using var builder = new PooledArrayBuilder<TNode>(newCount + nodes.Length);
Language\Syntax\SyntaxTokenList.cs (7)
62if (tokens.Length == 0) 67using var builder = new PooledArrayBuilder<SyntaxToken>(tokens.Length); 184if (tokens.Length == 0) 189using var builder = new PooledArrayBuilder<SyntaxToken>(count + tokens.Length); 200Debug.Assert(builder.Count == count + tokens.Length); 312if (tokens.Length == 0) 320using var builder = new PooledArrayBuilder<SyntaxToken>(newCount + tokens.Length);
Language\TagHelperBinder.cs (2)
143tagNameSpan = tagNameSpan[tagNamePrefixSpan.Length..]; 151parentTagNameSpan = parentTagNameSpan[tagNamePrefixSpan.Length..];
Language\TagHelperCollection_Factories.cs (3)
44using var builder = new FixedSizeBuilder(span.Length); 196minimumLength: collections.Length, clearOnReturn: true, out var destination); 216Debug.Assert(collections.Length >= 2);
Language\TagHelperCollection.cs (4)
267for (var i = 0; i < span.Length; i++) 286if (segmentStart < span.Length) 342for (var i = 0; i < span.Length; i++) 361if (segmentStart < span.Length)
Language\TagHelperCollection.SegmentBuilder.cs (2)
69for (var i = 0; i < span.Length; i++) 90if (segmentStart < span.Length)
SourceGenerators\RazorSourceGenerator.Helpers.cs (2)
31for (var i = 0; i < filePath.Length; i++) 35case '\\' or '/' when i + 1 < filePath.Length && filePath[i + 1] is '\\' or '/':
Microsoft.CodeAnalysis.ResxSourceGenerator (49)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
125if (remaining[index] == '\r' && remaining.Length > index + 1 && remaining[index + 1] == '\n')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Microsoft.CodeAnalysis.Workspaces (75)
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (2)
133if (expectedDocCommentId.Length < docCommentId.Length) 137if (docCommentId.Span[expectedDocCommentId.Length] != '.')
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.NavigateToSearchInfo.cs (17)
277if (loweredName.Length < SparseNgramGenerator.MinNgramLength) 364if (pattern.Length == 0) 370while (pattern.Length > 0) 379var end = sepIndex < 0 ? pattern.Length : sepIndex; 396while (pattern.Length > 0 && !PatternMatcher.IsWordChar(pattern[0])) 399while (pattern.Length > 0 && !PatternMatcher.IsWordChar(pattern[^1])) 402if (pattern.Length == 0) 428if (_containerCharSet == null || patternContainer.Length == 0) 476if (patternName.Length == 0) 528var n = pattern.Length; 619if (!isAllLowercase || pattern.Length < SparseNgramGenerator.MinNgramLength) 635if (_symbolNameLengthBitset == 0 || pattern.Length < WordSimilarityChecker.MinFuzzyLength) 638var threshold = WordSimilarityChecker.GetThreshold(pattern.Length); 642var candidateLength = pattern.Length + delta; 692var k = WordSimilarityChecker.GetThreshold(pattern.Length); 693var minShared = pattern.Length - 1 - 2 * k; 698for (var i = 0; i < pattern.Length - 1; i++)
FindSymbols\TopLevelSyntaxTree\SparseNgramGenerator.cs (5)
105if (text.Length < MinNgramLength) 110for (var i = 0; i + 2 <= text.Length; i++) 176if (text.Length < MinNgramLength) 181for (var i = 0; i + 2 <= text.Length; i++) 247if (text.Length < MinNgramLength)
PatternMatching\CompoundPatternMatcher.cs (1)
24_matchers = ArrayBuilder<PatternMatcher>.GetInstance(matchers.Length);
Shared\Utilities\BloomFilter.cs (1)
129var numberOfCharsLeft = key.Length;
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Workspace\Solution\Checksum.cs (1)
54if (checksum.Length < HashSize)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (4)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
Microsoft.CSharp (1)
Microsoft\CSharp\RuntimeBinder\Semantics\ExpressionBinder.cs (1)
1635Debug.Assert(ek >= ExpressionKind.FirstOp && (ek - ExpressionKind.FirstOp) < (int)EK2NAME.Length);
Microsoft.Data.Analysis (168)
Computations\Arithmetic.net8.cs (40)
113for (var i = 0; i < x.Length; i++) 121for (var i = 0; i < x.Length; i++) 129for (var i = 0; i < y.Length; i++) 139for (var i = 0; i < x.Length; i++) 147for (var i = 0; i < x.Length; i++) 155for (var i = 0; i < x.Length; i++) 163for (var i = 0; i < x.Length; i++) 171for (var i = 0; i < x.Length; i++) 179for (var i = 0; i < x.Length; i++) 187for (var i = 0; i < x.Length; i++) 195for (var i = 0; i < x.Length; i++) 203for (var i = 0; i < x.Length; i++) 211for (var i = 0; i < x.Length; i++) 219for (var i = 0; i < x.Length; i++) 227for (var i = 0; i < x.Length; i++) 471for (var i = 0; i < x.Length; i++) 479for (var i = 0; i < x.Length; i++) 487for (var i = 0; i < x.Length; i++) 495for (var i = 0; i < x.Length; i++) 503for (var i = 0; i < x.Length; i++) 511for (var i = 0; i < x.Length; i++) 519for (var i = 0; i < x.Length; i++) 527for (var i = 0; i < x.Length; i++) 535for (var i = 0; i < x.Length; i++) 543for (var i = 0; i < x.Length; i++) 551for (var i = 0; i < x.Length; i++) 559for (var i = 0; i < x.Length; i++) 572while (i < x.Length) 583while (i < x.Length) 594while (i < y.Length) 605while (i < x.Length) 616while (i < x.Length) 627while (i < y.Length) 638while (i < x.Length) 649while (i < x.Length) 660while (i < y.Length) 669for (var i = 0; i < x.Length; i++) 677for (var i = 0; i < x.Length; i++) 685for (var i = 0; i < x.Length; i++) 693for (var i = 0; i < x.Length; i++)
DataFrameColumns\ArrowStringDataFrameColumn.cs (3)
212mutableDataBuffer.IncreaseSize(value.Length); 214mutableOffsetsBuffer.Append(mutableOffsetsBuffer[mutableOffsetsBuffer.Length - 1] + value.Length); 262return Encoding.UTF8.GetString(data, bytes.Length);
DataFrameColumns\StringDataFrameColumn.cs (2)
351for (int i = 0; i < span.Length; i++) 373for (int i = 0; i < span.Length; i++)
DataFrameColumns\VBufferDataFrameColumn.cs (2)
237for (int i = 0; i < span.Length; i++) 259for (int i = 0; i < span.Length; i++)
DateTimeComputation.cs (4)
39for (int i = 0; i < readOnlySpan.Length; i++) 111for (int i = 0; i < readOnlySpan.Length; i++) 203for (int i = 0; i < readOnlySpan.Length; i++) 261for (int i = 0; i < readOnlySpan.Length; i++)
PrimitiveColumnContainer.BinaryOperations.cs (5)
129if (availableInRetSpan < leftSpan.Length) 144index += leftSpan.Length; 171if (availableInRetSpan < leftSpan.Length) 186index += leftSpan.Length; 194for (var i = 0; i < left.Length; i++)
PrimitiveColumnContainer.cs (11)
581for (int i = 0; i < span.Length; i++) 600for (int i = 0; i < span.Length; i++) 619for (int i = 0; i < span.Length; i++) 638for (int i = 0; i < span.Length; i++) 657for (int i = 0; i < span.Length; i++) 676for (int i = 0; i < span.Length; i++) 695for (int i = 0; i < span.Length; i++) 714for (int i = 0; i < span.Length; i++) 733for (int i = 0; i < span.Length; i++) 752for (int i = 0; i < span.Length; i++) 771for (int i = 0; i < span.Length; i++)
PrimitiveDataFrameColumn.cs (2)
370for (int i = 0; i < span.Length; i++) 625for (int i = 0; i < readOnlySpan.Length; i++)
PrimitiveDataFrameColumnComputations.cs (98)
129for (int i = 0; i < span.Length; i++) 147for (int i = 0; i < span.Length; i++) 282for (int i = 0; i < readOnlySpan.Length; i++) 346for (int i = 0; i < readOnlySpan.Length; i++) 410for (int i = 0; i < readOnlySpan.Length; i++) 474for (int i = 0; i < readOnlySpan.Length; i++) 537for (int i = 0; i < readOnlySpan.Length; i++) 585for (int i = 0; i < readOnlySpan.Length; i++) 632for (int i = 0; i < readOnlySpan.Length; i++) 677for (int i = 0; i < readOnlySpan.Length; i++) 769for (int i = 0; i < readOnlySpan.Length; i++) 833for (int i = 0; i < readOnlySpan.Length; i++) 897for (int i = 0; i < readOnlySpan.Length; i++) 961for (int i = 0; i < readOnlySpan.Length; i++) 1024for (int i = 0; i < readOnlySpan.Length; i++) 1072for (int i = 0; i < readOnlySpan.Length; i++) 1119for (int i = 0; i < readOnlySpan.Length; i++) 1164for (int i = 0; i < readOnlySpan.Length; i++) 1256for (int i = 0; i < readOnlySpan.Length; i++) 1320for (int i = 0; i < readOnlySpan.Length; i++) 1384for (int i = 0; i < readOnlySpan.Length; i++) 1448for (int i = 0; i < readOnlySpan.Length; i++) 1511for (int i = 0; i < readOnlySpan.Length; i++) 1559for (int i = 0; i < readOnlySpan.Length; i++) 1606for (int i = 0; i < readOnlySpan.Length; i++) 1651for (int i = 0; i < readOnlySpan.Length; i++) 1743for (int i = 0; i < readOnlySpan.Length; i++) 1807for (int i = 0; i < readOnlySpan.Length; i++) 1871for (int i = 0; i < readOnlySpan.Length; i++) 1935for (int i = 0; i < readOnlySpan.Length; i++) 1998for (int i = 0; i < readOnlySpan.Length; i++) 2046for (int i = 0; i < readOnlySpan.Length; i++) 2093for (int i = 0; i < readOnlySpan.Length; i++) 2138for (int i = 0; i < readOnlySpan.Length; i++) 2230for (int i = 0; i < readOnlySpan.Length; i++) 2294for (int i = 0; i < readOnlySpan.Length; i++) 2358for (int i = 0; i < readOnlySpan.Length; i++) 2422for (int i = 0; i < readOnlySpan.Length; i++) 2485for (int i = 0; i < readOnlySpan.Length; i++) 2533for (int i = 0; i < readOnlySpan.Length; i++) 2580for (int i = 0; i < readOnlySpan.Length; i++) 2625for (int i = 0; i < readOnlySpan.Length; i++) 2717for (int i = 0; i < readOnlySpan.Length; i++) 2781for (int i = 0; i < readOnlySpan.Length; i++) 2845for (int i = 0; i < readOnlySpan.Length; i++) 2909for (int i = 0; i < readOnlySpan.Length; i++) 2972for (int i = 0; i < readOnlySpan.Length; i++) 3020for (int i = 0; i < readOnlySpan.Length; i++) 3067for (int i = 0; i < readOnlySpan.Length; i++) 3112for (int i = 0; i < readOnlySpan.Length; i++) 3204for (int i = 0; i < readOnlySpan.Length; i++) 3268for (int i = 0; i < readOnlySpan.Length; i++) 3332for (int i = 0; i < readOnlySpan.Length; i++) 3396for (int i = 0; i < readOnlySpan.Length; i++) 3459for (int i = 0; i < readOnlySpan.Length; i++) 3507for (int i = 0; i < readOnlySpan.Length; i++) 3554for (int i = 0; i < readOnlySpan.Length; i++) 3599for (int i = 0; i < readOnlySpan.Length; i++) 3691for (int i = 0; i < readOnlySpan.Length; i++) 3755for (int i = 0; i < readOnlySpan.Length; i++) 3819for (int i = 0; i < readOnlySpan.Length; i++) 3883for (int i = 0; i < readOnlySpan.Length; i++) 3946for (int i = 0; i < readOnlySpan.Length; i++) 3994for (int i = 0; i < readOnlySpan.Length; i++) 4041for (int i = 0; i < readOnlySpan.Length; i++) 4086for (int i = 0; i < readOnlySpan.Length; i++) 4178for (int i = 0; i < readOnlySpan.Length; i++) 4242for (int i = 0; i < readOnlySpan.Length; i++) 4306for (int i = 0; i < readOnlySpan.Length; i++) 4370for (int i = 0; i < readOnlySpan.Length; i++) 4433for (int i = 0; i < readOnlySpan.Length; i++) 4481for (int i = 0; i < readOnlySpan.Length; i++) 4528for (int i = 0; i < readOnlySpan.Length; i++) 4573for (int i = 0; i < readOnlySpan.Length; i++) 4665for (int i = 0; i < readOnlySpan.Length; i++) 4729for (int i = 0; i < readOnlySpan.Length; i++) 4793for (int i = 0; i < readOnlySpan.Length; i++) 4857for (int i = 0; i < readOnlySpan.Length; i++) 4920for (int i = 0; i < readOnlySpan.Length; i++) 4968for (int i = 0; i < readOnlySpan.Length; i++) 5015for (int i = 0; i < readOnlySpan.Length; i++) 5060for (int i = 0; i < readOnlySpan.Length; i++) 5152for (int i = 0; i < readOnlySpan.Length; i++) 5216for (int i = 0; i < readOnlySpan.Length; i++) 5280for (int i = 0; i < readOnlySpan.Length; i++) 5344for (int i = 0; i < readOnlySpan.Length; i++) 5407for (int i = 0; i < readOnlySpan.Length; i++) 5455for (int i = 0; i < readOnlySpan.Length; i++) 5502for (int i = 0; i < readOnlySpan.Length; i++) 5547for (int i = 0; i < readOnlySpan.Length; i++) 5639for (int i = 0; i < readOnlySpan.Length; i++) 5703for (int i = 0; i < readOnlySpan.Length; i++) 5767for (int i = 0; i < readOnlySpan.Length; i++) 5831for (int i = 0; i < readOnlySpan.Length; i++) 5894for (int i = 0; i < readOnlySpan.Length; i++) 5942for (int i = 0; i < readOnlySpan.Length; i++) 5989for (int i = 0; i < readOnlySpan.Length; i++) 6034for (int i = 0; i < readOnlySpan.Length; i++)
Utils\BitUtility.cs (1)
151Debug.Assert(span.Length >= endByteIndex);
Microsoft.Data.Analysis.Tests (4)
VBufferColumnTests.cs (4)
32Assert.Equal(5, vBufferColumn[0].GetValues().Length); 45Assert.Equal(5, vBufferColumn[0].GetValues().Length); 64Assert.Equal(5, values.Length); 66for (int i = 0; i < values.Length; i++)
Microsoft.Diagnostics.DataContractReader (1)
ContractDescriptorTarget.cs (1)
529if (sizeof(T) != bytes.Length)
Microsoft.Diagnostics.DataContractReader.Contracts (12)
Contracts\CallingConvention\CallingConvention_1.cs (2)
319BlobReader blobReader = new(pSig, methodSig.Length); 358BlobReader blobReader = new(pSig, methodSig.Length);
Contracts\Debugger\Debugger_1.cs (2)
292int regCount = Math.Min(args.Length, cc.IntegerArgRegisters.Length); 301for (int i = args.Length - 1; i >= regCount; i--)
Contracts\EcmaMetadata_1.cs (2)
221for (int i = 0; i < targetEcmaMetadata.Schema.RowCount.Length; i++) 230for (int i = 0; i < targetEcmaMetadata.Schema.IsSorted.Length; i++)
Contracts\RuntimeTypeSystem_1.cs (5)
796if (instantiation.Length < 1) 1264if (instantiation.Length != typeArguments.Length) 1273for (int i = 0; i < instantiation.Length; i++) 1297if (candidateRetAndArgs.Length != retAndArgTypes.Length) 1299for (int i = 0; i < candidateRetAndArgs.Length; i++)
PrintfStressMessageFormatter.cs (1)
140if (value.Length > paddingFormat.Width)
Microsoft.Diagnostics.DataContractReader.Legacy (75)
_generated\21\Microsoft.Diagnostics.DataContractReader.Legacy.IDacDbiInterface.cs (1)
4099global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference>.GetManagedValuesDestination(refs).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacGcReference>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements).Length));
_generated\32\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSHandleEnum.cs (1)
76global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData>.GetManagedValuesDestination(handles).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData>.GetUnmanagedValuesSource(__handles_native, __handles_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSHandleData>.GetUnmanagedValuesSource(__handles_native, __handles_native__numElements).Length));
_generated\33\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSStackRefErrorEnum.cs (1)
76global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError>.GetManagedValuesDestination(refs).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefError>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements).Length));
_generated\34\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSStackRefEnum.cs (1)
78global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData>.GetManagedValuesDestination(refs).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStackRefData>.GetUnmanagedValuesSource(__refs_native, __refs_native__numElements).Length));
_generated\35\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSMemoryEnum.cs (1)
76global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion>.GetManagedValuesDestination(memRegions).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion>.GetUnmanagedValuesSource(__memRegions_native, __memRegions_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMemoryRegion>.GetUnmanagedValuesSource(__memRegions_native, __memRegions_native__numElements).Length));
_generated\36\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface.cs (18)
305for (int __i0 = 0; __i0 < __values_native__managedSpan.Length; ++__i0, ++__values_native__lastIndexMarshalled) 324__values_native__numElements = __values_native__marshaller.GetManagedValuesSource().Length; 367for (int __i0 = 0; __i0 < __values_native__nativeSpan.Length; ++__i0) 544for (int __i0 = 0; __i0 < __values_native__managedSpan.Length; ++__i0, ++__values_native__lastIndexMarshalled) 564__values_native__numElements = __values_native__marshaller.GetManagedValuesSource().Length; 608for (int __i0 = 0; __i0 < __values_native__nativeSpan.Length; ++__i0) 901for (int __i0 = 0; __i0 < __modules_native__managedSpan.Length; ++__i0, ++__modules_native__lastIndexMarshalled) 921__modules_native__numElements = __modules_native__marshaller.GetManagedValuesSource().Length; 965for (int __i0 = 0; __i0 < __modules_native__nativeSpan.Length; ++__i0) 2297for (int __i0 = 0; __i0 < __heaps_native__managedSpan.Length; ++__i0, ++__heaps_native__lastIndexMarshalled) 2316__heaps_native__numElements = __heaps_native__marshaller.GetManagedValuesSource().Length; 2359for (int __i0 = 0; __i0 < __heaps_native__nativeSpan.Length; ++__i0) 3322global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo>.GetManagedValuesDestination(codeHeaps).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo>.GetUnmanagedValuesSource(__codeHeaps_native, __codeHeaps_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpJitCodeHeapInfo>.GetUnmanagedValuesSource(__codeHeaps_native, __codeHeaps_native__numElements).Length)); 3612global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetManagedValuesDestination(interfaces).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetUnmanagedValuesSource(__interfaces_native, __interfaces_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetUnmanagedValuesSource(__interfaces_native, __interfaces_native__numElements).Length)); 3707global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetManagedValuesDestination(interfaces).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetUnmanagedValuesSource(__interfaces_native, __interfaces_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpCOMInterfacePointerData>.GetUnmanagedValuesSource(__interfaces_native, __interfaces_native__numElements).Length)); 3963for (int __i0 = 0; __i0 < __values_native__managedSpan.Length; ++__i0, ++__values_native__lastIndexMarshalled) 3983__values_native__numElements = __values_native__marshaller.GetManagedValuesSource().Length; 4027for (int __i0 = 0; __i0 < __values_native__nativeSpan.Length; ++__i0)
_generated\39\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface4.cs (3)
57for (int __i0 = 0; __i0 < __arguments_native__managedSpan.Length; ++__i0, ++__arguments_native__lastIndexMarshalled) 76__arguments_native__numElements = __arguments_native__marshaller.GetManagedValuesSource().Length; 119for (int __i0 = 0; __i0 < __arguments_native__nativeSpan.Length; ++__i0)
_generated\40\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface5.cs (1)
78global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData>.GetManagedValuesDestination(nativeCodeAddrs).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData>.GetUnmanagedValuesSource(__nativeCodeAddrs_native, __nativeCodeAddrs_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData, global::Microsoft.Diagnostics.DataContractReader.Legacy.DacpTieredVersionData>.GetUnmanagedValuesSource(__nativeCodeAddrs_native, __nativeCodeAddrs_native__numElements).Length));
_generated\45\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface10.cs (3)
66for (int __i0 = 0; __i0 < __mowList_native__managedSpan.Length; ++__i0, ++__mowList_native__lastIndexMarshalled) 86__mowList_native__numElements = __mowList_native__marshaller.GetManagedValuesSource().Length; 130for (int __i0 = 0; __i0 < __mowList_native__nativeSpan.Length; ++__i0)
_generated\50\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSMethodEnum.cs (1)
76global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData>.GetManagedValuesDestination(values).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSMethodData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements).Length));
_generated\53\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSStressLogThreadEnum.cs (1)
76global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData>.GetManagedValuesDestination(values).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSThreadStressLogData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements).Length));
_generated\54\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSStressLogMsgEnum.cs (4)
78global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData>.GetManagedValuesDestination(values).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSStressMsgData>.GetUnmanagedValuesSource(__values_native, __values_native__numElements).Length)); 110for (int __i0 = 0; __i0 < __args_native__managedSpan.Length; ++__i0, ++__args_native__lastIndexMarshalled) 129__args_native__numElements = __args_native__marshaller.GetManagedValuesSource().Length; 172for (int __i0 = 0; __i0 < __args_native__nativeSpan.Length; ++__i0)
_generated\56\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface18.cs (3)
126global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange>.GetManagedValuesDestination(ranges).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange>.GetUnmanagedValuesSource(__ranges_native, __ranges_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSCodeRange>.GetUnmanagedValuesSource(__ranges_native, __ranges_native__numElements).Length)); 179global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetManagedValuesDestination(offsets).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__offsets_native, __offsets_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__offsets_native, __offsets_native__numElements).Length)); 232global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime>.GetManagedValuesDestination(lifetimes).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime>.GetUnmanagedValuesSource(__lifetimes_native, __lifetimes_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime, global::Microsoft.Diagnostics.DataContractReader.Legacy.SOSGCSlotLifetime>.GetUnmanagedValuesSource(__lifetimes_native, __lifetimes_native__numElements).Length));
_generated\59\Microsoft.Diagnostics.DataContractReader.Legacy.IXCLRDataProcess.cs (2)
1913global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetManagedValuesDestination(flags).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__flags_native, __flags_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__flags_native, __flags_native__numElements).Length)); 2049global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetManagedValuesDestination(flags).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__flags_native, __flags_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<uint, uint>.GetUnmanagedValuesSource(__flags_native, __flags_native__numElements).Length));
_generated\62\Microsoft.Diagnostics.DataContractReader.Legacy.IXCLRDataStackWalk.cs (1)
87global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(contextBuf).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__contextBuf_native, __contextBuf_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__contextBuf_native, __contextBuf_native__numElements).Length));
_generated\63\Microsoft.Diagnostics.DataContractReader.Legacy.IXCLRDataFrame.cs (1)
132global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(contextBuf).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__contextBuf_native, __contextBuf_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__contextBuf_native, __contextBuf_native__numElements).Length));
_generated\66\Microsoft.Diagnostics.DataContractReader.Legacy.IXCLRDataMethodInstance.cs (1)
629global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap, global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap>.GetManagedValuesDestination(maps).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap, global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap>.GetUnmanagedValuesSource(__maps_native, __maps_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap, global::Microsoft.Diagnostics.DataContractReader.Legacy.ClrDataILAddressMap>.GetUnmanagedValuesSource(__maps_native, __maps_native__numElements).Length));
ClrDataMethodDefinition.cs (2)
50return rts.GetInstantiation(mt).Length > 0; 59return rts.GetGenericMethodInstantiation(md).Length > 0;
Dbi\DacDbiImpl.cs (8)
1593for (int i = 0; i < cdac.Length && diffs < 16; i++) 2779if (rts.GetInstantiation(thApprox).Length == 0) 3441cClassParams = (uint)classInst.Length; 3449for (int i = 0; i < classInst.Length; i++) 3457for (int i = 0; i < methodInst.Length; i++) 3710for (int i = 0; i < instantiation.Length; i++) 6242if (instantiation.Length > 0) 6298if (instantiation.Length > 0)
MethodSignatureHelpers.cs (1)
21BlobReader blobReader = new BlobReader(pSig, signature.Length);
OutputBufferHelpers.cs (4)
20*neededBufferSize = checked((uint)(strSpan.Length + 1)); 26int nullTerminatorLocation = strSpan.Length > bufferSize - 1 ? checked((int)(bufferSize - 1)) : strSpan.Length; 27truncated = strSpan.Length + 1 > bufferSize;
SigFormat.cs (8)
27BlobReader blobReader = new BlobReader(pSignature, signature.Length); 213if (methodInstantiation.Length > mvarIndex) 225if (typeInstantiation.Length > varIndex) 365if (instantiation.Length > 0) 368for (int i = 0; i < instantiation.Length; i++) 424for (int i = 1; i < retAndArgTypes.Length; i++) 427if (i != retAndArgTypes.Length - 1) 432if (retAndArgTypes.Length > 1)
SOSDacImpl.IXCLRDataProcess.cs (2)
895return rts.GetInstantiation(mt).Length > 0; 903return rts.GetGenericMethodInstantiation(md).Length > 0;
TypeNameBuilder.cs (6)
134if (genericMethodInstantiation.Length > 0 && !runtimeTypeSystem.IsGenericMethodDefinition(method)) 150if (typeInstantiationSigFormat.Length == 0 && runtimeTypeSystem.IsArray(th, out _)) 252for (int i = 1; i < retAndArgTypes.Length; i++) 263if (retAndArgTypes.Length > 2) 305if ((instantiationSpan.Length > 0) && (!typeSystemContract.IsGenericTypeDefinition(typeHandle) || toString)) 307if (instantiation.Length == 0)
Microsoft.Diagnostics.NETCore.Client (1)
DiagnosticsIpc\ProcessInfo.cs (1)
117metadataIndex = versionSpan.Length;
Microsoft.DiaSymReader (135)
_generated\10\Microsoft.DiaSymReader.ISymUnmanagedAsyncMethod.cs (3)
323global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(breakpointMethod).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__breakpointMethod_native, __breakpointMethod_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__breakpointMethod_native, __breakpointMethod_native__numElements).Length)); 324global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(breakpointOffset).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__breakpointOffset_native, __breakpointOffset_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__breakpointOffset_native, __breakpointOffset_native__numElements).Length)); 325global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(yieldOffsets).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__yieldOffsets_native, __yieldOffsets_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__yieldOffsets_native, __yieldOffsets_native__numElements).Length));
_generated\15\Microsoft.DiaSymReader.ISymUnmanagedConstant.cs (2)
81global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length)); 193global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(signature).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__signature_native, __signature_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__signature_native, __signature_native__numElements).Length));
_generated\17\Microsoft.DiaSymReader.ISymUnmanagedDocument.cs (3)
95global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(url).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__url_native, __url_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__url_native, __url_native__numElements).Length)); 324global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(checksum).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__checksum_native, __checksum_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__checksum_native, __checksum_native__numElements).Length)); 510global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(source).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__source_native, __source_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__source_native, __source_native__numElements).Length));
_generated\18\Microsoft.DiaSymReader.ISymUnmanagedEncUpdate.cs (3)
170for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 192__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 246for (int __i0 = 0; __i0 < __variables_native__nativeSpan.Length; ++__i0)
_generated\19\Microsoft.DiaSymReader.ISymUnmanagedMethod.cs (17)
373global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(ranges).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__ranges_native, __ranges_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__ranges_native, __ranges_native__numElements).Length)); 407for (int __i0 = 0; __i0 < __parameters_native__managedSpan.Length; ++__i0, ++__parameters_native__lastIndexMarshalled) 429__parameters_native__numElements = __parameters_native__marshaller.GetManagedValuesSource().Length; 483for (int __i0 = 0; __i0 < __parameters_native__nativeSpan.Length; ++__i0) 600for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 624__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 690for (int __i0 = 0; __i0 < __documents_native__nativeSpan.Length; ++__i0) 701global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(columns).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__columns_native, __columns_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__columns_native, __columns_native__numElements).Length)); 702global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(lines).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__lines_native, __lines_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__lines_native, __lines_native__numElements).Length)); 748for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 775__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 856for (int __i0 = 0; __i0 < __documents_native__nativeSpan.Length; ++__i0) 869global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(endColumns).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__endColumns_native, __endColumns_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__endColumns_native, __endColumns_native__numElements).Length)); 870global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(endLines).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__endLines_native, __endLines_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__endLines_native, __endLines_native__numElements).Length)); 871global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(startColumns).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__startColumns_native, __startColumns_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__startColumns_native, __startColumns_native__numElements).Length)); 872global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(startLines).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__startLines_native, __startLines_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__startLines_native, __startLines_native__numElements).Length)); 887global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetManagedValuesDestination(offsets).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__offsets_native, __offsets_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.GetUnmanagedValuesSource(__offsets_native, __offsets_native__numElements).Length));
_generated\20\Microsoft.DiaSymReader.ISymUnmanagedMethod2.cs (6)
293for (int __i0 = 0; __i0 < __parameters_native__managedSpan.Length; ++__i0, ++__parameters_native__lastIndexMarshalled) 315__parameters_native__numElements = __parameters_native__marshaller.GetManagedValuesSource().Length; 410for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 434__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 492for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 519__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length;
_generated\21\Microsoft.DiaSymReader.ISymUnmanagedNamespace.cs (7)
81global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length)); 115for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 137__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 191for (int __i0 = 0; __i0 < __namespaces_native__nativeSpan.Length; ++__i0) 248for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 270__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 324for (int __i0 = 0; __i0 < __variables_native__nativeSpan.Length; ++__i0)
_generated\22\Microsoft.DiaSymReader.ISymUnmanagedReader.cs (17)
153for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 175__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 229for (int __i0 = 0; __i0 < __documents_native__nativeSpan.Length; ++__i0) 448for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 470__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 524for (int __i0 = 0; __i0 < __variables_native__nativeSpan.Length; ++__i0) 581for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 603__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 657for (int __i0 = 0; __i0 < __variables_native__nativeSpan.Length; ++__i0) 803global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(customDebugInformation).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements).Length)); 837for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 859__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 913for (int __i0 = 0; __i0 < __namespaces_native__nativeSpan.Length; ++__i0) 1162global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length)); 1197for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 1220__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length; 1276for (int __i0 = 0; __i0 < __methods_native__nativeSpan.Length; ++__i0)
_generated\23\Microsoft.DiaSymReader.ISymUnmanagedReader2.cs (14)
160global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(customDebugInformation).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements).Length)); 195for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 218__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length; 274for (int __i0 = 0; __i0 < __methods_native__nativeSpan.Length; ++__i0) 370for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 392__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 543for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 565__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 623for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 645__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 768for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 790__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 971for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 994__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length;
_generated\24\Microsoft.DiaSymReader.ISymUnmanagedReader3.cs (14)
102global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(customDebugInformation).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements).Length)); 158global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(customDebugInformation).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__customDebugInformation_native, __customDebugInformation_native__numElements).Length)); 230for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 252__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 403for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 425__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 483for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 505__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 628for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 650__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 831for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 854__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length; 1043for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 1066__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length;
_generated\25\Microsoft.DiaSymReader.ISymUnmanagedReader4.cs (12)
265for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 287__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 438for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 460__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 518for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 540__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 663for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 685__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 866for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 889__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length; 1078for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 1101__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length;
_generated\26\Microsoft.DiaSymReader.ISymUnmanagedReader5.cs (12)
170for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 192__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 343for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 365__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 423for (int __i0 = 0; __i0 < __variables_native__managedSpan.Length; ++__i0, ++__variables_native__lastIndexMarshalled) 445__variables_native__numElements = __variables_native__marshaller.GetManagedValuesSource().Length; 568for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 590__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 771for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 794__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length; 983for (int __i0 = 0; __i0 < __methods_native__managedSpan.Length; ++__i0, ++__methods_native__lastIndexMarshalled) 1006__methods_native__numElements = __methods_native__marshaller.GetManagedValuesSource().Length;
_generated\27\Microsoft.DiaSymReader.ISymUnmanagedCompilerInfoReader.cs (1)
93global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length));
_generated\28\Microsoft.DiaSymReader.ISymUnmanagedScope.cs (9)
190for (int __i0 = 0; __i0 < __children_native__managedSpan.Length; ++__i0, ++__children_native__lastIndexMarshalled) 212__children_native__numElements = __children_native__marshaller.GetManagedValuesSource().Length; 266for (int __i0 = 0; __i0 < __children_native__nativeSpan.Length; ++__i0) 455for (int __i0 = 0; __i0 < __locals_native__managedSpan.Length; ++__i0, ++__locals_native__lastIndexMarshalled) 477__locals_native__numElements = __locals_native__marshaller.GetManagedValuesSource().Length; 531for (int __i0 = 0; __i0 < __locals_native__nativeSpan.Length; ++__i0) 588for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 610__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length; 664for (int __i0 = 0; __i0 < __namespaces_native__nativeSpan.Length; ++__i0)
_generated\29\Microsoft.DiaSymReader.ISymUnmanagedScope2.cs (9)
112for (int __i0 = 0; __i0 < __constants_native__managedSpan.Length; ++__i0, ++__constants_native__lastIndexMarshalled) 134__constants_native__numElements = __constants_native__marshaller.GetManagedValuesSource().Length; 188for (int __i0 = 0; __i0 < __constants_native__nativeSpan.Length; ++__i0) 317for (int __i0 = 0; __i0 < __children_native__managedSpan.Length; ++__i0, ++__children_native__lastIndexMarshalled) 339__children_native__numElements = __children_native__marshaller.GetManagedValuesSource().Length; 460for (int __i0 = 0; __i0 < __locals_native__managedSpan.Length; ++__i0, ++__locals_native__lastIndexMarshalled) 482__locals_native__numElements = __locals_native__marshaller.GetManagedValuesSource().Length; 540for (int __i0 = 0; __i0 < __namespaces_native__managedSpan.Length; ++__i0, ++__namespaces_native__lastIndexMarshalled) 562__namespaces_native__numElements = __namespaces_native__marshaller.GetManagedValuesSource().Length;
_generated\31\Microsoft.DiaSymReader.ISymUnmanagedVariable.cs (2)
93global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length)); 190global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetManagedValuesDestination(signature).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__signature_native, __signature_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.GetUnmanagedValuesSource(__signature_native, __signature_native__numElements).Length));
_generated\9\Microsoft.DiaSymReader.ISymEncUnmanagedMethod.cs (4)
85global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetManagedValuesDestination(name).CopyTo(global::System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements)), global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.GetUnmanagedValuesSource(__name_native, __name_native__numElements).Length)); 227for (int __i0 = 0; __i0 < __documents_native__managedSpan.Length; ++__i0, ++__documents_native__lastIndexMarshalled) 249__documents_native__numElements = __documents_native__marshaller.GetManagedValuesSource().Length; 303for (int __i0 = 0; __i0 < __documents_native__nativeSpan.Length; ++__i0)
Microsoft.DotNet.HotReload.Watch (21)
_generated\0\RegexGenerator.g.cs (21)
126base.runtextpos != inputSpan.Length) 144if (pos <= inputSpan.Length - 18) 157base.runtextpos = inputSpan.Length; 195iteration = slice.Length; 239while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 270if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 331base.runtextpos != inputSpan.Length) 349if (pos <= inputSpan.Length - 26) 362base.runtextpos = inputSpan.Length; 400iteration = slice.Length; 444while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 475if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 534base.runtextpos != inputSpan.Length) 552if (pos <= inputSpan.Length - 14) 565base.runtextpos = inputSpan.Length; 584iteration = slice.Length; 671iteration1 = slice.Length - 1; 689iteration2 = slice.Length - 1; 714iteration3 = slice.Length - 3;
Microsoft.DotNet.NativeWrapper (1)
_generated\0\LibraryImports.g.cs (1)
214for (int __i0 = 0; __i0 < __argv_native__managedSpan.Length; ++__i0, ++__argv_native__lastIndexMarshalled)
Microsoft.DotNet.ProjectTools (2)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\FileLevelDirectiveHelpers.cs (2)
342if (Patterns.DisallowedNameCharacters.Match(context.DirectiveText, beginning: 0, length: firstPart.Length).Success) 356Debug.Assert(secondPart.Length == 0,
Microsoft.DotNet.StrongName (3)
Signing.cs (3)
263var w = new BlobWriter(3 * sizeof(uint) + Constants.OffsetToKeyData + pubKeyData.Length); 266w.WriteUInt32((uint)(Constants.OffsetToKeyData + pubKeyData.Length)); 283w.WriteBytes(bytes, pubKeyData.Length);
Microsoft.DotNet.TemplateLocator (2)
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.SystemTextJson.cs (2)
59span = span.Slice(utf8Bom.Length, span.Length - utf8Bom.Length);
Microsoft.Extensions.AI (7)
ChatCompletion\DistributedCachingChatClient.cs (2)
140int length = FixedValuesCount + additionalValues.Length + clientValues.Length; 149clientValues.CopyTo(arr, FixedValuesCount + additionalValues.Length);
ChatCompletion\FunctionInvokingChatClient.cs (2)
1325var contents = new List<AIContent>(results.Length); 1326for (int i = 0; i < results.Length; i++)
Embeddings\DistributedCachingEmbeddingGenerator.cs (2)
116int length = FixedValuesCount + clientValues.Length + values.Length; 123clientValues.CopyTo(arr, FixedValuesCount + values.Length);
ToolReduction\EmbeddingToolReductionStrategy.cs (1)
227var result = new List<AITool>(capacity: toolInfo.Length);
Microsoft.Extensions.AI.Abstractions (3)
Embeddings\BinaryEmbedding.cs (3)
64int length = reader.HasValueSequence ? checked((int)reader.ValueSequence.Length) : reader.ValueSpan.Length; 69BitArray result = new(utf8.Length); 71for (int i = 0; i < utf8.Length; i++)
Microsoft.Extensions.AI.Evaluation.NLP (6)
Common\NGramExtensions.cs (6)
35ReadOnlySpan<T> next = input.Slice(0, Math.Min(n, input.Length)); 37while (next.Length == n) 42next = input.Slice(0, Math.Min(n, input.Length)); 65maxN = input.Length; // Update to use Length instead of Count() 74for (int i = 0; i <= input.Length - minN; i++) 76for (int s = minN; s <= maxN && s <= input.Length - i; s++)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Utilities\JsonOutputFixer.cs (1)
27if (trimmed.Length > markerLength && trimmed.Slice(0, markerLength).SequenceEqual(JsonMarker.AsSpan()))
Microsoft.Extensions.AI.Integration.Tests (3)
QuantizationEmbeddingGenerator.cs (3)
50var result = new BitArray(vector.Length); 51for (int i = 0; i < vector.Length; i++) 82var result = new Half[vector.Length];
Microsoft.Extensions.Caching.Hybrid (3)
Internal\HybridCachePayload.cs (3)
188if (bytes.Length < 19) // minimum needed for empty payload and zero tags 293if (bytes.Length != payloadLength + 2 336|| buffer.Length < (length = (int)u64Length)) // note buffer is now past the prefix via "ref"
Microsoft.Extensions.Compliance.Abstractions (4)
Redaction\NullRedactor.cs (3)
20public override int GetRedactedLength(ReadOnlySpan<char> input) => input.Length; 28Throw.IfBufferTooSmall(destination.Length, source.Length, nameof(destination)); 31return source.Length;
Redaction\Redactor.cs (1)
251var fmt = format.Length > 0 ? format.ToString() : string.Empty;
Microsoft.Extensions.Compliance.Abstractions.Tests (2)
Redaction\RedactorTest.cs (2)
331public override int GetRedactedLength(ReadOnlySpan<char> input) => input.Length; 336return source.Length;
Microsoft.Extensions.Compliance.Redaction.Tests (2)
FakePlaintextRedactor.cs (2)
10public override int GetRedactedLength(ReadOnlySpan<char> input) => input.Length; 15return source.Length;
Microsoft.Extensions.Configuration.Binder.SourceGeneration (12)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
src\runtime\src\libraries\Common\src\SourceGenerators\SourceWriter.cs (2)
93lineLength = remainingText.Length; 118builder.Append(ptr, span.Length);
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
Microsoft.Extensions.Configuration.EnvironmentVariables (3)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
Microsoft.Extensions.DataIngestion (7)
Chunkers\DocumentTokenChunker.cs (1)
115_ = stringBuilder.Append(ptr, overlapContent.Length);
Chunkers\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
Processors\ClassificationEnricher.cs (1)
57if (predefinedClasses.Length == 0)
Processors\KeywordEnricher.cs (2)
65if (predefinedKeywords.Length == 0) 84if (predefinedKeywords.Length > 0)
Microsoft.Extensions.DependencyModel (6)
DependencyContextJsonReader.cs (6)
66long expectedLength = Math.Max(utf8Bom.Length, stream.Length - stream.Position) + 1; 81Debug.Assert(rented.Length >= utf8Bom.Length); 86utf8Bom.Length - written); 89} while (lastRead > 0 && written < utf8Bom.Length); 92if (written == utf8Bom.Length && 93utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length)))
Microsoft.Extensions.Diagnostics.ResourceMonitoring (26)
Linux\LinuxUtilizationParserCgroupV1.cs (12)
136stat = stat.Slice(StartingTokens.Length, stat.Length - StartingTokens.Length); 223ReadOnlySpan<char> inactiveMemorySlice = memoryFile.Slice(index + TotalInactiveFile.Length, memoryFile.Length - index - TotalInactiveFile.Length); 271ReadOnlySpan<char> totalMemory = firstLine.Slice(MemTotal.Length, firstLine.Length - MemTotal.Length); 280if (next == -1 || totalMemory.Length - next < 2) 285ReadOnlySpan<char> unit = totalMemory.Slice(totalMemory.Length - 2, 2); 384while (numberStart < buffer.Length && char.IsWhiteSpace(buffer[numberStart])) 389if (numberStart == buffer.Length || !char.IsDigit(buffer[numberStart])) 398while (numberEnd < buffer.Length && char.IsDigit(buffer[numberEnd])) 406return numberEnd < buffer.Length ? numberEnd : -1; 416if (quotaBuffer.IsEmpty || (quotaBuffer.Length == 2 && quotaBuffer[0] == '-' && quotaBuffer[1] == '1')) 434if (periodBuffer.IsEmpty || (periodBuffer.Length == 2 && periodBuffer[0] == '-' && periodBuffer[1] == '1')) 472if (cpuPodWeightBuffer.IsEmpty || (cpuPodWeightBuffer.Length == 2 && cpuPodWeightBuffer[0] == '-' && cpuPodWeightBuffer[1] == '1'))
Linux\LinuxUtilizationParserCgroupV2.cs (14)
129if (colonIndex == -1 || colonIndex + 1 >= fileContent.Length) 182stat = stat.Slice(StartingTokens.Length, stat.Length - StartingTokens.Length); 374ReadOnlySpan<char> inactiveMemorySlice = memoryFile.Slice(index + InactiveFile.Length, memoryFile.Length - index - InactiveFile.Length); 418ReadOnlySpan<char> totalMemory = firstLine.Slice(MemTotal.Length, firstLine.Length - MemTotal.Length); 427if (next == -1 || totalMemory.Length - next < 2) 432ReadOnlySpan<char> unit = totalMemory.Slice(totalMemory.Length - 2, 2); 614while (numberStart < buffer.Length && char.IsWhiteSpace(buffer[numberStart])) 619if (numberStart == buffer.Length || !char.IsDigit(buffer[numberStart])) 628while (numberEnd < buffer.Length && char.IsDigit(buffer[numberEnd])) 636return numberEnd < buffer.Length ? numberEnd : -1; 674if (quotaBuffer.IsEmpty || (quotaBuffer.Length == 2 && quotaBuffer[0] == '-' && quotaBuffer[1] == '1')) 695ReadOnlySpan<char> cpuPeriodSlice = quotaBuffer.Slice(index + quotaString.Length, quotaBuffer.Length - index - quotaString.Length); 736else if (content.Length >= 2 && content[0] == '-' && content[1] == '1') 807if (cpuPodWeightBuffer.IsEmpty || (cpuPodWeightBuffer.Length == 2 && cpuPodWeightBuffer[0] == '-' && cpuPodWeightBuffer[1] == '1'))
Microsoft.Extensions.Http.Diagnostics (12)
Http\HttpDependencyMetadataResolver.cs (8)
113if (routeSpan.Length > 1 && routeSpan[routeSpan.Length - 1] == '/') 115routeSpan = routeSpan.Slice(0, routeSpan.Length - 1); 126else if (routeSpan.Length != route.Length) 367if (requestRouteAsSpan.Length > 1) 369if (requestRouteAsSpan[requestRouteAsSpan.Length - 1] == '/') 371requestRouteAsSpan = requestRouteAsSpan.Slice(0, requestRouteAsSpan.Length - 1); 382var requestPathEndIndex = requestRouteAsSpan.Length;
Latency\Internal\HttpClientLatencyLogEnricher.cs (3)
105var checkpointCount = latencyData.Checkpoints.Length; 126var measureCount = latencyData.Measures.Length; 146var tagCount = latencyData.Tags.Length;
Logging\Internal\HttpRequestReader.cs (1)
163int length = querySpan.Length;
Microsoft.Extensions.Identity.Core (2)
Base32.cs (2)
78if (trimmedInput.Length == 0) 83var output = new byte[trimmedInput.Length * 5 / 8];
Microsoft.Extensions.Logging.Abstractions (3)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
Microsoft.Extensions.Logging.Console (7)
AnsiParser.cs (3)
56for (int i = 0; i < span.Length; i++) 58if (span[i] == EscapeChar && span.Length >= i + 4 && span[i + 1] == '[') 78else if (span.Length >= i + 5 && span[i + 4] == 'm')
JsonConsoleFormatter.cs (1)
105var logMessageBuffer = ArrayPool<char>.Shared.Rent(Encoding.UTF8.GetMaxCharCount(messageBytes.Length));
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
Microsoft.Extensions.Logging.Generators (11)
LoggerMessageGenerator.Emitter.cs (1)
727=> variableOrTemplateName.Length > 0 && variableOrTemplateName[0] == '@';
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
Microsoft.Extensions.Options.SourceGeneration (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
Microsoft.Extensions.Primitives (2)
StringSegment.cs (2)
590for (i = 0; i < span.Length; i++) 610for (i = span.Length - 1; i >= 0; i--)
Microsoft.Extensions.ServiceDiscovery.Dns (3)
Resolver\DnsDataWriter.cs (2)
112if (_buffer.Length - _position < value.Length) 118_position += value.Length;
Resolver\DnsPrimitives.cs (1)
19if (buffer.Length < DnsMessageHeader.HeaderLength)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (5)
Fuzzers\DnsResponseFuzzer.cs (1)
38_length = data.Length;
Fuzzers\EncodedDomainNameFuzzer.cs (3)
10byte[] buffer = ArrayPool<byte>.Shared.Rent(data.Length); 16for (int i = 0; i < data.Length; i++) 18if (!DnsPrimitives.TryReadQName(buffer.AsMemory(0, data.Length), i, out EncodedDomainName name, out _))
Fuzzers\WriteDomainNameRoundTripFuzzer.cs (1)
16byte[] buffer = ArrayPool<byte>.Shared.Rent(data.Length * 2);
Microsoft.Extensions.Telemetry (19)
Http\HttpRouteFormatter.cs (2)
74if (startIndex >= httpPathAsSpan.Length) 92length = httpPathAsSpan.Slice(startIndex).Length;
Http\HttpRouteParser.cs (2)
67if (startIndex < httpPathAsSpan.Length) 76length = httpPathAsSpan.Slice(startIndex).Length;
Latency\Internal\LatencyConsoleExporter.cs (12)
54latencyData.Checkpoints.Length, 55latencyData.Tags.Length, 56latencyData.Measures.Length); 59if (_outputCheckpoints && latencyData.Checkpoints.Length > 0) 62for (int i = 0; i < latencyData.Checkpoints.Length; i++) 68for (int i = 0; i < latencyData.Checkpoints.Length; i++) 75if (_outputTags && latencyData.Tags.Length > 0) 78for (int i = 0; i < latencyData.Tags.Length; i++) 84for (int i = 0; i < latencyData.Tags.Length; i++) 91if (_outputMeasures && latencyData.Measures.Length > 0) 94for (int i = 0; i < latencyData.Measures.Length; i++) 100for (int i = 0; i < latencyData.Measures.Length; i++)
Logging\JustInTimeRedactor.cs (3)
114inputAsSpan = f.ToString(format.Length > 0 ? format.ToString() : string.Empty, formatProvider).AsSpan(); 128int maxLenToRedact = inputAsSpan.Length + DiscriminatorSeparator.Length + _discriminator.Length + MaxDayOfYearLength; 136charsInWorkBuffer = inputAsSpan.Length;
Microsoft.Extensions.Telemetry.Abstractions.Tests (12)
Latency\LatencyDataTests.cs (9)
15Assert.True(ld.Checkpoints.Length == 0); 16Assert.True(ld.Measures.Length == 0); 17Assert.True(ld.Tags.Length == 0); 31Assert.True(ld.Checkpoints.Length == num); 32Assert.True(ld.Measures.Length == num); 33Assert.True(ld.Tags.Length == num); 50Assert.True(ld.Checkpoints.Length == numCheckpoints); 51Assert.True(ld.Measures.Length == numMeasures); 52Assert.True(ld.Tags.Length == numTags);
Latency\NoopLatencyContextTests.cs (3)
73Assert.True(latencyData.Checkpoints.Length == 0); 74Assert.True(latencyData.Measures.Length == 0); 75Assert.True(latencyData.Tags.Length == 0);
Microsoft.Extensions.Telemetry.Tests (7)
Latency\Internal\LatencyContextProviderTests.cs (6)
60Assert.True(lc.LatencyData.Checkpoints.Length == 1); 61Assert.True(lc.LatencyData.Measures.Length == 1); 62Assert.True(lc.LatencyData.Tags.Length == 1); 91Assert.True(lc.LatencyData.Checkpoints.Length == 1); 92Assert.True(lc.LatencyData.Measures.Length == 1); 93Assert.True(lc.LatencyData.Tags.Length == 1);
Latency\Internal\TagCollectionTests.cs (1)
104for (int i = 0; i < tags.Length; i++)
Microsoft.Interop.ComInterfaceGenerator (4)
ComInterfaceGeneratorHelpers.cs (2)
42var literals = new CollectionElementSyntax[bytes.Length]; 44for (int i = 0; i < bytes.Length; i++)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
Microsoft.Interop.LibraryImportGenerator (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
Microsoft.Interop.SourceGeneration (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
Microsoft.JSInterop (2)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (2)
89var requiredCapacity = _itemsInUse + source.Length; 103_itemsInUse += source.Length;
Microsoft.Maui (1)
Debugger\DebuggerDisplayHelpers.cs (1)
37 var size = values.Length;
Microsoft.Maui.Essentials (2)
Types\Shared\WebUtils.shared.cs (2)
61 var chars = new char[span.Length]; 63 for (int i = 0; i < span.Length; i++)
Microsoft.Maui.Graphics (14)
Color.cs (14)
353 if (colorAsHex.Length == 6 || colorAsHex.Length == 3) 359 else if (colorAsHex.Length == 4) 375 else if (colorAsHex.Length == 8) 403 if (colorAsHex.Length == 6) 410 else if (colorAsHex.Length == 3) 423 else if (colorAsHex.Length == 4) 439 else if (colorAsHex.Length == 8) 758 Span<char> loweredValue = value.Length <= 128 ? stackalloc char[value.Length] : new char[value.Length]; 761 Debug.Assert(charsWritten == value.Length); 1000 if (!elem.IsEmpty && elem[elem.Length - 1] == '%' && acceptPercent) 1003 elem = elem.Slice(0, elem.Length - 1);
Microsoft.ML.Core (183)
Data\AnnotationUtils.cs (1)
400for (int i = 0; i < catIndicesValues.Length; i += 2)
Data\ReadOnlyMemoryUtils.cs (3)
221for (j = min; j < span.Length; j++) 231Contracts.Assert(j == span.Length); 252sb.Append(valueChars, span.Length);
Utilities\ArrayUtils.cs (1)
51Debug.Assert(0 <= min && min <= lim && lim <= input.Length);
Utilities\BigArray.cs (6)
329LongLimToMajorMaxMinorLim(_length + src.Length, out maMax, out miLim); 337Contracts.Assert(miLim - miMin == src.Length); 343Contracts.Assert((BlockSize - miMin) + miLim == src.Length); 366Contracts.Assert(srcSoFar < src.Length); 369Contracts.Assert(src.Length - srcSoFar == miLim); 375_length += src.Length;
Utilities\DoubleParser.cs (30)
113if (ich >= span.Length) 127if (span.Length - ich == 1) 143if (!DoubleParser.TryParse(span.Slice(ich, span.Length - ich), out value, out ichEnd, flags)) 150while (ichEnd < span.Length) 165if (ich >= span.Length) 179if (span.Length - ich == 1) 195if (!DoubleParser.TryParse(span.Slice(ich, span.Length - ich), out value, out ichEnd, flags)) 202while (ichEnd < span.Length) 494if (ich < span.Length) 505if (ich + 3 <= span.Length && span[ich + 1] == 'a' && span[ich + 2] == 'N') 514if (ich + 8 <= span.Length && span[ich + 1] == 'n' && span[ich + 2] == 'f' && span[ich + 3] == 'i' && span[ich + 4] == 'n' && span[ich + 5] == 'i' && span[ich + 6] == 't' && span[ich + 7] == 'y') 523if (ich + 2 <= span.Length && span[ich + 1] == InfinitySymbol) 530if (ich + 9 <= span.Length && span[ich + 1] == 'I' && span[ich + 2] == 'n' && span[ich + 3] == 'f' && span[ich + 4] == 'i' && span[ich + 5] == 'n' && span[ich + 6] == 'i' && span[ich + 7] == 't' && span[ich + 8] == 'y') 551Contracts.Assert(0 <= ich && ich <= span.Length); 562if (ich >= span.Length) 579if (++i >= span.Length) 585if (++i >= span.Length) 616Contracts.Assert(i < span.Length); 626if (++i >= span.Length) 632Contracts.Assert(i < span.Length); 638Contracts.Assert(i < span.Length); 644if (++i >= span.Length) 651Contracts.Assert(i < span.Length); 664Contracts.Assert(i < span.Length); 679if (++i >= span.Length) 686Contracts.Assert(i < span.Length); 690if (++i >= span.Length) 695if (++i >= span.Length) 711Contracts.Assert(i < span.Length); 718if (++i >= span.Length)
Utilities\FloatUtils.cs (2)
447for (int i = 0; i < values.Length; i++) 460for (int i = 0; i < values.Length; i++)
Utilities\Hashing.cs (2)
126for (int ich = 0; ich < span.Length; ich++) 192for (int ich = 0; ich < span.Length; ich++)
Utilities\LineParser.cs (3)
27for (int i = 0; i <= valuesToParse.Length; i++) 29if (i == valuesToParse.Length || valuesToParse[i] == ' ' || valuesToParse[i] == '\t') 61for (int i = 0; i < valuesToParse.Length; i++)
Utilities\MathUtils.cs (7)
150for (int i = a.Length - 1; i >= 0; i--) 179for (int i = a.Length - 1; i >= 0; i--) 207for (int i = 0; i < inputs.Length; i++) 219if (inputs.Length == 1) 225for (int i = 0; i < inputs.Length; i++) 739Contracts.Assert(aIdx >= 0 && aIdx <= a.Length - len); 740Contracts.Assert(bIdx >= 0 && bIdx <= b.Length - len);
Utilities\Stream.cs (19)
70writer.Write(values.Length); 71for (int i = 0; i < values.Length; i++) 82for (int i = 0; i < values.Length; i++) 93writer.Write(values.Length); 94for (int i = 0; i < values.Length; i++) 105for (int i = 0; i < values.Length; i++) 136writer.Write(values.Length); 138for (int i = 0; i < values.Length; i++) 174writer.Write(values.Length); 175for (int i = 0; i < values.Length; i++) 205for (int i = 0; i < values.Length; i++) 216writer.Write(values.Length); 217for (int i = 0; i < values.Length; i++) 228for (int i = 0; i < values.Length; i++) 239writer.Write(values.Length); 240for (int i = 0; i < values.Length; i++) 251for (int i = 0; i < values.Length; i++) 262writer.Write(values.Length); 263for (int i = 0; i < values.Length; i++)
Utilities\Utils.cs (5)
678if (values.Length < 1) 684for (int i = 1; i < values.Length; i++) 700Contracts.Check(values.Length >= len); 1272for (int i = 0; i < source.Length; i++) 1284for (int i = 0; i < source.Length; i++)
Utilities\VBufferUtils.cs (104)
26for (int i = 0; i < values.Length; i++) 37for (int i = 0; i < values.Length; i++) 48for (int i = 0; i < values.Length; i++) 59for (int i = 0; i < values.Length; i++) 92for (int i = 0; i < aValues.Length; i++) 98for (int i = 0; i < aValues.Length; i++) 128for (int i = 0; i < aValues.Length; i++) 134for (int i = 0; i < bValues.Length; i++) 144while (aI < aValues.Length && bI < bValues.Length) 182T aVal = (aI < aValues.Length && i == aIndices[aI]) ? aValues[aI++] : default(T); 192T bVal = (bI < bValues.Length && i == bIndices[bI]) ? bValues[bI++] : default(T); 203while (aI < aValues.Length && bI < bValues.Length) 224while (aI < aValues.Length) 230while (bI < bValues.Length) 368for (int i = values.Length; --i >= 0;) 373if (values.Length == 0) 378for (int ii = 0; ii < values.Length; ++ii) 389for (int i = 0; i < values.Length; ++i) 404if (dst.IsDense || denseCount == 0 || (dstValues.Length >= denseCount && dstIndices[denseCount - 1] == denseCount - 1)) 422int lim = Utils.FindIndexSorted(dstIndices, 0, dstValues.Length, denseCount); 424int newLen = dstValues.Length + denseCount - lim; 432int sliceLength = dstValues.Length - lim; 624if (srcValues.Length == 0) 636for (int i = 0; i < dstValues.Length; i++) 652for (int i = 0; i < srcValues.Length; i++) 670sIndex = ++sI == srcValues.Length ? src.Length : srcIndices[sI]; 678for (int i = 0; i < srcValues.Length; i++) 684if (dstValues.Length == 0) 690srcValues.Length, 693for (int i = 0; i < srcValues.Length; i++) 701int newCount = dstValues.Length; 703for (int sI = 0; sI < srcValues.Length; sI++) 706while (dI < dstValues.Length && dstIndices[dI] < sIndex) 708if (dI == dstValues.Length) 710newCount += srcValues.Length - sI; 719Contracts.Assert(0 < srcValues.Length && srcValues.Length <= newCount); 720Contracts.Assert(0 < dstValues.Length && dstValues.Length <= newCount); 739if (newCount != srcValues.Length && newCount != dstValues.Length) 752int sI = srcValues.Length - 1; 753dI = dstValues.Length - 1; 792if (newCount == dstValues.Length) 794if (newCount == srcValues.Length) 797Contracts.Assert(srcValues.Length == dstValues.Length); 798for (int i = 0; i < srcValues.Length; i++) 806Contracts.Assert(newCount > srcValues.Length); 812for (int i = 0; i < dstValues.Length; ++i) 817sIndex = ++sI == srcValues.Length ? src.Length : srcIndices[sI]; 825for (int sI = 0; sI < srcValues.Length; sI++) 837if (newCount == srcValues.Length) 843editor = VBufferEditor.Create(ref dst, newCount, dstValues.Length); 845for (dI = 0; dI < dstValues.Length; ++dI) 861for (sI = 0; sI < srcValues.Length; sI++) 886if (dstValues.Length == 0) 888if (srcValues.Length == 0) 894Contracts.Assert(srcValues.Length == src.Length); 903int count = srcValues.Length; 920if (srcValues.Length == 0) 938Contracts.Assert(srcValues.Length == src.Length); 946int count = srcValues.Length; 986int dstCount = dstValues.Length; 989if (srcValues.Length == 0) 1032Contracts.Assert(srcValues.Length > 0); 1037for (int ii = 0, jj = 0; ii < srcValues.Length; ii++) 1040while (jj < dstValues.Length && dstIndices[jj] < i) 1042if (jj == dstValues.Length) 1044resCount += srcValues.Length - ii; 1054Contracts.Assert(resCount <= srcValues.Length + dstCount); 1055Contracts.Assert(srcValues.Length <= resCount); 1083i = ++ii == srcValues.Length ? length : srcIndices[ii]; 1091i = ++ii == srcValues.Length ? length : srcIndices[ii]; 1107Contracts.Assert(ii == srcValues.Length && jj == dstCount); 1133if (srcValues.Length == 0) 1140srcValues.Length, 1153for (int i = 0; i < srcValues.Length; ++i) 1185if (aValues.Length == 0 && bValues.Length == 0) 1207TSrc1 aVal = (aI < aIndices.Length && i == aIndices[aI]) ? aValues[aI++] : default(TSrc1); 1217TSrc2 bVal = (bI < bIndices.Length && i == bIndices[bI]) ? bValues[bI++] : default(TSrc2); 1235while (aI < aIndices.Length && bI < bIndices.Length) 1245if (aI < aIndices.Length) 1246newCount += aIndices.Length - aI; 1247if (bI < bIndices.Length) 1248newCount += bIndices.Length - bI; 1256if (newCount == bValues.Length) 1258if (newCount == aValues.Length) 1262for (aI = 0; aI < aValues.Length; aI++) 1273for (bI = 0; aI < aValues.Length && bI < bValues.Length; bI++) 1279for (; bI < bValues.Length; bI++) 1283else if (newCount == aValues.Length) 1288for (aI = 0; bI < bValues.Length && aI < aValues.Length; aI++) 1294for (; aI < aValues.Length; aI++) 1303while (aI < aIndices.Length && bI < bIndices.Length) 1331for (; aI < aIndices.Length; aI++) 1338for (; bI < bIndices.Length; bI++)
Microsoft.ML.Core.Tests (39)
UnitTests\TestEntryPoints.cs (5)
4505Assert.Equal(5, treeValues.GetValues().Length); 4507Assert.Equal(5, leafIndicators.GetValues().Length); 4551Assert.Equal(150, feat.GetValues().Length); 5411for (int i = 0; i < slotNameValues.Length; i++) 6113for (int i = 0; i < avgValues.Length; i++)
UnitTests\TestVBuffer.cs (34)
38Assert.Equal(4, buffer.GetValues().Length); 101float infNorm = a.GetValues().Length == 0 ? 0 : a.Items().Max(iv => Math.Abs(iv.Value)); 471List<int> indices = new List<int>(a.GetIndices().Length); 472TDst[] values = new TDst[a.GetValues().Length]; 546if (a.GetValues().Length == 0 || c == 0) 554var editor = VBufferEditor.Create(ref aa, b.Length, aa.GetValues().Length, requireIndicesOnDense: true); 908while (index < a.GetValues().Length) 928Assert.True(expectedIndices.Count <= a.GetValues().Length); 1014var editor = VBufferEditor.Create(ref dst, src.Length, src.GetValues().Length); 1030Assert.Equal(expected.GetValues().Length, actual.GetValues().Length); 1034for (int i = 0; i < expected.GetIndices().Length; ++i) 1037for (int i = 0; i < expected.GetValues().Length; ++i) 1118GenerateVBuffer(rgen, len, a.GetValues().Length, out b); 1120for (int i = 0; i < a.GetIndices().Length; ++i) 1127GenerateVBuffer(rgen, a.GetValues().Length, rgen.Next(a.GetValues().Length), out b); 1128bEditor = VBufferEditor.Create(ref b, len, b.GetValues().Length); 1141int boundary = rgen.Next(a.GetValues().Length + 1); 1142GenerateVBuffer(rgen, len, a.GetValues().Length - boundary, out b); 1143if (a.GetValues().Length != 0 && b.GetValues().Length != 0 && a.GetValues().Length != b.GetValues().Length) 1189int j = actual.GetValues().Length == 0 ? length : actual.GetIndices()[jj]; 1195j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj]; 1205int i = expected.GetValues().Length == 0 ? length : expected.GetIndices()[ii]; 1211i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii]; 1222int i = expected.GetValues().Length == 0 ? length : expected.GetIndices()[ii]; 1223int j = actual.GetValues().Length == 0 ? length : actual.GetIndices()[jj]; 1231i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii]; 1232j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj]; 1237i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii]; 1243j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj];
Microsoft.ML.CpuMath (85)
AlignedArray.cs (5)
128Contracts.Assert(src.Length <= _size); 134Contracts.Assert(0 <= start && start <= _size - src.Length); 144Contracts.Assert(rgposSrc.Length <= valuesSrc.Length); 145Contracts.Assert(0 <= iposMin && iposMin <= iposLim && iposLim <= rgposSrc.Length);
AvxIntrinsics.cs (25)
570Contracts.Assert(count <= src.Length); 665Contracts.Assert(count <= src.Length); 719Contracts.Assert(count <= src.Length); 720Contracts.Assert(count <= dst.Length); 776Contracts.Assert(count <= src.Length); 778Contracts.Assert(count <= idx.Length); 827Contracts.Assert(count <= src.Length); 876Contracts.Assert(count <= src.Length); 878Contracts.Assert(count <= idx.Length); 924Contracts.Assert(count <= src1.Length); 925Contracts.Assert(count <= src2.Length); 981int length = src.Length; 1066float* pSrcEnd = psrc + src.Length; 1110float* pSrcEnd = psrc + src.Length; 1158float* pSrcEnd = psrc + src.Length; 1202float* pSrcEnd = psrc + src.Length; 1251float* pSrcEnd = psrc + src.Length; 1295float* pSrcEnd = psrc + src.Length; 1342Contracts.Assert(count <= src.Length); 1343Contracts.Assert(count <= dst.Length); 1396Contracts.Assert(count <= src.Length); 1397Contracts.Assert(count <= dst.Length); 1398Contracts.Assert(count <= idx.Length); 1453Contracts.Assert(count <= src.Length); 1454Contracts.Assert(count <= dst.Length);
CpuMathUtils.cs (9)
53Contracts.Assert(count <= source.Length); 72Contracts.Assert(count <= source.Length); 93Contracts.Assert(count <= source.Length); 94Contracts.Assert(count <= destination.Length); 112Contracts.Assert(count <= source.Length); 132Contracts.Assert(count <= left.Length); 133Contracts.Assert(count <= right.Length); 191Contracts.Assert(left.Length >= count); 192Contracts.Assert(right.Length >= count);
CpuMathUtils.netcoreapp.cs (21)
119Contracts.Assert(iposLimit <= rgposSrc.Length); 203Contracts.Assert(count <= source.Length); 204Contracts.Assert(count <= indices.Length); 239Contracts.Assert(count <= source.Length); 240Contracts.Assert(count <= indices.Length); 272if (source.Length < MinInputSize || !Sse.IsSupported) 275for (int i = 0; i < source.Length; i++) 302if (source.Length < MinInputSize || !Sse.IsSupported) 305for (int i = 0; i < source.Length; i++) 331if (source.Length < MinInputSize || !Sse.IsSupported) 334for (int i = 0; i < source.Length; i++) 365if (source.Length < MinInputSize || !Sse.IsSupported) 368for (int i = 0; i < source.Length; i++) 403Contracts.Assert(count < left.Length); 404Contracts.Assert(count <= right.Length); 405Contracts.Assert(count <= indices.Length); 440Contracts.Assert(count <= left.Length); 441Contracts.Assert(count <= right.Length); 535Contracts.Assert(count <= source.Length); 576Contracts.Assert(count <= source.Length); 577Contracts.Assert(count <= indices.Length);
SseIntrinsics.cs (25)
489Contracts.Assert(count <= src.Length); 559Contracts.Assert(count <= src.Length); 600Contracts.Assert(count <= src.Length); 601Contracts.Assert(count <= dst.Length); 644Contracts.Assert(count <= src.Length); 646Contracts.Assert(count <= idx.Length); 683Contracts.Assert(count <= src.Length); 720Contracts.Assert(count <= src.Length); 722Contracts.Assert(count <= idx.Length); 756Contracts.Assert(count <= src1.Length); 757Contracts.Assert(count <= src2.Length); 801int length = src.Length; 883float* pSrcEnd = psrc + src.Length; 914float* pSrcEnd = psrc + src.Length; 948float* pSrcEnd = psrc + src.Length; 979float* pSrcEnd = psrc + src.Length; 1013float* pSrcEnd = psrc + src.Length; 1044float* pSrcEnd = psrc + src.Length; 1076Contracts.Assert(count <= src.Length); 1077Contracts.Assert(count <= dst.Length); 1117Contracts.Assert(count <= src.Length); 1118Contracts.Assert(count <= dst.Length); 1119Contracts.Assert(count <= idx.Length); 1161Contracts.Assert(count <= src.Length); 1162Contracts.Assert(count <= dst.Length);
Microsoft.ML.Data (229)
Commands\ShowSchemaCommand.cs (1)
280itw.Write(": Length={0}, Count={0}", value.Length, value.GetValues().Length);
Data\BufferBuilder.cs (1)
398int count = values.Length;
Data\Conversion.cs (10)
771private bool HasNA(in VBuffer<R4> src) { var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (R4.IsNaN(srcValues[i])) return true; } return false; } 772private bool HasNA(in VBuffer<R8> src) { var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (R8.IsNaN(srcValues[i])) return true; } return false; } 795private bool HasZero(in VBuffer<U1> src) { if (!src.IsDense) return true; var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (srcValues[i] == 0) return true; } return false; } 796private bool HasZero(in VBuffer<U2> src) { if (!src.IsDense) return true; var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (srcValues[i] == 0) return true; } return false; } 797private bool HasZero(in VBuffer<U4> src) { if (!src.IsDense) return true; var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (srcValues[i] == 0) return true; } return false; } 798private bool HasZero(in VBuffer<U8> src) { if (!src.IsDense) return true; var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (srcValues[i] == 0) return true; } return false; } 1106switch (span.Length) 1187while (ich < span.Length) 1295while (ich < span.Length) 1341if (span.Length == 1 || !TryParseCore(span.Slice(1), out val) || (val > ((ulong)max + 1)))
Data\RowCursorUtils.cs (1)
279int count = srcValues.Length;
DataLoadSave\Binary\Codecs.cs (5)
53for (int i = 0; i < values.Length; ++i) 204int count = values.Length; 926_counts.Add(valueValues.Length); 927if (valueValues.Length > 0) 930for (int i = 0; i < valueIndices.Length; i++)
DataLoadSave\Text\TextSaver.cs (5)
182for (int i = 0; i < srcValues.Length; i++) 191for (int i = 0; i < srcValues.Length; i++) 204if (slotNamesValues.Length == 0) 208for (int i = 0; i < slotNamesValues.Length; i++) 814int ichLim = span.Length;
DataView\Transposer.cs (6)
585if (ii < rbuffIndices.Length && rbuffIndices[ii] == s) 609if (rbuff.GetValues().Length > 0) 629if (++ii < rbuffValues.Length) // Still more stuff. Add another followup item to the heap. 643countSum += _rbuff[irbuff].GetValues().Length; 1233if (indices.Length == 0) 1248while (ii < indices.Length && indices[ii] < lim)
Deprecated\Instances\HeaderSchema.cs (4)
170for (int i = 0; i < nameValues.Length; i++) 176ctx.Writer.Write(nameValues.Length); 177for (int ii = 0; ii < nameIndices.Length; ii++) 179for (int ii = 0; ii < nameValues.Length; ii++)
Deprecated\Vector\VBufferMathUtils.cs (39)
22if (aValues.Length == 0) 51if (aValues.Length == 0) 63if (aValues.Length == 0) 74if (aValues.Length == 0) 86if (c == 1 || dst.GetValues().Length == 0) 104int count = srcValues.Length; 144if (srcValues.Length == 0) 153CpuMathUtils.Add(srcValues, src.GetIndices(), editor.Values, srcValues.Length); 172if (srcValues.Length == 0 || c == 0) 181CpuMathUtils.AddScale(c, srcValues, src.GetIndices(), editor.Values, srcValues.Length); 198if (srcValues.Length == 0 || c == 0) 226if (c == 0 || b.GetValues().Length == 0) 228else if (a.GetValues().Length == 0) 246if (srcValues.Length == 0 || c == 0) 256CpuMathUtils.AddScale(c, srcValues, values, srcValues.Length); 258CpuMathUtils.AddScale(c, srcValues, src.GetIndices(), values, srcValues.Length); 268int dMin = dstIndices.Length == 0 ? 0 : dstIndices.FindIndexSorted(0, dstIndices.Length, offset); 269int dLim = dstIndices.Length == 0 ? 0 : dstIndices.FindIndexSorted(dMin, dstIndices.Length, offset + src.Length); 277gapCount = srcValues.Length; 279for (int iS = 0, iD = dMin; iS < srcIndices.Length && iD < dLim;) 298dstValues.Length + gapCount, 306if (dstValues.Length != dLim) 308Contracts.Assert(dLim < dstValues.Length); 309indices.Slice(dLim, dstValues.Length - dLim) 311values.Slice(dLim, dstValues.Length - dLim) 340int iS = srcIndices.Length - 1; 387else if (src.GetValues().Length == 0 || c == 0) 413if (srcValues.Length == 0) 418Contracts.Assert(-1 <= ind && ind < srcValues.Length); 437while (ind < srcIndices.Length && srcIndices[ind] == ind) 439Contracts.Assert(ind <= srcIndices.Length); 440Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]); 449if (srcValues.Length == 0) 454Contracts.Assert(-1 <= ind && ind < srcValues.Length); 473while (ind < srcIndices.Length && srcIndices[ind] == ind) 475Contracts.Assert(ind <= srcIndices.Length); 476Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]);
Deprecated\Vector\VectorUtils.cs (36)
34if (bValues.Length == 0) 38return CpuMathUtils.DotProductSparse(a, bValues, b.GetIndices(), bValues.Length); 47if (aValues.Length == 0 || bValues.Length == 0) 54return CpuMathUtils.DotProductSparse(aValues, bValues, b.GetIndices(), bValues.Length); 58return CpuMathUtils.DotProductSparse(bValues, aValues, a.GetIndices(), aValues.Length); 59return DotProductSparse(aValues, a.GetIndices(), 0, aValues.Length, bValues, b.GetIndices(), 0, bValues.Length); 83for (int i = 0; i < aValues.Length; i++) 175Contracts.Assert(valuesA.Length == indicesA.Length); 176Contracts.Assert(valuesB.Length == indicesB.Length); 182while (ia < indicesA.Length && ib < indicesB.Length) 205while (ia < indicesA.Length) 212while (ib < indicesB.Length) 225if (valuesB.Length == 0) 228var dotP = CpuMathUtils.DotProductSparse(valuesA, valuesB, indicesB, valuesB.Length); 235Contracts.Assert(0 <= length && length <= valuesA.Length); 236Contracts.Assert(0 <= length && length <= valuesB.Length); 258if (aValues.Length == 0 || bValues.Length == 0) 264return CpuMathUtils.DotProductSparse(aValues.Slice(offset), bValues, b.GetIndices(), bValues.Length); 270int aMin = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset); 271int aLim = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset + b.Length); 279for (int iA = aMin, iB = 0; iA < aLim && iB < bIndices.Length;) 309if (bValues.Length == 0) 314return CpuMathUtils.DotProductSparse(a.AsSpan(offset), bValues, b.GetIndices(), bValues.Length); 323Contracts.Assert(0 <= ia && ia < iaLim && iaLim <= aIndices.Length); 324Contracts.Assert(0 <= ib && ib < ibLim && ibLim <= bIndices.Length); 447if (srcValues.Length == 0 || c == 0) 451CpuMathUtils.AddScale(c, srcValues, dst, srcValues.Length); 455for (int i = 0; i < srcValues.Length; i++) 475if (srcValues.Length == 0 || c == 0) 486for (int i = 0; i < srcValues.Length; i++)
Evaluators\EvaluatorUtils.cs (3)
698srcValues.Length); 712for (int j = 0; j < srcValues.Length; j++) 1452for (int i = 0; i < values.Length; i++)
Evaluators\MultiOutputRegressionEvaluator.cs (2)
251Contracts.Assert(score.Length >= length); 252Contracts.Assert(label.Length >= length);
Evaluators\QuantileRegressionEvaluator.cs (5)
149for (int i = 0; i < scoreValues.Length; i++) 161for (int i = 0; i < scoreValues.Length; i++) 180for (int i = 0; i < lossValues.Length; i++) 187for (int i = 0; i < lossValues.Length; i++) 199for (int i = 0; i < srcValues.Length; i++)
Transforms\ColumnConcatenatingTransformer.cs (4)
723dstCount = checked(dstCount + tmpBufs[i].GetValues().Length); 746Contracts.Assert(bufferValues.Length <= dstCount - count); 750for (int i = 0; i < bufferValues.Length; i++) 759for (int i = 0; i < bufferValues.Length; i++)
Transforms\Hashing.cs (29)
1043if (srcValues.Length == 0) 1048var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1050for (int i = 0; i < srcValues.Length; ++i) 1067for (int i = 0; i < srcValues.Length; ++i) 1080for (int i = 0; i < srcValues.Length; ++i) 1097if (srcValues.Length == 0) 1102var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1104for (int i = 0; i < srcValues.Length; ++i) 1121for (int i = 0; i < srcValues.Length; ++i) 1134for (int i = 0; i < srcValues.Length; ++i) 1161if (srcValues.Length == 0) 1166var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1170for (int i = 0; i < srcValues.Length; ++i) 1176for (int i = 0; i < srcValues.Length; ++i) 1193for (int i = 0; i < srcValues.Length; ++i) 1203if (srcIndices.Length <= j || srcIndices[j] > i) 1225if (srcValues.Length == 0) 1230var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1234for (int i = 0; i < srcValues.Length; ++i) 1240for (int i = 0; i < srcValues.Length; ++i) 1257for (int i = 0; i < srcValues.Length; ++i) 1267if (srcIndices.Length <= j || srcIndices[j] > i) 1682Contracts.Assert(valueValues.Length == hashValues.Length); 1684for (int i = 0; i < valueValues.Length; ++i) 1727Contracts.Assert(valueValues.Length == hashValues.Length); 1730for (int i = 0; i < valueValues.Length; ++i) 1736for (int i = 0; i < valueValues.Length; ++i)
Transforms\InvertHashUtils.cs (1)
419writer.WriteLine("# Number of terms = {0} of length {1}", v.GetValues().Length, v.Length);
Transforms\KeyToValue.cs (3)
348if (0 < uintSrc && uintSrc <= values.Length) 390int srcCount = srcValues.Length; 479for (int i = 0; i < keyValues.Length; ++i)
Transforms\KeyToVector.cs (2)
531int count = values.Length; 576int cntSrc = values.Length;
Transforms\NormalizeColumn.cs (1)
944for (int i = 0; i < values.Length; i++)
Transforms\NormalizeColumnDbl.cs (52)
359Contracts.Assert(0 <= values.Length && values.Length <= size); 360if (values.Length == 0) 363if (values.Length == size) 365for (int j = 0; j < values.Length; j++) 375for (int k = 0; k < values.Length; k++) 470Contracts.Assert(0 <= values.Length && values.Length <= size); 471if (values.Length == 0) 474if (values.Length == size) 476for (int j = 0; j < values.Length; j++) 485for (int k = 0; k < values.Length; k++) 828Contracts.Assert(0 <= values.Length && values.Length <= size); 832if (values.Length == 0) 835if (values.Length >= size) 844for (int ii = 0; ii < values.Length; ii++) 858Contracts.Assert(0 <= values.Length && values.Length <= size); 863if (values.Length == 0) 870if (values.Length >= size) 888ivSrc = ++ii < values.Length ? indices[ii] : size; 889Contracts.Assert(ii == values.Length || ivSrc < size); 903Contracts.Assert(0 <= values.Length && values.Length <= size); 908if (values.Length == 0) 915if (values.Length >= size) 932Contracts.Assert(ii < values.Length && ivSrc == indices[ii] || ii == values.Length && ivSrc == size); 946ivSrc = ++ii < values.Length ? indices[ii] : size; 947Contracts.Assert((ii == values.Length) == (ivSrc >= size)); 956ivSrc = ++ii < values.Length ? indices[ii] : size; 957Contracts.Assert((ii == values.Length) == (ivSrc >= size)); 962Contracts.Assert(ii == values.Length); 1102Contracts.Assert(0 <= values.Length && values.Length <= size); 1107if (values.Length == 0) 1110if (values.Length >= size) 1127for (int ii = 0; ii < values.Length; ii++) 1313Contracts.Assert(0 <= values.Length && values.Length <= size); 1317if (values.Length == 0) 1323if (values.Length >= size) 1354ivSrc = ++ii < values.Length ? indices[ii] : size; 1355Contracts.Assert(ii == values.Length || ivSrc < size); 1365for (int ii = 0; ii < values.Length; ii++) 1937Host.Assert(0 <= values.Length && values.Length <= size); 1938if (values.Length == 0) 1941if (values.Length == size) 1943for (int j = 0; j < values.Length; j++) 1949for (int k = 0; k < values.Length; k++)
Transforms\NormalizeColumnSng.cs (9)
359var count = values.Length; 471var count = values.Length; 985int count = values.Length; 1016int count = values.Length; 1062int count = values.Length; 1262int count = values.Length; 1288for (int ii = 0; ii < indices.Length; ii++) 1474int count = values.Length; 2100int count = values.Length;
Transforms\ValueMapping.cs (1)
924for (int ich = 0; ich < values.Length; ich++)
Transforms\ValueToKeyMappingTransformerImpl.cs (7)
401for (int i = 0; i < values.Length; ++i) 419for (int i = 0; i < values.Length; ++i) 793for (int i = 0; i < srcValues.Length; ++i) 965int count = values.Length; 1014int nextExplicitSlot = indices.Length == 0 ? src.Length : indices[0]; 1021_host.Assert(islot < values.Length); 1025nextExplicitSlot = ++islot == indices.Length ? src.Length : indices[islot];
Utilities\SlotDropper.cs (2)
153var newCount = Math.Min(srcValues.Length, newLength); 173while (iiSrc < srcValues.Length)
Microsoft.ML.DataView (5)
src\Microsoft.ML.Core\Utilities\ArrayUtils.cs (1)
51Debug.Assert(0 <= min && min <= lim && lim <= input.Length);
VBuffer.cs (4)
53/// Note that if this vector <see cref="IsDense"/>, then this will be the same as the <see cref="ReadOnlySpan{T}.Length"/> 55/// this is a sparse representation, then that <see cref="ReadOnlySpan{T}.Length"/> will be somewhat shorter, as this 61/// The explicitly represented values. When this <see cref="IsDense"/>, the <see cref="ReadOnlySpan{T}.Length"/> 364/// items, which is to say, the <see cref="ReadOnlySpan{Int32}.Length"/> of the return value of <see cref="GetIndices"/>.
Microsoft.ML.Ensemble (3)
EnsembleUtils.cs (3)
60for (int i = 0; i < srcValues.Length; i++) 69for (int i = 0; i < srcValues.Length; i++) 90for (int i = 0; i < srcValues.Length; i++)
Microsoft.ML.EntryPoints (1)
FeatureCombiner.cs (1)
133for (int i = 0; i < metadataValues.Length; i++)
Microsoft.ML.FastTree (24)
BinFile\BinFinder.cs (2)
57var explicitValuesCount = explicitValues.Length; 232var valuesCount = values.GetValues().Length;
FastTree.cs (13)
1010Contracts.Assert(values.Length == indices.Length); 1013for (int i = 0; i < values.Length; ++i) 1210else if (!values.IsDense && zeroBin == 0 && valuesValues.Length < (1 - sparsifyThreshold) * values.Length) 1231for (int i = 0; i < valuesValues.Length; ++i) 1237firstBinCount += values.Length - valuesValues.Length; 1241for (int i = 0; i < valuesValues.Length; i++) 1311var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1312if (srcValues.Length > 0) 1318for (int i = 0; i < srcValues.Length; ++i) 1508for (int index = 0; index < doubleTempValues.Length; ++index) 1591for (int i = 0; i < tempValues.Length; ++i) 1881featureValues += cursor.Features.GetValues().Length;
GamModelParameters.cs (4)
211for (int i = 0; i < featuresValues.Length; ++i) 222for (int i = 0; i < featuresValues.Length; ++i) 242for (int i = 0; i < featuresValues.Length; ++i) 256for (int i = 0; i < featuresValues.Length; ++i)
TreeEnsemble\InternalRegressionTree.cs (3)
918Contracts.Assert(featIndices.Length == featValues.Length); 922int count = featValues.Length;
Utils\LinqExtensions.cs (2)
28if (span.Length == 0) 31for (int i = 1; i < span.Length; i++)
Microsoft.ML.ImageAnalytics (2)
MLImage.cs (1)
98if (imagePixelData.Length != width * height * 4)
VectorToImageTransform.cs (1)
359if (src.GetValues().Length == 0)
Microsoft.ML.KMeansClustering (3)
KMeansModelParameters.cs (3)
189for (int j = 0; j < values.Length; j++) 196else if (values.Length > 0) 245writer.Write(values.Length);
Microsoft.ML.LightGbm (5)
LightGbmTrainerBase.cs (5)
755nonZeroCount += cursor.Features.GetValues().Length; 896for (int i = 0; i < cursorFeaturesValues.Length; ++i) 927cnt = cursorFeaturesValues.Length; 1095if (numElem + cursor.Features.GetValues().Length > features.Length) 1174int numValue = cursor.Features.GetValues().Length;
Microsoft.ML.Mkl.Components (10)
OlsLinearRegression.cs (6)
238ch.Assert(values.Length + 1 == m); 249for (int j = 0; j < indices.Length; ++j) 322ch.Assert(values.Length + 1 == m); 341for (int ii = 0; ii < values.Length; ++ii) 916for (int i = 0; i < coeffs.Length; i++) 931for (int i = 0; i < coeffs.Length; i++)
SymSgdClassificationTrainer.cs (2)
426var instArrayLength = instArray.Length; 594int featureCount = featureValues.Length;
VectorWhitening.cs (2)
683int count = values.Length; 711Contracts.Assert(count <= indices.Length);
Microsoft.ML.OneDal (2)
OneDalUtils.cs (2)
58channel.Assert(values.Length == numberOfFeatures); 69for (int j = 0; j < indices.Length; ++j)
Microsoft.ML.OnnxTransformer (2)
OnnxUtils.cs (2)
563string[] stringData = new string[data.Length]; 564for (int i = 0; i < data.Length; i++)
Microsoft.ML.PCA (1)
PcaTransformer.cs (1)
439if (FloatUtils.IsFinite(weight) && weight >= 0 && (featureValues.Length == 0 || FloatUtils.IsFinite(featureValues)))
Microsoft.ML.Predictor.Tests (1)
TestTransposer.cs (1)
47for (int i = 0; i < tempValues.Length; ++i)
Microsoft.ML.Samples (3)
Dynamic\Transforms\Conversion\Hash.cs (1)
86for (int i = 0; i < indices.Length; i++)
Dynamic\Transforms\Conversion\HashWithOptions.cs (1)
100for (int i = 0; i < indices.Length; i++)
Dynamic\Transforms\ImageAnalytics\ConvertToGrayScaleInMemory.cs (1)
60for (int i = 0; i < imageData.Length; i += pixelSize)
Microsoft.ML.StandardTrainers (37)
Optimizer\SgdOptimizer.cs (9)
408for (int i = 0; i < xValues.Length; i++) 418for (int ii = 0; ii < xValues.Length; ii++) 431while (j < xprevValues.Length) 441for (int jj = 0; jj < xprevValues.Length; jj++) 454while (i < xValues.Length) 467while (ii < xValues.Length && jj < xprevValues.Length) 488while (ii < xValues.Length) 494while (jj < xprevValues.Length)
Standard\LinearPredictorUtils.cs (2)
53if (featureNames.GetValues().Length > 0) 120inputBuilder.AppendLine("Name=" + (featureNames.GetValues().Length == 0 ? "Feature_" + idx : name.IsEmpty ? $"f{idx}" : name.ToString()));
Standard\LogisticRegression\LbfgsPredictorBase.cs (3)
509ch.Assert(values.Length == nFeatures); 520for (int j = 0; j < indices.Length; ++j) 777for (int i = BiasCount; i < values.Length; i++)
Standard\LogisticRegression\LogisticRegression.cs (2)
293for (int i = 1; i < currentWeightsValues.Length; i++) 383for (int ii = 0; ii < values.Length; ++ii)
Standard\LogisticRegression\MulticlassLogisticRegression.cs (5)
698for (int i = 0; i < fwValues.Length; i++) 711count += fwIndices.Length; 726for (int i = 0; i < fwValues.Length; i++) 738count += fwValues.Length; 759for (int i = 0; i < values.Length; i++)
Standard\ModelStatistics.cs (1)
320Env.Assert(coeffStdErrorValues.Length == ParametersCount);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (4)
179for (int i = 0; i < featureValues.Length; i += 1) 188for (int i = 0; i < featureValues.Length; i += 1) 614for (int iFeature = 0; iFeature < srcValues.Length; iFeature += 1) 622for (int iFeature = 0; iFeature < srcValues.Length; iFeature += 1)
Standard\Online\LinearSvm.cs (2)
193if (_weightsUpdate.GetValues().Length == 0) 206Contracts.Assert(_weightsUpdate.GetValues().Length == 0);
Standard\SdcaBinary.cs (3)
880CpuMathUtils.SdcaL1UpdateDense(primalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values); 881else if (featureValues.Length > 0) 882CpuMathUtils.SdcaL1UpdateSparse(primalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
Standard\SdcaMulticlass.cs (6)
298CpuMathUtils.SdcaL1UpdateDense(-primalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values); 299else if (featureValues.Length > 0) 300CpuMathUtils.SdcaL1UpdateSparse(-primalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values); 329CpuMathUtils.SdcaL1UpdateDense(labelPrimalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values); 330else if (featureValues.Length > 0) 331CpuMathUtils.SdcaL1UpdateSparse(labelPrimalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
Microsoft.ML.TensorFlow.Tests (16)
TensorflowTests.cs (16)
305Assert.Equal(sample.OneDim.Length, oneDimValues.Length); 309Assert.Equal(sample.TwoDim.Length, twoDimValues.Length); 313Assert.Equal(sample.ThreeDim.Length, threeDimValues.Length); 317Assert.Equal(sample.FourDim.Length, fourDimValues.Length); 321Assert.Equal(sample.FourDimKnown.Length, fourDimKnownValues.Length); 446Assert.Equal(2, f64Values.Length); 449Assert.Equal(2, f32Values.Length); 452Assert.Equal(2, i64Values.Length); 455Assert.Equal(2, i32Values.Length); 458Assert.Equal(2, i16Values.Length); 461Assert.Equal(2, i8Values.Length); 464Assert.Equal(2, u64Values.Length); 467Assert.Equal(2, u32Values.Length); 470Assert.Equal(2, u16Values.Length); 473Assert.Equal(2, u8Values.Length); 476Assert.Equal(2, bValues.Length);
Microsoft.ML.TestFramework (3)
DataPipe\TestDataPipe.cs (1)
930TestCommon.CompareVec(in buffer, in expected[index++], buffer.GetValues().Length, (s1, s2) => s1.Span.SequenceEqual(s2.Span));
TestSparseDataView.cs (2)
60Assert.True(value.GetValues().Length == 3); 100Assert.True(value.GetValues().Length == 3);
Microsoft.ML.TestFrameworkCommon (2)
TestCommon.cs (2)
164int iv1 = v1.IsDense ? iiv1 : iiv1 < v1Indices.Length ? v1Indices[iiv1] : v1.Length; 165int iv2 = v2.IsDense ? iiv2 : iiv2 < v2Indices.Length ? v2Indices[iiv2] : v2.Length;
Microsoft.ML.Tests (16)
ImagesTests.cs (13)
219for (int i = 0; i < imageData.Length; i += pixelSize) 269for (int i = 0; i < imageData.Length; i += pixelSize) 292for (int i = 0; i < imageData1.Length; i += pixelSize1) 393for (int i = 0; i < restoredImageData.Length; i += pixelSize) 468for (int i = 0; i < restoredImageData.Length; i += pixelSize) 544for (int i = 0; i < restoredImageData.Length; i += pixelSize) 619for (int i = 0; i < restoredImageData.Length; i += pixelSize) 694for (int i = 0; i < restoredImageData.Length; i += pixelSize) 770for (int i = 0; i < restoredImageData.Length; i += pixelSize) 845for (int i = 0; i < restoredImageData.Length; i += pixelSize) 921for (int i = 0; i < restoredImageData.Length; i += pixelSize) 995for (int i = 0; i < restoredImageData.Length; i += pixelSize) 1245Assert.Equal(image1.Width * image1.Height * (image1.BitsPerPixel / 8), image1.Pixels.Length);
SvmLightTests.cs (2)
334Assert.True(features.GetValues().Length == 1); 335Assert.True(features.GetIndices().Length == 1);
TermEstimatorTests.cs (1)
149Assert.True(names1.GetValues().Length > 0);
Microsoft.ML.TimeSeries (2)
AdaptiveSingularSpectrumSequenceModeler.cs (2)
1507var horizon = meanForecast.Length; 1509Contracts.Check(sdForecast.Length >= horizon, "The forecast standard deviation values are not available.");
Microsoft.ML.Tokenizers (318)
Model\BPETokenizer.cs (41)
860span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 957sSpan = sSpan.Slice(0, sSpan.Length - EndOfWordSuffix!.Length); 964if (sSpan.Length > buffer.Length) 971charsWritten += sSpan.Length; 972buffer = buffer.Slice(sSpan.Length); 1017if (specialTokenSpan.Length > buffer.Length) 1023buffer = buffer.Slice(specialTokenSpan.Length); 1024charsWritten += specialTokenSpan.Length; 1036span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 1046if (current.Length < span.Length) 1051for (int i = 0; i < span.Length; i++) 1056current = utf8bytes.Slice(incompleteUtf8BytesInBufferIndex, incompleteUtf8BytesInBuffer + span.Length); 1192Word word = Word.WithCapacity(w.Length); 1199while (i < w.Length) 1203if (Char.IsHighSurrogate(w[i]) && i < w.Length - 1 && Char.IsLowSurrogate(w[i + 1])) 1217if (ContinuingSubwordPrefix.Length + s.Length <= buffer.Length) 1221s = buffer.Slice(0, ContinuingSubwordPrefix.Length + s.Length); 1235if (i + length >= w.Length && EndOfWordSuffix is not null) 1237if (s.Length + EndOfWordSuffix.Length <= buffer.Length) 1240EndOfWordSuffix.AsSpan().CopyTo(buffer.Slice(s.Length)); 1241s = buffer.Slice(0, s.Length + EndOfWordSuffix.Length); 1311tokens.Add(new EncodedToken(value.specialTokenId, value.specialToken, new Range(offset, offset + text.Length))); 1323int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length); 1354if (textSpan.Length <= MaxWordLengthToCache) 1421charsConsumed = text.Length; 1436int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length); 1459int res = WordToIds(ref hit, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens); 1462charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed]; 1470if (textSpan.Length <= MaxWordLengthToCache) 1480int result = WordToIds(ref word, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens); 1483charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed]; 1516int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length); 1539int res = WordToIdsFromEnd(ref hit, accumulatedIds, out textIndex, textSpan.Length, maxTokens); 1543textIndex = textIndex >= textSpan.Length ? text.Length : mapping[textIndex]; 1551if (textSpan.Length <= MaxWordLengthToCache) 1561int result = WordToIdsFromEnd(ref word, accumulatedIds, out textIndex, textSpan.Length, maxTokens); 1565textIndex = textIndex >= textSpan.Length ? text.Length : mapping[textIndex];
Model\CodeGenTokenizer.cs (40)
345if (span.Length + 1 > BufferLength) 347mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 352span = mutatedInputSpan.Slice(0, span.Length + 1); 385PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length); 401int index = addPrefixSpace ? Math.Max(0, textSpanToEncode.Length - 1) : textSpanToEncode.Length; 405return new EncodeResults<EncodedToken> { Tokens = tokens, NormalizedText = normalizedText, CharsConsumed = textSpanToEncode.Length }; 435tokens.Add(new EncodedToken(value.specialTokenId, value.specialToken, new Range(index, index + ((addPrefixSpace && offset == 0) ? textSpan.Length - 1 : textSpan.Length)))); 452int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length); 466if (textSpan.Length <= MaxTokenLengthToCache) 602if (span.Length + 1 > BufferLength) 604mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 609span = mutatedInputSpan.Slice(0, span.Length + 1); 625PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length); 821if (span.Length + 1 > BufferLength) 823mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 828span = mutatedInputSpan.Slice(0, span.Length + 1); 837PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length); 958if (span.Length + 1 > BufferLength) 960mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 965span = mutatedInputSpan.Slice(0, span.Length + 1); 974PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length); 1119charsConsumed = textSpan.Length; 1125return EncodeToIdsResult(hit, accumulatedIds, maxTokens, textSpan.Length, out charsConsumed); 1135int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length); 1149int length = text is not null ? text.Length : textSpan.Length; 1155return EncodeToIdsResult(result, accumulatedIds, maxTokens, textSpan.Length, out charsConsumed); 1172textIndex = textSpan.Length; 1189return EncodeToIdsFromEndResult(hit, accumulatedIds, maxTokens, textSpan.Length, out textIndex); 1199int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length); 1213int length = text is not null ? text.Length : textSpan.Length; 1219return EncodeToIdsFromEndResult(result, accumulatedIds, maxTokens, textSpan.Length, out textIndex); 1452if (specialTokenSpan.Length > buffer.Length) 1458buffer = buffer.Slice(specialTokenSpan.Length); 1459charsWritten += specialTokenSpan.Length; 1472if (current.Length < span.Length) 1477for (int i = 0; i < span.Length; i++) 1482current = utf8bytes.Slice(incompleteUtf8BytesInBufferIndex, incompleteUtf8BytesInBuffer + span.Length); 1682int endIndex = index + length < mapping.Length ? mapping[index + length] : originalText.Length;
Model\EnglishRobertaTokenizer.cs (15)
363char[] token = ArrayPool<char>.Shared.Rent(text.Length); 364int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 369for (int i = 0; i < text.Length; i++) 672return EncodeToIdsResult(hit, accumulatedIds, maxTokens, text.Length, out charsConsumed); 675char[] token = ArrayPool<char>.Shared.Rent(text.Length); 676int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 681for (int i = 0; i < text.Length; i++) 695charsConsumed = text.Length; 704return EncodeToIdsResult(result, accumulatedIds, maxTokens, text.Length, out charsConsumed); 711textIndex = text.Length; 717return EncodeToIdsFromEndResult(hit, accumulatedIds, maxTokens, text.Length, out textIndex); 720char[] token = ArrayPool<char>.Shared.Rent(text.Length); 721int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 726for (int i = 0; i < text.Length; i++) 749return EncodeToIdsFromEndResult(result, accumulatedIds, maxTokens, text.Length, out textIndex);
Model\SentencePieceBaseModel.cs (8)
722if (tokenSpan.Length > buffer.Length) 736buffer = buffer.Slice(tokenSpan.Length); 737charsConsumed += tokenSpan.Length; 744if (tokenSpan[tokenSpan.Length - 1] == prefixSuffixChar) 746suffixIndex = charsConsumed + tokenSpan.Length - 1; 749if (tokenSpan.Length > buffer.Length) 763charsConsumed += tokenSpan.Length; 785charsConsumed += tokenSpan.Length;
Model\SentencePieceBpeModel.cs (34)
86if (textToEncode.Length == 0) 131if (currentOffset < text.Length) 138tokens.Add(new EncodedToken(EndOfSentenceId, EndOfSentenceToken, new Range(text.Length, text.Length))); 152BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 203tokens.Add(new EncodedToken(EndOfSentenceId, EndOfSentenceToken, new Range(text.Length, text.Length))); 211for (int i = 0; i < text.Length; i++) 228int len = Encoding.UTF8.GetMaxByteCount(text.Length - i); 237int length = text.Length - i; 393if (currentOffset < text.Length && idsCount < maxTokens) 435BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 507for (int i = 0; i < text.Length; i++) 528int len = Encoding.UTF8.GetMaxByteCount(text.Length - i); 546charsConsumed += text.Length - i; 669if (currentOffset < text.Length && idsCount < maxTokens) 703BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 771for (int i = 0; i < text.Length; i++) 791int len = Encoding.UTF8.GetMaxByteCount(text.Length - i); 805charsConsumed += text.Length - i; 897Debug.Assert(text.Length > 0); 899textIndex = text.Length; 919if (current.Offset + current.Length < text.Length) 923textIndex -= splitText.Length - splitTextIndex; 941textIndex -= splitText.Length - splitTextIndex; 964textIndex = text.Length; 972BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 1047for (int i = text.Length - 1; i >= 0; i--) 1067int len = Encoding.UTF8.GetMaxByteCount(text.Length - i); 1131Debug.Assert(text.Length > 0); 1132Debug.Assert(symbols.Length >= text.Length); 1137while (spanIndex < text.Length) 1139int len = (Char.IsHighSurrogate(text[spanIndex]) && spanIndex < text.Length - 1 && Char.IsLowSurrogate(text[spanIndex + 1])) ? 2 : 1; 1143next: spanIndex + len >= text.Length ? -1 : symbolIndex + 1,
Model\SentencePieceTokenizer.cs (1)
131CharsConsumed = normalizedText?.Length ?? text?.Length ?? textSpan.Length
Model\SentencePieceUnigramModel.cs (27)
387int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 390char[] normalizedString = ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 422if (text.Length > remainingLength) 430text.CopyTo(normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd - text.Length)); 431normalizedStringCountFromEnd += text.Length; 449Debug.Assert(bytesConsumed == utf8Bytes.Length); 458if (text.Length > utf16NormalizedString.Length) 465normalizedStringIndex += text.Length; 471if (Encoding.UTF8.GetMaxCharCount(normalizationSpan.Length) > normalizedUtf16Span.Length) 521if (currentOffset < text.Length) 569Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) * 3 <= buffer.Length * sizeof(int)); 748Debug.Assert(normalized.Length > 0); 750int size = normalized.Length; 862int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 865char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 972if (currentOffset < text.Length) 1139charsConsumed += text.Length; 1177if (index + utf8UnknownBytes.Length > maxTokenCount) 1182addedTokensCount += utf8UnknownBytes.Length - 1; 1262int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 1265char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 1352if (currentOffset < text.Length && tokenCount < maxTokenCount) 1522return textToEncode.Length; 1533return textToEncode.Length; 1539int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 1542char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 1601if (current.Offset + current.Length < text.Length)
Model\TiktokenTokenizer.cs (20)
323int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length); 329indexMappingSpan[encodedLength] = text.Length; 341if (text.Length <= MaxWordLengthToCache) 430return EncodeToIdsResult(value, accumulatedIds, maxTokenCount, text.Length, out charsConsumed); 435charsConsumed = text.Length; 440int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length); 446indexMappingSpan[encodedLength] = text.Length; 455if (text.Length <= MaxWordLengthToCache) 461return EncodeToIdsResult(encodedTokens, accumulatedIds, maxTokenCount, text.Length, out charsConsumed); 596return EncodeToIdsResult(value, accumulatedIds: null, maxTokens, text.Length, out charsConsumed); 601charsConsumed = text.Length; 605int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length); 611indexMappingSpan[encodedLength] = text.Length; 620if (text.Length <= MaxWordLengthToCache) 626return EncodeToIdsResult(encodedTokens, accumulatedIds: null, maxTokens, text.Length, out charsConsumed); 722return EncodeToIdsFromEndResult(value, accumulatedIds: null, maxTokens, text.Length, out textIndex); 731int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length); 737indexMappingSpan[encodedLength] = text.Length; 746if (text.Length <= MaxWordLengthToCache) 752return EncodeToIdsFromEndResult(encodedTokens, accumulatedIds: null, maxTokens, text.Length, out textIndex);
Model\WordPieceTokenizer.cs (12)
317if (text.Length > MaxInputCharsPerWord) 319tokens.Add(new EncodedToken(UnknownTokenId, UnknownToken, new Range(offset, offset + text.Length))); 329int textLength = text.Length; 346subStr = buffer.Slice(0, ContinuingSubwordPrefix.Length + subStr.Length); 456if (text.Length > MaxInputCharsPerWord) 459charsConsumed = text.Length; 469int textLength = text.Length; 487subStr = buffer.Slice(0, ContinuingSubwordPrefix.Length + subStr.Length); 632if (charsConsumed != textSpanToEncode.Length) 635return fromEnd ? textSpanToEncode.Length : 0; 638return fromEnd ? 0 : textSpanToEncode.Length; 663return fromEnd ? 0 : textSpanToEncode.Length;
Normalizer\LowerCaseNormalizer.cs (2)
45char[] arrayPoolArray = ArrayPool<char>.Shared.Rent(original.Length); 48Debug.Assert(length == original.Length);
Normalizer\SentencePieceNormalizer.cs (6)
155int endIndex = original.Length - 1; 473while (isPrevSpace && sp.Length > 0 && sp[0] == (byte)' ') 480for (int n = 0; n < sp.Length; ++n) 507isPrevSpace = sp[sp.Length - 1] == (byte)' '; 571if (blob.Length <= sizeof(uint)) 586if (trieBlobSize >= blob.Length)
Normalizer\UpperCaseNormalizer.cs (2)
45char[] arrayPoolArray = ArrayPool<char>.Shared.Rent(original.Length); 48Debug.Assert(length == original.Length);
PreTokenizer\CompositePreTokenizer.cs (2)
151char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 154IEnumerable<(int Offset, int Length)> result = PreTokenize(buffer, text.Length);
PreTokenizer\PreTokenizer.cs (2)
136char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 138return SplitText(buffer, regex, text.Length);
PreTokenizer\RegexPreTokenizer.cs (2)
104char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 106return SplitText(buffer, _regex, _specialTokensRegex, text.Length);
RegexGenerator.g.cs (74)
260base.runtextpos != inputSpan.Length) 275if ((uint)pos < (uint)inputSpan.Length) 281base.runtextpos = inputSpan.Length; 322if ((uint)slice.Length < 2 || ((long)((0x8041800080418000UL << (int)(charMinusLowUInt64 = (uint)slice[1] - 'D')) & (charMinusLowUInt64 - 64)) >= 0)) 340if ((uint)slice.Length < 3 || 359if ((uint)slice.Length < 3 || 376if ((uint)slice.Length < 3 || 410while ((uint)iteration < (uint)slice.Length && char.IsLetter(slice[iteration])) 436while (iteration1 < 3 && (uint)iteration1 < (uint)slice.Length && char.IsNumber(slice[iteration1])) 471while ((uint)iteration2 < (uint)slice.Length && ((ch = slice[iteration2]) < 128 ? ("쇿\uffff\ufffeﰀ\u0001\u0001"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\0\rd\0\u0002\u0004\u0005\u0003\u0001\0\0\t\n\v\0"))) 490iteration3 = slice.Length; 509while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 524if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 543while ((uint)iteration5 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration5])) 592while ((uint)iteration6 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration6])) 710base.runtextpos != inputSpan.Length) 725if ((uint)pos < (uint)inputSpan.Length) 731base.runtextpos = inputSpan.Length; 765if ((uint)slice.Length < 2) 779if ((uint)slice.Length < 3 || slice[2] != 'l') 790if ((uint)slice.Length < 3 || slice[2] != 'e') 801if ((uint)slice.Length < 3 || slice[2] != 'e') 836while ((uint)iteration < (uint)slice.Length && char.IsLetter(slice[iteration])) 871while ((uint)iteration1 < (uint)slice.Length && char.IsNumber(slice[iteration1])) 906while ((uint)iteration2 < (uint)slice.Length && ((ch = slice[iteration2]) < 128 ? ("쇿\uffff\ufffeﰀ\u0001\u0001"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\0\rd\0\u0002\u0004\u0005\u0003\u0001\0\0\t\n\v\0"))) 932while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 947if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 966while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 1084base.runtextpos != inputSpan.Length) 1099if ((uint)pos < (uint)inputSpan.Length) 1105base.runtextpos = inputSpan.Length; 1175while ((uint)iteration < (uint)slice.Length && ((0xFD & (1 << (int)char.GetUnicodeCategory(slice[iteration]))) != 0)) 1205while ((uint)iteration1 < (uint)slice.Length && ((0xFA & (1 << (int)char.GetUnicodeCategory(slice[iteration1]))) != 0)) 1259if ((uint)slice.Length < 2 || ((uint)((slice[1] | 0x20) - 's') > (uint)('t' - 's'))) 1275if ((uint)slice.Length < 3 || 1292if ((uint)slice.Length < 3 || 1310if ((uint)slice.Length < 2 || ((slice[1] | 0x20) != 'm')) 1328if ((uint)slice.Length < 3 || 1348if ((uint)slice.Length < 2 || ((slice[1] | 0x20) != 'd')) 1422while ((uint)iteration2 < (uint)slice.Length && ((0xFD & (1 << (int)char.GetUnicodeCategory(slice[iteration2]))) != 0)) 1458while ((uint)iteration3 < (uint)slice.Length && ((0xFA & (1 << (int)char.GetUnicodeCategory(slice[iteration3]))) != 0)) 1506if ((uint)slice.Length < 2 || ((uint)((slice[1] | 0x20) - 's') > (uint)('t' - 's'))) 1522if ((uint)slice.Length < 3 || 1539if ((uint)slice.Length < 3 || 1557if ((uint)slice.Length < 2 || ((slice[1] | 0x20) != 'm')) 1575if ((uint)slice.Length < 3 || 1595if ((uint)slice.Length < 2 || ((slice[1] | 0x20) != 'd')) 1640while (iteration4 < 3 && (uint)iteration4 < (uint)slice.Length && char.IsNumber(slice[iteration4])) 1677while ((uint)iteration5 < (uint)slice.Length && ((ch = slice[iteration5]) < 128 ? ("쇿\uffff\ufffeﰀ\u0001\u0001"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\0\rd\0\u0002\u0004\u0005\u0003\u0001\0\0\t\n\v\0"))) 1713iteration6 = slice.Length; 1734while ((uint)iteration7 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration7])) 1766iteration8 = slice.Length; 1792while ((uint)iteration9 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration9])) 1853while ((uint)iteration10 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration10])) 1919base.runtextpos != inputSpan.Length) 1934if ((uint)pos < (uint)inputSpan.Length) 1947base.runtextpos = inputSpan.Length; 1969while ((uint)iteration < (uint)slice.Length && Utilities.IsWordChar(slice[iteration])) 2049base.runtextpos != inputSpan.Length) 2064if ((uint)pos < (uint)inputSpan.Length) 2070base.runtextpos = inputSpan.Length; 2093while ((uint)iteration < (uint)slice.Length && Utilities.IsWordChar(slice[iteration])) 2119while ((uint)iteration1 < (uint)slice.Length && ((ch = slice[iteration1]) < 128 ? ("쇿\uffff\ufffeﰀ\u0001砀\u0001"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\0\v\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0d"))) 2182base.runtextpos != inputSpan.Length) 2197if ((uint)pos < (uint)inputSpan.Length) 2210base.runtextpos = inputSpan.Length; 2226while ((uint)iteration < (uint)slice.Length && !char.IsWhiteSpace(slice[iteration])) 2259if ((uint)i < (uint)span.Length) 2274while ((uint)i < (uint)span.Length); 2285if ((uint)i < (uint)span.Length) 2300while ((uint)i < (uint)span.Length); 2330return (uint)chDiv8 < (uint)ascii.Length ?
Tokenizer.cs (2)
257return tokens.NormalizedText?.Length ?? textSpan.Length; 456fullTextLength = textSpan.Length;
Utils\BytePairEncoder.cs (2)
111while (finalEndIndex < indexMappingSpan.Length && indexMappingSpan[finalEndIndex] == mappedEndIndex) 268while (finalEndIndex < indexMappingSpan.Length && indexMappingSpan[finalEndIndex] == mappedEndIndex)
Utils\DoubleArrayTrie.cs (1)
1072for (int i = 0; i < key.Length; ++i)
Utils\Helpers.cs (16)
57while (utf8Bytes.Length > 0) 61utf8Bytes = utf8Bytes.Slice(Math.Min(bytesLength, utf8Bytes.Length)); 70Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 75for (int i = 0; i < text.Length; i++) 96if (i < text.Length - 1 && char.IsSurrogatePair((char)c, text[i + 1])) 141if (text.Length > 1 && char.IsSurrogatePair((char)c, text[1])) 162Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 168for (int i = 0; i < text.Length; i++) 189if (i < text.Length - 1 && char.IsSurrogatePair((char)c, text[i + 1])) 217for (int i = 0; i < text.Length; i++) 244while (byteIndex < utf8Bytes.Length) 283if (byteIndex + additionalBytes >= utf8Bytes.Length) 321Debug.Assert(input.Length > 0); 328else if (input.Length >= 2 && (input[0] & 0xE0) == 0xC0) 337else if (input.Length >= 3 && (input[0] & 0xF0) == 0xE0) 346else if (input.Length >= 4 && (input[0] & 0xf8) == 0xF0)
Utils\Helpers.netcoreapp.cs (1)
81Debug.Assert(textIndex < text.Length);
Utils\LruCache.cs (1)
78if (_cache.TryGetValue(new StringSpanOrdinalKey(ptr, key.Length), out LinkedListNode<KeyValuePair<string, TValue>>? cached))
Utils\StringSpanOrdinalKey.cs (4)
103return _map.TryGetValue(new StringSpanOrdinalKey(ptr, key.Length), out value!); 181return map.TryGetValue(new StringSpanOrdinalKey(ptr, key.Length), out value!); 193return map.TryGetValue(new StringSpanOrdinalKeyPair(ptr1, key1.Length, ptr2, key2.Length), out value!);
Utils\ValueStringBuilder.cs (3)
352if (pos > _chars.Length - value.Length) 354Grow(value.Length); 358_pos += value.Length;
Microsoft.ML.Tokenizers.Tests (24)
NormalizerTests.cs (3)
95StringBuilder sb = new StringBuilder(original.Length); 110if (start >= original.Length) 118for (int i = start; i < original.Length; i++)
PreTokenizerTests.cs (3)
90while (index < text.Length && char.IsWhiteSpace(text[index])) 96while (end < text.Length && !char.IsWhiteSpace(text[end])) 101if (index < text.Length)
src\Microsoft.ML.Tokenizers\Utils\DoubleArrayTrie.cs (1)
1072for (int i = 0; i < key.Length; ++i)
src\Microsoft.ML.Tokenizers\Utils\Helpers.cs (16)
57while (utf8Bytes.Length > 0) 61utf8Bytes = utf8Bytes.Slice(Math.Min(bytesLength, utf8Bytes.Length)); 70Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 75for (int i = 0; i < text.Length; i++) 96if (i < text.Length - 1 && char.IsSurrogatePair((char)c, text[i + 1])) 141if (text.Length > 1 && char.IsSurrogatePair((char)c, text[1])) 162Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 168for (int i = 0; i < text.Length; i++) 189if (i < text.Length - 1 && char.IsSurrogatePair((char)c, text[i + 1])) 217for (int i = 0; i < text.Length; i++) 244while (byteIndex < utf8Bytes.Length) 283if (byteIndex + additionalBytes >= utf8Bytes.Length) 321Debug.Assert(input.Length > 0); 328else if (input.Length >= 2 && (input[0] & 0xE0) == 0xC0) 337else if (input.Length >= 3 && (input[0] & 0xF0) == 0xE0) 346else if (input.Length >= 4 && (input[0] & 0xf8) == 0xF0)
src\Microsoft.ML.Tokenizers\Utils\Helpers.netcoreapp.cs (1)
81Debug.Assert(textIndex < text.Length);
Microsoft.ML.TorchSharp (16)
AutoFormerV2\ObjectDetectionTrainer.cs (2)
398Contracts.Assert(boxValues.Length == labelValues.Length * 4, "Must have 4 coordinates for each label");
Utils\DataUtils.cs (14)
79var array = new T[s1.Length + s2.Length]; 81s2.CopyTo(array.AsSpan(s1.Length)); 87var array = new T[s1.Length + s2.Length + s3.Length]; 89s2.CopyTo(array.AsSpan(s1.Length)); 90s3.CopyTo(array.AsSpan(s1.Length + s2.Length)); 96var array = new T[s1.Length + 1]; 98array.AsSpan(s1.Length)[0] = s2; 104var array = new T[s1.Length + 2]; 106array.AsSpan(s1.Length)[0] = s2; 107array.AsSpan(s1.Length + 1)[0] = s3;
Microsoft.ML.Transforms (100)
Dracula\CountTableTransformer.cs (2)
291for (int i = 0; i < indices.Length; i++) 722for (int i = 0; i < srcIndices.Length; i++)
ExpressionTransformer.cs (6)
620int count = src0.GetValues().Length; 647int count = src0.GetValues().Length; 694int count = src0.GetValues().Length; 757int count = src0.GetValues().Length; 823int count = src0.GetValues().Length; 892int count = src0.GetValues().Length;
GcnTransform.cs (15)
476int count = srcValues.Length; 529Contracts.Assert(0 <= values.Length && values.Length <= length); 530if (values.Length == 0) 535if (values.Length != length && tmpMean != 0) 539sumSq = (length - values.Length) * meanSq; 551Contracts.Assert(0 <= values.Length && values.Length <= length); 552if (values.Length == 0) 555if (values.Length != length && mean != 0) 559sumSq = (length - values.Length) * meanSq; 571if (values.Length == 0) 582if (values.Length == 0) 593if (values.Length == 0) 600if (length == 0 || src.Length == 0)
LearnerFeatureSelection.cs (8)
128if (scoresValues.Length == 0) 145for (int i = 0; i < scoresValues.Length; i++) 161while (++i < scoresValues.Length) 192Contracts.Assert(max < scoresValues.Length); 195range.max = max == scoresIndices.Length - 1 ? scores.Length - 1 : scoresIndices[max + 1] - 1; 211for (; ii <= scoresIndices.Length; ii++) 214var gapMax = ii == scoresIndices.Length ? scores.Length - 1 : scoresIndices[ii] - 1; 236for (int i = 0; i < scores.Length; i++)
MissingValueDroppingTransformer.cs (13)
259for (int i = 0; i < srcValues.Length; i++) 264Host.Assert(newCount <= srcValues.Length); 272if (newCount == srcValues.Length) 277Host.Assert(dst.GetValues().Length == newCount); 287for (int i = 0; i < srcValues.Length; i++) 303for (int i = 0; i < srcValues.Length; i++) 308Host.Assert(newCount <= srcValues.Length); 312VBufferUtils.Resize(ref dst, src.Length - srcValues.Length, 0); 316if (newCount == srcValues.Length) 326for (int i = 0; i < srcValues.Length; i++) 339var newLength = src.Length - srcValues.Length - newCount; 344for (int i = 0; i < srcValues.Length; i++) 356Host.Assert(offset == srcValues.Length - newCount);
MissingValueIndicatorTransform.cs (4)
300var editor = VBufferEditor.Create(ref buffer, size * 2, values.Length); 306for (int ivSrc = 0; ivSrc < values.Length; ivSrc++) 331for (int iivSrc = 0; iivSrc < values.Length; iivSrc++) 354ectx.Assert(0 <= iivDst && iivDst <= values.Length);
MissingValueIndicatorTransformer.cs (1)
307var srcCount = srcValues.Length;
MissingValueReplacing.cs (3)
261for (int slot = 0; slot < srcValues.Length; slot++) 714int srcCount = srcValues.Length; 788int srcCount = srcValues.Length;
MissingValueReplacingUtils.cs (2)
221var srcCount = srcValues.Length; 245var srcCount = srcValues.Length;
MutualInformationFeatureSelection.cs (12)
733for (int i = 0; i < labelsValues.Length; i++) 746for (int i = 0; i < labelsValues.Length; i++) 750if (ii == featureIndices.Length || i < featureIndices[ii]) 761Contracts.Assert(ii == featureIndices.Length); 800var bounds = _binFinder.FindBins(numBins, _singles, input.Length - input.GetValues().Length); 819for (int i = 0; i < inputValues.Length; i++) 826var bounds = _binFinder.FindBins(numBins, _singles, input.Length - inputValues.Length); 845for (int i = 0; i < inputValues.Length; i++) 852var bounds = _binFinder.FindBins(numBins, _doubles, input.Length - inputValues.Length); 894var editor = VBufferEditor.Create(ref output, input.Length, inputValues.Length); 895for (int i = 0; i < inputValues.Length; i++) 901if (!input.IsDense && inputValues.Length > 0)
RandomFourierFeaturizing.cs (2)
578featuresAligned.CopyFrom(srcIndices, srcValues, 0, 0, srcValues.Length, zeroItems: false); 580srcValues.Length, productAligned, transformInfo.NewDim);
SvmLight\SvmLightLoader.cs (2)
307for (int i = 0; i < inputValues.Length; i++) 692for (int i = 0; i < values.Length; ++i)
Text\LdaSingleBox.cs (14)
199Contracts.Check(termID.Length >= termNum); 200Contracts.Check(termVal.Length >= termNum); 203int[] pVal = new int[termVal.Length]; 204for (int i = 0; i < termVal.Length; i++) 215Contracts.Check(termVal.Length >= termNum); 218int[] pVal = new int[termVal.Length]; 219for (int i = 0; i < termVal.Length; i++) 264Contracts.Check(termVal.Length >= termNum); 265Contracts.Check(termID.Length >= termNum); 268int[] pVal = new int[termVal.Length]; 269for (int i = 0; i < termVal.Length; i++) 296Contracts.Check(termVal.Length >= termNum); 297int[] pVal = new int[termVal.Length]; 298for (int i = 0; i < termVal.Length; i++)
Text\LdaTransform.cs (4)
426for (int i = 0; i < inputValues.Length; i++) 484if (srcValues.Length == 0) 494for (int i = 0; i < srcValues.Length; i++) 884for (int termID = 0; termID < srcValues.Length; termID++)
Text\NgramUtils.cs (1)
100if (iindex < srcIndices.Length && i == srcIndices[iindex])
Text\StopWordsRemovingTransformer.cs (2)
426for (int i = 0; i < srcValues.Length; i++) 1114for (int i = 0; i < srcValues.Length; i++)
Text\TextNormalizing.cs (1)
372for (int i = 0; i < srcValues.Length; i++)
Text\TokenizingByCharacters.cs (4)
520for (int i = 0; i < srcValues.Length; i++) 534for (int i = 0; i < srcValues.Length; i++) 559for (int i = 0; i < srcValues.Length; i++) 587for (int i = 0; i < srcValues.Length; i++)
Text\WordEmbeddingsExtractor.cs (1)
579for (int word = 0; word < srcValues.Length; word++)
Text\WordTokenizing.cs (1)
293for (int i = 0; i < srcValues.Length; i++)
UngroupTransform.cs (2)
662while (cachedIndex < rowIndices.Length && _pivotColPosition > rowIndices[cachedIndex]) 665if (cachedIndex < rowIndices.Length && _pivotColPosition == rowIndices[cachedIndex])
Microsoft.NET.Build.Containers (9)
_generated\0\RegexGenerator.g.cs (9)
78base.runtextpos != inputSpan.Length) 96if (pos <= inputSpan.Length - 4) 111while ((uint)prev < (uint)slice.Length && Utilities.IsWordChar(slice[prev])) 129base.runtextpos = inputSpan.Length; 173iteration = slice.Length; 197if ((uint)slice.Length < 2 || slice[1] != ',') 214if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 264return (uint)chDiv8 < (uint)ascii.Length ?
Microsoft.NET.Build.Tasks (2)
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.SystemTextJson.cs (2)
59span = span.Slice(utf8Bom.Length, span.Length - utf8Bom.Length);
Microsoft.NET.HostModel (9)
AppHost\BinaryUtils.cs (9)
53if (patternToReplace.Length < searchPattern.Length) 55for (int i = patternToReplace.Length; i < searchPattern.Length; i++) 97int[] table = new int[pattern.Length]; 98if (pattern.Length >= 1) 102if (pattern.Length >= 2) 109while (pos < pattern.Length) 141if (i == pattern.Length - 1)
Microsoft.Net.Http.Headers (11)
ContentDispositionHeaderValue.cs (9)
545var requiredLength = MimePrefix.Length + 547MimeSuffix.Length; 555var bufferContent = buffer.Slice(MimePrefix.Length); 562var result = Encoding.UTF8.GetString(buffer.Slice(0, MimePrefix.Length + base64ContentLength + MimeSuffix.Length)); 621while (remaining.Length > 0) 626length = remaining.Length; 631if (remaining.Length == 0) 639length = remaining.Length;
SetCookieHeaderValue.cs (1)
326span = span.Slice(other.Length);
src\aspnetcore\src\Shared\HttpRuleParser.cs (1)
68return (firstNonTokenCharIdx == -1) ? subspan.Length : firstNonTokenCharIdx;
Microsoft.NET.Sdk.StaticWebAssets.Tasks (13)
Data\ContentTypeProvider.cs (3)
429var fileName = relativePath[(relativePath.Length - fileNameSpan.Length)..]; 491return fileName[..fileNameNoExtension.Length];
FingerprintPatternMatcher.cs (2)
109relativePathCandidateMemory.Slice(stem.Length); 111relativePathCandidateMemory.Slice(0, relativePathCandidateMemory.Length - pattern.Length - 1);
Utils\Globbing\StaticWebAssetGlobMatcher.cs (7)
123stemLength += segments[i].Length; 135index += segment.Length; 214if (index > span.Length) 260if (remainingSpan.Length == 0 && j == parts.Count - 1) 288return index + minimumCharactersToConsume <= span.Length; 292return index == span.Length; 327if (extensionIndex >= segment.Length)
Utils\Globbing\StaticWebAssetGlobMatcherBuilder.cs (1)
161if (lastSegmentIndex + 1 < segmentSpan.Length)
Microsoft.NET.Sdk.WorkloadManifestReader (2)
WorkloadManifestReader.SystemTextJson.cs (2)
59span = span.Slice(utf8Bom.Length, span.Length - utf8Bom.Length);
Microsoft.NET.StringTools (18)
InternableString.cs (9)
68if (newCharIndex < _string._inlineSpan.Length) 124Length = span.Length; 188if (_inlineSpan.SequenceCompareTo(other.AsSpan(0, _inlineSpan.Length)) != 0) 195int otherStart = _inlineSpan.Length; 221if (_inlineSpan.Length == Length) 249Unsafe.CopyBlockUnaligned(destPtr, sourcePtr, 2 * (uint)_inlineSpan.Length); 251destPtr += _inlineSpan.Length; 288if (_inlineSpan.Length == Length) 327hash = GetHashCodeHelper(charPtr, _inlineSpan.Length, hash, ref hashedOddNumberOfCharacters);
SpanBasedStringBuilder.cs (9)
172if (_spans.Count == 0 || other.IsEmpty || Length != other.Length) 272while (i < span.Length && char.IsWhiteSpace(span[i])) 294while (i < span.Length && span[i] == c) 318int i = span.Length - 1; 323if (i + 1 < span.Length) 326Length -= span.Length - (i + 1); 340int i = span.Length - 1; 345if (i + 1 < span.Length) 348Length -= span.Length - (i + 1);
Microsoft.Private.Windows.Core (80)
_generated\12\Windows.Win32.byte.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\129\Windows.Win32.IDispatch.g.cs (2)
103 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 104 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\130\Windows.Win32.IDispatchEx.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\156\Windows.Win32.IPictureDisp.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\159\Windows.Win32.ISequentialStream.g.cs (2)
105 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 116 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\161\Windows.Win32.IStorage.g.cs (1)
193 winmdroot.Foundation.HRESULT __result = this.CopyTo((uint )rgiidExclude.Length, rgiidExcludeLocal, snbExcludeLocal, pstgDest);
_generated\162\Windows.Win32.IStream.g.cs (2)
91 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 102 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\164\Windows.Win32.ITypeInfo.g.cs (2)
227 if (!rgszNames.IsEmpty && !pMemId.IsEmpty && rgszNames.Length != pMemId.Length) throw new ArgumentException(); 228 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(rgszNamesLocal, (uint )(pMemId.IsEmpty ? rgszNames.Length : pMemId.Length), pMemIdLocal);
_generated\205\Windows.Win32.PInvokeCore.USER32.dll.g.cs (1)
751 int __result = PInvokeCore.MapWindowPoints(hWndFrom, hWndTo, lpPointsLocal, (uint )lpPoints.Length);
_generated\214\Windows.Win32.RECT.InlineArrays.g.cs (1)
48 int initLength = value.Length;
_generated\248\Windows.Win32.System_Com_ISequentialStream_Extensions.g.cs (2)
55 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 66 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\250\Windows.Win32.System_Com_IStream_Extensions.g.cs (2)
55 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 66 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\252\Windows.Win32.System_Com_ITypeInfo_Extensions.g.cs (2)
95 if (!rgszNames.IsEmpty && !pMemId.IsEmpty && rgszNames.Length != pMemId.Length) throw new ArgumentException(); 96 winmdroot.Foundation.HRESULT __result = @this.GetIDsOfNames(rgszNamesLocal, (uint )(pMemId.IsEmpty ? rgszNames.Length : pMemId.Length), pMemIdLocal);
_generated\255\Windows.Win32.System_Com_StructuredStorage_IStorage_Extensions.g.cs (1)
75 winmdroot.Foundation.HRESULT __result = @this.CopyTo((uint )rgiidExclude.Length, rgiidExcludeLocal, snbExcludeLocal, pstgDest);
_generated\37\Windows.Win32.char.InlineArrays.g.cs (4)
55 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 78 int initLength = value.Length; 119 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 142 int initLength = value.Length;
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\IO\PathExtensions.cs (4)
18if (path1.Length == 0) 20if (path2.Length == 0) 55Debug.Assert(first.Length > 0 && second.Length > 0, "should have dealt with empty paths");
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\IO\StreamExtensions.cs (2)
56byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 60stream.Write(sharedBuffer, 0, buffer.Length);
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\SpanExtensions.cs (1)
28for (int i = 0; i < span.Length; i++)
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\StringExtensions.cs (15)
40int length = checked(str0.Length + str1.Length); 51str1.CopyTo(resultSpan[str0.Length..]); 60int length = checked(str0.Length + str1.Length + str2.Length); 71resultSpan = resultSpan[str0.Length..]; 73resultSpan = resultSpan[str1.Length..]; 94int length = checked(str0.Length + str1.Length + str2.Length + str3.Length); 105resultSpan = resultSpan[str0.Length..]; 107resultSpan = resultSpan[str1.Length..]; 109resultSpan = resultSpan[str2.Length..];
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\Text\EncodingExtensions.cs (2)
26return encoding.GetBytes(sourcePointer, source.Length, destinationPointer, destination.Length); 44return encoding.GetString(sourcePointer, source.Length);
System\IO\Compression\RunLengthEncoder.cs (1)
44for (int i = 0; i < encoded.Length; i += 2)
System\SpanHelpers.cs (2)
17if (source.Length >= destination.Length) 25destination[source.Length] = '\0';
System\SpanReader.cs (14)
26readonly get => Span.Length - _unread.Length; 99if (count > _unread.Length) 136if (sizeof(TValue) > _unread.Length * sizeof(T)) 170if (sizeof(TValue) * count > _unread.Length * sizeof(T)) 206UnsafeAdvance(next.Length); 225count = _unread.Length; 246public void Rewind(int count) => _unread = Span[(Span.Length - _unread.Length - count)..]; 260Debug.Assert((uint)count <= (uint)_unread.Length); 261UncheckedSlice(ref _unread, count, _unread.Length - count); 267Debug.Assert((uint)length <= (uint)span.Length); 278Debug.Assert((uint)start <= (uint)span.Length && (uint)length <= (uint)(span.Length - start));
System\SpanWriter.cs (2)
46if (_unwritten.Length >= values.Length) 50UnsafeAdvance(values.Length);
System\Text\ValueStringBuilder.cs (3)
294if (pos > _chars.Length - value.Length) 296Grow(value.Length); 300_pos += value.Length;
System\TypeExtensions.cs (5)
253if (publicKey1.Length == publicKey2.Length) 258if (publicKey1.Length == 0 || publicKey2.Length == 0) 265return publicKey1.Length == PublicKeyTokenLength
Windows\Win32\Graphics\Gdi\ARGB.cs (2)
47Color[] colors = new Color[argbColors.Length]; 48for (int i = 0; i < argbColors.Length; i++)
Microsoft.SourceLink.AzureDevOpsServer.Git (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.AzureRepos.Git (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.Bitbucket.Git (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.Common (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.Gitea (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.Gitee (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.GitHub (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.GitLab (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.SourceLink.GitWeb (2)
src\sourcelink\src\Common\Utilities\Hash.cs (2)
228for (var i = 0; i < data.Length; i++) 410for (var i = 0; i < data.Length; i++)
Microsoft.Win32.Registry (4)
Microsoft\Win32\RegistryKey.cs (3)
1132while (chars.Length > 1 || (chars.Length == 1 && chars[0] != '\0')) 1163if (chars.Length == 0)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
NuGet.Commands (1)
RestoreCommand\Utility\LockFileUtils.cs (1)
857return segment.Length > roslynPrefix.Length
NuGet.ProjectModel (2)
src\nuget-client\build\Shared\Utf8JsonStreamReader.cs (2)
342_bufferUsed = leftover.Length; 345if (leftover.Length == _buffer.Length)
PresentationBuildTasks (11)
MS\Internal\MarkupCompiler\PathInternal.cs (6)
196int pathLength = path.Length; 290path.Length >= DevicePrefixLength 303return path.Length >= UncExtendedPrefixLength 328return path.Length >= DevicePrefixLength 339=> path.Length > 0 && PathInternal.IsDirectorySeparator(path[path.Length - 1]);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ReflectionUtils.cs (5)
66fullName = fullName.Slice(0, fullName.Length - nameSlice.Length + commaIndex); 108int tokenLength = tokenEnding == 0 ? assemblyName.Slice(versionIndex).Length : tokenEnding; 118int tokenLength = tokenEnding == 0 ? assemblyName.Slice(tokenIndex).Length : tokenEnding; 123if (assemblyToken.Length != 16)
PresentationCore (6)
MS\Internal\Ink\InkSerializedFormat\AlgoModule.cs (1)
48int i = DefaultFirstSquareRoot.Length - 2;
MS\Internal\Ink\InkSerializedFormat\InkSerializer.cs (3)
88int isfBase64PrefixLength = Base64HeaderBytes.Length; 2091if (data.Length < Base64HeaderBytes.Length) 2096for (int x = 0; x < Base64HeaderBytes.Length; x++)
System\Windows\Input\TextCompositionManager.cs (1)
407ptrMultiByte, multiByte.Length, ptrOutputChars, outputChars.Length);
System\Windows\PresentationSource.cs (1)
577for (int i = 1; i < visuals.Length; i++)
PresentationFramework (45)
MS\Internal\AppModel\ResourceContainer.cs (12)
199int totalLength = assemblyName.Length + assemblyVersion.Length + assemblyToken.Length; 210UpdateCachedRMW(key.Slice(0, assemblyName.Length), assembly); 215assemblyVersion.CopyTo(key.Slice(assemblyName.Length)); 216UpdateCachedRMW(key.Slice(0, assemblyName.Length + assemblyVersion.Length), assembly); 224assemblyToken.CopyTo(key.Slice(assemblyName.Length + assemblyVersion.Length)); 229assemblyToken.CopyTo(key.Slice(assemblyName.Length)); 230UpdateCachedRMW(key.Slice(0, assemblyName.Length + assemblyToken.Length), assembly);
MS\Internal\Commands\CommandHelpers.cs (1)
104for (int i = 0; i < inputGestures.Length; i++)
MS\Internal\Globalization\BamlResourceContent.cs (6)
103StringBuilder stringBuilder = new(contentSpan.Length); 106for (int i = firstEscapeToken; i < contentSpan.Length; i++) 110if (contentSpan.Length > i + 1) // Check whether we're at the end 131if (contentSpan.Length > 5 && contentSpan[5] == ';') 146else if (contentSpan.Length > 4 && contentSpan[4] == ';') 155else if (contentSpan.Length > 3 && contentSpan[3] == ';')
MS\Internal\Ink\LassoHelper.cs (2)
167int marginCount = (points.Length * percentIntersect) / 100; 169if ((0 == marginCount) || (50 <= ((points.Length * percentIntersect) % 100)))
MS\Internal\PtsHost\ListMarkerSourceInfo.cs (2)
249for (int i = 0; i < RomanNumericSizeIncrements.Length; i++) 261if (i < RomanNumericSizeIncrements.Length - 1)
MS\Internal\TraceData.cs (1)
92for (int i = 0; i < parameters.Length; i++)
System\Windows\Controls\DataGridLengthConverter.cs (2)
242if (valueSpan.Length == strLenUnit) 258ReadOnlySpan<char> valueString = valueSpan.Slice(0, valueSpan.Length - strLenUnit);
System\Windows\Controls\DocumentViewer.cs (3)
1137(_zoomLevelIndex < ZoomLevelCollection.Length - 1)) 2223if ((_zoomLevelIndex < 0) || (_zoomLevelIndex >= ZoomLevelCollection.Length)) 2245for (loopIndex = 0; loopIndex < ZoomLevelCollection.Length - 1; loopIndex++)
System\Windows\Controls\VirtualizingStackPanel.cs (1)
12250return args.IsEmpty ? string.Empty : string.Format(CultureInfo.InvariantCulture, s_format[args.Length], args);
System\Windows\Documents\TextStore.cs (1)
4838return args.IsEmpty ? string.Empty : string.Format(CultureInfo.InvariantCulture, s_format[args.Length], args);
System\Windows\Documents\XamlToRtfWriter.cs (6)
3545if (s.Length == 0) 3551int n = s.Length - 1; 3558if (n < s.Length - 1) 3814while (s < thickness.Length) 3818while (e < thickness.Length && thickness[e] != ',') 3824if (onenum.Length > 0)
System\Windows\LengthConverter.cs (1)
204valueSpan = valueSpan.Slice(0, valueSpan.Length - pixelUnit.Name.Length);
System\Windows\Markup\Primitives\ExtensionSimplifierMarkupObject.cs (2)
357if (value.Length > 1 && value[1] == '}') 371for (int i = 0; i < value.Length; i++)
System\Windows\Markup\Primitives\MarkupWriter.cs (1)
1640for (int i = 0; i < ns.Length; i++)
System\Windows\Markup\XamlFigureLengthSerializer.cs (2)
229if (valueSpan.Length == strLenUnit && unit != FigureUnitType.Pixel) 240ReadOnlySpan<char> valueString = valueSpan.Slice(0, valueSpan.Length - strLenUnit);
System\Windows\Markup\XamlGridLengthSerializer.cs (2)
229if (valueSpan.Length == strLenUnit 240ReadOnlySpan<char> valueString = valueSpan.Slice(0, valueSpan.Length - strLenUnit);
PresentationUI (3)
MS\Internal\Documents\DocumentApplicationDocumentViewer.cs (3)
1856if ((!culture.IsNeutralCulture) && (zoomString.Length > 0)) 1864if (zoomString.Length - 1 == zoomString.LastIndexOf( 1868zoomString = zoomString.Slice(0, zoomString.Length - 1);
RepoTasks (22)
_generated\0\RegexGenerator.g.cs (22)
120base.runtextpos != inputSpan.Length) 138if (pos <= inputSpan.Length - 14) 151base.runtextpos = inputSpan.Length; 175while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 202iteration1 = slice.Length; 280base.runtextpos = inputSpan.Length; 292if (pos <= inputSpan.Length - 3) 302base.runtextpos = inputSpan.Length; 326iteration = slice.Length; 349iteration1 = slice.Length - 1; 362if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n')) 412base.runtextpos != inputSpan.Length) 430if (pos <= inputSpan.Length - 4) 433if (pos < inputSpan.Length - 5) 435base.runtextpos = inputSpan.Length - 5; 441base.runtextpos = inputSpan.Length; 506if ((uint)slice.Length < 2) 516if ((uint)slice.Length < 3 || slice[2] != 't') 528if ((uint)slice.Length < 3 || slice[2] != 'r') 577if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
Roslyn.Diagnostics.Analyzers (49)
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
828var sb = new StringBuilder(path.Length); 831if (path.Length > 1 && IsAnyDirectorySeparator(path[0]) && IsAnyDirectorySeparator(path[1])) 839for (int i = start; i < path.Length; i++)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
135uint length = (uint)source.Length;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
253state.TotalLength += (uint)source.Length; 258if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 260source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 261state.BufferedCount += (uint)source.Length; 281Debug.Assert(sourceIndex < source.Length); 284if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 286ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 316else if (source.Length - sourceIndex > InternalBufferLengthBytes) 324while (source.Length - sourceIndex > InternalBufferLengthBytes); 331Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 332Debug.Assert(sourceIndex < source.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (1)
50int length = path.Length;
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (3)
235for (int i = 0; i < data.Length; i++) 299for (int i = 0; i < data.Length; i++) 403for (int i = 0; i < data.Length; i++)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
413text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length); 532for (var i = 0; i < ascii.Length; i++) 538if (ascii.Length != text.Length) 543for (var i = 0; i < ascii.Length; i++)
src\roslyn\src\Dependencies\Collections\Extensions\MemoryExtensions.cs (1)
20int high = span.Length - 1;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
125if (remaining[index] == '\r' && remaining.Length > index + 1 && remaining[index + 1] == '\n')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
330WriteArrayLength(span.Length); 368var spanLength = span.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (11)
87while (chars.Length != 0) 98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 106if (indexOfFirstNonSpace == chars.Length) 115if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0) 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 155for (int i = 0; i < chars.Length; i++) 178for (int i = 0; i < chars.Length; i++) 191consumed = chars.Length; 199int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4. 205if (utf16.Length == 0) 305if (srcLength != utf16.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
170return source.Length <= target.Length 182Debug.Assert(source.Length <= target.Length); 187while (source.Length > 0 && source[^1] == target[^1]) 193while (source.Length > 0 && source[0] == target[0]) 207var sourceLength = source.Length; 208var targetLength = target.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
25for (var start = 0; start < text.Length;) 43var length = identifier.Length;
Roslyn.Diagnostics.CSharp.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
310for (var i = 0; i < names.Length; i++)
Shared (14)
ServerSentEvents\Helpers.cs (6)
52Span<byte> buffer = writer.GetSpan(value.Length); 53Debug.Assert(value.Length <= buffer.Length); 55writer.Advance(value.Length); 65int maxByteCount = Encoding.UTF8.GetMaxByteCount(value.Length); 75bytesWritten = Encoding.UTF8.GetBytes(chars, value.Length, bytes, maxByteCount); 122Encoding.UTF8.GetString(ptr, bytes.Length);
ServerSentEvents\SseFormatter.cs (1)
156if (data[i++] == '\r' && i < data.Length && data[i] == '\n')
ServerSentEvents\SseParser_1.cs (7)
125while (FillLineBuffer() != 0 && _lineLength < Utf8Bom.Length); 205while (await FillLineBufferAsync(cancellationToken).ConfigureAwait(false) != 0 && _lineLength < Utf8Bom.Length) ; 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 394(remainder[0] is LF || (remainder[0] is CR && remainder.Length > 1))) 396advance = line.Length + newlineLength + (remainder.StartsWith(CRLF) ? 2 : 1); 420_dataLength += fieldValue.Length; 462advance = line.Length + GetNewLineLength();
System.Collections (3)
src\runtime\src\libraries\Common\src\System\Collections\Generic\BitHelper.cs (1)
45bitArrayIndex < (uint)span.Length &&
System\Collections\Generic\PriorityQueue.cs (2)
887for (int i = 0; i < nodes.Length; i++) 897for (int i = 0; i < nodes.Length; i++)
System.Collections.Immutable (46)
System\Collections\Frozen\FrozenDictionary.cs (1)
54Dictionary<TKey, TValue> d = new(source.Length, comparer);
System\Collections\Frozen\FrozenHashTable.cs (10)
154Debug.Assert(hashCodes.Length != 0); 155Debug.Assert(!hashCodesAreUnique || new HashSet<int>(hashCodes.ToArray()).Count == hashCodes.Length); 164int uniqueCodesCount = hashCodes.Length; 169new HashSet<int>(hashCodes.Length); 189if (minNumBuckets + hashCodes.Length > Array.MaxLength) 199while ((uint)minPrimeIndexInclusive < (uint)primes.Length && minNumBuckets > primes[minPrimeIndexInclusive]) 204if (minPrimeIndexInclusive >= primes.Length) 217while ((uint)maxPrimeIndexExclusive < (uint)primes.Length && maxNumBuckets > primes[maxPrimeIndexExclusive]) 222if (maxPrimeIndexExclusive < primes.Length) 247if (codes is not null && uniqueCodesCount != hashCodes.Length)
System\Collections\Frozen\FrozenSet.cs (2)
31if (source.Length == 0) 40new(source.Length, equalityComparer); // we assume there are few-to-no duplicates when using this API
System\Collections\Frozen\String\Hashing.cs (2)
26int length = s.Length; 89int length = s.Length;
System\Collections\Frozen\String\KeyAnalyzer.cs (2)
52int acceptableNonUniqueCount = uniqueStrings.Length / 20; 66uniqueStrings.Length,
System\Collections\Frozen\String\LengthBucketsFrozenDictionary.AlternateLookup.cs (1)
32int bucketIndex = (key.Length - _minLength) * LengthBuckets.MaxPerLength;
System\Collections\Frozen\String\LengthBucketsFrozenSet.AlternateLookup.cs (1)
32int bucketIndex = (item.Length - _minLength) * LengthBuckets.MaxPerLength;
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedCaseInsensitiveAsciiSubstring.cs (1)
28private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedCaseInsensitiveSubstring.cs (1)
28private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSingleChar.cs (1)
27private protected override int GetHashCode(ReadOnlySpan<char> s) => s[s.Length + HashIndex];
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSubstring.cs (1)
28private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinal(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.AlternateLookup.cs (2)
36if ((uint)(key.Length - _minimumLength) <= (uint)_maximumLengthDiff) 38if (CheckLengthQuick((uint)key.Length))
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedCaseInsensitiveAsciiSubstring.cs (1)
27private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedCaseInsensitiveSubstring.cs (1)
27private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSingleChar.cs (1)
24private protected override int GetHashCode(ReadOnlySpan<char> s) => s[s.Length + HashIndex];
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSubstring.cs (1)
25private protected override int GetHashCode(ReadOnlySpan<char> s) => Hashing.GetHashCodeOrdinal(s.Slice(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet.AlternateLookup.cs (2)
36if ((uint)(item.Length - _minimumLength) <= (uint)_maximumLengthDiff) 38if (CheckLengthQuick((uint)item.Length))
System\Collections\Immutable\ImmutableArray_1.Builder.cs (5)
436this.Count += items.Length; 438items.CopyTo(new Span<T>(_elements, offset, items.Length)); 449this.Count += items.Length; 451var elements = new Span<T>(_elements, offset, items.Length); 452for (int i = 0; i < items.Length; i++)
System\Collections\Immutable\ImmutableArray_1.cs (4)
990if (items.Length == 1) 1514var tmp = new T[Length + items.Length]; 1519items.CopyTo(new Span<T>(tmp, index, items.Length)); 1522Array.Copy(array!, index, tmp, index + items.Length, Length - index);
System\Collections\Immutable\ImmutableList_1.Node.cs (2)
273int rightCount = (items.Length - 1) / 2; 274int leftCount = (items.Length - 1) - rightCount;
System\Collections\Immutable\ImmutableQueue.cs (1)
95for (int i = items.Length - 1; i >= 0; i--)
System\Collections\Immutable\ImmutableSortedSet_1.cs (3)
332if (this.IsEmpty || (this.Count + other.Length) * RefillOverIncrementalThreshold > this.Count) 1252list = new List<T>(addedItems.Length); 1259list = new List<T>(this.Count + addedItems.Length);
System.Collections.Specialized (1)
System\Collections\Specialized\BitVector32.cs (1)
169dst = dst.Slice(prefix.Length, 32);
System.CommandLine (2)
Parsing\StringExtensions.cs (2)
211for (int i = 0; i < alias.Length; i++) 233if (i != alias.Length - 1 && ((Option)found.Symbol!).Greedy)
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\PhoneAttribute.cs (1)
110if (potentialExtension.Length == 0)
System.ComponentModel.TypeConverter (8)
_generated\0\RegexGenerator.g.cs (4)
71base.runtextpos != inputSpan.Length) 89if (pos <= inputSpan.Length - 4) 102base.runtextpos = inputSpan.Length; 115if ((uint)slice.Length < 4 ||
System\Drawing\PointConverter.cs (1)
30if (text.Length == 0)
System\Drawing\RectangleConverter.cs (1)
30if (text.Length == 0)
System\Drawing\SizeConverter.cs (1)
30if (text.Length == 0)
System\Drawing\SizeFConverter.cs (1)
30if (text.Length == 0)
System.Console (12)
src\runtime\src\libraries\Common\src\System\Text\ConsoleEncoding.cs (1)
11if (encoding.Preamble.Length == 0)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\ConsolePal.Unix.cs (2)
654for (int i = 0; i < src.Length; i++) 986int count = buffer.Length;
System\IO\CachedConsoleStream.cs (1)
27int maxCharCount = _encoding.GetMaxCharCount(buffer.Length);
System\IO\KeyParser.cs (4)
60if (input.Length < MinimalSequenceLength || input[0] != Escape || (input[1] != '[' && input[1] != 'O')) 71if (input[1] == 'O' || char.IsAsciiLetter(input[2]) || input.Length == MinimalSequenceLength) 122|| SequencePrefixLength + digitCount >= input.Length) // it's too short to be a complete sequence 155|| SequencePrefixLength + digitCount + 2 >= input.Length
System\IO\StdInReader.cs (1)
61int maxCharsCount = _encoding.GetMaxCharCount(buffer.Length);
System.Data.Common (29)
_generated\0\RegexGenerator.g.cs (17)
120base.runtextpos = inputSpan.Length; 132if ((uint)pos < (uint)inputSpan.Length) 142base.runtextpos = inputSpan.Length; 195while ((uint)iteration < (uint)slice.Length && (char.GetUnicodeCategory(slice[iteration]) != UnicodeCategory.Control)) 241if ((uint)(pos - 1) >= inputSpan.Length || !char.IsWhiteSpace(inputSpan[pos - 1])) 257if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 307base.runtextpos = inputSpan.Length; 325base.runtextpos = inputSpan.Length; 348while ((uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < 128 ? ("\0\0コ\ud7ff\uffff\uffff\uffff翿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\b\u0002\"#'(;<=>d\u000f"))) 358if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 408base.runtextpos = inputSpan.Length; 420if (pos <= inputSpan.Length - 2) 430base.runtextpos = inputSpan.Length; 560if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n'))
System\Data\Filter\Operators.cs (1)
142return (uint)op < (uint)priorities.Length ? priorities[op] : PriMax;
System\Data\SQLTypes\SQLBytes.cs (7)
331return span.Length; 352if (buffer.Length > _rgbBuf.Length - offset) 420if (buffer.Length != 0) 422Span<byte> span = _rgbBuf.AsSpan((int)offset, buffer.Length); 427if (_lCurLen < offset + buffer.Length) 428_lCurLen = offset + buffer.Length; 763_lPosition += buffer.Length;
System\Data\SQLTypes\SQLDecimal.cs (4)
786Debug.Assert(rglData.Length >= 4); 2471Debug.Assert(rgulS.Length >= ciulS, "rgulS.Length >= ciulS", "Invalid array length"); 2612Debug.Assert(rgulU.Length == s_cNumeMax); 3032Debug.Assert(rguiData.Length == 4);
System.Data.Odbc (17)
_generated\1\RegexGenerator.g.cs (17)
120base.runtextpos = inputSpan.Length; 132if ((uint)pos < (uint)inputSpan.Length) 142base.runtextpos = inputSpan.Length; 195while ((uint)iteration < (uint)slice.Length && (char.GetUnicodeCategory(slice[iteration]) != UnicodeCategory.Control)) 241if ((uint)(pos - 1) >= inputSpan.Length || !char.IsWhiteSpace(inputSpan[pos - 1])) 257if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 307base.runtextpos = inputSpan.Length; 325base.runtextpos = inputSpan.Length; 348while ((uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < 128 ? ("\0\0コ\ud7ff\uffff\uffff\uffff翿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\b\u0002\"#'(;<=>d\u000f"))) 358if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 408base.runtextpos = inputSpan.Length; 420if (pos <= inputSpan.Length - 2) 430base.runtextpos = inputSpan.Length; 560if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n'))
System.Data.OleDb (17)
_generated\4\RegexGenerator.g.cs (17)
120base.runtextpos = inputSpan.Length; 132if ((uint)pos < (uint)inputSpan.Length) 142base.runtextpos = inputSpan.Length; 195while ((uint)iteration < (uint)slice.Length && (char.GetUnicodeCategory(slice[iteration]) != UnicodeCategory.Control)) 241if ((uint)(pos - 1) >= inputSpan.Length || !char.IsWhiteSpace(inputSpan[pos - 1])) 257if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 307base.runtextpos = inputSpan.Length; 325base.runtextpos = inputSpan.Length; 348while ((uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < 128 ? ("\0\0コ\ud7ff\uffff\uffff\uffff翿"[ch >> 4] & (1 << (ch & 0xF))) != 0 : RegexRunner.CharInClass((char)ch, "\u0001\b\u0002\"#'(;<=>d\u000f"))) 358if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 408base.runtextpos = inputSpan.Length; 420if (pos <= inputSpan.Length - 2) 430base.runtextpos = inputSpan.Length; 560if (2 < slice.Length || (1 < slice.Length && slice[1] != '\n'))
System.Diagnostics.DiagnosticSource (47)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Diagnostics\Activity.cs (7)
1963if (idData.Length != 16) 1972if (idData.Length != 32 || !ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData)) 2020if (idData.Length != 32) 2079Debug.Assert(outBytes.Length * 2 == charData.Length); 2130if (idData.Length != 8) 2139if (idData.Length != 16 || !ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData)) 2184if (idData.Length != 16)
System\Diagnostics\DsesFilterAndTransform.cs (3)
239if (suffixPart.Length > 0) 295if (eventName.Length > 0) 326if (activityName.Length > 0 && activitySourceName.Length == 1 && activitySourceName[0] == '*')
System\Diagnostics\Metrics\AggregatorStore.cs (5)
336int expectedLabels = labels.Length; 343if (l.Length != expectedLabels) 398LabelInstruction[] valueFetches = new LabelInstruction[labels.Length]; 399for (int i = 0; i < labels.Length; i++) 438if (labels.Length != _expectedLabelCount)
System\Diagnostics\Metrics\RuntimeMetrics.cs (1)
21private static readonly int s_maxGenerations = Math.Min(GC.GetGCMemoryInfo().GenerationInfo.Length, s_genNames.Length);
System\Diagnostics\Metrics\TagList.netcore.cs (3)
40_tagsCount = tagList.Length; 284for (int i = 0; i < tags.Length; i++) 294for (int i = 0; i < tags.Length; i++)
System\Diagnostics\W3CPropagator.cs (15)
120if (keyValueSeparator <= 0 || keyValueSeparator >= currentEntry.Length - 1) 136} while (baggageSpan.Length > 0); 189if (equalIndex <= 0 || equalIndex >= entry.Length - 1) 201int nextLength = vsb.Length + entry.Length + (vsb.Length > 0 ? 1 : 0); 303for (int i = 0; i < valueSpan.Length; i++) 332if (i + 5 >= valueSpan.Length || valueSpan[i + 3] != Percent || !TryDecodeEscapedByte(valueSpan.Slice(i + 3), out byte b1) || (b1 & 0xC0) != 0x80) 348if (i + 8 >= valueSpan.Length || 369if (i + 11 >= valueSpan.Length || 414Debug.Assert(span.Length > 0 && span[0] == Percent); 416if (span.Length < 3 || !TryDecodeHexDigit(span[1], out byte byte1) || !TryDecodeHexDigit(span[2], out byte byte2)) 454key.Length > MaxTraceStateKeyLength || 465value.IsEmpty || value.Length > MaxTraceStateValueLength || value[value.Length - 1] == Space || 517for (int i = indexOfInvalidCharacter; i < value.Length; i++) 543if (i < value.Length - 1 && char.IsSurrogatePair(c, value[i + 1]))
System.Diagnostics.EventLog (2)
_generated\0\LibraryImports.g.cs (2)
1468for (int __i0 = 0; __i0 < __valuePaths_native__managedSpan.Length; ++__i0, ++__valuePaths_native__lastIndexMarshalled) 1666for (int __i0 = 0; __i0 < __values_native__managedSpan.Length; ++__i0, ++__values_native__lastIndexMarshalled)
System.Diagnostics.FileVersionInfo (1)
System\Diagnostics\FileVersionInfo.Unix.cs (1)
234for (int index = 0; index < s.Length; index++)
System.Diagnostics.PerformanceCounter (15)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
System\Diagnostics\PerformanceCounterLib.cs (14)
136dataBlock.Validate(data.Length); 151perfObject.Validate(dataSpan.Length); 165perfCounter.Validate(dataSpan.Length); 1394dataBlock.Validate(data.Length); 1416perfObjectType.Validate(dataSpan.Length); 1453perfCounter.Validate(dataSpan.Length); 1493perfInstance.Validate(dataSpan.Length); 1527perfCounterBlock.Validate(dataSpan.Length); 1541dataBlock.Validate(data.Length); 1552type.Validate(dataSpan.Length); 1568perfObject.Validate(dataSpan.Length); 1582perfCounterDefinition.Validate(dataSpan.Length); 1592perfInstance.Validate(dataSpan.Length); 1599perfCounterBlock.Validate(dataSpan.Length);
System.Diagnostics.Process (23)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (6)
32if (mount.MountPoint.Length < currentBestLength) 42if (mount.MountPoint.Length == path.Length) 48if (mount.MountPoint.Length > 1 && path[mount.MountPoint.Length] != '/') 53currentBestLength = mount.MountPoint.Length; 58if (currentFormat.Length > 0)
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
144if (span.Length > 0 && span[0] == '+') 167if (span.Length > 0 && span[0] == '+')
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\SpanOfCharAsUtf8StringMarshaller.cs (1)
41if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Diagnostics\Process.Multiplexing.cs (10)
206if (preamble.Length > 0 && byteBuffer.Length >= preamble.Length 207&& byteBuffer.Slice(0, preamble.Length).SequenceEqual(preamble)) 209return preamble.Length; 213if (byteBuffer.Length >= 2) 227if (byteBuffer.Length >= 4 && byteBuffer[2] == 0 && byteBuffer[3] == 0) 239if (byteBuffer.Length >= 3 && firstTwoBytes == 0xBBEF && byteBuffer[2] == 0xBF) 246if (byteBuffer.Length >= 4 && firstTwoBytes == 0 && byteBuffer[2] == 0xFE && byteBuffer[3] == 0xFF) 352if (!preambleChecked && unconsumedBytes.Length > 0)
System\Diagnostics\Process.Multiplexing.Unix.cs (1)
235if (bytes.Length >= MaxEncodingBytesLength)
System.DirectoryServices.Protocols (1)
System\DirectoryServices\Protocols\Interop\LdapPal.Linux.cs (1)
131bv_len = new CLong(MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)passwordPtr).Length),
System.Drawing.Common (79)
_generated\3\Windows.Win32.byte.InlineArrays.g.cs (1)
60 int initLength = value.Length;
System\Drawing\Drawing2D\GraphicsPath.cs (22)
43if (pts.Length != types.Length) 52PInvokeGdiPlus.GdipCreatePath2((GdiPlus.PointF*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); 79if (pts.Length != types.Length) 88PInvokeGdiPlus.GdipCreatePath2I((GdiPlus.Point*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed(); 334if (points.Length == 0) 341PInvokeGdiPlus.GdipAddPathLine2(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); 361if (points.Length == 0) 368PInvokeGdiPlus.GdipAddPathLine2I(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); 413PInvokeGdiPlus.GdipAddPathBeziers(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); 435if (points.Length == 0) 440PInvokeGdiPlus.GdipAddPathBeziersI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); 499points.Length, 547points.Length, 575PInvokeGdiPlus.GdipAddPathClosedCurve2(_nativePath, (GdiPlus.PointF*)p, points.Length, tension).ThrowIfFailed(); 605PInvokeGdiPlus.GdipAddPathClosedCurve2I(_nativePath, (GdiPlus.Point*)p, points.Length, tension).ThrowIfFailed(); 634PInvokeGdiPlus.GdipAddPathRectangles(_nativePath, (RectF*)r, rects.Length).ThrowIfFailed(); 654PInvokeGdiPlus.GdipAddPathRectanglesI(_nativePath, (Rect*)r, rects.Length).ThrowIfFailed(); 743PInvokeGdiPlus.GdipAddPathPolygon(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed(); 764PInvokeGdiPlus.GdipAddPathPolygonI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed(); 915destPoints.Length,
System\Drawing\Drawing2D\Matrix.cs (4)
277pts.Length).ThrowIfFailed(); 306pts.Length).ThrowIfFailed(); 335pts.Length).ThrowIfFailed(); 369pts.Length).ThrowIfFailed();
System\Drawing\Drawing2D\PathGradientBrush.cs (4)
40if (points.Length < 2) 48points.Length, 81if (points.Length < 2) 89points.Length,
System\Drawing\Font.cs (1)
502if (name.Length > 1 && name[0] == '@')
System\Drawing\FontFamily.cs (1)
95Debug.Assert(n is null || n[name.Length] == '\0', "Expected null-terminated string.");
System\Drawing\Graphics.cs (31)
770CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectangles(NativeGraphics, pen.NativePen, (RectF*)r, rects.Length)); 795CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectanglesI(NativeGraphics, pen.NativePen, (Rect*)r, rects.Length)); 869CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygon(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); 894CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygonI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); 929CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); 954(GdiPlus.PointF*)p, points.Length, 990(GdiPlus.PointF*)p, points.Length, 1014CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurveI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); 1039(GdiPlus.Point*)p, points.Length, 1072(GdiPlus.Point*)p, points.Length, 1100(GdiPlus.PointF*)p, points.Length)); 1131(GdiPlus.PointF*)p, points.Length, 1156(GdiPlus.Point*)p, points.Length)); 1182(GdiPlus.Point*)p, points.Length, 1266CheckErrorStatus(PInvokeGdiPlus.GdipFillRectangles(NativeGraphics, brush.NativeBrush, (RectF*)r, rects.Length)); 1288CheckErrorStatus(PInvokeGdiPlus.GdipFillRectanglesI(NativeGraphics, brush.NativeBrush, (Rect*)r, rects.Length)); 1321(GdiPlus.PointF*)p, points.Length, 1360(GdiPlus.Point*)p, points.Length, 1463(GdiPlus.PointF*)p, points.Length)); 1504(GdiPlus.PointF*)p, points.Length, 1531(GdiPlus.Point*)p, points.Length)); 1567(GdiPlus.Point*)p, points.Length, 1749c, s.Length, 1811text.Length, 1979text.Length, 2377CheckErrorStatus(PInvokeGdiPlus.GdipDrawLines(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length)); 2424CheckErrorStatus(PInvokeGdiPlus.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length)); 2606pts.Length)); 2632pts.Length)); 2807(GdiPlus.PointF*)p, points.Length)); 2839points.Length));
System\Drawing\Icon.cs (2)
551_handle = PInvoke.CreateIconFromResourceEx(b, (uint)bestImage.Length, fIcon: true, 0x00030000, 0, 0, 0); 558_handle = PInvoke.CreateIconFromResourceEx(b, (uint)bestImage.Length, fIcon: true, 0x00030000, 0, 0, 0);
System\Drawing\Imaging\ColorMatrix.cs (1)
340ArgumentOutOfRangeException.ThrowIfNotEqual(newColorMatrix.Length, 25, nameof(newColorMatrix));
System\Drawing\Imaging\Effects\ColorLookupTableEffect.cs (4)
41ArgumentOutOfRangeException.ThrowIfGreaterThan(redLookupTable.Length, 256, nameof(redLookupTable)); 42ArgumentOutOfRangeException.ThrowIfGreaterThan(greenLookupTable.Length, 256, nameof(greenLookupTable)); 43ArgumentOutOfRangeException.ThrowIfGreaterThan(blueLookupTable.Length, 256, nameof(blueLookupTable)); 44ArgumentOutOfRangeException.ThrowIfGreaterThan(alphaLookupTable.Length, 256, nameof(alphaLookupTable));
System\Drawing\Imaging\ImageAttributes.cs (6)
361using BufferScope<(ARGB, ARGB)> buffer = new(stackBuffer, map.Length); 363for (int i = 0; i < map.Length; i++) 374(uint)map.Length, 386using BufferScope<(ARGB, ARGB)> buffer = new(stackBuffer, map.Length); 388for (int i = 0; i < map.Length; i++) 399(uint)map.Length,
System\Drawing\Imaging\ImageCodecInfo.cs (2)
83ImageCodecInfo[] codecs = new ImageCodecInfo[codecInfo.Length]; 85for (int i = 0; i < codecInfo.Length; i++)
System.Drawing.Primitives (3)
System\Drawing\KnownColorTable.cs (3)
478Debug.Assert(ColorValueTable.Length == ColorKindTable.Length); 481for (int index = 1; index < colorValueTable.Length; ++index)
System.Formats.Asn1 (134)
System\Formats\Asn1\Asn1Tag.cs (1)
184if (source.Length <= bytesConsumed)
System\Formats\Asn1\AsnCharacterStringEncodings.cs (9)
218for (int i = 0; i < chars.Length; i++) 236return chars.Length; 246for (int i = 0; i < bytes.Length; i++) 266return bytes.Length; 287for (int i = 0; i < chars.Length; i++) 320if (bytes.Length % 2 != 0) 323bytes.Slice(bytes.Length - 1).ToArray(), 324bytes.Length - 1); 332for (int i = 0; i < bytes.Length; i += 2)
System\Formats\Asn1\AsnCharacterStringEncodings.net.cs (10)
38if (chars.Length >= Vector<byte>.Count && Vector.IsHardwareAccelerated) 43for (; position < chars.Length; position++) 61return chars.Length; 68if (bytes.Length >= Vector<byte>.Count && Vector.IsHardwareAccelerated) 73for (; position < bytes.Length; position++) 93return bytes.Length; 100int available = write ? Math.Min(chars.Length, bytes.Length) : chars.Length; 135int available = write ? Math.Min(bytes.Length, chars.Length) : bytes.Length;
System\Formats\Asn1\AsnDecoder.BitString.cs (17)
82if (localValue.Length == 0 || normalizedLastByte == localValue[localValue.Length - 1]) 189if (value.Length > destination.Length) 199bytesWritten = value.Length; 295if (localValue.Length > 0) 340if (ruleSet == AsnEncodingRules.CER && source.Length > MaxCERSegmentSize) 346if (source.Length == 0) 359if (source.Length == 1) 378byte lastByte = source[source.Length - 1]; 404if (value.Length == 0) 411destination[value.Length - 1] = normalizedLastByte; 502int localLen = headerLength + encodedValue.Length; 506totalLength += contents.Length; 507lastSegmentLength = encodedValue.Length; 512curDest = curDest.Slice(contents.Length); 552readerStack.Push((curOffset, cur.Length, isIndefinite, bytesRead)); 672bytesConsumed = headerLength + encodedValue.Length;
System\Formats\Asn1\AsnDecoder.Boolean.cs (1)
59if (contents.Length != 1)
System\Formats\Asn1\AsnDecoder.cs (11)
205bytesConsumed = headerLength + ret.Length; 374if (lengthLength + 1 > source.Length) 513if (totalLength > source.Length) 611cur = cur.Slice(tlv.Length); 612totalLen += tlv.Length; 631consumed == data.Length) 641int len = Math.Min(longestPermitted, source.Length); 649if (length < 0 || source.Length - offset < length) 668if (lengthVal < 0 || source.Length - offset < lengthVal) 685return bigger.Slice(offset, smaller.Length); 1042_data = _data.Slice(encodedValue.Length);
System\Formats\Asn1\AsnDecoder.GeneralizedTime.cs (6)
74CryptoPool.Return(rented, contents.Length); 117if (strict && contentOctets.Length < 15) 122else if (contentOctets.Length < 10) 165while (state == HmsState && contents.Length != 0) 251if (contents.Length != 0) 303if (contents.Length != 0)
System\Formats\Asn1\AsnDecoder.Integer.cs (5)
443if (contents.Length > sizeLimit) 453for (int i = 0; i < contents.Length; i++) 492if (contents.Length > 1 && contents[0] == 0) 497if (contents.Length > sizeLimit) 506for (int i = 0; i < contents.Length; i++)
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (2)
368Debug.Assert(valueSpan.Length <= sizeof(long)); 373for (int byteIdx = 0; byteIdx < valueSpan.Length; byteIdx++)
System\Formats\Asn1\AsnDecoder.Null.cs (1)
56if (contents.Length != 0)
System\Formats\Asn1\AsnDecoder.OctetString.cs (10)
86if (contents.Length > destination.Length) 94bytesWritten = contents.Length; 177CryptoPool.Return(rented, contents.Length); 214if (ruleSet == AsnEncodingRules.CER && encodedValue.Length > MaxCERSegmentSize) 220bytesConsumed = headerLength + encodedValue.Length; 361int localLen = headerLength + contents.Length; 365totalLength += contents.Length; 366lastSegmentLength = contents.Length; 377curDest = curDest.Slice(contents.Length); 417readerStack.Push((curOffset, cur.Length, isIndefinite, bytesRead));
System\Formats\Asn1\AsnDecoder.Oid.cs (4)
85Debug.Assert(source.Length > 0); 127for (idx = 0; idx < source.Length; idx++) 234if (contents.Length < 1) 250StringBuilder builder = new StringBuilder(((byte)contents.Length) * 4);
System\Formats\Asn1\AsnDecoder.Sequence.cs (1)
78if (length.Value > source.Length - headerLength)
System\Formats\Asn1\AsnDecoder.SetOf.cs (2)
125contentLength = contents.Length; 126bytesConsumed = headerLength + contents.Length + suffix;
System\Formats\Asn1\AsnDecoder.Text.cs (4)
352if (contents.Length > destination.Length) 360bytesWritten = contents.Length; 416CryptoPool.Return(rented, contents.Length); 456CryptoPool.Return(rented, contents.Length);
System\Formats\Asn1\AsnDecoder.UtcTime.cs (12)
99Debug.Fail($"UtcTime did not fit in tmpSpace ({contents.Length} total)"); 100CryptoPool.Return(rented, contents.Length); 134if (contentOctets.Length != HasSecondsZulu) 142if (contentOctets.Length < NoSecondsZulu || 143contentOctets.Length > HasSecondsOffset || 144(contentOctets.Length & 1) != 1) 161if (contentOctets.Length == HasSecondsOffset || 162contentOctets.Length == HasSecondsZulu) 167if (contentOctets.Length == NoSecondsZulu || 168contentOctets.Length == HasSecondsZulu) 178contentOctets.Length == NoSecondsOffset || 179contentOctets.Length == HasSecondsOffset);
System\Formats\Asn1\AsnWriter.BitString.cs (10)
57if (bitString.Length == 0 && unusedBitCount != 0) 62byte lastByte = bitString.IsEmpty ? (byte)0 : bitString[bitString.Length - 1]; 80if (bitString.Length >= AsnReader.MaxCERSegmentSize) 90WriteLength(bitString.Length + 1); 94_offset += bitString.Length; 147Debug.Assert(payload.Length > MaxCERContentSize); 149int expectedSize = DetermineCerBitStringTotalLength(tag, payload.Length); 164while (remainingData.Length > MaxCERContentSize) 181WriteLength(remainingData.Length + 1); 188_offset += remainingData.Length;
System\Formats\Asn1\AsnWriter.cs (3)
581if (!read || consumed != value.Length) 588EnsureWriteCapacity(value.Length); 590_offset += value.Length;
System\Formats\Asn1\AsnWriter.Integer.cs (6)
227if (value.Length > 1 && value[0] == 0 && value[1] < 0x80) 237WriteLength(checked(value.Length + 1)); 243WriteLength(value.Length); 247_offset += value.Length; 272WriteLength(value.Length); 275_offset += value.Length;
System\Formats\Asn1\AsnWriter.OctetString.cs (8)
88if (octetString.Length > AsnReader.MaxCERSegmentSize) 97WriteLength(octetString.Length); 99_offset += octetString.Length; 106Debug.Assert(payload.Length > MaxCERSegmentSize); 111int fullSegments = Math.DivRem(payload.Length, MaxCERSegmentSize, out int lastSegmentSize); 144while (remainingData.Length > MaxCERSegmentSize) 158WriteLength(remainingData.Length); 161_offset += remainingData.Length;
System\Formats\Asn1\AsnWriter.Oid.cs (7)
65WriteLength(wellKnownContents.Length); 67_offset += wellKnownContents.Length; 81if (oidValue.Length < 3) 89byte[] tmp = CryptoPool.Rent(oidValue.Length / 2); 153endIndex = oidValue.Length; 155else if (endIndex == 0 || endIndex == oidValue.Length - 1) 173oidValue = oidValue.Slice(Math.Min(oidValue.Length, endIndex + 1));
System\Formats\Asn1\SetOfValueComparer.cs (4)
17int min = Math.Min(x.Length, y.Length); 35return x.Length - y.Length;
System.Formats.Cbor (24)
System\Formats\Cbor\CborConformanceLevel.cs (8)
229if (left.Length != right.Length) 231return left.Length - right.Length; 248if (left.Length != right.Length) 250return left.Length - right.Length;
System\Formats\Cbor\Reader\CborReader.cs (1)
325if (buffer.Length < requiredLength)
System\Formats\Cbor\Reader\CborReader.Integer.cs (1)
148if (length > (ulong)(data.Length - bytesRead))
System\Formats\Cbor\Reader\CborReader.Map.cs (1)
53if (2 * (ulong)mapSize > (ulong)(buffer.Length - bytesRead))
System\Formats\Cbor\Writer\CborWriter.cs (7)
172EnsureWriteCapacity(encodedValue.Length); 186_offset += encodedValue.Length; 195using var manager = new PointerMemoryManager<byte>(ptr, encodedValue.Length); 238if (encoding.Length > destination.Length) 244return encoding.Length; 256if (encoding.Length > destination.Length) 263bytesWritten = encoding.Length;
System\Formats\Cbor\Writer\CborWriter.Map.cs (1)
171s = s.Slice(keyValuePairEncoding.Length);
System\Formats\Cbor\Writer\CborWriter.String.cs (5)
41WriteUnsignedInteger(CborMajorType.ByteString, (ulong)value.Length); 42EnsureWriteCapacity(value.Length); 50_currentIndefiniteLengthStringRanges.Add((_offset, value.Length)); 54_offset += value.Length; 146_currentIndefiniteLengthStringRanges.Add((_offset, value.Length));
System.Formats.Nrbf (3)
System\Formats\Nrbf\NrbfDecoder.cs (3)
42=> bytes.Length >= SerializedStreamHeaderRecord.Size 44&& bytes.Slice(SerializedStreamHeaderRecord.Size - HeaderSuffix.Length, HeaderSuffix.Length).SequenceEqual(HeaderSuffix);
System.Formats.Tar (42)
src\runtime\src\libraries\Common\src\System\IO\Archiving.Utils.Unix.cs (1)
18nonSlash = path.Length;
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (11)
16internal static bool StartsWithDirectorySeparator(ReadOnlySpan<char> path) => path.Length > 0 && IsDirectorySeparator(path[0]); 22=> path.Length == GetRootLength(path); 138for (int i = skip; i < path.Length; i++) 142if (IsDirectorySeparator(c) && i + 1 < path.Length) 153if ((i + 2 == path.Length || IsDirectorySeparator(path[i + 2])) && 162if (i + 2 < path.Length && 163(i + 3 == path.Length || IsDirectorySeparator(path[i + 3])) && 172sb.Length = (i + 3 >= path.Length && s == skip) ? s + 1 : s; // to avoid removing the complete "\tmp\" segment in cases like \\?\C:\tmp\..\, C:\tmp\.. 197if (!flippedSeparator && sb.Length == path.Length) 231path.Slice(0, path.Length - 1) : 238path.Length > 0 && IsDirectorySeparator(path[^1]);
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (1)
24return path.Length > 0 && IsDirectorySeparator(path[0]) ? 1 : 0;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Formats\Tar\GnuSparseStream.cs (1)
484if (!Utf8Parser.TryParse(span, out long value, out int consumed) || consumed != span.Length)
System\Formats\Tar\TarHeader.Read.cs (10)
619if (buffer.Length > 0) 694if (!int.TryParse(length, NumberStyles.None, CultureInfo.InvariantCulture, out int lengthValue) || lengthValue != (line.Length + 1)) 731if (buffer.Length < 2) 740if (buffer.Length >= 6 && 749if (buffer.Length >= 2 && buffer[1] == 0x4B) 756if (buffer.Length >= 2 && buffer[1] == 0x8B) 763if (buffer.Length >= 3 && buffer[1] == 0x5A && buffer[2] == 0x68) 770if (buffer.Length >= 6 && 779if (buffer.Length >= 4 && 796if (buffer.Length >= 2)
System\Formats\Tar\TarHeader.Write.cs (14)
406if (pathNameBytes.Length <= FieldLengths.Name) 428while (prefix.Length - name.Length > FieldLengths.Prefix) 440if (prefix.Length <= FieldLengths.Prefix && name.Length <= FieldLengths.Name) 442Debug.Assert(prefix.Length != 1 || !PathInternal.Utf8DirectorySeparators.Contains(prefix[0])); 786int numToCopy = Math.Min(bytesToWrite.Length, destination.Length); 803int numToCopy = Math.Min(bytesToWrite.Length, destination.Length - 1); 805int copyPos = destination.Length - 1 - bytesToWrite.Length; 820if (Vector.IsHardwareAccelerated && bytes.Length >= vectorSize) 827Debug.Assert(bytes.Length <= 512); 831for (; i <= bytes.Length - vectorSize; i += vectorSize) 847for (; i < bytes.Length; i++) 977string.Concat("/tmp", result.AsSpan(tmp.Length)) :
System\Formats\Tar\TarHelpers.cs (1)
231if (buffer.Length == 0)
System.IO.Compression (57)
System\IO\Compression\Crc32Helper.ZLib.cs (1)
25return Interop.ZLib.crc32(crc32, bufferPtr, buffer.Length);
System\IO\Compression\DeflateDecoder.cs (4)
69if (destination.IsEmpty && source.Length > 0) 80_state.AvailIn = (uint)source.Length; 86bytesConsumed = source.Length - (int)_state.AvailIn; 121bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\DeflateEncoder.cs (4)
207if (destination.IsEmpty && (source.Length > 0 || isFinalBlock)) 220_state.AvailIn = (uint)source.Length; 226bytesConsumed = source.Length - (int)_state.AvailIn; 334bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\DeflateManaged\InflaterManaged.cs (3)
398if ((uint)symbol >= ExtraLengthBits.Length) 420if (_length < 0 || _length >= LengthBase.Length) 558for (int i = _codeLengthCodeCount; i < CodeOrder.Length; i++)
System\IO\Compression\DeflateZLib\DeflateStream.cs (1)
586_deflater.SetInput(bufferPtr, buffer.Length);
System\IO\Compression\GZipDecoder.cs (1)
65bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\GZipEncoder.cs (1)
157bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\PositionPreservingWriteOnlyStreamWrapper.cs (1)
40_position += buffer.Length;
System\IO\Compression\WinZipAesKeyMaterial.cs (1)
64int maxPasswordByteCount = Encoding.UTF8.GetMaxByteCount(password.Length);
System\IO\Compression\WinZipAesStream.cs (2)
327Debug.Assert(dest.Length <= src.Length); 483int bytesToProcess = Math.Min(buffer.Length, workBuffer.Length);
System\IO\Compression\ZipArchive.cs (2)
629if (currPosition < sizedFileBuffer.Length) 631_archiveStream.Seek(-(sizedFileBuffer.Length - currPosition), SeekOrigin.Current);
System\IO\Compression\ZipArchiveEntry.cs (2)
2335if (source.Length == 0) 2348_position += source.Length;
System\IO\Compression\ZipBlocks.cs (10)
51if (bytes.Length < SizeOfHeader) 60if ((bytes.Length - SizeOfHeader) < field._size) 287if (data.Length < FieldLengths.UncompressedSize) 321if (data.Length < FieldLengths.CompressedSize) 340if (data.Length < FieldLengths.LocalHeaderOffset) 359if (data.Length < FieldLengths.StartDiskNumber) 776while (extraFieldData.Length >= 4) // Need at least 4 bytes for header ID and size 782if (fieldSize > extraFieldData.Length) 900Debug.Assert(buffer.Length >= BlockConstantSectionSize); 1000int remainingBufferLength = buffer.Length - FieldLocations.DynamicData;
System\IO\Compression\ZipCryptoStream.cs (2)
130byte[] passwordBytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(password.Length)); 326int chunkSize = Math.Min(buffer.Length, workBuffer.Length);
System\IO\Compression\ZipCustomStreams.cs (4)
399if (source.Length == 0) 415_position += source.Length; 622if (data.Length == 0) 639_totalBytesRead += data.Length;
System\IO\Compression\ZipHelper.cs (2)
95Debug.Assert(signatureToFind.Length != 0); 117int overlap = totalBytesRead == 0 ? 0 : signatureToFind.Length;
System\IO\Compression\ZLibDecoder.cs (1)
65bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\ZLibEncoder.cs (1)
149bool success = status == OperationStatus.Done && consumed == source.Length;
System\IO\Compression\Zstandard\ZstandardDecoder.cs (4)
194size = (nuint)source.Length, 259ulong frameContentSize = Interop.Zstd.ZSTD_decompressBound(dataPtr, (nuint)data.Length); 297sourcePtr, (nuint)source.Length); 342sourcePtr, (nuint)source.Length, dictionary.DecompressionDictionary);
System\IO\Compression\Zstandard\ZstandardDictionary.cs (7)
97if (sampleLengths.Length < 5) 105byte[] lengthsArray = ArrayPool<byte>.Shared.Rent(sampleLengths.Length * sizeof(nuint)); 109Span<nuint> lengthsAsNuint = MemoryMarshal.Cast<byte, nuint>(lengthsArray.AsSpan(0, sampleLengths.Length * sizeof(nuint))); 110Debug.Assert(lengthsAsNuint.Length == sampleLengths.Length); 113for (int i = 0; i < sampleLengths.Length; i++) 124if (totalLength != samples.Length) 142samplesPtr, lengthsAsNuintPtr, (uint)sampleLengths.Length);
System\IO\Compression\Zstandard\ZstandardEncoder.cs (2)
246size = (nuint)source.Length, 376nuint result = Interop.Zstd.ZSTD_compress2(ctx, outBytes, (nuint)destination.Length, inBytes, (nuint)source.Length);
System\IO\Compression\Zstandard\ZstandardStream.Compress.cs (1)
124Debug.Assert(buffer.Length == 0);
System.IO.Compression.Brotli (11)
System\IO\Compression\dec\BrotliDecoder.cs (6)
65nuint availableInput = (nuint)source.Length; 82Debug.Assert(availableInput <= (nuint)source.Length); 85bytesConsumed += source.Length - (int)availableInput; 96source = source.Slice(source.Length - (int)availableInput); 98if (brotliResult == 2 && source.Length == 0) 120bool success = Interop.Brotli.BrotliDecoderDecompress((nuint)source.Length, inBytes, &availableOutput, outBytes) != Interop.BOOL.FALSE;
System\IO\Compression\enc\BrotliEncoder.cs (5)
150nuint availableInput = (nuint)source.Length; 166Debug.Assert(availableInput <= (nuint)source.Length); 169bytesConsumed += source.Length - (int)availableInput; 178source = source.Slice(source.Length - (int)availableInput); 218bool success = Interop.Brotli.BrotliEncoderCompress(quality, window, /*BrotliEncoderMode*/ 0, (nuint)source.Length, inBytes, &availableOutput, outBytes) != Interop.BOOL.FALSE;
System.IO.Compression.ZipFile (3)
src\runtime\src\libraries\Common\src\System\IO\Archiving.Utils.Windows.cs (3)
59nonSlash = path.Length; 73return string.Create(appendPathSeparator ? tmpPath.Length + 1 : tmpPath.Length, (appendPathSeparator, RosPtr: (IntPtr)(&tmpPath)), static (dest, state) =>
System.IO.FileSystem.AccessControl (21)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (11)
16internal static bool StartsWithDirectorySeparator(ReadOnlySpan<char> path) => path.Length > 0 && IsDirectorySeparator(path[0]); 22=> path.Length == GetRootLength(path); 138for (int i = skip; i < path.Length; i++) 142if (IsDirectorySeparator(c) && i + 1 < path.Length) 153if ((i + 2 == path.Length || IsDirectorySeparator(path[i + 2])) && 162if (i + 2 < path.Length && 163(i + 3 == path.Length || IsDirectorySeparator(path[i + 3])) && 172sb.Length = (i + 3 >= path.Length && s == skip) ? s + 1 : s; // to avoid removing the complete "\tmp\" segment in cases like \\?\C:\tmp\..\, C:\tmp\.. 197if (!flippedSeparator && sb.Length == path.Length) 231path.Slice(0, path.Length - 1) : 238path.Length > 0 && IsDirectorySeparator(path[^1]);
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Windows.cs (6)
141path.Length >= DevicePrefixLength 154return path.Length >= UncExtendedPrefixLength 171return path.Length >= DevicePrefixLength 183int pathLength = path.Length; 252if (path.Length < 2) 268return !((path.Length >= 3)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System.IO.FileSystem.DriveInfo (6)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (6)
32if (mount.MountPoint.Length < currentBestLength) 42if (mount.MountPoint.Length == path.Length) 48if (mount.MountPoint.Length > 1 && path[mount.MountPoint.Length] != '/') 53currentBestLength = mount.MountPoint.Length; 58if (currentFormat.Length > 0)
System.IO.FileSystem.Watcher (21)
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (11)
16internal static bool StartsWithDirectorySeparator(ReadOnlySpan<char> path) => path.Length > 0 && IsDirectorySeparator(path[0]); 22=> path.Length == GetRootLength(path); 138for (int i = skip; i < path.Length; i++) 142if (IsDirectorySeparator(c) && i + 1 < path.Length) 153if ((i + 2 == path.Length || IsDirectorySeparator(path[i + 2])) && 162if (i + 2 < path.Length && 163(i + 3 == path.Length || IsDirectorySeparator(path[i + 3])) && 172sb.Length = (i + 3 >= path.Length && s == skip) ? s + 1 : s; // to avoid removing the complete "\tmp\" segment in cases like \\?\C:\tmp\..\, C:\tmp\.. 197if (!flippedSeparator && sb.Length == path.Length) 231path.Slice(0, path.Length - 1) : 238path.Length > 0 && IsDirectorySeparator(path[^1]);
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (1)
24return path.Length > 0 && IsDirectorySeparator(path[0]) ? 1 : 0;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\IO\FileSystemWatcher.cs (1)
377if (name.Length == 0)
System\IO\FileSystemWatcher.Linux.cs (5)
562ReadOnlySpan<WatchedDirectory> dirs = watch is not null ? GetWatchedDirectories(watch, ref _dirBuffer, offset: movedFromDirs.Length) : default; 628movedFromWatchCount = dirs.Length; 1367length = Parent.GetPath("", pathBuffer, fullPath).Length; 1383if (path.Length == 0) 1395length += path.Length;
System.IO.Hashing (81)
System\IO\Hashing\Adler32.cs (12)
198source.Length >= Vector128<byte>.Count * 2) 200if (Vector512.IsHardwareAccelerated && Avx512BW.IsSupported && source.Length >= Vector512<byte>.Count) 205if (Vector256.IsHardwareAccelerated && Avx2.IsSupported && source.Length >= Vector256<byte>.Count) 225int k = source.Length < NMax ? source.Length : NMax; 236while (source.Length > 0); 245Debug.Assert(source.Length >= Vector128<byte>.Count * 2); 253int length = source.Length; 365Debug.Assert(source.Length >= Vector256<byte>.Count); 373int length = source.Length; 424Debug.Assert(source.Length >= Vector512<byte>.Count); 432int length = source.Length;
System\IO\Hashing\Crc32ParameterSet.cs (2)
140if (consumed < source.Length) 174if (consumed < source.Length)
System\IO\Hashing\Crc32ParameterSet.Vectorized.cs (12)
64if (!_canVectorize || source.Length < _shouldVectorizeScale * Vector128<byte>.Count) 80if (remaining.Length >= Vector128<byte>.Count * 4) 91while (remaining.Length >= Vector128<byte>.Count * 4) 118while (remaining.Length >= Vector128<byte>.Count) 137bytesConsumed = source.Length - remaining.Length; 198if (!_canVectorize || source.Length < Vector128<byte>.Count) 213if (remaining.Length >= Vector128<byte>.Count * 4) 224while (remaining.Length >= Vector128<byte>.Count * 4) 251while (remaining.Length >= Vector128<byte>.Count) 272bytesConsumed = source.Length - remaining.Length;
System\IO\Hashing\Crc32ParameterSet.WellKnown.cs (6)
140while (source.Length >= sizeof(ulong)) 149for (int i = 0; i < source.Length; i++) 162while (source.Length >= sizeof(uint)) 171for (int i = 0; i < source.Length; i++) 201while (source.Length >= sizeof(ulong)) 209while (source.Length >= sizeof(uint))
System\IO\Hashing\Crc64ParameterSet.cs (2)
140if (consumed < source.Length) 174if (consumed < source.Length)
System\IO\Hashing\Crc64ParameterSet.Vectorized.cs (12)
74if (!_canVectorize || source.Length < Vector128<byte>.Count) 89if (remaining.Length >= Vector128<byte>.Count * 4) 100while (remaining.Length >= Vector128<byte>.Count * 4) 127while (remaining.Length >= Vector128<byte>.Count) 147bytesConsumed = source.Length - remaining.Length; 201if (!_canVectorize || source.Length < Vector128<byte>.Count) 216if (remaining.Length >= Vector128<byte>.Count * 4) 227while (remaining.Length >= Vector128<byte>.Count * 4) 254while (remaining.Length >= Vector128<byte>.Count) 273bytesConsumed = source.Length - remaining.Length;
System\IO\Hashing\XxHash128.cs (1)
131uint length = (uint)source.Length;
System\IO\Hashing\XxHash3.cs (1)
129uint length = (uint)source.Length;
System\IO\Hashing\XxHash32.cs (7)
97if (source.Length >= remain) 108_length += source.Length; 113while (source.Length >= StripeSize) 120if (source.Length > 0) 124_length += source.Length; 254int totalLength = source.Length; 257while (source.Length >= StripeSize)
System\IO\Hashing\XxHash32.State.cs (3)
39Debug.Assert(source.Length >= StripeSize); 75while (remaining.Length >= sizeof(uint)) 85for (int i = 0; i < remaining.Length; i++)
System\IO\Hashing\XxHash64.cs (7)
97if (source.Length >= remain) 108_length += source.Length; 113while (source.Length >= StripeSize) 120if (source.Length > 0) 124_length += source.Length; 254int totalLength = source.Length; 257while (source.Length >= StripeSize)
System\IO\Hashing\XxHash64.State.cs (4)
50Debug.Assert(source.Length >= StripeSize); 110while (remaining.Length >= sizeof(ulong)) 122if (remaining.Length >= sizeof(uint)) 133for (int i = 0; i < remaining.Length; i++)
System\IO\Hashing\XxHashShared.cs (12)
245state.TotalLength += (uint)source.Length; 250if (source.Length <= InternalBufferLengthBytes - state.BufferedCount) 252source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 253state.BufferedCount += (uint)source.Length; 273Debug.Assert(sourceIndex < source.Length); 276if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) 278ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; 302Debug.Assert(sourceIndex < source.Length); // at least some bytes left 308else if (source.Length - sourceIndex > InternalBufferLengthBytes) 316while (source.Length - sourceIndex > InternalBufferLengthBytes); 323Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 324Debug.Assert(sourceIndex < source.Length);
System.IO.Packaging (9)
System\IO\Packaging\ContentType.cs (4)
315if (parameterAndValue.Length == 1) 327if (equalSignIndex <= 0 || equalSignIndex == (parameterAndValue.Length - 1)) 370length = s.Length; 460for (int i = 0; i < quotedText.Length; i++)
System\IO\Packaging\InterleavedZipPackagePartStream.cs (5)
309if (buffer.Length == 0) 331while (totalBytesWritten < buffer.Length) 334int numBytesToWriteInCurrentPiece = buffer.Length - totalBytesWritten; 364if (!_dir.IsLastPiece(pieceNumber) && totalBytesWritten < buffer.Length) 384Debug.Assert(totalBytesWritten == buffer.Length);
System.IO.Pipelines (2)
System\IO\Pipelines\Pipe.cs (2)
1215int writable = Math.Min(destination.Length, source.Length); 1220if (source.Length == 0)
System.IO.Pipes (1)
System\IO\Pipes\PipeStream.Unix.cs (1)
291while (buffer.Length > 0)
System.IO.Ports (1)
System\IO\Ports\SerialStream.Unix.cs (1)
817int numBytes = Interop.Serial.Write(_handle, bufPtr, buff.Length);
System.Linq (38)
System\Linq\Aggregate.cs (1)
31for (int i = 1; i < span.Length; i++)
System\Linq\Average.cs (5)
32if (Vector.IsHardwareAccelerated && span.Length >= Vector<int>.Count) 42while (i <= span.Length - Vector<int>.Count); 46for (; (uint)i < (uint)span.Length; i++) 51return (double)sum / span.Length; 101return TResult.CreateChecked(Sum<TSource, TAccumulator>(span)) / TResult.CreateChecked(span.Length);
System\Linq\Max.cs (4)
125for (i = 0; i < span.Length && T.IsNaN(span[i]); i++) ; 127if (i == span.Length) 132for (value = span[i]; (uint)i < (uint)span.Length; i++) 245for (int i = 1; (uint)i < (uint)span.Length; i++)
System\Linq\Min.cs (2)
107for (int i = 1; (uint)i < (uint)span.Length; i++) 225for (int i = 1; (uint)i < (uint)span.Length; i++)
System\Linq\OrderedEnumerable.SpeedOpt.cs (1)
390if (span.Length != 0)
System\Linq\SegmentedArrayBuilder.cs (8)
85for (int i = 0; i < segments.Length; i++) 145ReadOnlySpan<T> sourceSlice = sourceSpan.Slice(0, Math.Min(availableSpaceInCurrentSpan, sourceSpan.Length)); 147_countInCurrentSegment += sourceSlice.Length; 148sourceSlice = sourceSpan.Slice(sourceSlice.Length); 152Expand(sourceSlice.Length); 154_countInCurrentSegment = sourceSlice.Length; 312destination = destination.Slice(firstSegment.Length); 322destination = destination.Slice(segment.Length);
System\Linq\Select.SpeedOpt.cs (4)
399if (source.Length == 0) 404var results = new TResult[source.Length]; 414var results = new List<TResult>(source.Length); 415Fill(source, SetCountAndGetSpan(results, source.Length), _selector);
System\Linq\Single.cs (2)
120for (int i = 0; i < span.Length; i++) 125for (i++; (uint)i < (uint)span.Length; i++)
System\Linq\SkipTake.SpeedOpt.cs (3)
151if (sourceIndex < sourceSpan.Length) 174if (minInclusive < span.Length) 176return span.Slice(minInclusive, GetAdjustedCount(minInclusive, _maxIndexInclusive, span.Length)).IndexOf(item);
System\Linq\Sum.cs (4)
54&& span.Length >= Vector<T>.Count * 4) 82Debug.Assert(span.Length >= Vector<T>.Count * 4); 120while (span.Length >= Vector<T>.Count * 4) 143while (span.Length >= Vector<T>.Count)
System\Linq\ToCollection.cs (2)
181Dictionary<TKey, TSource> d = new Dictionary<TKey, TSource>(source.Length, comparer); 239Dictionary<TKey, TElement> d = new Dictionary<TKey, TElement>(source.Length, comparer);
System\Linq\Where.SpeedOpt.cs (2)
344for (int i = source.Length - 1; i >= 0; i--) 492for (int i = source.Length - 1; i >= 0; i--)
System.Memory (58)
System\Buffers\BuffersExtensions.cs (6)
68if (span.Length > destination.Length) 90destination = destination.Slice(span.Length); 121if (value.Length <= destination.Length) 124writer.Advance(value.Length); 137int writeSize = Math.Min(destination.Length, input.Length); 141if (input.Length > 0)
System\Buffers\ReadOnlySequence.Helpers.cs (1)
688return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<char, T>(ref MemoryMarshal.GetReference(spanOfChar)), spanOfChar.Length);
System\Buffers\SequenceReader.cs (12)
30_moreData = first.Length > 0; 151if ((CurrentSpanIndex + offset) <= CurrentSpan.Length - 1) 160long remainingOffset = offset - (CurrentSpan.Length - CurrentSpanIndex); 204if (CurrentSpanIndex >= CurrentSpan.Length) 317if ((count & TooBigOrNegative) == 0 && CurrentSpan.Length - CurrentSpanIndex > (int)count) 339if (CurrentSpanIndex >= CurrentSpan.Length) 355Debug.Assert(CurrentSpanIndex < CurrentSpan.Length); 368int remaining = CurrentSpan.Length - CurrentSpanIndex; 417if (firstSpan.Length >= destination.Length) 434Debug.Assert(firstSpan.Length < destination.Length); 436int copied = firstSpan.Length; 444int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
System\Buffers\SequenceReader.Search.cs (33)
35if (!TryReadToInternal(out ReadOnlySequence<T> sequence, delimiter, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex)) 148int i = remaining.Length - 2; 155escapeCount += remaining.Length - 2 - i; 168AdvanceCurrentSpan(remaining.Length); 220AdvanceCurrentSpan(remaining.Length); 300for (int i = remaining.Length; i > 0 && remaining[i - 1].Equals(delimiterEscape); i--, escapeCount++) 302if (priorEscape && escapeCount == remaining.Length) 310Advance(remaining.Length); 331int index = delimiters.Length == 2 347if (!TryReadToAnyInternal(out ReadOnlySequence<T> sequence, delimiters, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex)) 378int index = delimiters.Length == 2 398Advance(remaining.Length); 423AdvanceCurrentSpan(index + (advancePastDelimiter ? delimiter.Length : 0)); 453if (delimiter.Length == 0) 470if (delimiter.Length == 1) 489Advance(delimiter.Length); 581for (i = CurrentSpanIndex; i < CurrentSpan.Length && CurrentSpan[i].Equals(value); i++) 613for (i = CurrentSpanIndex; i < CurrentSpan.Length && values.Contains(CurrentSpan[i]); i++) 645for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) 682for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) 719for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) 795AdvanceCurrentSpan(next.Length); 801return unread.Length < next.Length && IsNextSlow(next, advancePast); 809Debug.Assert(currentSpan.Length < next.Length); 811int fullLength = next.Length; 816if (next.Length == currentSpan.Length) 837next = next.Slice(currentSpan.Length); 839if (currentSpan.Length > next.Length) 841currentSpan = currentSpan.Slice(0, next.Length);
System\Buffers\SequenceReaderExtensions.Binary.cs (2)
29if (span.Length < sizeof(T)) 39Debug.Assert(reader.UnreadSpan.Length < sizeof(T));
System\Text\EncodingExtensions.cs (4)
39if (chars.Length <= MaxInputElementsPerIteration) 230if (bytes.Length <= MaxInputElementsPerIteration) 432int byteCountForThisSlice = (chars.Length <= MaxInputElementsPerIteration) 525int charCountForThisSlice = (bytes.Length <= MaxInputElementsPerIteration)
System.Memory.Data (1)
System\BinaryData.cs (1)
468if (span.Length > 2 && span[0] == 0xEF && span[1] == 0xBB && span[2] == 0xBF)
System.Net.Http (168)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\DynamicTable.cs (2)
60int entryLength = HeaderField.GetLength(name.Length, value.Length);
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HeaderField.cs (1)
20Debug.Assert(name.Length > 0);
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (7)
188while (currentIndex < data.Length); 215if (currentIndex < data.Length) 287if (currentIndex < data.Length) 313if (currentIndex < data.Length) 425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 646for (; currentIndex < data.Length; currentIndex++)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (8)
424if (IntegerEncoder.Encode(value.Length, 7, destination, out int integerLength)) 429if (value.Length <= destination.Length) 434bytesWritten = integerLength + value.Length; 517if (values.Length == 0) 521else if (values.Length == 1) 530int valueLength = checked((values.Length - 1) * separator.Length); 561for (int i = 1; i < values.Length; i++) 576for (int i = 1; i < values.Length; i++)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\Huffman.cs (1)
692while (i < src.Length)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
42if (buffer.Length != 0)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (8)
239while (currentIndex < data.Length); 287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 342if (currentIndex < data.Length) 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 426if (currentIndex < data.Length) 534if (currentIndex < data.Length) 563if (currentIndex < data.Length) 695for (; currentIndex < data.Length; currentIndex++)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackEncoder.cs (5)
222if (values.Length == 1) 227if (values.Length == 0) 237int valueLength = separator.Length * (values.Length - 1); 266for (int i = 1; i < values.Length; i++) 281for (int i = 1; i < values.Length; i++)
src\runtime\src\libraries\Common\src\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs (1)
70switch (nameSpan.Length)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (2)
403if (_length < source.Length) 413if (source.Length <= block.Length)
src\runtime\src\libraries\Common\src\System\Text\SimpleRegex.cs (6)
26while (inputPos < input.Length) 28if (patternPos < pattern.Length && pattern[patternPos] == '*') 35else if (patternPos < pattern.Length && 61while (patternPos < pattern.Length && pattern[patternPos] == '*') 68Debug.Assert(patternPos <= pattern.Length); 69return patternPos == pattern.Length;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Net\Http\Headers\AltSvcHeaderParser.cs (9)
203switch (span.Length) 251var builder = value.Length <= 128 ? 253new ValueStringBuilder(value.Length); 262if ((value.Length - idx) < 3 || !TryReadAlpnHexDigit(value[idx + 1], out int hi) || !TryReadAlpnHexDigit(value[idx + 2], out int lo)) 276if (value.Length != 0) 350result = value.Length != 0 ? new string(value) : null; 358if (idx + 1 == value.Length) 378if (value.Length != 0) 417if (value.Length == 0)
System\Net\Http\Headers\ContentDispositionHeaderValue.cs (3)
289dateString = dateString.Slice(1, dateString.Length - 2); 431value.Length > 1 && 433value[value.Length - 1] == '"';
System\Net\Http\Headers\HeaderDescriptor.cs (5)
85Debug.Assert(headerName.Length > 0); 136if (headerValue.Length == 0) 189switch (contentTypeValue.Length) 304Debug.Assert(candidate is null || candidate.Length == contentTypeValue.Length); 313char[] rented = ArrayPool<char>.Shared.Rent(input.Length);
System\Net\Http\Headers\HeaderUtilities.cs (3)
82length = utf8.Length; 97length = utf8.Length; 338for (int i = 0; i < headers.Length; i++)
System\Net\Http\Headers\KnownHeaders.cs (1)
137switch (key.Length)
System\Net\Http\HttpContent.cs (23)
126Debug.Assert(firstBuffer.Length >= 4 || firstBuffer.Length == stream.Length); 177if (firstBuffer.Length == stream.Length) 718return data.StartsWith(UTF8Preamble) ? UTF8Preamble.Length : 0; 721return data.StartsWith(UTF32Preamble) ? UTF32Preamble.Length : 0; 724return data.StartsWith(UnicodePreamble) ? UnicodePreamble.Length : 0; 727return data.StartsWith(BigEndianUnicodePreamble) ? BigEndianUnicodePreamble.Length : 0; 740preambleLength = UTF8Preamble.Length; 747preambleLength = UTF32Preamble.Length; 754preambleLength = UnicodePreamble.Length; 761preambleLength = BigEndianUnicodePreamble.Length; 916if (_maxBufferSize - _totalLength < buffer.Length) 924if (lastBuffer.Length - offset >= buffer.Length) 927_lastBufferOffset = offset + buffer.Length; 928_totalLength += buffer.Length; 938Debug.Assert(_totalLength + buffer.Length <= _maxBufferSize); 946newBufferCapacity = Math.Max(newBufferCapacity, _totalLength + buffer.Length); 978newBuffer = new byte[_totalLength + buffer.Length <= _expectedFinalSize ? _expectedFinalSize : newTotalCapacity]; 986_totalLength += buffer.Length; 1001_totalLength = _lastBufferOffset = buffer.Length; 1008_totalLength += buffer.Length; 1013Debug.Assert(remainingInCurrentBuffer.Length < buffer.Length); 1019_lastBufferOffset = buffer.Length;
System\Net\Http\HttpMethod.cs (2)
98if (method.Length >= 3) // 3 == smallest known method 107'p' => method.Length switch
System\Net\Http\HttpRuleParser.cs (2)
44return index < 0 ? slice.Length : index; 171return slice.Length;
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (3)
340if (bytesConsumed != currentLine.Length) 387if (currentLine.Length != 0) 443for (int i = 0; i < lineAfterChunkSize.Length; i++)
System\Net\Http\SocketsHttpHandler\ChunkedEncodingWriteStream.cs (3)
23BytesWritten += buffer.Length; 28if (buffer.Length == 0) 35ValueTask writeTask = connection.WriteHexInt32Async(buffer.Length, async: false);
System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs (1)
25BytesWritten += buffer.Length;
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (19)
201int requiredSpace = Http2ConnectionPreface.Length + 209_outgoingBuffer.Commit(Http2ConnectionPreface.Length); 719if (frameData.Length == 0) 727if (frameData.Length < padLength) 732frameData = frameData.Slice(0, frameData.Length - padLength); 737if (frameData.Length < FrameHeader.PriorityInfoLength) 771if ((frameHeader.StreamId != 0 && originLength == 0) || (frameHeader.StreamId == 0 && span.Length >= originLength && span.Slice(0, originLength).SequenceEqual(_pool.Http2AltSvcOriginUri))) 797if (frameData.Length > 0 || endStream) 802if (frameData.Length > 0) 804bool windowUpdateSent = ExtendWindow(frameData.Length); 850while (settings.Length > 0) 852Debug.Assert((settings.Length % 6) == 0); 1443if (NetEventSource.Log.IsEnabled()) Trace($"{nameof(bytes.Length)}={bytes.Length}"); 1445headerBuffer.EnsureAvailableSpace(bytes.Length); 1447headerBuffer.Commit(bytes.Length); 1459int headerListSize = entries.Length * HeaderField.RfcOverhead; 1507byte[]? separator = headerValues.Length > 1 ? header.Key.SeparatorBytes : null; 1979Debug.Assert(buffer.Length >= Size);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (5)
681AdjustHeaderBudget(descriptor.Name.Length + value.Length); 731Debug.Assert(name.Length > 0); 887if (_responseBuffer.ActiveMemory.Length + buffer.Length > _windowManager.StreamWindowSize) 893_responseBuffer.EnsureAvailableSpace(buffer.Length); 895_responseBuffer.Commit(buffer.Length);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (6)
776int headerListSize = entries.Length * HeaderField.RfcOverhead; 816byte[]? separator = headerValues.Length > 1 ? header.Key.SeparatorBytes : null; 893_sendBuffer.EnsureAvailableSpace(span.Length); 895_sendBuffer.Commit(span.Length); 993Debug.Assert(name.Length > 0); 1035_headerBudgetRemaining -= descriptor.Name.Length + (staticValue?.Length ?? literalValue.Length);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (21)
485_writeBuffer.EnsureAvailableSpace(bytes.Length); 487_writeBuffer.Commit(bytes.Length); 1237int spIdx = name.Length - 1; 1239if ((uint)spIdx < (uint)name.Length) 1257while (value.Length != 0 && value[0] is (byte)' ' or (byte)'\t') 1265int spIdx = value.Length - 1; 1267if ((uint)spIdx >= (uint)value.Length || !(value[spIdx] is (byte)' ' or (byte)'\t')) 1379Debug.Assert(source.Length <= _writeBuffer.AvailableLength); 1381_writeBuffer.Commit(source.Length); 1388if (source.Length <= remaining) 1403if (source.Length >= _writeBuffer.Capacity) 1474if (source.Length <= _writeBuffer.AvailableLength) 1553if (bytes.Length > 0) 1555_writeBuffer.Discard(bytes.Length); 1573if (NetEventSource.Log.IsEnabled()) Trace($"Writing {source.Length} bytes."); 1599if (buffer.Length < MaxChunkBytesAllowed) 1614int length = (uint)carriageReturnIndex < (uint)buffer.Length && buffer[carriageReturnIndex] == '\r' 1716Debug.Assert(buffer.Length > 0); 1718int originalBufferLength = buffer.Length; 1730if (tabOrSpaceIndex == buffer.Length) 1752int toCopy = Math.Min(available.Length, buffer.Length);
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (1)
301if (value.Length != 3 ||
System\Net\Http\SocketsHttpHandler\MultiProxy.cs (5)
203int originalLength = proxyString.Length; 209while (iter < proxyString.Length && ProxyDelimiters.Contains(proxyString[iter])) 214if (iter == proxyString.Length) 257iter = proxyString.Length; 263charactersConsumed = originalLength - proxyString.Length + iter;
System\Net\Http\SocketsHttpHandler\RawConnectionStream.cs (1)
159if (buffer.Length != 0)
System.Net.Http.WinHttpHandler (2)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
src\runtime\src\libraries\Common\src\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs (1)
70switch (nameSpan.Length)
System.Net.HttpListener (13)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
System\Net\Managed\HttpListenerRequest.Managed.cs (1)
96if (version.Length != 8 || !version.StartsWith("HTTP/", StringComparison.Ordinal))
System\Net\Managed\HttpListenerResponse.Managed.cs (1)
279int preamble = encoding.Preamble.Length;
System.Net.Mail (36)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Net\Base64Stream.cs (1)
223if (written < buffer.Length)
System\Net\BufferBuilder.cs (2)
46EnsureBuffer(value.Length); 48_offset += value.Length;
System\Net\BufferedReadStream.cs (2)
92if (buffer.Length == 0) 95int count = buffer.Length;
System\Net\Mail\MailBnfHelper.cs (1)
241i = span.Length;
System\Net\Mail\SmtpReplyReaderFactory.cs (2)
86if (buffer.Length == 0) 92int length = buffer.Length;
System\Net\Mime\Base64Encoder.cs (1)
47return LineBreakNeeded(bytes.Length);
System\Net\Mime\ByteEncoder.cs (1)
25for (; cur < buffer.Length; cur++)
System\Net\Mime\EightBitStream.cs (1)
99for (int i = 0; i < buffer.Length; i++)
System\Net\Mime\MediaTypeMap.cs (2)
808if (!extension.IsEmpty && extension[0] != '.' && extension.Length < MaxExtensionLength) 810Span<char> buffer = stackalloc char[1 + extension.Length];
System\Net\Mime\QEncodedStream.cs (1)
234if (written < buffer.Length)
System\Net\Mime\QEncoder.cs (2)
49if (bytes.Length == 1 || IsCRLF(bytes)) // preserve same behavior as in EncodeBytes 54int numberOfCharsToAppend = bytes.Length * SizeOfQEncodedChar;
System\Net\Mime\QuotedPrintableStream.cs (4)
206for (; processed < buffer.Length; processed++) 227if (buffer[processed] == '\r' && processed + 1 < buffer.Length && buffer[processed + 1] == '\n') 271(processed + 1 >= buffer.Length)) 348if (written < buffer.Length)
System\Net\Mime\WriteStateInfoBase.cs (3)
82EnsureSpaceInBuffer(bytes.Length); 84_currentLineLength += bytes.Length; 85_currentBufferUsed += bytes.Length;
System.Net.NameResolution (7)
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System\Net\Dns.cs (3)
445hostSpan = hostSpan.Slice(0, hostSpan.Length - 1); 450(hostSpan.Length == reservedName.Length || 451hostSpan[hostSpan.Length - reservedName.Length - 1] == '.');
System.Net.NetworkInformation (23)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
144if (span.Length > 0 && span[0] == '+') 167if (span.Length > 0 && span[0] == '+')
System\Net\NetworkInformation\LinuxIPv4InterfaceProperties.cs (1)
46for (int i = 0; i < paths.Length; i++)
System\Net\NetworkInformation\PhysicalAddress.cs (7)
106if ((address.Length + 1) % 3 != 0) 112buffer = new byte[(address.Length + 1) / 3]; // allow any length that's a multiple of 3 147if (address.Length % 2 > 0) 152validSegmentLength = address.Length; 153buffer = new byte[address.Length / 2]; 158for (int i = 0; i < address.Length; i++) 208for (int i = 0; i < address.Length; i++)
System\Net\NetworkInformation\StringParsingHelpers.Connections.cs (3)
321if (remoteAddressString.Length <= 8) // IPv4 Address 325else if (remoteAddressString.Length == 32) // IPv6 Address 360Debug.Assert(hexAddress.Length == 32);
System.Net.Ping (8)
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
66if (socketAddressBuffer.Length >= SocketAddress.GetMaximumAddressSize(endPoint.AddressFamily) &&
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\SpanOfCharAsUtf8StringMarshaller.cs (1)
41if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length)
System\Net\NetworkInformation\Ping.RawSocket.cs (2)
483for (int i = 0; i < buffer.Length; i += 2) 487ushort element1 = (i + 1 < buffer.Length)
System.Net.Primitives (44)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
66if (socketAddressBuffer.Length >= SocketAddress.GetMaximumAddressSize(endPoint.AddressFamily) &&
src\runtime\src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (8)
138while (start < name.Length) 164(uint)(start + 1) < (uint)name.Length && char.IsAsciiDigit((char)ToUShort(name[start + 1]))) 221for (; current < name.Length; current++) 235if (current < name.Length) 254for (; current < name.Length; current++) 273if (current < name.Length && ch == '.') 296else if (current >= name.Length) 299end = name.Length;
src\runtime\src\libraries\Common\src\System\Net\IPv6AddressHelper.Common.cs (8)
21for (int i = 0; i < numbers.Length; i++) 113int end = name.Length; 327for (int i = (address[0] == TChar.CreateTruncating('[') ? 1 : 0); i < address.Length && address[i] != TChar.CreateTruncating(']');) 343for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']') && address[i] != TChar.CreateTruncating('/'); ++i) 349for (; i < address.Length && address[i] != TChar.CreateTruncating(']'); ++i) 374for (int j = i; j < address.Length && 390while (j < address.Length && (address[j] != TChar.CreateTruncating(']')) && (address[j] != TChar.CreateTruncating('/')) && (address[j] != TChar.CreateTruncating('%'))) 416for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']'); i++)
src\runtime\src\libraries\Common\src\System\Net\NetworkInformation\InterfaceInfoPal.Unix.cs (1)
33bufferSize = interfaceName.Length + 1;
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System\Net\Cookie.cs (2)
339int idxOfSeparator = host.Length - domain.Length - 1;
System\Net\IPAddress.cs (4)
142if (address.Length != IPAddressParserStatics.IPv6AddressBytes) 157Debug.Assert(numbers.Length == NumberOfLabels); 184if (address.Length == IPAddressParserStatics.IPv4AddressBytes) 188else if (address.Length == IPAddressParserStatics.IPv6AddressBytes)
System\Net\IPAddressParser.cs (4)
29return address != IPv4AddressHelper.Invalid && end == ipSpan.Length; 67if (tmpAddr != IPv4AddressHelper.Invalid && end == ipSpan.Length) 94if (scopeIdSpan.Length > 1) 252for (int i = zeroEnd; i < address.Length; i++)
System\Net\IPEndPoint.cs (2)
104int addressLength = s.Length; // If there's no port then send the entire string to the address parser 124if (addressLength == s.Length)
System.Net.Quic (57)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (1)
44BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length);
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
66if (socketAddressBuffer.Length >= SocketAddress.GetMaximumAddressSize(endPoint.AddressFamily) &&
src\runtime\src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (8)
138while (start < name.Length) 164(uint)(start + 1) < (uint)name.Length && char.IsAsciiDigit((char)ToUShort(name[start + 1]))) 221for (; current < name.Length; current++) 235if (current < name.Length) 254for (; current < name.Length; current++) 273if (current < name.Length && ch == '.') 296else if (current >= name.Length) 299end = name.Length;
src\runtime\src\libraries\Common\src\System\Net\IPv6AddressHelper.Common.cs (8)
21for (int i = 0; i < numbers.Length; i++) 113int end = name.Length; 327for (int i = (address[0] == TChar.CreateTruncating('[') ? 1 : 0); i < address.Length && address[i] != TChar.CreateTruncating(']');) 343for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']') && address[i] != TChar.CreateTruncating('/'); ++i) 349for (; i < address.Length && address[i] != TChar.CreateTruncating(']'); ++i) 374for (int j = i; j < address.Length && 390while (j < address.Length && (address[j] != TChar.CreateTruncating(']')) && (address[j] != TChar.CreateTruncating('/')) && (address[j] != TChar.CreateTruncating('%'))) 416for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']'); i++)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (2)
403if (_length < source.Length) 413if (source.Length <= block.Length)
src\runtime\src\libraries\Common\src\System\Net\Security\SslKeyLogger.cs (15)
48if (data.Length > 0) 83Span<byte> clientRandomUtf8 = clientRandom.Length <= 1024 ? stackalloc byte[clientRandom.Length * 2] : new byte[clientRandom.Length * 2]; 100if (secret.Length == 0) 107int totalLength = checked(labelUtf8.Length + 1 + clientRandomUtf8.Length + 1 + 2 * secret.Length + 1); 111line[labelUtf8.Length] = (byte)' '; 113clientRandomUtf8.CopyTo(line.Slice(labelUtf8.Length + 1)); 114line[labelUtf8.Length + 1 + clientRandomUtf8.Length] = (byte)' '; 116HexEncode(secret, line.Slice(labelUtf8.Length + 1 + clientRandomUtf8.Length + 1)); 124for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
src\runtime\src\libraries\Common\src\System\Net\StreamBuffer.cs (7)
95Debug.Assert(buffer.Length > 0); 107return (false, buffer.Length); 110_buffer.EnsureAvailableSpaceUpToLimit(buffer.Length, _maxBufferSize); 112int bytesWritten = Math.Min(buffer.Length, _buffer.AvailableMemory.Length); 122if (buffer.Length == 0) 135if (buffer.Length == 0) 145Debug.Assert(bytesWritten == buffer.Length);
System\Net\Quic\Internal\ReceiveBuffers.cs (1)
53for (int i = 0; i < quicBuffers.Length; ++i)
System.Net.Requests (1)
System\Net\FtpControlStream.cs (1)
930if (dateTimeLine.Length < 14)
System.Net.Security (155)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs (9)
126inputBytes.Length, 170inputBytes.Length, 246inputBytes.Length, 274inputBytes.Length, 343return Wrap(out minorStatus, contextHandle, ref isEncrypt, inputBytesPtr, inputBytes.Length, ref outBuffer); 356return Unwrap(out minorStatus, contextHandle, out isEncrypt, inputBytesPtr, inputBytes.Length, ref outBuffer); 368return GetMic(out minorStatus, contextHandle, inputBytesPtr, inputBytes.Length, ref outBuffer); 381return VerifyMic(out minorStatus, contextHandle, inputBytesPtr, inputBytes.Length, tokenBytesPtr, tokenBytes.Length);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (1)
44BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (3)
51buf.Length, 55x509Issuers.Length, 88buf.Length);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (6)
741input.Length, 833int upperBound = ComputeMaxTlsOutput(input.Length); 854input.Length, 862if (retVal != input.Length) 1360int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1361if (bytes != buffer.Length)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (3)
186return BioNewSocketReplay(socket.DangerousGetHandle(), pPrefix, prefix.Length); 408Debug.Assert(stapledResponse.Length > 0); 412CryptoNative_SslStapleOcsp(ssl, ptr, stapledResponse.Length);
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (8)
138while (start < name.Length) 164(uint)(start + 1) < (uint)name.Length && char.IsAsciiDigit((char)ToUShort(name[start + 1]))) 221for (; current < name.Length; current++) 235if (current < name.Length) 254for (; current < name.Length; current++) 273if (current < name.Length && ch == '.') 296else if (current >= name.Length) 299end = name.Length;
src\runtime\src\libraries\Common\src\System\Net\IPv6AddressHelper.Common.cs (8)
21for (int i = 0; i < numbers.Length; i++) 113int end = name.Length; 327for (int i = (address[0] == TChar.CreateTruncating('[') ? 1 : 0); i < address.Length && address[i] != TChar.CreateTruncating(']');) 343for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']') && address[i] != TChar.CreateTruncating('/'); ++i) 349for (; i < address.Length && address[i] != TChar.CreateTruncating(']'); ++i) 374for (int j = i; j < address.Length && 390while (j < address.Length && (address[j] != TChar.CreateTruncating(']')) && (address[j] != TChar.CreateTruncating('/')) && (address[j] != TChar.CreateTruncating('%'))) 416for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']'); i++)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
src\runtime\src\libraries\Common\src\System\Net\Security\MD4.cs (5)
101count[0] += (uint)(input.Length << 3); 102if (count[0] < (input.Length << 3)) 107count[1] += (uint)(input.Length >> 29); 112if (input.Length >= partLen) 125for (i = partLen; i + 63 < input.Length; i += 64)
src\runtime\src\libraries\Common\src\System\Net\Security\RC4.cs (3)
60index1 = (byte)((index1 + 1) % key.Length); 78Debug.Assert(input.Length == output.Length); 81for (int counter = 0; counter < input.Length; counter++)
src\runtime\src\libraries\Common\src\System\Net\Security\SslKeyLogger.cs (15)
48if (data.Length > 0) 83Span<byte> clientRandomUtf8 = clientRandom.Length <= 1024 ? stackalloc byte[clientRandom.Length * 2] : new byte[clientRandom.Length * 2]; 100if (secret.Length == 0) 107int totalLength = checked(labelUtf8.Length + 1 + clientRandomUtf8.Length + 1 + 2 * secret.Length + 1); 111line[labelUtf8.Length] = (byte)' '; 113clientRandomUtf8.CopyTo(line.Slice(labelUtf8.Length + 1)); 114line[labelUtf8.Length + 1 + clientRandomUtf8.Length] = (byte)' '; 116HexEncode(secret, line.Slice(labelUtf8.Length + 1 + clientRandomUtf8.Length + 1)); 124for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (3)
17int base64Len = ((input.Length + 2) / 3) * 4; 22Debug.Fail($"Convert.TryToBase64 failed with {input.Length} bytes to a {base64.Length} buffer"); 43written += source.Length;
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (24)
364Debug.Assert(HeaderLength == NtlmHeader.Length); 381if (length == 0 || offset < 0 || offset > payload.Length - length) 403SetField(ref field, data.Length, offset); 405offset += data.Length; 423if (password.Length > 128) 454Debug.Assert(serverChallenge.Length == ChallengeLength); 456Debug.Assert(ntlm2hash.Length == DigestLength); 458Span<byte> blob = payload.Slice(payloadOffset, sizeof(NtChallengeResponse) + serverInfo.Length); 466serverInfo.CopyTo(MemoryMarshal.CreateSpan(ref temp.ServerInfo[0], serverInfo.Length)); 521byte[] targetInfoBuffer = new byte[targetInfo.Length + 20 /* channel binding */ + 4 + spnSize /* SPN */ + 8 /* flags */ + 4 /* EOL */]; 527if (targetInfo.Length > 0) 530while (info.Length >= 4) 543if (length > info.Length - 4) 632if (blob.Length < sizeof(ChallengeMessage)) 642!NtlmHeader.SequenceEqual(blob.Slice(0, NtlmHeader.Length))) 811if (signature.Length != SignatureLength || 845Span<byte> output = outputWriter.GetSpan(input.Length + SignatureLength); 846_clientSeal.Transform(input, output.Slice(SignatureLength, input.Length)); 851outputWriter.Advance(input.Length + SignatureLength); 865if (input.Length < SignatureLength) 870Span<byte> output = outputWriter.GetSpan(input.Length - SignatureLength); 871_serverSeal.Transform(input.Slice(SignatureLength), output.Slice(0, input.Length - SignatureLength)); 872if (!VerifyMIC(output.Slice(0, input.Length - SignatureLength), input.Slice(0, SignatureLength))) 878outputWriter.Advance(input.Length - SignatureLength);
System\Net\NegotiateAuthenticationPal.Unix.cs (6)
347encryptedBuffer.Span.CopyTo(outputWriter.GetSpan(encryptedBuffer.Span.Length)); 348outputWriter.Advance(encryptedBuffer.Span.Length); 375decryptedBuffer.Span.CopyTo(outputWriter.GetSpan(decryptedBuffer.Span.Length)); 376outputWriter.Advance(decryptedBuffer.Span.Length); 407unwrappedLength = decryptedBuffer.Span.Length; 527int length = tokenBytes.Length;
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (2)
38_cbtPrefixByteArraySize = cbtPrefix.Length; 41cbtPrefix.CopyTo(new Span<byte>((byte*)cbtPrefixPtr, cbtPrefix.Length));
System\Net\Security\SslConnectionInfo.Linux.cs (1)
27else if (alpn.Length > 0)
System\Net\Security\SslStream.cs (1)
826PoolingPointerMemoryManager memoryManager = RentPointerMemoryManager(ref _writePointerMemoryManager, ptr, buffer.Length);
System\Net\Security\SslStream.IO.cs (4)
561while (availableData.Length - chunkSize > TlsFrameHelper.HeaderSize) 577if ((nextHeader.Type != TlsContentType.Handshake && nextHeader.Type != TlsContentType.ChangeCipherSpec) && !_isRenego || frameSize > availableData.Length - chunkSize) 600if (alert.Length == 0) 1107if (buffer.Length < TlsFrameHelper.HeaderSize)
System\Net\Security\SslStream.Protocol.cs (1)
1554Size = payload.Length;
System\Net\Security\TlsFrameHelper.cs (26)
171if (frame.Length < HeaderSize) 230if (frame.Length < HeaderSize) 256if (info.Header.Type != TlsContentType.Handshake || frame.Length <= HandshakeTypeOffset) 276bool isComplete = frame.Length >= info.Header.Length; 308if (frame.Length < 7 || frame[0] != (byte)TlsContentType.Alert) 384if (sslHandshake.Length < HelloOffset || 394if (helloLength < ProtocolVersionSize || helloData.Length < helloLength) 440if (p.Length < sizeof(ushort)) 448if (extensionListLength != p.Length) 483if (p.Length < sizeof(ushort)) 491if (extensionListLength != p.Length) 505while (extensions.Length >= ExtensionHeader) 512if (extensions.Length < extensionLength) 573if (serverNameListExtension.Length < ServerNameListOffset) 581if (serverNameListLength != serverNameList.Length) 604if (serverName.Length < HostNameStructOffset) 629if (hostNameStruct.Length < HostNameOffset) 637if (hostNameLength != hostName.Length) 672if (extensionData.Length != supportedVersionLength) 678while (extensionData.Length >= VersionLength) 705if (extensionData.Length < AlpnListOffset) 712if (AlpnListLength != alpnList.Length) 720if (alpnList.Length < protocolLength + 1) 816return (numberOfBytesToSkip < bytes.Length) ? bytes.Slice(numberOfBytesToSkip) : ReadOnlySpan<byte>.Empty; 827if (bytes.Length < OpaqueTypeLengthSize) 841if (bytes.Length < OpaqueTypeLengthSize)
System\Net\Security\TlsSession.cs (13)
553return native.Length; 583if (destination.Length < source.Length) 590bytesWritten = source.Length; 888if (input.Length < TlsFrameHelper.HeaderSize) 899if (input.Length < frameHeader.Length) 927if (frameLength > 0 && frameLength <= input.Length) 1128if (bytesConsumed > 0 && bytesConsumed < input.Length) 1168int chunk = Math.Min(plaintext.Length, _maxDataSize); 1240if (ciphertext.Length < TlsFrameHelper.HeaderSize) 1252if (ciphertext.Length < frameSize) 1547_pendingBuffer.EnsureAvailableSpace(data.Length); 1549_pendingBuffer.Commit(data.Length); 2168while (totalConsumed < buffer.Length)
System\Net\Security\TlsSession.OpenSsl.cs (1)
273int ret = Interop.Ssl.SslWrite(ssl, ref MemoryMarshal.GetReference(buffer), buffer.Length, out Interop.Ssl.SslErrorCode err);
System\Security\Authentication\ExtendedProtection\ServiceNameCollection.cs (1)
225host.Length == hostPortAndDistinguisher.Length ?
System.Net.ServerSentEvents (12)
System\Net\ServerSentEvents\Helpers.cs (4)
35Span<byte> buffer = writer.GetSpan(value.Length); 36Debug.Assert(value.Length <= buffer.Length); 38writer.Advance(value.Length); 48int maxByteCount = Encoding.UTF8.GetMaxByteCount(value.Length);
System\Net\ServerSentEvents\SseFormatter.cs (1)
153if (data[i++] == '\r' && i < data.Length && data[i] == '\n')
System\Net\ServerSentEvents\SseParser_1.cs (7)
112while (FillLineBuffer() != 0 && _lineLength < Utf8Bom.Length) ; 192while (await FillLineBufferAsync(cancellationToken).ConfigureAwait(false) != 0 && _lineLength < Utf8Bom.Length) ; 388ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 390(remainder[0] is LF || (remainder[0] is CR && remainder.Length > 1))) 392advance = line.Length + newlineLength + (remainder.StartsWith(CRLF) ? 2 : 1); 425_dataLength += fieldValue.Length; 467advance = line.Length + GetNewLineLength();
System.Net.Sockets (16)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.Bind.cs (1)
17=> Bind(socket, socketProtocolType, socketAddress, socketAddress.Length);
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
66if (socketAddressBuffer.Length >= SocketAddress.GetMaximumAddressSize(endPoint.AddressFamily) &&
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System\Net\Sockets\SafeSocketHandle.Unix.OptionTracking.cs (2)
85Debug.Assert(values.Length == TrackableOptionCount); 96for (int i = 0; i < values.Length; i++)
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
2019int bufferIndexIgnored = 0, offset = 0, count = buffer.Length;
System\Net\Sockets\SocketPal.Unix.cs (4)
260SocketAddressLen = socketAddress.Length, 323SocketAddressLen = socketAddress.Length, 957int bufferIndex = 0, offset = 0, count = buffer.Length; 1515Interop.Error err = Interop.Sys.SetRawSockOpt(handle, optionLevel, optionName, optionValuePtr, optionValue.Length);
System\Net\Sockets\UnixDomainSocketEndPoint.cs (2)
71if (socketAddress.Length > s_nativePathOffset) 73_encodedPath = new byte[socketAddress.Length - s_nativePathOffset];
System.Net.WebClient (14)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\IO\ChunkedMemoryStream.cs (2)
50int toCopy = Math.Min(remaining, buffer.Length); 59AppendChunk(buffer.Length);
System\Net\WebClient.cs (2)
1144bomLengthInData = preamble.Length; 1157bomLengthInData = data.AsSpan().StartsWith(preamble) ? preamble.Length : 0;
System.Net.WebHeaderCollection (1)
System\Net\HeaderInfoTable.cs (1)
74equalsPos = lastElement.Length;
System.Net.WebSockets (14)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (5)
49_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(payload.Length, MinInitialBufferLength)); 60Debug.Assert(consumed == payload.Length); 84if (payload.Length == 0) 130_stream.AvailIn = (uint)input.Length; 140consumed = input.Length - (int)_stream.AvailIn;
System\Net\WebSockets\ManagedWebSocket.cs (9)
649int payloadLength = payloadBuffer.Length; 673if (payloadBuffer.Length > 0) 730if (payload.Length <= 125) 732sendBuffer[1] = (byte)payload.Length; 735else if (payload.Length <= ushort.MaxValue) 738BinaryPrimitives.WriteUInt16BigEndian(sendBuffer.AsSpan(2), (ushort)payload.Length); 744BinaryPrimitives.WriteUInt64BigEndian(sendBuffer.AsSpan(2), (ulong)payload.Length); 1785for (int i = 0; i < span.Length;) 1832while (state.AdditionalBytesExpected > 0 && i < span.Length)
System.Numerics.Tensors (385)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (4)
70nuint remainder = (uint)x.Length; 1176if (x.Length != y.Length) 1189nuint remainder = (uint)x.Length;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (6)
61if (x.Length != y.Length) 66if (x.Length > destination.Length) 83nuint remainder = (uint)x.Length; 1400if (x.Length > destination.Length) 1415nuint remainder = (uint)x.Length;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (51)
85oneVectorFromEnd = x.Length - Vector512<T>.Count; 101if (i != x.Length && 102TAnyAll.ShouldEarlyExit(TOperator.Invoke(Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count))))) 113oneVectorFromEnd = x.Length - Vector256<T>.Count; 129if (i != x.Length && 130TAnyAll.ShouldEarlyExit(TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count))))) 141oneVectorFromEnd = x.Length - Vector128<T>.Count; 157if (i != x.Length && 158TAnyAll.ShouldEarlyExit(TOperator.Invoke(Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count))))) 167while (i < x.Length) 187if (x.Length > destination.Length) 219int vectorFromEnd = x.Length - Vector512<T>.Count; 231if (i != x.Length) 233i = x.Length - Vector512<T>.Count; 250int vectorFromEnd = x.Length - Vector256<T>.Count; 262if (i != x.Length) 264i = x.Length - Vector256<T>.Count; 281int vectorFromEnd = x.Length - Vector128<T>.Count; 293if (i != x.Length) 295i = x.Length - Vector128<T>.Count; 310while (i < x.Length) 327int vectorsFromEnd = x.Length - (Vector512<T>.Count * sizeof(T)); 339if (i != x.Length) 341i = x.Length - (Vector512<T>.Count * sizeof(T)); 361int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T)); 373if (i != x.Length) 375i = x.Length - (Vector256<T>.Count * sizeof(T)); 395int vectorsFromEnd = x.Length - (Vector128<T>.Count * sizeof(T)); 407if (i != x.Length) 409i = x.Length - (Vector128<T>.Count * sizeof(T)); 427while (i < x.Length) 444int vectorsFromEnd = x.Length - (Vector512<T>.Count * sizeof(T)); 456if (i != x.Length) 458i = x.Length - (Vector512<T>.Count * sizeof(T)); 482int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T)); 494if (i != x.Length) 496i = x.Length - (Vector256<T>.Count * sizeof(T)); 520int vectorsFromEnd = x.Length - (Vector128<T>.Count * sizeof(T)); 532if (i != x.Length) 534i = x.Length - (Vector128<T>.Count * sizeof(T)); 556while (i < x.Length) 573int vectorsFromEnd = x.Length - (Vector512<T>.Count * sizeof(T)); 585if (i != x.Length) 587i = x.Length - (Vector512<T>.Count * sizeof(T)); 621int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T)); 633if (i != x.Length) 635i = x.Length - (Vector256<T>.Count * sizeof(T)); 669int vectorsFromEnd = x.Length - (Vector128<T>.Count * sizeof(T)); 681if (i != x.Length) 683i = x.Length - (Vector128<T>.Count * sizeof(T)); 713while (i < x.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IIndexOfMinMaxOperator.cs (22)
31if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count) 39if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count) 47if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count) 68for (int i = 1; i < x.Length; i++) 112if (span.Length >= Vector128<T>.Count) 120int start = x.Length - Vector128<T>.Count; 180if (span.Length >= Vector128<T>.Count) 188int start = x.Length - Vector128<T>.Count; 257if (span.Length >= Vector128<T>.Count) 265int start = x.Length - Vector128<T>.Count; 343if (span.Length >= Vector256<T>.Count) 351int start = x.Length - Vector256<T>.Count; 411if (span.Length >= Vector256<T>.Count) 419int start = x.Length - Vector256<T>.Count; 488if (span.Length >= Vector256<T>.Count) 496int start = x.Length - Vector256<T>.Count; 574if (span.Length >= Vector512<T>.Count) 582int start = x.Length - Vector512<T>.Count; 642if (span.Length >= Vector512<T>.Count) 650int start = x.Length - Vector512<T>.Count; 719if (span.Length >= Vector512<T>.Count) 727int start = x.Length - Vector512<T>.Count;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (2)
34if (x.Length > destination.Length) 49nuint remainder = (uint)x.Length;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (12)
46if (x.Length != y.Length || x.Length != z.Length) 51if (x.Length > destination.Length) 70nuint remainder = (uint)x.Length; 1523if (x.Length != y.Length) 1528if (x.Length > destination.Length) 1545nuint remainder = (uint)x.Length; 3016if (x.Length > destination.Length) 3031nuint remainder = (uint)x.Length;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (47)
51if (x.Length > destination1.Length) 56if (x.Length > destination2.Length) 63ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2); 72oneVectorFromEnd = x.Length - Vector512<T>.Count; 87if (i != x.Length) 89i = x.Length - Vector512<T>.Count; 102oneVectorFromEnd = x.Length - Vector256<T>.Count; 117if (i != x.Length) 119i = x.Length - Vector256<T>.Count; 132oneVectorFromEnd = x.Length - Vector128<T>.Count; 147if (i != x.Length) 149i = x.Length - Vector128<T>.Count; 160while (i < x.Length) 178if (x.Length != y.Length) 183if (x.Length > destination1.Length) 188if (x.Length > destination2.Length) 197ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2); 207oneVectorFromEnd = x.Length - Vector512<T>.Count; 222if (i != x.Length) 224Vector512<T> mask = Vector512.Equals(CreateRemainderMaskVector512<T>(x.Length - i), Vector512<T>.Zero); 226i = x.Length - Vector512<T>.Count; 255oneVectorFromEnd = x.Length - Vector256<T>.Count; 270if (i != x.Length) 272Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero); 274i = x.Length - Vector256<T>.Count; 303oneVectorFromEnd = x.Length - Vector128<T>.Count; 318if (i != x.Length) 320Vector128<T> mask = Vector128.Equals(CreateRemainderMaskVector128<T>(x.Length - i), Vector128<T>.Zero); 322i = x.Length - Vector128<T>.Count; 349while (i < x.Length) 367if (x.Length > destination1.Length) 372if (x.Length > destination2.Length) 379ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2); 388oneVectorFromEnd = x.Length - Vector512<T>.Count; 405if (i != x.Length) 407Vector512<T> mask = Vector512.Equals(CreateRemainderMaskVector512<T>(x.Length - i), Vector512<T>.Zero); 409i = x.Length - Vector512<T>.Count; 438oneVectorFromEnd = x.Length - Vector256<T>.Count; 455if (i != x.Length) 457Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero); 459i = x.Length - Vector256<T>.Count; 488oneVectorFromEnd = x.Length - Vector128<T>.Count; 505if (i != x.Length) 507Vector128<T> mask = Vector128.Equals(CreateRemainderMaskVector128<T>(x.Length - i), Vector128<T>.Zero); 509i = x.Length - Vector128<T>.Count; 536while (i < x.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToFourOperator.cs (11)
35if (x.Length > destination.Length) 49oneVectorFromEnd = x.Length - Vector512<TInput>.Count; 66if (i != x.Length) 68i = x.Length - Vector512<TInput>.Count; 86oneVectorFromEnd = x.Length - Vector256<TInput>.Count; 103if (i != x.Length) 105i = x.Length - Vector256<TInput>.Count; 123oneVectorFromEnd = x.Length - Vector128<TInput>.Count; 140if (i != x.Length) 142i = x.Length - Vector128<TInput>.Count; 155while (i < x.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToTwoOperator.cs (11)
35if (x.Length > destination.Length) 49oneVectorFromEnd = x.Length - Vector512<TInput>.Count; 64if (i != x.Length) 66i = x.Length - Vector512<TInput>.Count; 82oneVectorFromEnd = x.Length - Vector256<TInput>.Count; 97if (i != x.Length) 99i = x.Length - Vector256<TInput>.Count; 115oneVectorFromEnd = x.Length - Vector128<TInput>.Count; 130if (i != x.Length) 132i = x.Length - Vector128<TInput>.Count; 143while (i < x.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (2)
70if (x.Length > destination.Length) 89nuint remainder = (uint)x.Length;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryTwoToOneOperator.cs (11)
35if (x.Length > destination.Length) 49twoVectorsFromEnd = x.Length - (Vector512<TInput>.Count * 2); 64if (i != x.Length) 66i = x.Length - (Vector512<TInput>.Count * 2); 82twoVectorsFromEnd = x.Length - (Vector256<TInput>.Count * 2); 97if (i != x.Length) 99i = x.Length - (Vector256<TInput>.Count * 2); 115twoVectorsFromEnd = x.Length - (Vector128<TInput>.Count * 2); 130if (i != x.Length) 132i = x.Length - (Vector128<TInput>.Count * 2); 143while (i < x.Length)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (3)
111_shape = TensorShape.Create(ref reference, span.Length, pinned: false); 141_shape = TensorShape.Create(ref reference, span.Length, lengths, strides, pinned: false); 288public int Rank => Lengths.Length;
System\Numerics\Tensors\netcore\Tensor.cs (34)
128if (tensors.Length < 2) 140for (int i = 1; i < tensors.Length; i++) 167for (int i = 0; i < tensors.Length; i++) 201if (tensors.Length < 2) 213for (int i = 0; i < tensors.Length; i++) 223for (int i = 1; i < tensors.Length; i++) 283for (int i = 0; i < tensors.Length; i++) 304for (int i = 0; i < tensors.Length; i++) 1331if (!dimensions.IsEmpty && dimensions.Length != tensor.Lengths.Length) 1349for (int i = 0; i < dimensions.Length; i++) 1351if (dimensions[i] >= tensor.Lengths.Length || dimensions[i] < 0) 1395for (int i = 0; i < lengths.Length; i++) 1467for (int i = 0; i < lengths.Length; i++) 1544for (int i = 0; i < lengths.Length; i++) 1612if (newSize >= span.Length) 1672if (ospan.Length >= span.Length) 1929for (int i = 0, index = 0; i < tensor.Lengths.Length; i++) 1996for (int i = 0, index = 0; i < tensor.Lengths.Length; i++) 2063for (int i = 0, index = 0; i < tensor.Lengths.Length; i++) 2119if (tensors.Length < 2) 2122for (int i = 1; i < tensors.Length; i++) 2133Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2134for (int i = 0; i < tensors.Length; i++) 2159if (tensors.Length < 2) 2162for (int i = 1; i < tensors.Length; i++) 2173Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2174for (int i = 0; i < tensors.Length; i++) 2187ArgumentOutOfRangeException.ThrowIfNotEqual(maximumLengths.Length, tensor.Rank); 2313for (int i = 1; i < values.Length; i++) 2333if (tensor.Lengths.Length < 2) 2407if (dimension > tensor.Lengths.Length) 2444if (dimension > tensor.Lengths.Length) 2481if (dimension > tensor.Lengths.Length)
System\Numerics\Tensors\netcore\TensorOperation.cs (7)
2003for (int i = 0; i < x.Length; i++) 2021for (int i = 0; i < x.Length; i++) 2106for (int i = 0; i < x.Length; i++) 2119for (int i = 0; i < x.Length; i++) 2138for (int i = 0; i < x.Length; i++) 2291for (int i = 0; i < x.Length; i++) 2310for (int i = 0; i < x.Length; i++)
System\Numerics\Tensors\netcore\TensorPrimitives.Average.cs (1)
25return Sum(x) / T.CreateChecked(x.Length);
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertHelpers.cs (1)
19if (source.Length > destination.Length)
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (42)
52if (x.Length != y.Length) 61if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count) 71int oneVectorFromEnd = x.Length - Vector512<T>.Count; 85if (i != x.Length) 87Vector512<T> remainderMask = CreateRemainderMaskVector512<T>(x.Length - i); 90Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count)) & remainderMask, 91Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<T>.Count)) & remainderMask, 98if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count) 108int oneVectorFromEnd = x.Length - Vector256<T>.Count; 122if (i != x.Length) 124Vector256<T> remainderMask = CreateRemainderMaskVector256<T>(x.Length - i); 127Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask, 128Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask, 135if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count) 145int oneVectorFromEnd = x.Length - Vector128<T>.Count; 159if (i != x.Length) 161Vector128<T> remainderMask = CreateRemainderMaskVector128<T>(x.Length - i); 164Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count)) & remainderMask, 165Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<T>.Count)) & remainderMask, 175for (int i = 0; i < x.Length; i++) 191if (x.Length != y.Length) 201if (Vector512.IsHardwareAccelerated && x.Length >= Vector512<short>.Count) 212int oneVectorFromEnd = x.Length - Vector512<short>.Count; 227if (i != x.Length) 229Vector512<short> remainderMask = CreateRemainderMaskVector512<short>(x.Length - i); 232Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<short>.Count)) & remainderMask); 234Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<short>.Count)) & remainderMask); 243if (Vector256.IsHardwareAccelerated && x.Length >= Vector256<short>.Count) 254int oneVectorFromEnd = x.Length - Vector256<short>.Count; 269if (i != x.Length) 271Vector256<short> remainderMask = CreateRemainderMaskVector256<short>(x.Length - i); 274Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask); 276Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask); 285if (Vector128.IsHardwareAccelerated && x.Length >= Vector128<short>.Count) 296int oneVectorFromEnd = x.Length - Vector128<short>.Count; 311if (i != x.Length) 313Vector128<short> remainderMask = CreateRemainderMaskVector128<short>(x.Length - i); 316Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<short>.Count)) & remainderMask); 318Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<short>.Count)) & remainderMask); 330for (int i = 0; i < x.Length; i++)
System\Numerics\Tensors\netcore\TensorPrimitives.Half.cs (1)
307source.Length >= Vector128<short>.Count;
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (29)
22if (x.Length != y.Length) 28for (int i = 0; i < x.Length; i++) 55MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(x)), x.Length), 56MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(y)), y.Length)); 65if (x.Length != y.Length) 75if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count) 77if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count) 79if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count) 84int oneVectorFromEnd = x.Length - Vector512<T>.Count; 98if (i != x.Length) 100Vector512<T> xVec = Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count)); 101Vector512<T> yVec = Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<T>.Count)); 103Vector512<T> remainderMask = CreateRemainderMaskVector512<T>(x.Length - i); 116int oneVectorFromEnd = x.Length - Vector256<T>.Count; 130if (i != x.Length) 132Vector256<T> xVec = Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)); 133Vector256<T> yVec = Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<T>.Count)); 135Vector256<T> remainderMask = CreateRemainderMaskVector256<T>(x.Length - i); 149int oneVectorFromEnd = x.Length - Vector128<T>.Count; 163if (i != x.Length) 165Vector128<T> xVec = Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count)); 166Vector128<T> yVec = Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<T>.Count)); 168Vector128<T> remainderMask = CreateRemainderMaskVector128<T>(x.Length - i); 178for (int i = 0; i < x.Length; i++) 189for (int i = 0; i < x.Length; i++) 198Debug.Assert(count >= 0 && count <= x.Length, $"Expected count to be in the range [0, {x.Length}], got {count}.");
System\Numerics\Tensors\netcore\TensorPrimitives.IsCanonical.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Fill(true);
System\Numerics\Tensors\netcore\TensorPrimitives.IsComplexNumber.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Clear();
System\Numerics\Tensors\netcore\TensorPrimitives.IsFinite.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Fill(true);
System\Numerics\Tensors\netcore\TensorPrimitives.IsImaginaryNumber.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Clear();
System\Numerics\Tensors\netcore\TensorPrimitives.IsInteger.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Fill(true);
System\Numerics\Tensors\netcore\TensorPrimitives.IsNaN.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Clear();
System\Numerics\Tensors\netcore\TensorPrimitives.IsNegative.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Clear();
System\Numerics\Tensors\netcore\TensorPrimitives.IsRealNumber.cs (2)
23if (x.Length > destination.Length) 28destination.Slice(0, x.Length).Fill(true);
System\Numerics\Tensors\netcore\TensorPrimitives.Max.cs (13)
140if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count) 160int oneVectorFromEnd = x.Length - Vector512<T>.Count; 184if (i != x.Length) 186current = Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count)); 205if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count) 225int oneVectorFromEnd = x.Length - Vector256<T>.Count; 249if (i != x.Length) 251current = Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)); 271if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count) 291int oneVectorFromEnd = x.Length - Vector128<T>.Count; 315if (i != x.Length) 317current = Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count)); 343for (int i = 1; i < x.Length; i++)
System\Numerics\Tensors\netcore\TensorPrimitives.PopCount.cs (1)
20for (int i = 0; i < x.Length; i++)
System\Numerics\Tensors\netcore\TensorPrimitives.SoftMax.cs (1)
32if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\TensorPrimitives.StdDev.cs (1)
29T variance = sumSquaredDiff / T.CreateChecked(x.Length);
System\Numerics\Tensors\netcore\TensorShape.cs (54)
70int rank = lengths.Length; 103if (strides.Length == 0) 137else if (strides.Length != lengths.Length) 268Debug.Assert((flattenedLength == minimumLinearLength) || (strides.Length != 0)); 281int rank = lengths.Length; 282Debug.Assert(strides.Length == rank); 417for (int i = 0; i < strides.Length; i++) 419int rankIndex = lengths.Length - (i + 1); 420int destinationRankIndex = destinationShape.Lengths.Length - (i + 1); 448for (int i = strides.Length; i < destinationLengths.Length; i++) 450int rankIndex = destinationLengths.Length - (i + 1); 482for (int i = 0; i < strides.Length; i++) 484int rankIndex = lengths.Length - (i + 1); 485int destinationRankIndex = destinationShape.Lengths.Length - (i + 1); 513for (int i = destinationLengths.Length - 1; i >= strides.Length; i--) 515int rankIndex = destinationLengths.Length - (i + 1); 596for (int i = 0; i < lengths1.Length; i++) 626for (int i = 0; i < strides1.Length; i++) 643int rankDelta = shape1Lengths.Length - shape2.Rank; 667for (int i = 0; i < lengths1.Length; i++) 752if ((start.Length != 0) && (start.Length != rank)) 759if (lengths.Length == 0) 784if (start.Length != 0) 797for (int i = 0; i < start.Length; i++) 799int index = start.Length - (i + 1); 832else if (start.Length != 0) 837if ((lengths.Length != 0) || (strides.Length != 0)) 884if ((lengths.Length != 0) || (strides.Length != 0)) 910if ((lengths.Length != 0) || (strides.Length != 0)) 959if ((lengths.Length != 0) || (strides.Length != 0)) 1005if ((state.Length != lengths.Length) || 1006(state.Length != strides.Length)) 1013for (int i = 0; i < state.Length; i++) 1027if ((uint)dimension > (uint)lengths.Length) 1055if ((state.Length != lengths.Length) || 1056(state.Length != strides.Length)) 1140if ((state.Length != previousLengths.Length) || 1141(state.Length != previousStrides.Length)) 1250for (int i = 0; i < strides.Length; i++) 1252int index = strides.Length - (i + 1);
System\Numerics\Tensors\netcore\TensorSpan_1.cs (1)
189public int Rank => Lengths.Length;
System\Numerics\Tensors\TensorPrimitives.Single.cs (1)
852if (x.Length > destination.Length)
System.Private.CoreLib (2229)
Internal\Reflection\Augments\ReflectionAugments.cs (1)
365int numParameters = parameters.Length;
Internal\Reflection\Extensions\NonPortable\CustomAttributeInstantiator.cs (4)
48if (parameters.Length != constructorArguments.Count) 51for (i = 0; i < parameters.Length; i++) 58if (i == parameters.Length) 71int arity = matchingParameters.Length;
Internal\Runtime\CompilerHelpers\InteropHelpers.cs (1)
73int numChars = Math.Min(managed.Length, length - 1);
src\runtime\src\libraries\Common\src\Interop\Interop.ICU.cs (1)
20InitICUFunctions(icuuc, icuin, version.ToString(), suffix.Length > 0 ? suffix.ToString() : null);
src\runtime\src\libraries\Common\src\Interop\Linux\os-release\Interop.OSReleaseFile.cs (2)
65ReadOnlySpan<char> fieldValue = line.Slice(prefix.Length); 68if (fieldValue.Length >= 2 &&
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (6)
32if (mount.MountPoint.Length < currentBestLength) 42if (mount.MountPoint.Length == path.Length) 48if (mount.MountPoint.Length > 1 && path[mount.MountPoint.Length] != '/') 53currentBestLength = mount.MountPoint.Length; 58if (currentFormat.Length > 0)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs (1)
41Debug.Assert(nameBytes.Length > 0, "we shouldn't have gotten a garbage value from the OS");
src\runtime\src\libraries\Common\src\System\Collections\Generic\BitHelper.cs (1)
45bitArrayIndex < (uint)span.Length &&
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (23)
122Debug.Assert(source.Length >= (Vector128<TChar>.Count / 2)); 138nuint lengthSubVector128 = (nuint)source.Length - (nuint)(Vector128<TChar>.Count / 2); 172if (pos == (nuint)source.Length) 189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 192if ((AdvSimd.Arm64.IsSupported || Ssse3.IsSupported || PackedSimd.IsSupported) && (source.Length >= (Vector128<byte>.Count / 2))) 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 209if ((AdvSimd.Arm64.IsSupported || Ssse3.IsSupported || PackedSimd.IsSupported) && (source.Length >= (Vector128<ushort>.Count / 2))) 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 280(utf8Source.Length >= Vector128<byte>.Count)) 292(source.Length >= (Vector128<ushort>.Count * 2))) 307Debug.Assert(source.Length <= (destination.Length * 2)); 308Debug.Assert((source.Length % 2) == 0); 321Debug.Assert(source.Length >= elementsReadPerIteration); 324nuint lengthSubElementsReadPerIteration = (nuint)source.Length - (nuint)elementsReadPerIteration; 424if (offset == (nuint)source.Length) 426elementsProcessed = source.Length; 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (11)
16internal static bool StartsWithDirectorySeparator(ReadOnlySpan<char> path) => path.Length > 0 && IsDirectorySeparator(path[0]); 22=> path.Length == GetRootLength(path); 138for (int i = skip; i < path.Length; i++) 142if (IsDirectorySeparator(c) && i + 1 < path.Length) 153if ((i + 2 == path.Length || IsDirectorySeparator(path[i + 2])) && 162if (i + 2 < path.Length && 163(i + 3 == path.Length || IsDirectorySeparator(path[i + 3])) && 172sb.Length = (i + 3 >= path.Length && s == skip) ? s + 1 : s; // to avoid removing the complete "\tmp\" segment in cases like \\?\C:\tmp\..\, C:\tmp\.. 197if (!flippedSeparator && sb.Length == path.Length) 231path.Slice(0, path.Length - 1) : 238path.Length > 0 && IsDirectorySeparator(path[^1]);
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (1)
24return path.Length > 0 && IsDirectorySeparator(path[0]) ? 1 : 0;
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
144if (span.Length > 0 && span[0] == '+') 167if (span.Length > 0 && span[0] == '+')
src\runtime\src\libraries\Common\src\System\Number.Formatting.Common.cs (29)
58if (format.Length > 0) 66if (format.Length == 1) 72if (format.Length == 2) 82else if (format.Length == 3) 98while ((uint)i < (uint)format.Length && char.IsAsciiDigit(format[i])) 110if ((uint)i >= (uint)format.Length || format[i] == '\0') 120return format.Length == 0 || c == '\0' ? // For compat, treat '\0' as the end of the specifier, even if the specifier extends beyond it. 330while (src < format.Length && (ch = pFormat[src++]) != 0 && ch != ';') 381while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch) ; 385if (src < format.Length && pFormat[src] != 0) 393if ((src < format.Length && pFormat[src] == '0') || 394(src + 1 < format.Length && (pFormat[src] == '+' || pFormat[src] == '-') && pFormat[src + 1] == '0')) 396while (++src < format.Length && pFormat[src] == '0') ; 539while (src < format.Length && (ch = pFormat[src++]) != 0 && ch != ';') 630while (src < format.Length && pFormat[src] != 0 && pFormat[src] != ch) 635if (src < format.Length && pFormat[src] != 0) 642if (src < format.Length && pFormat[src] != 0) 655if (src < format.Length && pFormat[src] == '0') 660else if (src + 1 < format.Length && pFormat[src] == '+' && pFormat[src + 1] == '0') 665else if (src + 1 < format.Length && pFormat[src] == '-' && pFormat[src + 1] == '0') 676while (++src < format.Length && pFormat[src] == '0') 693if (src < format.Length) 700while (src < format.Length && pFormat[src] == '0') 784bufferSize += sGroup.Length; 813for (int j = sGroup.Length - 1; j >= 0; j--) 1153if (src >= format.Length) 1162while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch) ; 1166if (src < format.Length && pFormat[src] != 0) 1178if (src < format.Length && pFormat[src] != 0 && pFormat[src] != ';')
src\runtime\src\libraries\Common\src\System\Number.Parsing.Common.cs (3)
289if ((index == value.Length) || ((styles & AllowTrailingInvalidCharacters) != 0)) 308bool succeeded = TryParseNumber(stringPointer, stringPointer + value.Length, styles, ref number, info, out elementsConsumed); 321return index + ((nullsToConsume >= 0) ? nullsToConsume : remainder.Length);
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (1)
108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (2)
63if (input.Length == 0) 347if (_index < _input.Length)
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\SpanOfCharAsUtf8StringMarshaller.cs (1)
41if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length)
src\runtime\src\libraries\Common\src\System\Sha1ForNonSecretPurposes.cs (3)
35int originalLength = source.Length; 37while (source.Length >= 64) 49int pos = source.Length;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\AppDomain.cs (1)
152parameters: entry.GetParametersAsSpan().Length > 0 ? [args] : null,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Array.cs (3)
742Debug.Assert(indices.Length == Rank); 748for (int i = 0; i < indices.Length; i++) 750int index = indices[i] - Unsafe.Add(ref bounds, indices.Length + i);
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (15)
443if (value.Length < sizeof(char)) 478if (value.Length < sizeof(short)) 516if (value.Length < sizeof(int)) 554if (value.Length < sizeof(long)) 592if (value.Length < Int128.Size) 619if (value.Length < sizeof(ushort)) 649if (value.Length < sizeof(uint)) 679if (value.Length < sizeof(ulong)) 719if (value.Length < UInt128.Size) 744if (value.Length < sizeof(BFloat16)) 769if (value.Length < sizeof(Half)) 797if (value.Length < sizeof(float)) 825if (value.Length < sizeof(double)) 877while (i < src.Length) 951if (value.Length < sizeof(byte))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Boolean.cs (4)
269int originalLength = value.Length; 273if (value.Length != originalLength) 295while (start < value.Length) 304int end = value.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (8)
289if (destination.Length < source.Length) 310while (i <= source.Length - Vector256<T>.Count) 319while (i <= source.Length - Vector128<T>.Count) 326while (i < source.Length) 338int i = source.Length; 381if (destination.Length < source.Length) 391for (int i = 0; i < source.Length; i++) 399for (int i = source.Length - 1; i >= 0; i--)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
538if (!value.IsEmpty && value.Length <= 10)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\StandardFormat.cs (3)
99if (format.Length == 0) 104if (format.Length == 1) 111for (int srcIndex = 1; srcIndex < format.Length; srcIndex++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (2)
104int upperBound = GetMaxDecodedLength(source.Length); 236int upperBound = GetMaxDecodedLength(source.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Encoder.cs (4)
94byte[] destination = new byte[GetEncodedLength(source.Length)]; 191char[] destination = new char[GetEncodedLength(source.Length)]; 204string.Create(GetEncodedLength(source.Length), source, static (buffer, source) => 207Debug.Assert(buffer.Length == charsWritten, $"The source length: {source.Length}, chars written: {charsWritten}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64DecoderHelper.cs (16)
38int srcLength = decoder.SrcLength(isFinalBlock, source.Length); 159if (src == srcBytes + source.Length) 242if (srcLength != source.Length) 253if (srcLength != source.Length && isFinalBlock) 294bytesConsumed += source.Length; 531for (; encodedIdx < source.Length && (uint)bufferIdx < (uint)buffer.Length; ++encodedIdx) 551hasAnotherBlock = source.Length >= BlockSize; 555hasAnotherBlock = source.Length > 1; 591for (int i = 0; i < source.Length; ++i) 636for (; encodedIdx < source.Length && (uint)bufferIdx < (uint)buffer.Length; ++encodedIdx) 656hasAnotherBlock = source.Length >= BlockSize; 660hasAnotherBlock = source.Length > 1; 696for (int i = 0; i < source.Length; ++i) 708bytesConsumed += source.Length; 1649for (int i = 0; i < span.Length; i++) 1866for (int i = 0; i < span.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64EncoderHelper.cs (1)
35int srcLength = source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64ValidatorHelper.cs (3)
23if ((uint)index >= (uint)base64Text.Length) 25length += base64Text.Length; 26lastChar = base64Text[base64Text.Length - 1];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (2)
164int upperBound = GetMaxDecodedLength(source.Length); 262int upperBound = GetMaxDecodedLength(source.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (4)
89byte[] destination = new byte[GetEncodedLength(source.Length)]; 140char[] destination = new char[GetEncodedLength(source.Length)]; 156int encodedLength = GetEncodedLength(source.Length); 162Debug.Assert(buffer.Length == charsWritten, $"The source length: {source.Length}, bytes written: {charsWritten}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (3)
25Debug.Assert(log2ToPow10.Length == 64); 54Debug.Assert((elementOffset + 1) <= powersOf10.Length); 102Debug.Assert(table.Length == 32, "Every result of uint.Log2(value) needs a long entry in the table.");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Boolean.cs (2)
32if (source.Length >= 4) 42if (source.Length > 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Default.cs (1)
18if (source.Length < 26)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.G.cs (1)
17if (source.Length < 19)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.O.cs (3)
21if (source.Length < 27) 196byte offsetChar = (source.Length <= 27) ? default : source[27]; 228if (source.Length < 33)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.R.cs (1)
17if (source.Length < 29)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Float.cs (1)
116int remaining = source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Guid.cs (2)
56if (text.Length < 32) 109if (source.Length < expectedCodingUnits)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.D.cs (34)
10if (source.Length < 1) 20if ((uint)index >= (uint)source.Length) 27if ((uint)index >= (uint)source.Length) 41if ((uint)index >= (uint)source.Length) 52if ((uint)index >= (uint)source.Length) 61if ((uint)index >= (uint)source.Length) 73if ((uint)index >= (uint)source.Length) 95if (source.Length < 1) 105if ((uint)index >= (uint)source.Length) 112if ((uint)index >= (uint)source.Length) 126if ((uint)index >= (uint)source.Length) 137if ((uint)index >= (uint)source.Length) 145if ((uint)index >= (uint)source.Length) 153if ((uint)index >= (uint)source.Length) 162if ((uint)index >= (uint)source.Length) 174if ((uint)index >= (uint)source.Length) 196if (source.Length < 1) 206if ((uint)index >= (uint)source.Length) 213if ((uint)index >= (uint)source.Length) 227if ((uint)index >= (uint)source.Length) 238if ((uint)index >= (uint)source.Length) 246if ((uint)index >= (uint)source.Length) 254if ((uint)index >= (uint)source.Length) 262if ((uint)index >= (uint)source.Length) 270if ((uint)index >= (uint)source.Length) 278if ((uint)index >= (uint)source.Length) 286if ((uint)index >= (uint)source.Length) 294if ((uint)index >= (uint)source.Length) 303if ((uint)index >= (uint)source.Length) 317if ((uint)index >= (uint)source.Length) 348if ((uint)idx >= (uint)source.Length) { goto FalseExit; } 382if (source.Length < overflowLength) 390if ((uint)idx >= (uint)source.Length) { break; } // EOF 401if ((uint)idx >= (uint)source.Length) { break; } // EOF
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.N.cs (24)
10if (source.Length < 1) 20if ((uint)index >= (uint)source.Length) 27if ((uint)index >= (uint)source.Length) 46if ((uint)index >= (uint)source.Length) 70if ((uint)index >= (uint)source.Length) 79if ((uint)index >= (uint)source.Length) 102if (source.Length < 1) 112if ((uint)index >= (uint)source.Length) 119if ((uint)index >= (uint)source.Length) 138if ((uint)index >= (uint)source.Length) 162if ((uint)index >= (uint)source.Length) 171if ((uint)index >= (uint)source.Length) 194if (source.Length < 1) 204if ((uint)index >= (uint)source.Length) 211if ((uint)index >= (uint)source.Length) 230if ((uint)index >= (uint)source.Length) 257if ((uint)index >= (uint)source.Length) 266if ((uint)index >= (uint)source.Length) 289if (source.Length < 1) 299if ((uint)index >= (uint)source.Length) 306if ((uint)index >= (uint)source.Length) 325if ((uint)index >= (uint)source.Length) 352if ((uint)index >= (uint)source.Length) 361if ((uint)index >= (uint)source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.D.cs (27)
10if (source.Length < 1) 24if ((uint)index >= (uint)source.Length) 35if ((uint)index >= (uint)source.Length) 44if ((uint)index >= (uint)source.Length) 54if ((uint)index >= (uint)source.Length) 76if (source.Length < 1) 90if ((uint)index >= (uint)source.Length) 101if ((uint)index >= (uint)source.Length) 109if ((uint)index >= (uint)source.Length) 117if ((uint)index >= (uint)source.Length) 126if ((uint)index >= (uint)source.Length) 136if ((uint)index >= (uint)source.Length) 158if (source.Length < 1) 172if ((uint)index >= (uint)source.Length) 183if ((uint)index >= (uint)source.Length) 191if ((uint)index >= (uint)source.Length) 199if ((uint)index >= (uint)source.Length) 207if ((uint)index >= (uint)source.Length) 215if ((uint)index >= (uint)source.Length) 223if ((uint)index >= (uint)source.Length) 231if ((uint)index >= (uint)source.Length) 239if ((uint)index >= (uint)source.Length) 248if ((uint)index >= (uint)source.Length) 258if ((uint)index >= (uint)source.Length) 298if (source.Length < ParserHelpers.UInt64OverflowLength) 306if ((uint)idx >= (uint)source.Length) { break; } // EOF 317if ((uint)idx >= (uint)source.Length) { break; } // EOF
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.N.cs (20)
13if (source.Length < 1) 21if ((uint)index >= (uint)source.Length) 40if ((uint)index >= (uint)source.Length) 62if ((uint)index >= (uint)source.Length) 71if ((uint)index >= (uint)source.Length) 94if (source.Length < 1) 102if ((uint)index >= (uint)source.Length) 121if ((uint)index >= (uint)source.Length) 143if ((uint)index >= (uint)source.Length) 152if ((uint)index >= (uint)source.Length) 175if (source.Length < 1) 183if ((uint)index >= (uint)source.Length) 202if ((uint)index >= (uint)source.Length) 224if ((uint)index >= (uint)source.Length) 233if ((uint)index >= (uint)source.Length) 256if (source.Length < 1) 264if ((uint)index >= (uint)source.Length) 283if ((uint)index >= (uint)source.Length) 305if ((uint)index >= (uint)source.Length) 314if ((uint)index >= (uint)source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.X.cs (20)
10if (source.Length < 1) 32if (source.Length <= ParserHelpers.ByteOverflowLengthHex) 35for (int index = 1; index < source.Length; index++) 64for (int index = ParserHelpers.ByteOverflowLengthHex; index < source.Length; index++) 85bytesConsumed = source.Length; 92if (source.Length < 1) 114if (source.Length <= ParserHelpers.Int16OverflowLengthHex) 117for (int index = 1; index < source.Length; index++) 146for (int index = ParserHelpers.Int16OverflowLengthHex; index < source.Length; index++) 167bytesConsumed = source.Length; 174if (source.Length < 1) 196if (source.Length <= ParserHelpers.Int32OverflowLengthHex) 199for (int index = 1; index < source.Length; index++) 228for (int index = ParserHelpers.Int32OverflowLengthHex; index < source.Length; index++) 249bytesConsumed = source.Length; 256if (source.Length < 1) 278if (source.Length <= ParserHelpers.Int64OverflowLengthHex) 281for (int index = 1; index < source.Length; index++) 310for (int index = ParserHelpers.Int64OverflowLengthHex; index < source.Length; index++) 331bytesConsumed = source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Number.cs (11)
26if (source.Length == 0) 47if (srcIndex >= source.Length) 64while (srcIndex < source.Length) 72if (srcIndex == source.Length) 82while (srcIndex < source.Length) 118if (srcIndex == source.Length) 137while (srcIndex < source.Length) 182if (srcIndex == source.Length) 226if (srcIndex == source.Length) 242if (srcIndex == source.Length) 271while (srcIndex < source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.BigG.cs (8)
12while (srcIndex < source.Length) 20if (srcIndex == source.Length) 32if (srcIndex == source.Length) 48if (srcIndex == source.Length || source[srcIndex++] != Utf8Constants.Colon) 63if (srcIndex == source.Length || source[srcIndex++] != Utf8Constants.Colon) 78if (srcIndex == source.Length || source[srcIndex++] != Utf8Constants.Colon) 93if (srcIndex == source.Length || source[srcIndex++] != Utf8Constants.Period) 120if (srcIndex != source.Length && (source[srcIndex] == Utf8Constants.Period || source[srcIndex] == Utf8Constants.Colon))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.cs (2)
47if (srcIndex == source.Length) 66while (srcIndex < source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpanSplitter.cs (5)
41while (srcIndex < source.Length) 49if (srcIndex == source.Length) 60if (srcIndex == source.Length) 166if (srcIndex != source.Length && (source[srcIndex] == Utf8Constants.Period || source[srcIndex] == Utf8Constants.Colon)) 181if (srcIndex == source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Byte.cs (5)
298if (source.Length != 0) 309if ((source.Length > sizeof(byte)) && (source[..^sizeof(byte)].ContainsAnyExcept((byte)0x00))) 319result = source[source.Length - sizeof(byte)]; 331if (source.Length != 0) 342if ((source.Length > sizeof(byte)) && (source[sizeof(byte)..].ContainsAnyExcept((byte)0x00)))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (13)
81private static bool IsLatin1(char c) => (uint)c < (uint)Latin1CharInfo.Length; 224if (s.Length != 1) 243if (s.Length != 1) 257bytesConsumed != utf8Text.Length) 274bytesConsumed != utf8Text.Length || 1252if (source.Length != 0) 1263if ((source.Length > sizeof(char)) && (source[..^sizeof(char)].ContainsAnyExcept((byte)0x00))) 1272if (source.Length >= sizeof(char)) 1275result = (char)BinaryPrimitives.ReadUInt16BigEndian(source.Slice(source.Length - sizeof(char))); 1293if (source.Length != 0) 1304if ((source.Length > sizeof(char)) && (source[sizeof(char)..].ContainsAnyExcept((byte)0x00))) 1313if (source.Length >= sizeof(char)) 2004bytesConsumed != utf8Text.Length ||
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (3)
176while (valuesAsBytes.Length >= Vector512<byte>.Count) 189while (valuesAsBytes.Length >= Vector256<byte>.Count) 202while (valuesAsBytes.Length >= Vector128<byte>.Count * 2)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Generic\CollectionExtensions.cs (7)
105if (list._items.Length - list._size < source.Length) 107list.Grow(checked(list._size + source.Length)); 111list._size += source.Length; 137if (list._items.Length - list._size < source.Length) 139list.GrowForInsertion(index, source.Length); 146Array.Copy(list._items, index, list._items, index + source.Length, list._size - index); 153list._size += source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (2)
91(uint)alternate.Length * 2, 136alternate.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Convert.cs (38)
2349if (bytes.Length == 0) 2361int outputLength = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks: true); 2423if (bytes.Length == 0) 2431int charLengthRequired = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks); 2455Debug.Assert(destination.Length >= ToBase64_CalculateAndValidateOutputLength(source.Length, insertLineBreaks: true)); 2461int chunkSize = Math.Min(source.Length, Base64LineBreakPosition / 4 * 3); // 76 base64 chars == 57 bytes 2585if (chars.Length == 0) 2590if (!int.IsEvenInteger(chars.Length)) 2595byte[] result = GC.AllocateUninitializedArray<byte>(chars.Length / 2); 2611if (utf8Source.Length == 0) 2616if (!int.IsEvenInteger(utf8Source.Length)) 2621byte[] result = GC.AllocateUninitializedArray<byte>(utf8Source.Length / 2); 2659(int quotient, int remainder) = Math.DivRem(source.Length, 2); 2681source = source.Slice(0, source.Length - 1); 2699charsConsumed = source.Length; 2715(int quotient, int remainder) = Math.DivRem(utf8Source.Length, 2); 2737utf8Source = utf8Source.Slice(0, utf8Source.Length - 1); 2755bytesConsumed = utf8Source.Length; 2799if (bytes.Length == 0) 2803ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes)); 2815if (source.Length == 0) 2820else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2))) 2827charsWritten = source.Length * 2; 2838if (source.Length == 0) 2843else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2))) 2850bytesWritten = source.Length * 2; 2894if (bytes.Length == 0) 2898ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes)); 2910if (source.Length == 0) 2915else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2))) 2922charsWritten = source.Length * 2; 2933if (source.Length == 0) 2938else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2))) 2945bytesWritten = source.Length * 2;
src\runtime\src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (3)
537if (format.Length == 1) 854if (format.Length == 0) 859if (format.Length == 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (1)
293if (bits.Length == 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (46)
60paramOrder[i] = new int[(par.Length > args.Length) ? par.Length : args.Length]; 65for (j = 0; j < par.Length; j++) 112if (par.Length == 0) 128else if (par.Length > args.Length) 133for (j = args.Length; j < par.Length - 1; j++) 139if (j != par.Length - 1) 154else if (par.Length < args.Length) 158int lastArgPos = par.Length - 1; 175int lastArgPos = par.Length - 1; 189int argsToCheck = (paramArrayType != null) ? par.Length - 1 : args.Length; 254if (paramArrayType != null && j == par.Length - 1) 313if (parms.Length == args.Length) 317object[] objs = new object[parms.Length]; 318int lastPos = parms.Length - 1; 325else if (parms.Length > args.Length) 327object?[] objs = new object[parms.Length]; 329for (i = 0; i < parms.Length; i++) 338if (i == parms.Length - 1 && paramArrayTypes[0] != null) 355object[] objs = new object[parms.Length]; 356int paramArrayPos = parms.Length - 1; 403if (parameters.Length == args.Length) 407object[] objs = new object[parameters.Length]; 408int lastPos = parameters.Length - 1; 415else if (parameters.Length > args.Length) 417object?[] objs = new object[parameters.Length]; 422for (; i < parameters.Length - 1; i++) 440object[] objs = new object[parameters.Length]; 441int paramArrayPos = parameters.Length - 1; 568if (par.Length != types.Length) 803if (par.Length == 0) 896if (paramArrayType1 != null && paramOrder1[i] >= p1.Length - 1) 901if (paramArrayType2 != null && paramOrder2[i] >= p2.Length - 1) 925if (p1.Length > p2.Length) 929else if (p2.Length > p1.Length) 1104if (params1.Length != params2.Length) 1107int numParams = params1.Length; 1188bool[] used = new bool[pars.Length]; 1191for (int i = 0; i < pars.Length; i++) 1197for (j = 0; j < pars.Length; j++) 1208if (j == pars.Length) 1214for (int i = 0; i < pars.Length; i++) 1218for (; pos < pars.Length; pos++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Delegate.cs (1)
49for (int i = 1; i < delegates.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (2)
24if (payload.Length <= 0) 109for (int j = 1; j < payload.Length; j += 2)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (2)
1777int totalLength = namespaceBytes.Length + nameByteCount; 1781Encoding.BigEndianUnicode.GetBytes(name, source.Slice(namespaceBytes.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs (4)
441descriptors[0].SetMetadata(pMetadata0, providerMetadata.Length, 2); 548descriptors[0].SetMetadata(pMetadata0, providerMetadata.Length, 2); 619descriptors[0].SetMetadata(pMetadata0, providerMetadata.Length, 2); 735bool hasProviderMetadata = ProviderMetadata.Length > 0;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Enum.cs (6)
1055while (value.Length > 0) 1066else if (endIndex != value.Length - 1) 1900if (format.Length == 1) 2110Debug.Assert(foundItems.Length >= 2, $"{nameof(foundItems)} == {foundItems.Length}"); 2112for (int i = foundItems.Length - 1; i != 0; i--)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CalendricalCalculationsHelper.cs (1)
128for (int i = 1; i < coefficients.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (5)
96Debug.Assert(index >= 0 && index < s.Length, "index < s.Length"); 103if (index < s.Length - 1) 438Debug.Assert((uint)index < (uint)s.Length, "index < s.Length"); 445if ((uint)index < (uint)s.Length) 452if ((uint)index < (uint)s.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.cs (12)
141if (text.Length == 0) 291InvariantModeCasing.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length) : 438return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length); 452return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length); 611matchLength = (matched) ? prefix.Length : 0; 754matchLength = (matched) ? suffix.Length : 0; 1064return (fromBeginning) ? 0 : source.Length; 1106*matchLengthPtr = value.Length; 1329return source.Length; // Empty target string trivially occurs at the last index of every search space.
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (89)
63return Interop.Globalization.CompareString(_sortHandle, pString1, string1.Length, pString2, string2.Length, options); 71Debug.Assert(target.Length != 0); 92return Interop.Globalization.IndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr); 94return Interop.Globalization.LastIndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr); 122if (target.Length > source.Length) 138endIndex = source.Length - target.Length + 1; 145startIndex = source.Length - target.Length; 155for (; targetIndex < target.Length; targetIndex++, sourceIndex++) 180if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80) 186if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80) 189*matchLengthPtr = target.Length; 213return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 215return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 237if (target.Length > source.Length) 253endIndex = source.Length - target.Length + 1; 260startIndex = source.Length - target.Length; 270for (; targetIndex < target.Length; targetIndex++, sourceIndex++) 284if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80) 290if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80) 293*matchLengthPtr = target.Length; 307return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 309return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 338return Interop.Globalization.StartsWith(_sortHandle, pPrefix, prefix.Length, pSource, source.Length, options, matchLengthPtr); 350int length = Math.Min(source.Length, prefix.Length); 385if (a < ap + source.Length - 1 && *(a + 1) >= 0x80) 387if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80) 394if (source.Length < prefix.Length) 403if (source.Length > prefix.Length) 412*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length 421return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr); 432int length = Math.Min(source.Length, prefix.Length); 456if (a < ap + source.Length - 1 && *(a + 1) >= 0x80) 458if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80) 465if (source.Length < prefix.Length) 474if (source.Length > prefix.Length) 484*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length 493return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr); 522return Interop.Globalization.EndsWith(_sortHandle, pSuffix, suffix.Length, pSource, source.Length, options, matchLengthPtr); 534int length = Math.Min(source.Length, suffix.Length); 539char* a = ap + source.Length - 1; 540char* b = bp + suffix.Length - 1; 578if (source.Length < suffix.Length) 587if (source.Length > suffix.Length) 597*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length 606return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr); 617int length = Math.Min(source.Length, suffix.Length); 622char* a = ap + source.Length - 1; 623char* b = bp + suffix.Length - 1; 650if (source.Length < suffix.Length) 659if (source.Length > suffix.Length) 669*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length 678return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr); 769actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options); 815return Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options); 863int sortKeyLength = checked((source.Length > 1024 * 1024 / 4) ? 0 : 4 * source.Length); 882sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options); 905sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Invariant.cs (8)
46Debug.Assert(sortKey.Length >= source.Length * sizeof(char)); 48for (int i = 0; i < source.Length; i++) 58Debug.Assert(sortKey.Length >= source.Length * sizeof(char)); 60for (int i = 0; i < source.Length; i++) 63if (char.IsHighSurrogate(c) && i < source.Length - 1) 93if ((uint)destination.Length < (uint)source.Length * sizeof(char)) 107return source.Length * sizeof(char); 119int byteLength = source.Length * sizeof(char);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (16)
64source.Length, 66value.Length, 69Debug.Assert(ret >= -1 && ret <= source.Length); 83Debug.Assert(source.Length != 0); 84Debug.Assert(value.Length != 0); 117int sourceLength = source.Length; 229string1.Length, 231string2.Length, 263int lpStringSourceLength = lpStringSource.Length; 282lpStringValue.Length, 288Debug.Assert(result >= -1 && result <= lpStringSource.Length); 302Debug.Assert(target.Length != 0); 342*matchLengthPtr = source.Length - idx; // all chars from idx to the end of the string are consumed 430int sourceLength = source.Length; 485int sourceLength = source.Length; 525return Interop.Kernel32.IsNLSDefinedString(Interop.Kernel32.COMPARE_STRING, 0, IntPtr.Zero, pText, text.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Utf8.cs (2)
83int sourceMaxCharCount = Encoding.UTF8.GetMaxCharCount(source.Length); 114int prefixMaxCharCount = Encoding.UTF8.GetMaxCharCount(prefix.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (5)
72bufferIndex += extension.Length; 367Debug.Assert(icuFormatString.Length < ICU_ULOC_FULLNAME_CAPACITY); 373for (int i = 0; i < icuFormatString.Length; i++) 386if (i + 1 < icuFormatString.Length && icuFormatString[i + 1] == '\'') 402for (; i < icuFormatString.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (15)
200while ((uint)index < (uint)format.Length && format[index] == patternChar) 289int formatLen = format.Length; 346if ((uint)(pos + 1) >= (uint)format.Length) 401for (i = index + tokenLen; i < format.Length && format[i] != patternToMatch; i++) { /* Do nothing here */ } 403if (i < format.Length) 407while (++i < format.Length && format[i] == patternToMatch) 442while (i < format.Length) 628((i + tokenLen < format.Length && format[i + tokenLen] == DateTimeFormatInfoScanner.CJKYearSuff) || 629(i + tokenLen < format.Length - 1 && format[i + tokenLen] == '\'' && format[i + tokenLen + 1] == DateTimeFormatInfoScanner.CJKYearSuff))) 1090else if (format.Length == 1) 1209while (i < format.Length) 1214if (i == format.Length - 1) 1230while (i < format.Length && format[i] != quoteChar) 1235if (i >= format.Length) 1278int length = format.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (2)
2248} while (i < str.Value.Length && (state != HebrewNumberParsingState.FoundEndOfHebrewNumber)); 2300Debug.Assert(str.Index < str.Value.Length, "DateTimeFormatInfo.Tokenize(): start < value.Length");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (32)
86if (s.Length == 0) 92if (format.Length == 0) 179if (s.Length == 0) 409Debug.Assert(DateParsingStates.Length == Width * Height); 421if (target.Length > (str.Value.Length - str.Index)) 433if (nextCharIndex < str.Value.Length) 2497if (s.Length == 0) 3357for (int i = 0; i < format.Length; i++) 3378while (i + 1 < format.Length && format[i + 1] == 'd') 3411if (span.Length >= 3) 3512if (span.Length >= 3) 3613if (span.Length >= 3) 3680if (span.Length >= 3) 4465for (int i = 0; i < quotedSpan.Length; i++) 4500if (format.Index >= format.Value.Length - 1 || format.Value[format.Index + 1] == '%') 4592while ((uint)pos < (uint)format.Length) 4607if ((uint)pos < (uint)format.Length) 4665if (formatParam.Length == 1) 4735if (str.Index < str.Value.Length - 1) 4887if (source.Length != 29) 5084if (source.Length < 27 || 5217if (source.Length > 27) 5223if (source.Length != 28) 5235if (source.Length == 33) 5248else if (source.Length == 32) // special-case allowed for compat: only one offset hour digit 5497internal int Length => Value.Length; 5690int valueRemaining = Value.Length - Index; 5708if (thisPosition >= Value.Length - segmentLength) 5736while (thisPosition < Value.Length && char.IsWhiteSpace(Value[thisPosition])) 5754if (thisPosition > Value.Length - segmentLength) 5768if (nextCharIndex < Value.Length) 6003Span<char> result = new char[Value.Length - i];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\GlobalizationMode.cs (1)
74version = icuSuffixAndVersion.AsSpan(icuSuffix.Length + 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\GlobalizationMode.Unix.cs (1)
65string extension = version.Length > 0 ? "so." : "so";
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IcuLocaleData.cs (7)
37045 => (LcidSortPrefix5Index, indices.Length), 3711int hi = indices.Length / 4 - 1; 3779Debug.Assert(CulturesCount == (ThreeLetterWindowsLanguageName.Length / 3)); 3821Debug.Assert(CulturesCount * 2 == LocalesNamesIndexes.Length); 3863string result = string.FastAllocateString(buffer.Length); 3864var s = new Span<char>(ref result.GetRawStringData(), buffer.Length); 3865for (int i = 0; i < buffer.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.cs (25)
107if (unicode.Length == 0) 114throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode)); 183if (ascii.Length > 0 && ascii[^1] == (char)0) 214Debug.Assert(input.Length > 0); 217originalString.Length == input.Length && 218input.Length == output.Length && 219Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(input), ref MemoryMarshal.GetReference(output), input.Length)) 262Debug.Assert(unicode.Length >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now."); 265throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode)); 283if (unicode.Length <= destination.Length) 286charsWritten = unicode.Length; 296Debug.Assert(unicode.Length >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now."); 299throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode)); 325if (unicode.Length == 0) 331for (int i = 0; i < unicode.Length; i++) 371if (iLastDot == -1 && unicode.Length > c_labelLimit) 375if (unicode.Length > c_defaultNameLimit - (IsDot(unicode[^1]) ? 0 : 1)) 414if (unicode.Length == 0) 417StringBuilder output = new StringBuilder(unicode.Length); 423while (iNextDot < unicode.Length) 430iNextDot = iNextDot < 0 ? unicode.Length : iNextDot + iAfterLastDot; 436if (iNextDot != unicode.Length) 606if (iNextDot != unicode.Length) 638if (char.IsHighSurrogate(s[index]) && index + 1 < s.Length && char.IsLowSurrogate(s[index + 1]))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (4)
60int actualLength = Interop.Globalization.ToAscii(flags, unicode, unicode.Length, destination, destination.Length); 104int realLen = Interop.Globalization.ToUnicode(flags, ascii, ascii.Length, output, output.Length); 131int actualLength = Interop.Globalization.ToUnicode(flags, ascii, ascii.Length, destination, destination.Length); 170for (int i = 0; i < s.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Nls.cs (6)
46int length = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, output, output.Length); 63int length = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, Span<char>.Empty, 0); 76int actualLength = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, destination, destination.Length); 120int length = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, output, output.Length); 137int length = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, Span<char>.Empty, 0); 150int actualLength = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, destination, destination.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (18)
114Debug.Assert(source.Length <= destination.Length); 116for (int i = 0; i < source.Length; i++) 119if (char.IsHighSurrogate(c) && i < source.Length - 1) 140Debug.Assert(source.Length <= destination.Length); 142for (int i = 0; i < source.Length; i++) 145if (char.IsHighSurrogate(c) && i < source.Length - 1) 226Debug.Assert(value.Length > 0); 227Debug.Assert(value.Length <= source.Length); 233char* pSourceLimit = pSource + (source.Length - value.Length); 234char* pValueLimit = pValue + value.Length - 1; 288Debug.Assert(value.Length > 0); 289Debug.Assert(value.Length <= source.Length); 295char* pValueLimit = pValue + value.Length - 1; 296char* pCurrentSource = pSource + (source.Length - value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.cs (2)
58charsWritten = source.Length; 79return source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (5)
35ret = Interop.Globalization.IsNormalized(normalizationForm, pInput, source.Length); 149realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, source.Length, pDest, destination.Length); 188realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, source.Length, null, 0); 221for (; (uint)i < (uint)s.Length; i++) 243if ((uint)(i + 1) >= (uint)s.Length || !char.IsLowSurrogate(s[i + 1]))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (3)
24result = Interop.Normaliz.IsNormalizedString(normalizationForm, pInput, source.Length); 136realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, source.Length, pDest, destination.Length); 179realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, source.Length, null, 0);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (22)
332if (value.Length == 0) 337if (value.Length > source.Length) 364int valueTailLength = value.Length - 1; 365int searchSpaceMinusValueTailLength = source.Length - valueTailLength; 466Debug.Assert(offset + ch1ch2Distance + Vector256<ushort>.Count <= source.Length); 508if (EqualsIgnoreCase(ref Unsafe.Add(ref searchSpace, offset + charPos), ref valueRef, value.Length)) 532Debug.Assert(offset + ch1ch2Distance + Vector128<ushort>.Count <= source.Length); 574if (EqualsIgnoreCase(ref Unsafe.Add(ref searchSpace, offset + charPos), ref valueRef, value.Length)) 660if (value.Length == 0) 662return source.Length; 665if (value.Length > source.Length) 693if (destination.Length < source.Length) 699return source.Length; 705return source.Length; 709return source.Length; 718if (destination.Length < source.Length) 725return source.Length; 732return source.Length; 736return source.Length; 761for (; i < source.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (3)
100while ((spanA.Length | spanB.Length) != 0); 410while (spanB.Length != 0);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (20)
182for (int i = start; (uint)i < (uint)source.Length; i++) 191if (char.IsHighSurrogate(c) && i < source.Length - 1) 236for (int i = start; (uint)i < (uint)source.Length; i++) 245if (char.IsHighSurrogate(c) && i < source.Length - 1) 365Debug.Assert(value.Length > 0); 366Debug.Assert(value.Length <= source.Length); 374char* pSourceLimit = pSource + (source.Length - value.Length); 375char* pValueLimit = pValue + value.Length - 1; 429Debug.Assert(value.Length > 0); 430Debug.Assert(value.Length <= source.Length); 438char* pValueLimit = pValue + value.Length - 1; 439char* pCurrentSource = pSource + (source.Length - value.Length); 492ushort[]?[] table = new ushort[]?[s_casingTableInit.Length * 8]; 493for (int i = 0; i < s_casingTableInit.Length * 8; ++i) 523ushort[]?[] table = new ushort[]?[s_casingTableInit.Length * 8]; 524for (int i = 0; i < s_casingTableInit.Length * 8; ++i)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\StringInfo.cs (1)
220builder.Append(str.Length - remaining.Length); // a new extended grapheme cluster begins at this offset
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (5)
237Debug.Assert(destination.Length >= source.Length); 244Debug.Assert(destination.Length >= source.Length); 294instance.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, 531if (valueChars.Length == 2) 553if (valueChars.Length == 2)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (9)
55if (format.Length == 0) 60if (format.Length == 1) 162requiredOutputLength += decimalSeparator.Length; 172requiredOutputLength += decimalSeparator.Length; 275else if (decimalSeparator.Length == 1) 281decimalSeparator.CopyTo(new Span<TChar>(p, decimalSeparator.Length)); 282p += decimalSeparator.Length; 318while (i < format.Length) 513for (int i = 0; i < format.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanParse.cs (15)
188if ((uint)pos >= (uint)value.Length) 205if ((uint)++pos >= (uint)value.Length || (uint)(digit = value[pos] - '0') > 9) 225while ((uint)++pos < (uint)value.Length) 248while ((uint)++pos < (uint)value.Length && !char.IsAsciiDigit(value[pos])) 258internal bool EOL => _pos >= (_value.Length - 1); 268return (uint)pos < (uint)_value.Length ? 591Debug.Assert(powersOfTen.Length == MaxFractionDigits + 1); 1230if (format.Length == 0) 1235if (format.Length == 1) 1269while ((uint)i < (uint)format.Length) 1451for (int i = 0; i < span.Length; i++) 1479if (_pos < str.Length) 1485_ch = (uint)pos < (uint)str.Length ? 1559if (_pos < _str.Length) 1669if (input.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\UmAlQuraCalendar.cs (1)
230DateMapping[] mapping = new DateMapping[rawData.Length / 4];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Guid.cs (29)
68if (b.Length != 16) 85if (b.Length != 16) 420if (format.Length != 1) 455if (format.Length != 1 || input.Length < 32) // Minimal length we can parse ('N' format) 489if (guidString.Length < 32) // Minimal length we can parse ('N' format) 511if (guidString.Length != 38 || guidString[0] != TChar.CastFrom('{') || guidString[37] != TChar.CastFrom('}')) 524if (guidString.Length != 36 || guidString[8] != TChar.CastFrom('-') || guidString[13] != TChar.CastFrom('-') || guidString[18] != TChar.CastFrom('-') || guidString[23] != TChar.CastFrom('-')) 526result.SetFailure(guidString.Length != 36 ? ParseFailure.Format_GuidInvLen : ParseFailure.Format_GuidDashes); 612if (guidString.Length != 32) 655if (guidString.Length != 38 || guidString[0] != TChar.CastFrom('(') || guidString[37] != TChar.CastFrom(')')) 682if (guidString.Length == 0 || guidString[0] != TChar.CastFrom('{')) 756if ((uint)guidString.Length <= (uint)(numStart + numLen + 1) || guidString[numStart + numLen + 1] != TChar.CastFrom('{')) 813if (numStart + numLen + 1 >= guidString.Length || guidString[numStart + numLen + 1] != TChar.CastFrom('}')) 820if (numStart + numLen + 1 != guidString.Length - 1) 833Debug.Assert(lookup.Length == 256); 860if (guidString.Length > 0) 867if (guidString.Length > 1 && guidString[0] == TChar.CastFrom('0') && (guidString[1] | TChar.CastFrom(0x20)) == TChar.CastFrom('x')) 875for (; i < guidString.Length && guidString[i] == TChar.CastFrom('0'); i++) ; 879for (; i < guidString.Length; i++) 911var chArr = new char[charSpan.Length]; 920for (; i < charSpan.Length; i++) 940while (i < srcUtf8Span.Length) 956if (i == srcUtf8Span.Length) 962Span<byte> destUtf8Span = new byte[srcUtf8Span.Length]; 971while (i < srcUtf8Span.Length) 994i + 1 < str.Length && 1283if (format.Length == 0) 1289if (format.Length != 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\HashCode.cs (6)
319if (value.Length < (sizeof(int) * 4)) 336Debug.Assert(value.Length >= sizeof(int)); 341Debug.Assert(value.Length >= sizeof(int)); 346Debug.Assert(value.Length >= sizeof(int)); 354while (value.Length >= sizeof(int) * 4) 367while (value.Length >= sizeof(int))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (14)
760if (source.Length != 0) 770if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= Size)) 779if (source.Length > Size) 800if (source.Length >= Size) 803result = BinaryPrimitives.ReadInt128BigEndian(source.Slice(source.Length - Size)); 811for (int i = 0; i < source.Length; i++) 819result |= ((One << ((Size * 8) - 1)) >> (((Size - source.Length) * 8) - 1)); 833if (source.Length != 0) 843if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= Size)) 852if (source.Length > Size) 873if (source.Length >= Size) 886for (int i = 0; i < source.Length; i++) 892result <<= ((Size - source.Length) * 8); 897result |= ((One << ((Size * 8) - 1)) >> (((Size - source.Length) * 8) - 1));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (9)
308if (source.Length != 0) 318if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(short))) 327if (source.Length > sizeof(short)) 348if (source.Length >= sizeof(short)) 351result = BinaryPrimitives.ReadInt16BigEndian(source.Slice(source.Length - sizeof(short))); 374if (source.Length != 0) 384if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(short))) 393if (source.Length > sizeof(short)) 414if (source.Length >= sizeof(short))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (14)
329if (source.Length != 0) 339if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(int))) 348if (source.Length > sizeof(int)) 369if (source.Length >= sizeof(int)) 372result = BinaryPrimitives.ReadInt32BigEndian(source.Slice(source.Length - sizeof(int))); 380for (int i = 0; i < source.Length; i++) 388result |= ((1 << ((sizeof(int) * 8) - 1)) >> (((sizeof(int) - source.Length) * 8) - 1)); 402if (source.Length != 0) 412if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(int))) 421if (source.Length > sizeof(int)) 442if (source.Length >= sizeof(int)) 455for (int i = 0; i < source.Length; i++) 461result <<= ((sizeof(int) - source.Length) * 8); 466result |= ((1 << ((sizeof(int) * 8) - 1)) >> (((sizeof(int) - source.Length) * 8) - 1));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (14)
326if (source.Length != 0) 336if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(long))) 345if (source.Length > sizeof(long)) 366if (source.Length >= sizeof(long)) 369result = BinaryPrimitives.ReadInt64BigEndian(source.Slice(source.Length - sizeof(long))); 377for (int i = 0; i < source.Length; i++) 385result |= ((1L << ((sizeof(long) * 8) - 1)) >> (((sizeof(long) - source.Length) * 8) - 1)); 399if (source.Length != 0) 409if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(long))) 418if (source.Length > sizeof(long)) 439if (source.Length >= sizeof(long)) 452for (int i = 0; i < source.Length; i++) 458result <<= ((sizeof(long) - source.Length) * 8); 463result |= ((1L << ((sizeof(long) * 8) - 1)) >> (((sizeof(long) - source.Length) * 8) - 1));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (14)
355if (source.Length != 0) 365if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(nint_t))) 374if (source.Length > sizeof(nint_t)) 395if (source.Length >= sizeof(nint_t)) 398result = BinaryPrimitives.ReadIntPtrBigEndian(source.Slice(source.Length - sizeof(nint_t))); 406for (int i = 0; i < source.Length; i++) 414result |= (((nint)1 << ((sizeof(nint_t) * 8) - 1)) >> (((sizeof(nint_t) - source.Length) * 8) - 1)); 428if (source.Length != 0) 438if (isUnsigned && sbyte.IsNegative(sign) && (source.Length >= sizeof(nint_t))) 447if (source.Length > sizeof(nint_t)) 468if (source.Length >= sizeof(nint_t)) 481for (int i = 0; i < source.Length; i++) 487result <<= ((sizeof(nint_t) - source.Length) * 8); 492result |= (((nint)1 << ((sizeof(nint_t) * 8) - 1)) >> (((sizeof(nint_t) - source.Length) * 8) - 1));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (4)
395byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 399Write(array, 0, buffer.Length); 425if (chars.Length <= MaxArrayPoolRentalSize) 430int maxByteCount = _encoding.GetMaxByteCount(chars.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (6)
783int bytesToWrite = Math.Min(_bufferSize - _writePos, buffer.Length); 940totalUserbytes = _writePos + buffer.Length; 942useBuffer = ((uint)totalUserbytes + buffer.Length < (_bufferSize + _bufferSize)); 952Debug.Assert(bytesWritten == buffer.Length); 966Debug.Assert(bytesWritten == buffer.Length); 982buffer.CopyTo(new Span<byte>(_buffer, _writePos, buffer.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\DirectoryInfo.cs (3)
94&& ((trimmedNewPath.Length == trimmedCurrentPath.Length) || PathInternal.IsDirectorySeparator(newPath[trimmedCurrentPath.Length])))
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.cs (1)
38ReadOnlySpan<char> relativePath = Directory.Slice(RootDirectory.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (6)
84if (_fullPath.Length == 0) 86Debug.Assert(Directory.Length + FileName.Length < _pathBuffer.Length, 87$"directory ({Directory.Length} chars) & name ({Directory.Length} chars) too long for buffer ({_pathBuffer.Length} chars)"); 100if (_directoryEntry.NameLength != 0 && _fileName.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEnumerableFactory.cs (2)
49if (directoryName.Length != 0) 53expression = expression.Substring(directoryName.Length + 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemName.cs (10)
148if (expression.Length == 0 || name.Length == 0) 154if (expression.Length == 1) 169if (name.Length < expressionEnd.Length) 193int maxState = expression.Length * 2; 219if (nameOffset < name.Length) 246while (expressionOffset < expression.Length) 331if (++expressionOffset == expression.Length) 367if (++expressionOffset == expression.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (5)
1556int preambleSize = preamble.Length; 1571int bytesNeeded = checked(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1589ReadOnlySpan<char> toEncode = contents.Slice(0, Math.Min(contents.Length, ChunkSize)); 1590contents = contents.Slice(toEncode.Length); 1663if (contents.Length < ChunkSize)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\FileStatus.Unix.cs (2)
195Debug.Assert(handle is not null || path.Length > 0); 493Debug.Assert(handle is not null || path.Length > 0);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\FileSystem.Unix.cs (1)
353stackDir.Append(mkdirPath.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (2)
633int i = _position + buffer.Length; 655buffer.CopyTo(new Span<byte>(_buffer, _position, buffer.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (58)
161int end = path.Length; 197int length = path.Length; 227if (path.Length == result.Length) 238int root = GetPathRoot(path).Length; 257if (path.Length == result.Length) 331for (int i = path.Length - 1; i >= 0; i--) 336return i != path.Length - 1; 390for (int i = 0; i < paths.Length; i++) 417for (int i = firstComponent; i < paths.Length; i++) 448if (path1.Length == 0) 450if (path2.Length == 0) 458if (path1.Length == 0) 461if (path2.Length == 0) 464if (path3.Length == 0) 472if (path1.Length == 0) 475if (path2.Length == 0) 478if (path3.Length == 0) 481if (path4.Length == 0) 552maxSize += paths.Length - 1; 557for (int i = 0; i < paths.Length; i++) 586if (path1.Length == 0 && path2.Length == 0) 589if (path1.Length == 0 || path2.Length == 0) 591ref ReadOnlySpan<char> pathToUse = ref path1.Length == 0 ? ref path2 : ref path1; 592if (destination.Length < pathToUse.Length) 598charsWritten = pathToUse.Length; 603int charsNeeded = path1.Length + path2.Length + (needsSeparator ? 1 : 0); 609destination[path1.Length] = DirectorySeparatorChar; 611path2.CopyTo(destination.Slice(path1.Length + (needsSeparator ? 1 : 0))); 620if (path1.Length == 0 && path2.Length == 0 && path3.Length == 0) 623if (path1.Length == 0) 625if (path2.Length == 0) 627if (path3.Length == 0) 635int charsNeeded = path1.Length + path2.Length + path3.Length + neededSeparators; 646charsWritten += path3.Length; 705Debug.Assert(first.Length > 0 && second.Length > 0, "should have dealt with empty paths"); 716Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0, "should have dealt with empty paths"); 732Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0 && fourth.Length > 0, "should have dealt with empty paths"); 746first.Length + second.Length + third.Length + fourth.Length + state.NeedSeparator1 + state.NeedSeparator2 + state.NeedSeparator3, 752destination = destination.Slice(first.Length); 762destination = destination.Slice(second.Length); 772destination = destination.Slice(third.Length); 781Debug.Assert(fourth.Length == destination.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Path.Unix.cs (1)
104int totalByteCount = checked(tempPathByteCount + fileTemplate.Length + 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (2)
122int bytesToWrite = GetNumberOfBytesToWrite(buffer.Length); 149if (bytesWritten == buffer.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\ReadOnlyMemoryStream.cs (1)
90if ((uint)position < (uint)span.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (5)
500if (numBytes >= source.Length) 503_writePos += source.Length; 523if (source.Length >= _bufferSize) 542else if (source.Length == 0) 550_writePos = source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (2)
917byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 921Write(sharedBuffer, 0, buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (10)
173int preambleLength = encoding.Preamble.Length; 554Debug.Assert(_bytePos < preamble.Length, "_compressPreamble was called with the current bytePos greater than the preamble buffer length. Are two threads using this StreamReader at the same time?"); 555int len = Math.Min(_byteLen, preamble.Length); 568Debug.Assert(_bytePos <= preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); 570if (_bytePos == preamble.Length) 573CompressBuffer(preamble.Length); 599Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); 703Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); 1141Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); 1336Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (6)
295if (preamble.Length > 0) 406if (buffer.Length <= 4 && // Threshold of 4 chosen based on perf experimentation 407buffer.Length <= _charLen - _charPos) 411for (int i = 0; i < buffer.Length; i++) 431int count = buffer.Length; 506int estimatedLength = checked((format?.Length ?? 0) + args.Length * 8);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StringStream.cs (1)
161int charsToEncode = Math.Min(2, remaining.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (8)
152if (valueChars.Length > 1) 192char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 197Write(array, 0, buffer.Length); 385if (valueChars.Length > 1) 416char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 421WriteLine(array, 0, buffer.Length); 604if (valueChars.Length > 1) 698if (valueChars.Length > 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStream.cs (4)
633long n = pos + buffer.Length; 664if (bytesLeft < buffer.Length) 673SpanHelpers.Memmove(ref *(pointer + pos + _offset), ref MemoryMarshal.GetReference(buffer), (nuint)buffer.Length); 685SpanHelpers.Memmove(ref *(_mem + pos), ref MemoryMarshal.GetReference(buffer), (nuint)buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\WritableMemoryStream.cs (3)
246if (buffer.Length == 0) 251EnsureCapacity(buffer.Length); 259_position += buffer.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.cs (1)
23public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed) => ComputeHash32(ref MemoryMarshal.GetReference(data), (uint)data.Length, (uint)seed, (uint)(seed >> 32));
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (309)
337span.Length); 344span.Length); 351span.Length); 358span.Length); 362return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length); 820span.Length); 827span.Length); 834span.Length); 841span.Length); 845return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length); 869span.Length); 876span.Length); 883span.Length); 890span.Length); 897for (int i = 0; i < span.Length; i++) 915for (int i = 0; i < span.Length; i++) 948span.Length); 956span.Length); 960return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 986span.Length); 994span.Length); 1001for (int i = 0; i < span.Length; i++) 1020for (int i = 0; i < span.Length; i++) 1056span.Length); 1065span.Length); 1069return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 1097span.Length); 1106span.Length); 1113for (int i = 0; i < span.Length; i++) 1132for (int i = 0; i < span.Length; i++) 1160span.Length); 1170span.Length); 1174return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length); 1187switch (values.Length) 1210if (sizeof(T) == sizeof(byte) && values.Length == 5) 1221span.Length); 1223else if (sizeof(T) == sizeof(short) && values.Length == 5) 1234span.Length); 1242span.Length, 1244values.Length); 1247for (int i = 0; i < span.Length; i++) 1270switch (values.Length) 1285for (int i = 0; i < span.Length; i++) 1398span.Length); 1405span.Length); 1412span.Length); 1419span.Length); 1423return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length); 1447span.Length); 1454span.Length); 1461span.Length); 1468span.Length); 1475for (int i = span.Length - 1; i >= 0; i--) 1493for (int i = span.Length - 1; i >= 0; i--) 1526span.Length); 1534span.Length); 1538return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 1564span.Length); 1572span.Length); 1579for (int i = span.Length - 1; i >= 0; i--) 1598for (int i = span.Length - 1; i >= 0; i--) 1634span.Length); 1643span.Length); 1647return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 1675span.Length); 1684span.Length); 1691for (int i = span.Length - 1; i >= 0; i--) 1711for (int i = span.Length - 1; i >= 0; i--) 1739span.Length); 1749span.Length); 1753return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length); 1766switch (values.Length) 1773return span.Length - 1; 1790if (sizeof(T) == sizeof(byte) && values.Length == 5) 1801span.Length); 1803else if (sizeof(T) == sizeof(short) && values.Length == 5) 1814span.Length); 1822span.Length, 1824values.Length); 1827for (int i = span.Length - 1; i >= 0; i--) 1850switch (values.Length) 1853return span.Length - 1; 1865for (int i = span.Length - 1; i >= 0; i--) 1933span.Length); 1942span.Length); 1951span.Length); 1960span.Length); 1964return SpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 2004span.Length); 2013span.Length); 2022span.Length); 2031span.Length); 2035return SpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 2075span.Length); 2084span.Length); 2093span.Length); 2102span.Length); 2106return SpanHelpers.LastIndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 2135return span.Length - 1; 2146span.Length); 2155span.Length); 2164span.Length); 2173span.Length); 2177return SpanHelpers.LastIndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 2218span.Length); 2224span.Length); 2230span.Length); 2236span.Length); 2239return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 2259span.Length); 2265span.Length); 2271span.Length); 2277span.Length); 2283for (int i = 0; i < span.Length; i++) 2300for (int i = 0; i < span.Length; i++) 2326span.Length, 2328value.Length); 2333span.Length, 2335value.Length); 2338return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 2355span.Length, 2357value.Length); 2362span.Length, 2364value.Length); 2370if (value.Length == 0) 2414span.Length); 2421span.Length); 2428span.Length); 2435span.Length); 2439return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 2460span.Length); 2467span.Length); 2474span.Length); 2481span.Length); 2488for (int i = span.Length - 1; i >= 0; i--) 2506for (int i = span.Length - 1; i >= 0; i--) 2533span.Length, 2535value.Length); 2541span.Length, 2543value.Length); 2547return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 2565span.Length, 2567value.Length); 2573span.Length, 2575value.Length); 2582if (value.Length == 0) 2584return span.Length; 2589int pos = span.Length; 2678span.Length); 2686span.Length); 2690return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 2713span.Length); 2721span.Length); 2728for (int i = 0; i < span.Length; i++) 2746for (int i = 0; i < span.Length; i++) 2779span.Length); 2788span.Length); 2792return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2817span.Length); 2826span.Length); 2833for (int i = 0; i < span.Length; i++) 2852for (int i = 0; i < span.Length; i++) 2881switch (values.Length) 2887return SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length); 2894span.Length); 2902span.Length); 2911span.Length); 2921span.Length); 2929return values.Length switch 29321 => SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length), 2937span.Length), 2943span.Length), 2950span.Length), 2958span.Length), 2959_ => ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length), 2964return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length); 2975switch (values.Length) 2992for (int i = 0; i < span.Length; i++) 3098span.Length); 3106span.Length); 3110return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 3133span.Length); 3141span.Length); 3148for (int i = span.Length - 1; i >= 0; i--) 3167for (int i = span.Length - 1; i >= 0; i--) 3200span.Length); 3209span.Length); 3213return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 3238span.Length); 3247span.Length); 3254for (int i = span.Length - 1; i >= 0; i--) 3274for (int i = span.Length - 1; i >= 0; i--) 3303switch (values.Length) 3309return SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length); 3316span.Length); 3324span.Length); 3333span.Length); 3343span.Length); 3351return values.Length switch 33541 => SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length), 3359span.Length), 3365span.Length), 3372span.Length), 3380span.Length), 3381_ => ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length), 3386return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length); 3397switch (values.Length) 3414for (int i = span.Length - 1; i >= 0; i--) 3449int length = span.Length; 3450int otherLength = other.Length; 3485if (span.Length != other.Length) 3500((uint)span.Length) * (nuint)sizeof(T)); // If this multiplication overflows, the Span we got overflows the entire address range. There's no happy outcome for this API in such a case so we choose not to take the overhead of checking. 3504for (int i = 0; i < span.Length; i++) 3518for (int i = 0; i < span.Length; i++) 3541span.Length, 3543other.Length); 3548span.Length, 3550other.Length); 3552return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 3560int minLength = Math.Min(span.Length, other.Length); 3572return span.Length.CompareTo(other.Length); 3591int valueLength = value.Length; 3594return valueLength <= span.Length && 3601return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength); 3614value.Length <= span.Length && 3615SequenceEqual(span.Slice(0, value.Length), value, comparer); 3633int spanLength = span.Length; 3634int valueLength = value.Length; 3661value.Length <= span.Length && 3662SequenceEqual(span.Slice(span.Length - value.Length), value, comparer); 3673span.Length != 0 && (span[0]?.Equals(value) ?? (object?)value is null); 3685span.Length != 0 && 3697span.Length != 0 && (span[^1]?.Equals(value) ?? (object?)value is null); 3709span.Length != 0 && 4133return (nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) || 4134(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T))); 4152if ((nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) || 4153(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T)))) 4249/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>. 4271/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>. 4297/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>. 4632uint length = (uint)source.Length; 4648((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) || 4716uint length = (uint)source.Length; 4732((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) || 4788destination = destination.Slice(0, source.Length); 4790for (int i = 0; i < source.Length; i++) 4801destination = destination.Slice(0, source.Length); 4804for (int i = 0; i < source.Length; i++) 4828if (source.Length > destination.Length) 4840ReplaceAny(destination.Slice(0, source.Length), values, newValue); 4878if (source.Length > destination.Length) 4890ReplaceAnyExcept(destination.Slice(0, source.Length), values, newValue); 4939nuint length = Math.Min((nuint)(uint)span.Length, (nuint)(uint)other.Length); 4966for (int i = 0; i < span.Length; i++) 4974return span.Length; 4998for (int i = 0; i < span.Length; i++) 5006return span.Length; 5013if (other.Length > span.Length) 5015other = other.Slice(0, span.Length); 5018span = span.Slice(0, other.Length); 5148int startInclusive = 0, endExclusive = source.Length; 5201if (separators.IsEmpty && destination.Length > source.Length) 5242if (separators.IsEmpty && destination.Length > source.Length) 5275if (source.Length == 0) 5291endExclusive = source.Length; 5325separatorLength = separatorOrSeparators.Length; 5378endExclusive = source.Length; 5435span.Length); 5442span.Length); 5449span.Length); 5456span.Length); 5463span.Length); 5484span.Length); 5491span.Length); 5498span.Length); 5505span.Length); 5513for (int i = 0; i < span.Length; i++) 5532for (int i = 0; i < span.Length; i++) 5561switch (value.Length) 5575span = span.Slice(pos + value.Length); 5591switch (value.Length) 5605span = span.Slice(pos + value.Length); 5810format.ValidateNumberOfArgs(args.Length); 5811return args.Length switch 5927if (typeof(T) == typeof(char) && separators.Length == 0) 5947_splitMode = separator.Length == 0 ? 5985separatorLength = _separatorBuffer.Length; 6008_startNext = _endCurrent = _source.Length; 6296_pos += value.Length; 6316int paddingRequired = alignment - value.Length; 6325Debug.Assert(alignment > value.Length); 6331_pos += value.Length; 6340_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (34)
19for (int i = 0; i < span.Length; i++) 82if (span.Length != value.Length) 84if (value.Length == 0) // span.Length == value.Length == 0 92if (span.Length != value.Length) 94if (value.Length == 0) // span.Length == value.Length == 0 96return Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), span.Length); 121if (span.Length == 0 || other.Length == 0) 122return span.Length - other.Length; 127return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 143return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 192span.Length, 194value.Length); 247if (destination.Length < source.Length) 254return source.Length; 271if (destination.Length < source.Length) 278return source.Length; 299if (destination.Length < source.Length) 306return source.Length; 323if (destination.Length < source.Length) 330return source.Length; 387=> value.Length <= span.Length 389ref Unsafe.Add(ref MemoryMarshal.GetReference(span), span.Length - value.Length), 391value.Length); 425=> value.Length <= span.Length 426&& Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.Utf8.cs (8)
19if ((span.Length | value.Length) == 0) // span.Length == value.Length == 0 24return Ordinal.EqualsIgnoreCaseUtf8(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 70if ((span.Length | value.Length) == 0) // span.Length == value.Length == 0 75return Ordinal.StartsWithIgnoreCaseUtf8(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.MinMax.cs (14)
144for (i = 0; i < span.Length; i++) 155for (; (uint)i < (uint)span.Length; i++) 175for (int i = 1; i < span.Length; i++) 186for (int i = 1; i < span.Length; i++) 240if (!Vector128.IsHardwareAccelerated || !Vector128<T>.IsSupported || span.Length < Vector128<T>.Count) 243for (int i = 1; i < span.Length; i++) 257if (!Vector256.IsHardwareAccelerated || span.Length < Vector256<T>.Count) 263while (data.Length > Vector128<T>.Count) 268best128 = TMinMax.Compare(best, Vector128.Create(span.Slice(span.Length - Vector128<T>.Count))); 270else if (!Vector512.IsHardwareAccelerated || span.Length < Vector512<T>.Count) 276while (data.Length > Vector256<T>.Count) 281best = TMinMax.Compare(best, Vector256.Create(span.Slice(span.Length - Vector256<T>.Count))); 292while (data.Length > Vector512<T>.Count) 297best = TMinMax.Compare(best, Vector512.Create(span.Slice(span.Length - Vector512<T>.Count)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Trim.cs (47)
136for (; start < span.Length; start++) 146for (; start < span.Length; start++) 167Debug.Assert((uint)start <= span.Length); 169int end = span.Length - 1; 204if (trimElements.Length > 1) 212if (trimElements.Length == 1) 229if (trimElements.Length > 1) 234if (trimElements.Length == 1) 251if (trimElements.Length > 1) 256if (trimElements.Length == 1) 273if (trimElements.Length > 1) 281if (trimElements.Length == 1) 298if (trimElements.Length > 1) 303if (trimElements.Length == 1) 320if (trimElements.Length > 1) 325if (trimElements.Length == 1) 342if (trimElements.Length > 1) 349if (trimElements.Length == 1) 366if (trimElements.Length > 1) 371if (trimElements.Length == 1) 388if (trimElements.Length > 1) 393if (trimElements.Length == 1) 410if (trimElements.Length > 1) 417if (trimElements.Length == 1) 434if (trimElements.Length > 1) 439if (trimElements.Length == 1) 456if (trimElements.Length > 1) 461if (trimElements.Length == 1) 478for (; start < span.Length; start++) 499Debug.Assert((uint)start <= span.Length); 501int end = span.Length - 1; 573if (span.Length == 0 || 584for (; start < span.Length; start++) 592int end = span.Length - 1; 611for (; start < span.Length; start++) 628int end = span.Length - 1; 648for (; start < span.Length; start++) 656int end = span.Length - 1; 676for (; start < span.Length; start++) 694int end = span.Length - 1; 731for (; start < span.Length; start++) 733for (int i = 0; i < trimChars.Length; i++) 763int end = span.Length - 1; 766for (int i = 0; i < trimChars.Length; i++) 843for (; start < span.Length; start++) 862Debug.Assert((uint)start <= span.Length); 864int end = span.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Trim.Utf8.cs (4)
20while (span.Length != 0) 45if (span.Length == 0) 71while (span.Length != 0) 83while (span.Length != 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (17)
38ValueStringBuilder sb = valueSpan.Length < 80 ? 40new ValueStringBuilder(valueSpan.Length + 200); 67ValueStringBuilder sb = valueSpan.Length < 80 ? 69new ValueStringBuilder(valueSpan.Length + 200); 80for (int i = 0; i < input.Length; i++) 118if ((uint)(i + 1) < (uint)input.Length && 167ValueStringBuilder sb = valueSpan.Length <= 256 ? 169new ValueStringBuilder(valueSpan.Length); 192ValueStringBuilder sb = valueSpan.Length <= 256 ? 194new ValueStringBuilder(valueSpan.Length); 205for (int i = 0; i < input.Length; i++) 280for (int i = input.IndexOfAnyExcept(s_htmlAsciiNonEncodingChars); (uint)i < (uint)input.Length; i++) 388for (int i = source.IndexOfAnyExcept(s_safeUrlBytes); (uint)i < (uint)source.Length; i++) 945var dictionary = new Dictionary<ulong, char>(tableData.Length / (sizeof(ulong) + sizeof(char))); 963if (entity.Length <= 8) 978Debug.Assert(entity.Length <= 8); 981for (int i = 0; i < entity.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (2)
922Debug.Assert((Pow10BigNumTableIndices[^1] + MaxBlockCount + 2) == Pow10BigNumTable.Length); 944Debug.Assert((pow10BigNumTableIndex + ((sizeof(BigInteger) + sizeof(uint) - 1) / sizeof(uint))) < Pow10BigNumTable.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Conversions.cs (1)
195if (deficit >= UInt128.PowersOf10.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128DecimalReduce.cs (2)
236int tableLength = TrigOneOverTwoPi.Length; 243for (int j = 0; j < integerWords.Length; j++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (15)
1092if (format.Length == 0) 1208if (format.Length == 0) 1324if (format.Length == 0) 1440if (format.Length == 0) 1557if (format.Length == 0) 1675if (format.Length == 0) 1800int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1811Debug.Assert(p == buffer + sNegative.Length); 1813for (int i = sNegative.Length - 1; i >= 0; i--) 2233int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 2244Debug.Assert(p == buffer + sNegative.Length); 2246for (int i = sNegative.Length - 1; i >= 0; i--) 2663int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2674Debug.Assert(p == buffer + sNegative.Length); 2676for (int i = sNegative.Length - 1; i >= 0; i--)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Grisu3.cs (6)
476Debug.Assert((uint)(exponentGuess) < SmallPowersOfTen.Length); 820Debug.Assert(CachedPowersSignificand.Length == CachedPowersBinaryExponent.Length); 821Debug.Assert(CachedPowersSignificand.Length == CachedPowersDecimalExponent.Length); 826Debug.Assert((uint)(index) < CachedPowersSignificand.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Parsing.cs (69)
333if ((uint)index >= (uint)value.Length) 353if ((uint)index >= (uint)value.Length) 363if ((uint)index >= (uint)value.Length) 375if ((uint)index >= (uint)value.Length) 391index += positiveSign.Length; 393if ((uint)index >= (uint)value.Length) 402index += negativeSign.Length; 404if ((uint)index >= (uint)value.Length) 425if ((uint)index >= (uint)value.Length) 448if ((uint)index >= (uint)value.Length) 472if ((uint)index >= (uint)value.Length) 510if ((uint)index >= (uint)value.Length) 524if ((uint)index >= (uint)value.Length) 561if ((index == value.Length) || ((styles & AllowTrailingInvalidCharacters) != 0)) 587for (index++; index < value.Length; index++) 596if ((uint)index >= (uint)value.Length) 655if ((uint)index >= (uint)value.Length) 676if ((uint)index >= (uint)value.Length) 695if ((uint)index >= (uint)value.Length) 714if ((uint)index >= (uint)value.Length) 732if ((uint)index >= (uint)value.Length) 764if ((index == value.Length) || ((styles & AllowTrailingInvalidCharacters) != 0)) 790for (index++; index < value.Length; index++) 800if ((uint)index >= (uint)value.Length) 1012elementsConsumed = value.Length - valueTrim.Length; 1040ReadOnlySpan<TChar> afterSign = valueTrim.Slice(positiveSign.Length); 1041elementsConsumed = value.Length - afterSign.Length; 1063ReadOnlySpan<TChar> afterSign = valueTrim.Slice(negativeSign.Length); 1064elementsConsumed = value.Length - afterSign.Length; 1075elementsConsumed = value.Length - afterHyphen.Length; 1183if (!symbol.IsEmpty && symbol.Length <= candidate.Length && SpanEqualsOrdinalIgnoreCase(candidate.Slice(0, symbol.Length), symbol)) 1185ReadOnlySpan<TChar> trailing = SpanTrimStart(candidate.Slice(symbol.Length)); 1189elementsConsumed += candidate.Length - trailing.Length; 1214while (index < value.Length && IsWhite(TChar.CastToUInt32(value[index]))) 1220if (index >= value.Length) 1234index += negativeSign.Length; 1246index += positiveSign.Length; 1251if (index >= value.Length) 1259index + 1 >= value.Length || 1267if (index >= value.Length) 1285while (index < value.Length) 1319if ((styles & NumberStyles.AllowDecimalPoint) != 0 && index < value.Length) 1324index += decimalSeparator.Length; 1327while (index < value.Length) 1372if (index < value.Length && ((TChar.CastToUInt32(value[index]) | 0x20) == 'p')) 1376if (index >= value.Length) 1388index += negSign.Length; 1397index += posSign.Length; 1400if (index >= value.Length) 1407while (index < value.Length) 1448while (index < value.Length && IsWhite(TChar.CastToUInt32(value[index]))) 1459if ((index != value.Length) && ((styles & AllowTrailingInvalidCharacters) == 0)) 1611elementsConsumed = value.Length - valueTrim.Length; 1643ReadOnlySpan<TChar> afterSign = valueTrim.Slice(positiveSign.Length); 1644elementsConsumed = value.Length - afterSign.Length; 1666ReadOnlySpan<TChar> afterSign = valueTrim.Slice(negativeSign.Length); 1667elementsConsumed = value.Length - afterSign.Length; 1678elementsConsumed = value.Length - afterHyphen.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Colors\Argb.T.cs (1)
66if (values.Length < 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Colors\Rgba.T.cs (1)
66if (values.Length < 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\INumberBase.cs (6)
310int textMaxCharCount = Encoding.UTF8.GetMaxCharCount(utf8Text.Length); 471charsConsumed = s.Length; 492int textMaxCharCount = Encoding.UTF8.GetMaxCharCount(utf8Text.Length); 550bytesConsumed = utf8Text.Length; 618int textMaxCharCount = Encoding.UTF8.GetMaxCharCount(utf8Text.Length); 665int textMaxCharCount = Encoding.UTF8.GetMaxCharCount(utf8Text.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (5)
134bool xIsLonger = x.Length >= y.Length; 138ReadOnlySpan<byte> extra = longer[..(longer.Length - shorter.Length)]; 151int suffixComparison = longer[extra.Length..].SequenceCompareTo(shorter);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (2)
92if (values.Length < Count) 110if (values.Length < Vector<byte>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (1)
825if (values.Length < Vector<T>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (1)
432if (values.Length < ElementCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (1)
469if (values.Length < ElementCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.cs (1)
520if (values.Length < ElementCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\ParseNumbers.cs (7)
35int length = s.Length; 123int length = s.Length; 208for (; localIndex < s.Length && char.IsWhiteSpace(s[localIndex]); localIndex++) ; 223while (i < s.Length && IsDigit(s[i], radix, out int value)) 250while (i < s.Length && IsDigit(s[i], radix, out int value)) 284while (i < s.Length && IsDigit(s[i], radix, out int value)) 309while (i < s.Length && IsDigit(s[i], radix, out int value))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (6)
497choices.Length <= 256) 503if (BitOperations.IsPow2(choices.Length)) 509int mask = choices.Length - 1; 535int mask = (int)BitOperations.RoundUpToPowerOf2((uint)choices.Length) - 1; 558if (masked < (uint)choices.Length) 574destination[i] = choices[Next(choices.Length)];
src\runtime\src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (3)
228return new ReadOnlySpan<T>(ref Unsafe.As<TDerived, T>(ref items._reference), items.Length); 256if (index < _span.Length) 415var destination = new T[Length];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyName.cs (1)
363charsToCopy = stringToEscape.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\EventInfo.cs (1)
50for (int i = 0; i < p.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBase.cs (3)
129if (paramInfo.Length == 0) 134Type[] parameterTypes = new Type[paramInfo.Length]; 135for (int i = 0; i < paramInfo.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\NullabilityInfoContext.cs (2)
119for (int i = 0; i < parameters.Length; i++) 214ParameterInfo parameter = parameters[parameters.Length - 1];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\ParameterInfo.cs (2)
84if (PositionImpl < args.Length) 93if (PositionImpl > -1 && PositionImpl < args.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\TypeNameResolver.cs (2)
109Type[] genericTypes = new Type[genericArgs.Length]; 110for (int i = 0; i < genericArgs.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncProfilerEventSource.cs (1)
89int length = buffer.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (7)
409_pos += value.Length; 430int paddingRequired = alignment - value.Length; 440EnsureCapacityForAdditionalChars(value.Length + paddingRequired); 444_pos += value.Length; 453_pos += value.Length; 616Grow(value.Length); 618_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\RuntimeHelpers.cs (1)
140if ((int)srcET >= primitiveWidenTable.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (5)
51numElements = managed.Length; 120if (managed.Length <= buffer.Length) 122_span = buffer[0..managed.Length]; 126int bufferSize = checked(managed.Length * sizeof(TUnmanagedElement)); 128_span = new Span<TUnmanagedElement>(_allocatedMemory, managed.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (6)
62checked(span.Length * sizeof(T))); 101internal static unsafe ref T GetNonNullPinnableReference<T>(ReadOnlySpan<T> span) => ref (span.Length != 0) ? ref Unsafe.AsRef(in span._reference) : ref Unsafe.AsRef<T>((void*)1); 184uint fromLength = (uint)span.Length; 477if (source.Length < sizeof(T)) 496if (source.Length < sizeof(T)) 581if (span.Length < sizeof(T))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeBuffer.cs (2)
328SpaceCheck(ptr, checked((nuint)(alignedSizeofT * data.Length))); 336for (int i = 0; i < data.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\ISimdVector_2.cs (1)
253if (values.Length < TSelf.ElementCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (1)
1064if (values.Length < Vector128<T>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (1)
1064if (values.Length < Vector256<T>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (1)
959if (values.Length < Vector512<T>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (1)
1038if (values.Length < Vector64<T>.Count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Versioning\FrameworkName.cs (2)
163if (value.Length > 0 && (value[0] == VersionValuePrefix || value[0] == 'V')) 181if (value.Length > 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SByte.cs (5)
311if (source.Length != 0) 330if (source.Length > sizeof(sbyte)) 352result = (sbyte)source[source.Length - sizeof(sbyte)]; 364if (source.Length != 0) 383if (source.Length > sizeof(sbyte))
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedIgnoreCaseSearchValues.cs (2)
37PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length); 42PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), _e0, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (5)
20Debug.Assert(values.Length == 1); 36SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 40SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 44SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedIgnoreCaseSearchValues.cs (4)
44PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 49PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2SearchValues.cs (5)
20Debug.Assert(values.Length == 2); 36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (5)
20Debug.Assert(values.Length == 3); 36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any4SearchValues.cs (5)
20Debug.Assert(values.Length == 4); 39SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 43SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 47SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 51SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any5SearchValues.cs (5)
20Debug.Assert(values.Length == 5); 40SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 44SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 48SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 52SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\AnyByteSearchValues.cs (6)
32ref MemoryMarshal.GetReference(span), span.Length, ref _state); 40ref MemoryMarshal.GetReference(span), span.Length, ref _state); 48ref MemoryMarshal.GetReference(span), span.Length, ref _state); 56ref MemoryMarshal.GetReference(span), span.Length, ref _state); 64ref MemoryMarshal.GetReference(span), span.Length, ref _state); 72ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiByteSearchValues.cs (6)
48ref MemoryMarshal.GetReference(span), span.Length, ref _state); 56ref MemoryMarshal.GetReference(span), span.Length, ref _state); 64ref MemoryMarshal.GetReference(span), span.Length, ref _state); 72ref MemoryMarshal.GetReference(span), span.Length, ref _state); 80ref MemoryMarshal.GetReference(span), span.Length, ref _state); 88ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiCharSearchValues.cs (6)
50ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 58ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 66ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 74ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 82ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 90ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\BitmapCharSearchValues.cs (4)
56IndexOfAny<IndexOfAnyAsciiSearcher.DontNegate>(ref MemoryMarshal.GetReference(span), span.Length); 60IndexOfAny<IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length); 64LastIndexOfAny<IndexOfAnyAsciiSearcher.DontNegate>(ref MemoryMarshal.GetReference(span), span.Length); 68LastIndexOfAny<IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\EmptySearchValues.cs (1)
25span.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (1)
104if (!IsVectorizationSupported || values.Length > 16)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticCharSearchValues.cs (4)
26ProbabilisticMap.IndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 29ProbabilisticMapState.IndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 32ProbabilisticMap.LastIndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 35ProbabilisticMapState.LastIndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (2)
49for (int i = 0; i < values.Length; ++i) 110values.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (3)
133int modulus = HashHelpers.GetPrime(values.Length); 150modulus = HashHelpers.GetPrime(values.Length); 196if (unique.Count == values.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticWithAsciiCharSearchValues.cs (18)
44if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[0])) 61span.Length, 71span.Length, 76if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset])) 87span.Length, 105if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[0])) 110span.Length, 114if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset])) 125span.Length, 141if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[^1])) 160span.Length, 170span.Length, 175if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset])) 186span.Length, 194if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[^1])) 199span.Length, 203if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset])) 214span.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\RangeCharSearchValues.cs (4)
43? PackedSpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), _lowInclusive, _rangeInclusive, span.Length) 48span.Length); 53? PackedSpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), _lowInclusive, _rangeInclusive, span.Length) 58span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.cs (13)
35if (values.Length == 1) 48if (values.Length >= 4 && IndexOfAnyAsciiSearcher.CanUseUniqueLowNibbleSearch(values, maxInclusive)) 53if (values.Length <= 5) 55Debug.Assert(values.Length is 2 or 3 or 4 or 5); 56return values.Length switch 88if (values.Length == 1) 105if (values.Length == 2) 123if (values.Length == 3) 138maxInclusive < 128 && values.Length == 4 && minInclusive > 0) 169if (values.Length == 4) 174if (values.Length == 5) 189if (ShouldUseProbabilisticMap(values.Length, maxInclusive)) 251if (range > values.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\AsciiStringSearchValuesTeddyBase.cs (19)
159if (Vector512.IsHardwareAccelerated && Avx512Vbmi.IsSupported && span.Length >= CharsPerIterationAvx512 + MatchStartOffsetN2) 164if (Avx2.IsSupported && span.Length >= CharsPerIterationAvx2 + MatchStartOffsetN2) 180if (Vector512.IsHardwareAccelerated && Avx512Vbmi.IsSupported && span.Length >= CharsPerIterationAvx512 + MatchStartOffsetN3) 185if (Avx2.IsSupported && span.Length >= CharsPerIterationAvx2 + MatchStartOffsetN3) 201if (span.Length < CharsPerIterationVector128 + MatchStartOffsetN2) 207ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationVector128); 256Debug.Assert(span.Length >= CharsPerIterationAvx2 + MatchStartOffsetN2); 259ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx2); 308Debug.Assert(span.Length >= CharsPerIterationAvx512 + MatchStartOffsetN2); 311ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx512); 361if (span.Length < CharsPerIterationVector128 + MatchStartOffsetN3) 367ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationVector128); 434Debug.Assert(span.Length >= CharsPerIterationAvx2 + MatchStartOffsetN3); 437ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx2); 489Debug.Assert(span.Length >= CharsPerIterationAvx512 + MatchStartOffsetN3); 492ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx512); 553int lengthRemaining = span.Length - offsetFromStart; 600int lengthRemaining = span.Length - offsetFromStart; 645int lengthRemaining = span.Length - offsetFromStart;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasick.cs (8)
92int remainingLength = span.Length - i; 115if ((uint)i >= (uint)span.Length) 122Debug.Assert((uint)i < (uint)span.Length); 204int remainingLength = span.Length - i; 224if ((uint)i >= (uint)span.Length) 231Debug.Assert((uint)i < (uint)span.Length); 246(uint)(i + 1) < (uint)span.Length && 268Ordinal.ToUpperOrdinal(span.Slice(i, i + 1 == span.Length ? 1 : 2), destination);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasickBuilder.cs (1)
29for (int i = 1; i < values.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\CharacterFrequencyHelper.cs (1)
89for (int i = 1; i < span.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (8)
42Debug.Assert(values.Length <= MaxValues); 112Debug.Assert(span.Length <= MaxInputLength, "Teddy should have handled short inputs."); 118if (span.Length >= hashLength) 120ref char end = ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (uint)(span.Length - hashLength)); 139if (StartsWith<TCaseSensitivity>(ref current, span.Length - startOffset, bucket)) 164Debug.Assert(span.Length <= MaxInputLength, "Teddy should have handled long inputs."); 166if (_hashLength > span.Length) 172Span<char> upperCase = stackalloc char[MaxInputLength].Slice(0, span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (1)
36int availableLength = span.Length - currentOffset;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\TeddyBucketizer.cs (6)
17Debug.Assert(values.Length <= 8); 22for (int i = 0; i < values.Length; i++) 78Debug.Assert(values.Length > bucketCount, "Should be using a non-bucketized implementation."); 79Debug.Assert(values.Length <= RabinKarp.MaxValues); 83Span<int> bucketIndexes = stackalloc int[RabinKarp.MaxValues].Slice(0, values.Length); 90for (int i = 0; i < values.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\MultiStringIgnoreCaseSearchValuesFallback.cs (1)
26for (int i = 0; i < span.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesPackedThreeChars.cs (1)
79IndexOf(ref MemoryMarshal.GetReference(span), span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (1)
74IndexOf(ref MemoryMarshal.GetReference(span), span.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (10)
26if (values.Length == 0) 31if (values.Length == 1) 42var uniqueValues = new HashSet<string>(values.Length, ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal); 112if (values.Length == 1) 177if (values.Length > RabinKarp.MaxValues) 248values.Length < TeddyBucketCount && 282Debug.Assert(values.Length > 1); 285if (values.Length > TeddyBucketCount) 307Debug.Assert(values.Length < maxValues); 329Debug.Assert(newValuesCount > values.Length, "Shouldn't have been called if there were no letters present");
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValuesBase.cs (2)
57for (int i = 0; i < span.Length; i++) 71for (int i = span.Length - 1; i >= 0; i--)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (2)
38_buffer = UnmanagedBuffer.Allocate(GetAlignedByteSize(value.Length)); 39_decryptedLength = value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SpanHelpers.BinarySearch.cs (1)
20return BinarySearch(ref MemoryMarshal.GetReference(span), span.Length, comparable);
src\runtime\src\libraries\System.Private.CoreLib\src\System\StartupHookProvider.cs (2)
127for (int j = 0; j < disallowedSimpleAssemblyNameChars.Length; j++) 225initializeMethod.GetParametersAsSpan().Length == 0);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (8)
349=> SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(strA), strA.Length, ref MemoryMarshal.GetReference(strB), strB.Length); 717return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 750return Marvin.ComputeHash32OrdinalIgnoreCase(ref MemoryMarshal.GetReference(value), value.Length /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32)); 803int length = span.Length; 913int length = span.Length; 990return GetNonRandomizedHashCodeOrdinalIgnoreCaseSlow(hash1, hash2, span.Slice(span.Length - length)); 995int length = str.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.cs (5)
313if (value.Length == 0) 316string result = FastAllocateString(value.Length); 317Buffer.Memmove(ref result._firstChar, ref MemoryMarshal.GetReference(value), (uint)value.Length); 774if (s.Length > MaxLength) 783if (s.Length <= MaxLength)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (96)
101if (args.Length <= 1) 117var strings = new string[args.Length]; 121for (int i = 0; i < args.Length; i++) 310int length = checked(str0.Length + str1.Length); 320str1.CopyTo(resultSpan.Slice(str0.Length)); 327int length = checked(str0.Length + str1.Length + str2.Length); 337resultSpan = resultSpan.Slice(str0.Length); 340resultSpan = resultSpan.Slice(str1.Length); 349int length = checked(str0.Length + str1.Length + str2.Length + str3.Length); 359resultSpan = resultSpan.Slice(str0.Length); 362resultSpan = resultSpan.Slice(str1.Length); 365resultSpan = resultSpan.Slice(str2.Length); 374int length = checked(str0.Length + str1.Length + str2.Length + str3.Length + str4.Length); 384resultSpan = resultSpan.Slice(str0.Length); 387resultSpan = resultSpan.Slice(str1.Length); 390resultSpan = resultSpan.Slice(str2.Length); 393resultSpan = resultSpan.Slice(str3.Length); 413if (values.Length <= 1) 429for (int i = 0; i < values.Length; i++) 452for (int i = 0; i < values.Length; i++) 559sb.EnsureCapacity(format.Length + args.Length * 8); 655format.ValidateNumberOfArgs(args.Length); 656return args.Length switch 907if (values.Length == 1) 916for (int i = 1; i < values.Length; i++) 1056if (values.Length <= 1) 1063long totalSeparatorsLength = (long)(values.Length - 1) * separator.Length; 1092for (int i = 0; i < values.Length; i++) 1114if (i < values.Length - 1) 1122if (separator.Length == 1) 1128separator.CopyTo(new Span<char>(ref dest, separator.Length)); 1131copiedLength += separator.Length; 1245result.EnsureCapacity(searchSpace.Length); 1432Debug.Assert(indices.Length > 0); 1434long dstLength = this.Length + ((long)(newValue.Length - oldValueLength)) * indices.Length; 1444for (int r = 0; r < indices.Length; r++) 1607if ((uint)idx >= (uint)text.Length) 1621if ((uint)nextCharIdx < (uint)text.Length && text[nextCharIdx] == '\n') 1665if ((uint)idx >= (uint)remaining.Length) break; // no more newline chars 1666stride = remaining[idx] == '\r' && (uint)(idx + 1) < (uint)remaining.Length && remaining[idx + 1] == '\n' ? 2 : 1; 1804if (sepList.Length == 0) 1882if (sepList.Length == 0) 1928if (sepList.Length == 0) 1935? SplitWithPostProcessing(sepList, default, separator.Length, count, options) 1936: SplitWithoutPostProcessing(sepList, default, separator.Length, count); 1952int numActualReplaces = (sepList.Length < count) ? sepList.Length : count; 1985int numReplaces = sepList.Length; 2063if (separators.Length == 0) 2065for (int i = 0; i < source.Length; i++) 2075else if (separators.Length <= 3) 2079sep1 = separators.Length > 1 ? separators[1] : sep0; 2080sep2 = separators.Length > 2 ? separators[2] : sep1; 2081if (Vector128.IsHardwareAccelerated && source.Length >= Vector128<ushort>.Count * 2) 2087for (int i = 0; i < source.Length; i++) 2104for (int i = 0; i < source.Length; i++) 2122Debug.Assert(sourceSpan.Length >= Vector128<ushort>.Count*2); 2127if (Vector512.IsHardwareAccelerated && (uint)remaining.Length >= (uint)Vector512<ushort>.Count*2) 2142while ((uint)remaining.Length >= (uint)Vector512<ushort>.Count*2) 2184while ((uint)remaining.Length >= (uint)Vector512<ushort>.Count) 2207if (remaining.Length > 0) 2209Vector512<ushort> vector = Vector512.Create(sourceSpanUInt16.Slice(sourceSpanUInt16.Length - Vector512<ushort>.Count)); 2211int finalIndex = sourceSpanUInt16.Length - Vector512<ushort>.Count; 2212ulong mask = cmp.ExtractMostSignificantBits() & 0x5555555555555555 & ~((1UL << (Vector512<byte>.Count - remaining.Length * sizeof(char))) - 1); 2222else if (Vector256.IsHardwareAccelerated && (uint)remaining.Length >= (uint)Vector256<ushort>.Count*2) 2237while ((uint)remaining.Length >= (uint)Vector256<ushort>.Count*2) 2279while ((uint)remaining.Length >= (uint)Vector256<ushort>.Count) 2302if (remaining.Length > 0) 2304Vector256<ushort> vector = Vector256.Create(sourceSpanUInt16.Slice(sourceSpanUInt16.Length - Vector256<ushort>.Count)); 2306int finalIndex = sourceSpanUInt16.Length - Vector256<ushort>.Count; 2307uint mask = cmp.ExtractMostSignificantBits() & 0x55555555 & ~((1u << (Vector256<byte>.Count - remaining.Length * sizeof(char))) - 1); 2332while ((uint)remaining.Length >= (uint)Vector128<ushort>.Count*2) 2374while ((uint)remaining.Length >= (uint)Vector128<ushort>.Count) 2397if (remaining.Length > 0) 2399Vector128<ushort> vector = Vector128.Create(sourceSpanUInt16.Slice(sourceSpanUInt16.Length - Vector128<ushort>.Count)); 2401int finalIndex = sourceSpanUInt16.Length - Vector128<ushort>.Count; 2402uint mask = cmp.ExtractMostSignificantBits() & 0x5555 & ~((1u << (Vector128<byte>.Count - remaining.Length * sizeof(char))) - 1); 2438i += separator.Length; 2439source = source.Slice(index + separator.Length); 2454for (int i = 0; i < source.Length; i++) 2456for (int j = 0; j < separators.Length; j++) 2464if (source[i] == separator[0] && currentSepLength <= source.Length - i) 2761return TrimHelper(pTrimChars, trimChars.Length, TrimType.Both); 2828return TrimHelper(pTrimChars, trimChars.Length, TrimType.Head); 2895return TrimHelper(pTrimChars, trimChars.Length, TrimType.Tail);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (2)
171if (source.Length <= destination.Length) 173numElementsToConvert = (uint)source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.cs (2)
22IsValidCore(ref MemoryMarshal.GetReference(value), value.Length); 32IsValidCore(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(value)), value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (18)
25=> left.Length == right.Length 26&& Equals<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length); 30=> left.Length == right.Length 31&& Equals<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 39=> left.Length == right.Length 40&& Equals<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 176=> left.Length == right.Length 177&& EqualsIgnoreCase<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length); 181=> left.Length == right.Length 182&& EqualsIgnoreCase<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 190=> left.Length == right.Length 191&& EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Transcoding.cs (4)
25if (source.Length <= destination.Length) 27numElementsToConvert = (uint)source.Length; 60if (source.Length <= destination.Length) 62numElementsToConvert = (uint)source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Trimming.cs (2)
57for (; start < value.Length; start++) 67int end = value.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (8)
147return GetByteCountCommon(charsPtr, chars.Length); 322return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 332int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 394int numElementsToConvert = Math.Min(chars.Length, bytes.Length); 489return GetCharCountCommon(bytesPtr, bytes.Length); 613return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 623int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false); 682int numElementsToConvert = Math.Min(bytes.Length, chars.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\CompositeFormat.cs (1)
343if ((uint)pos >= (uint)format.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Decoder.cs (3)
115return GetCharCount(bytesPtr, bytes.Length, flush); 202return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length, flush); 308Convert(bytesPtr, bytes.Length, charsPtr, chars.Length, flush, out bytesUsed, out charsUsed, out completed);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\DecoderFallback.cs (2)
210return (Fallback(remainingBytes.Slice(0, fallbackLength).ToArray(), index: _originalByteCount - remainingBytes.Length)) 217if (Fallback(remainingBytes.Slice(0, fallbackLength).ToArray(), index: _originalByteCount - remainingBytes.Length))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\DecoderNLS.cs (3)
212_leftoverByteCount = bytes.Length; 381for (int i = 0; i < srcLeft.Length; i++) 393for (int i = 0; i < srcRight.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Encoder.cs (3)
113return GetByteCount(charsPtr, chars.Length, flush); 199return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length, flush); 307Convert(charsPtr, chars.Length, bytesPtr, bytes.Length, flush, out charsUsed, out bytesUsed, out completed);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\EncoderFallback.cs (2)
137if (chars.Length > 1) 145int index = originalCharCount - chars.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\EncoderLatin1BestFitFallback.cs (3)
126int highBound = ArrayCharBestFit.Length; 142Debug.Assert(index + 1 < ArrayCharBestFit.Length, 163Debug.Assert(index + 1 < ArrayCharBestFit.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (5)
585return GetByteCount(charsPtr, chars.Length); 732return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length); 787return GetCharCount(bytesPtr, bytes.Length); 881return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length); 917return string.CreateStringFromEncoding(bytesPtr, bytes.Length, this);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (15)
274charsLength: chars.Length, 367charsLength: chars.Length, 551charsLength: chars.Length, 572encoder._charsUsed = originalCharCount - chars.Length; // total number of characters consumed up until now 609Debug.Assert(charsConsumedThisIteration == chars.Length, "If returning NeedMoreData, should out the entire buffer length as chars consumed."); 654charsLength: chars.Length, 698Debug.Assert(originalCharsLength >= chars.Length, "About to report a negative number of chars used?"); 699encoder._charsUsed = originalCharsLength - chars.Length; // number of chars consumed 874bytesLength: bytes.Length, 963bytesLength: bytes.Length, 1154bytesLength: bytes.Length, 1211Debug.Assert(bytesConsumedThisIteration == bytes.Length, "If returning NeedMoreData, should out the entire buffer length as bytes consumed."); 1254bytesLength: bytes.Length, 1295Debug.Assert(originalBytesLength >= bytes.Length, "About to report a negative number of bytes used?"); 1296decoder._bytesUsed = originalBytesLength - bytes.Length; // number of bytes consumed
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\EncodingTable.cs (10)
42int right = EncodingNameIndices.Length - 2; 46Debug.Assert(EncodingNameIndices.Length == CodePagesByName.Length + 1); 57Debug.Assert(index < EncodingNameIndices.Length - 1); 80Debug.Assert(left < EncodingNameIndices.Length - 1); 100EncodingInfo[] arrayEncodingInfo = new EncodingInfo[(LocalAppContextSwitches.EnableUnsafeUTF7Encoding) ? mappedCodePages.Length : (mappedCodePages.Length - 1)]; 105for (int i = 0; i < mappedCodePages.Length; i++) 131for (int i = 0; i < mappedCodePages.Length; i++) 169Interlocked.CompareExchange<CodePageDataItem?[]?>(ref s_codePageToCodePageData, new CodePageDataItem[MappedCodePages.Length], null);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (7)
86return GetByteCountCommon(charsPtr, chars.Length); 234return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 244int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 381return bytes.Length; 529return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 536if (bytes.Length <= chars.Length) 541charsWritten = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (18)
350if (source.Length > 1) 379charsConsumed = source.Length; 455if (source.Length <= 1) 509if (source.Length <= 2) 534if (source.Length <= 3) 586int index = source.Length - 1; 587if ((uint)index < (uint)source.Length) 606if ((uint)index < (uint)source.Length) 630charsConsumed = (int)((uint)(-source.Length) >> 31); // 0 -> 0, all other lengths -> 1 646int index = source.Length - 1; 647if ((uint)index < (uint)source.Length) 681if ((uint)index >= (uint)source.Length) 722if (tempBytesConsumed == source.Length) 871if (input.Length <= 1) 979if (bytesConsumed == utf8Text.Length) 993if (DecodeFromUtf8(utf8Text, out Rune result, out int bytesConsumed) != OperationStatus.Done || bytesConsumed != utf8Text.Length) 1029if (DecodeFromUtf16(s, out Rune result, out int charsConsumed) != OperationStatus.Done || charsConsumed != s.Length) 1040if (DecodeFromUtf16(s, out result, out int charsConsumed) != OperationStatus.Done || charsConsumed != s.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\SpanLineEnumerator.cs (2)
57if ((uint)idx < (uint)remaining.Length) 61if (remaining[idx] == '\r' && (uint)(idx + 1) < (uint)remaining.Length && remaining[idx + 1] == '\n')
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (33)
977long insertingChars = (long)value.Length * count; 988ReplaceInPlaceAtChunk(ref chunk!, ref indexInChunk, ref MemoryMarshal.GetReference(value), value.Length); 1135Append(ref MemoryMarshal.GetReference(value), value.Length); 1318for (int i = 1; i < values.Length; i++) 1458if (value.Length != 0) 1460Insert(index, ref MemoryMarshal.GetReference(value), value.Length); 1749if ((uint)index >= (uint)args.Length) 1796if (itemFormatSpan.Length != 0) 1932format.ValidateNumberOfArgs(args.Length); 1933return args.Length switch 2075if (span.Length != Length) 2090if (!chunk.EqualsOrdinal(span.Slice(span.Length - offset, chunk_length))) 2141if (oldValue.Length == 0) 2160while (oldValue.Length <= remainingChunk.Length) 2171remainingChunk = remainingChunk.Slice(foundPos + oldValue.Length); 2172indexInChunk += oldValue.Length; 2173count -= foundPos + oldValue.Length; 2188int move = remainingChunk.Length - (oldValue.Length - 1); 2195Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2196$"oldValue.Length = {oldValue.Length}, chunk.m_ChunkLength - indexInChunk = {chunk.m_ChunkLength - indexInChunk}, count == {count}"); 2204indexInChunk += oldValue.Length; 2205count -= oldValue.Length; 2226ReplaceAllInChunk(replacements.AsSpan(), chunk, oldValue.Length, newValue); 2227index += (newValue.Length - oldValue.Length) * replacements.Length; 2446long longDelta = (value.Length - removeCount) * (long)replacements.Length; 2467ReplaceInPlaceAtChunk(ref targetChunk!, ref targetIndexInChunk, ref MemoryMarshal.GetReference<char>(value), value.Length); 2470if ((uint)i >= replacements.Length) 2507for (int i = 0; i < value.Length; i++) 3212int paddingRequired = alignment - value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (1)
484int rentalLength = Math.Clamp(buffer.Length, MinWriteRentedArraySize, MaxWriteRentedArraySize);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf16Utility.cs (2)
306char* pFirstInvalidChar = GetPointerToFirstInvalidChar(pValue, utf16Data.Length, out _, out _); 309return (index < utf16Data.Length) ? index : -1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (4)
64inputLength: source.Length, 155inputLength: source.Length, 250inputLength: source.Length, 604_pos += utf8Value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.cs (2)
32byte* pFirstInvalidByte = GetPointerToFirstInvalidByte(pUtf8Data, utf8Data.Length, out int utf16CodeUnitCountAdjustment, out _); 36return (index < utf8Data.Length) ? index : -1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (6)
196return GetByteCountCommon(charsPtr, chars.Length); 368return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 378int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 489return GetCharCountCommon(bytesPtr, bytes.Length); 563return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 573int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\ValueStringBuilder.AppendFormat.cs (2)
194if ((uint)index >= (uint)args.Length) 233if (itemFormatSpan.Length != 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (3)
877return tokens.Length switch 945_linkingRegistrations = new CancellationTokenRegistration[tokens.Length]; 947for (int i = 0; i < tokens.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (8)
5141for (int i = tasks.Length - 1; i >= 0; i--) 5158AddToList(task, ref waitedOnTaskList, initSize: tasks.Length); 5164if (!taskIsCompleted) AddToList(task, ref waitedOnTaskList, initSize: tasks.Length); 6196switch (tasks.Length) 6222Debug.Assert(tasks.Length != 0, "Expected a non-zero length task array"); 6249_remainingToComplete = tasks.Length; 6728if (tasks.Length == 2) 7128if (tasks.Length != 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (17)
243Debug.Assert(waitHandles.Length > 0); 244Debug.Assert(waitHandles.Length <= MaxWaitHandles); 250for (int i = 0; i < waitHandles.Length; ++i) 265for (int i = 0; i < waitHandles.Length; ++i) 300if (waitHandles.Length == 0) 304if (waitHandles.Length > MaxWaitHandles) 312SafeWaitHandle?[]? safeWaitHandles = RentSafeWaitHandleArray(waitHandles.Length); 320IntPtr[] unsafeWaitHandles = new IntPtr[waitHandles.Length]; 326Span<IntPtr> unsafeWaitHandles = stackalloc IntPtr[waitHandles.Length]; 331if (waitResult >= WaitAbandoned && waitResult < WaitAbandoned + waitHandles.Length) 348for (int i = 0; i < waitHandles.Length; ++i) 368Debug.Assert(safeWaitHandles.Length != 0); 369Debug.Assert(safeWaitHandles.Length <= MaxWaitHandles); 378IntPtr[] unsafeWaitHandles = new IntPtr[safeWaitHandles.Length]; 379for (int i = 0; i < safeWaitHandles.Length; ++i) 388Span<IntPtr> unsafeWaitHandles = stackalloc IntPtr[safeWaitHandles.Length]; 389for (int i = 0; i < safeWaitHandles.Length; ++i)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.Unix.cs (8)
377Debug.Assert(waitHandles.Length > 0); 378Debug.Assert(waitHandles.Length <= WaitHandle.MaxWaitHandles); 384if (waitHandles.Length == 1 && HandleManager.FromHandle(waitHandles[0]) is NamedMutex namedMutex) 391WaitableObject?[] waitableObjects = waitInfo.GetWaitedObjectArray(waitHandles.Length); 396for (int i = 0; i < waitHandles.Length; ++i) 429for (int i = 0; i < waitHandles.Length; ++i) 436if (waitHandles.Length == 1) 447waitHandles.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (3)
707if (format.Length == 1) 1025if (format.Length == 0) 1030if (format.Length == 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (12)
782if (offset.Length > 0) 938if ((uint)index >= (uint)date.Length || !char.IsAsciiDigit(date[index])) 949} while ((uint)index < (uint)date.Length && char.IsAsciiDigit(date[index])); 953if (julianDay == 0 || julianDay > days[days.Length - 1]) 959while (i < days.Length && julianDay > days[i]) 964Debug.Assert(i > 0 && i < days.Length); 1030if (index < posixFormat.Length && posixFormat[index] == ',') 1035if (index < posixFormat.Length && posixFormat[index] == ',') 1048bool isBracketEnclosed = index < posixFormat.Length && posixFormat[index] == '<'; 1057if (index < posixFormat.Length && posixFormat[index] == '>') 1081if (index < posixFormat.Length && posixFormat[index] == '/') 1097for (; index < posixFormat.Length; index++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Type.Helpers.cs (1)
541str = str.Slice(0, str.Length - 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (9)
1108if (source.Length != 0) 1119if ((source.Length > Size) && (source[..^Size].ContainsAnyExcept((byte)0x00))) 1128if (source.Length >= Size) 1131result = BinaryPrimitives.ReadUInt128BigEndian(source.Slice(source.Length - Size)); 1139for (int i = 0; i < source.Length; i++) 1156if (source.Length != 0) 1167if ((source.Length > Size) && (source[Size..].ContainsAnyExcept((byte)0x00))) 1176if (source.Length >= Size) 1189for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (7)
295if (source.Length != 0) 306if ((source.Length > sizeof(ushort)) && (source[..^sizeof(ushort)].ContainsAnyExcept((byte)0x00))) 315if (source.Length >= sizeof(ushort)) 318result = BinaryPrimitives.ReadUInt16BigEndian(source.Slice(source.Length - sizeof(ushort))); 336if (source.Length != 0) 347if ((source.Length > sizeof(ushort)) && (source[sizeof(ushort)..].ContainsAnyExcept((byte)0x00))) 356if (source.Length >= sizeof(ushort))
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
342if (source.Length != 0) 353if ((source.Length > sizeof(uint)) && (source[..^sizeof(uint)].ContainsAnyExcept((byte)0x00))) 362if (source.Length >= sizeof(uint)) 365result = BinaryPrimitives.ReadUInt32BigEndian(source.Slice(source.Length - sizeof(uint))); 373for (int i = 0; i < source.Length; i++) 390if (source.Length != 0) 401if ((source.Length > sizeof(uint)) && (source[sizeof(uint)..].ContainsAnyExcept((byte)0x00))) 410if (source.Length >= sizeof(uint)) 423for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (9)
349if (source.Length != 0) 360if ((source.Length > sizeof(ulong)) && (source[..^sizeof(ulong)].ContainsAnyExcept((byte)0x00))) 369if (source.Length >= sizeof(ulong)) 372result = BinaryPrimitives.ReadUInt64BigEndian(source.Slice(source.Length - sizeof(ulong))); 380for (int i = 0; i < source.Length; i++) 397if (source.Length != 0) 408if ((source.Length > sizeof(ulong)) && (source[sizeof(ulong)..].ContainsAnyExcept((byte)0x00))) 417if (source.Length >= sizeof(ulong)) 430for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (9)
350if (source.Length != 0) 361if ((source.Length > sizeof(nuint_t)) && (source[..^sizeof(nuint_t)].ContainsAnyExcept((byte)0x00))) 370if (source.Length >= sizeof(nuint_t)) 373result = BinaryPrimitives.ReadUIntPtrBigEndian(source.Slice(source.Length - sizeof(nuint_t))); 381for (int i = 0; i < source.Length; i++) 398if (source.Length != 0) 409if ((source.Length > sizeof(nuint_t)) && (source[sizeof(nuint_t)..].ContainsAnyExcept((byte)0x00))) 418if (source.Length >= sizeof(nuint_t)) 431for (int i = 0; i < source.Length; i++)
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParser.cs (3)
57int errorIndex = typeName.Length - parser._inputString.Length; 255_inputString = _inputString.Slice(candidate.Length);
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (5)
40return input.Length; // no type name end chars were found, the whole input is the type name 48isNestedType = offset > 0 && offset < input.Length && input[offset] == '+'; 54for (; offset < input.Length; offset++) 61if (offset == input.Length || // invalid name that ends with escape character 146for (; offset < input.Length; offset++)
System\ActivatorImplementation.cs (1)
120if (invokeMethod.GetParametersAsSpan().Length == 0)
System\CrashInfo.cs (1)
390Span<byte> destination = AllocBuffer(bytes.Length);
System\Reflection\ConstructorInvoker.cs (1)
22_parameterCount = constructor.GetParametersAsSpan().Length;
System\Reflection\DynamicInvokeInfo.cs (3)
67_argumentCount = parameters.Length; 71ArgumentInfo[] arguments = new ArgumentInfo[parameters.Length]; 72for (int i = 0; i < parameters.Length; i++)
System\Reflection\MethodInvoker.cs (1)
22_parameterCount = method.GetParametersAsSpan().Length;
System\Reflection\Runtime\BindingFlagSupport\MemberPolicies.cs (4)
93if (p1.Length != p2.Length) 102for (int i = 0; i < p1.Length; i++) 116for (int i = 0; i < p1.Length; i++)
System\Reflection\Runtime\BindingFlagSupport\Shared.cs (6)
45if (argumentTypes.Length != parameterInfos.Length) 54bool excessSuppliedArguments = argumentTypes.Length > parameterInfos.Length; 94if (parameterInfos.Length == 0) 98bool shortByMoreThanOneSuppliedArgument = argumentTypes.Length < parameterInfos.Length - 1; 103ParameterInfo lastParameter = parameterInfos[parameterInfos.Length - 1]; 127for (int i = 0; i < parameterInfos.Length; i++)
System\Reflection\Runtime\CustomAttributes\RuntimeCustomAttributeData.cs (1)
77if (parameterCount != candidateParameters.Length)
System\Reflection\Runtime\EventInfos\RuntimeEventInfo.cs (1)
114if (parameters.Length == 0)
System\Reflection\Runtime\General\MetadataReaderExtensions.NativeFormat.cs (2)
491int idx = namespaceParts.Length; 514int idx = namespaceParts.Length;
System\Reflection\Runtime\MethodInfos\CustomMethodInvoker.cs (1)
44int argCount = arguments.Length;
System\Reflection\Runtime\MethodInfos\CustomMethodMapper.cs (2)
34Type[] parameterTypes = new Type[parameterInfos.Length]; 35for (int i = 0; i < parameterInfos.Length; i++)
System\Reflection\Runtime\MethodInfos\RuntimeMethodInfo.cs (4)
335if (delegateParameters.Length == targetParameters.Length) 357if (delegateParameters.Length == targetParameters.Length)
System\Reflection\Runtime\TypeInfos\RuntimeTypeInfo.BindingFlags.cs (1)
33if (firstCandidate.GetParametersAsSpan().Length == 0)
System\Reflection\Runtime\TypeInfos\RuntimeTypeInfo.InvokeMember.cs (1)
362finalist.GetParametersAsSpan().Length == 0 &&
System\Reflection\TypeNameResolver.NativeAot.cs (1)
209for (int i = 0; i < nestedTypeNames.Length; i++)
System\Runtime\InteropServices\PInvokeMarshal.cs (1)
551ansiBufferLen = span.Length;
System.Private.CoreLib.Generators (8)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
System.Private.DataContractSerialization (53)
_generated\0\RegexGenerator.g.cs (12)
225base.runtextpos = inputSpan.Length; 237if (pos <= inputSpan.Length - 359) 247base.runtextpos = inputSpan.Length; 270while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 288while ((uint)iteration1 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration1])) 306while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 324while ((uint)iteration3 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration3])) 342while ((uint)iteration4 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration4])) 351if ((uint)slice.Length < 320 || 364while ((uint)iteration5 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration5])) 393if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (4)
257while (buffer.Length > 0) 259int size = Math.Min(_chars.Length, buffer.Length); 331if (data.Length < 2) 347if (data.Length >= 3 && data[2] == 0xBF)
System\Xml\EncodingStreamWrapper.cs (1)
184if (bom.Length > 0)
System\Xml\XmlBinaryWriter.cs (19)
607if (chars.Length > 0) 611UnsafeWriteText(pch, chars.Length); 862WriteArray(XmlBinaryNodeType.BoolTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 869WriteArray(XmlBinaryNodeType.Int16TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 873WriteArrayInfo(XmlBinaryNodeType.Int16TextWithEndElement, items.Length); 885WriteArray(XmlBinaryNodeType.Int32TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 889WriteArrayInfo(XmlBinaryNodeType.Int32TextWithEndElement, items.Length); 901WriteArray(XmlBinaryNodeType.Int64TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 905WriteArrayInfo(XmlBinaryNodeType.Int64TextWithEndElement, items.Length); 917WriteArray(XmlBinaryNodeType.FloatTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 921WriteArrayInfo(XmlBinaryNodeType.FloatTextWithEndElement, items.Length); 935WriteArray(XmlBinaryNodeType.DoubleTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 939WriteArrayInfo(XmlBinaryNodeType.DoubleTextWithEndElement, items.Length); 953WriteArray(XmlBinaryNodeType.DecimalTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 958WriteArrayInfo(XmlBinaryNodeType.DecimalTextWithEndElement, items.Length); 976WriteArrayInfo(XmlBinaryNodeType.DateTimeTextWithEndElement, items.Length); 987WriteArray(XmlBinaryNodeType.GuidTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 992WriteArrayInfo(XmlBinaryNodeType.GuidTextWithEndElement, items.Length); 1004WriteArrayInfo(XmlBinaryNodeType.TimeSpanTextWithEndElement, items.Length);
System\Xml\XmlStreamNodeWriter.cs (7)
230if (bytes.Length < bufferLength) 232var buffer = GetBuffer(bytes.Length, out int offset).AsSpan(offset, bytes.Length); 234Advance(bytes.Length); 279if (value.Length < bufferLength) 281byte[] buffer = GetBuffer(value.Length, out int offset); 283Advance(value.Length);
System.Private.Reflection.Execution (1)
Internal\Reflection\Execution\TypeLoader\ConstraintValidatorSupport.cs (1)
290if (!ctor.IsStatic && ctor.IsPublic && ctor.GetParametersAsSpan().Length == 0)
System.Private.StackTraceMetadata (7)
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (7)
33if (src.Length == 0) 43for (int i = startIndex; i < src.Length; i += 2) 46if (i + 1 < src.Length) 56_numCharactersHashed += src.Length; 77if (src.Length == 0) 85for (int i = 0; i < src.Length; i += 2) 88if (i + 1 < src.Length)
System.Private.TypeLoader (11)
Internal\TypeSystem\RuntimeNoMetadataType.cs (1)
50GenericVariance variance = runtimeVarianceData.Length == 0 ? GenericVariance.None : runtimeVarianceData[i] switch
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8Span.cs (3)
17public int Length => _value.Length; 33if (_value.Length < value.Length) 47return _value.Length == value.Length; // All char ANSI, all matching
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (7)
33if (src.Length == 0) 43for (int i = startIndex; i < src.Length; i += 2) 46if (i + 1 < src.Length) 56_numCharactersHashed += src.Length; 77if (src.Length == 0) 85for (int i = 0; i < src.Length; i += 2) 88if (i + 1 < src.Length)
System.Private.Uri (109)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (8)
138while (start < name.Length) 164(uint)(start + 1) < (uint)name.Length && char.IsAsciiDigit((char)ToUShort(name[start + 1]))) 221for (; current < name.Length; current++) 235if (current < name.Length) 254for (; current < name.Length; current++) 273if (current < name.Length && ch == '.') 296else if (current >= name.Length) 299end = name.Length;
src\runtime\src\libraries\Common\src\System\Net\IPv6AddressHelper.Common.cs (8)
21for (int i = 0; i < numbers.Length; i++) 113int end = name.Length; 327for (int i = (address[0] == TChar.CreateTruncating('[') ? 1 : 0); i < address.Length && address[i] != TChar.CreateTruncating(']');) 343for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']') && address[i] != TChar.CreateTruncating('/'); ++i) 349for (; i < address.Length && address[i] != TChar.CreateTruncating(']'); ++i) 374for (int j = i; j < address.Length && 390while (j < address.Length && (address[j] != TChar.CreateTruncating(']')) && (address[j] != TChar.CreateTruncating('/')) && (address[j] != TChar.CreateTruncating('%'))) 416for (++i; i < address.Length && address[i] != TChar.CreateTruncating(']'); i++)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\DomainNameHelper.cs (5)
121length = hostname.Length; 148int labelLength = dotIndex < 0 ? hostname.Length : dotIndex; 285int charsWritten = label.ToLowerInvariant(dest.AppendSpan(label.Length)); 286Debug.Assert(charsWritten == label.Length); 290i += label.Length;
System\IPv6AddressHelper.cs (4)
137if (name.Length < 3 || (name[1] == ':' && name[2] != ':')) 143for (i = 1; i < name.Length; ++i) 168if (++i == name.Length) 225i = name.Length;
System\IriHelper.cs (3)
78for (int i = 0; (uint)i < (uint)span.Length; i++) 84if ((uint)(i + 2) < (uint)span.Length) 128if (char.IsHighSurrogate(ch) && (uint)(i + 1) < (uint)span.Length)
System\PercentEncodingHelper.cs (2)
16Debug.Assert(input.Length >= 3); 32if ((uint)(input.Length - i) <= 2 || input[i] != '%')
System\UncNameHelper.cs (3)
46for (; i < name.Length; i++) 72for (; (uint)i < (uint)name.Length; i++) 103if ((uint)(i - 1) >= (uint)name.Length || name[i - 1] != '.')
System\Uri.cs (31)
1643charsWritten = result.Length; 1993while (!str.IsEmpty && UriHelper.IsLWS(str[str.Length - 1])) 1995str = str.Slice(0, str.Length - 1); 2013(idx + 1 < str.Length)) 2019for (; (uint)i < (uint)str.Length; i++) 2036if ((uint)(i + 1) < (uint)str.Length && str[i + 1] is ':' or '|' && char.IsAsciiLetter(str[i])) 2038if ((uint)(i + 2) >= (uint)str.Length || str[i + 2] is not ('\\' or '/')) 2068(uint)i < (uint)str.Length && str[i] is not ('?' or '#')) 2089else if ((uint)(idx + 1) < (uint)str.Length) 2169if ((uint)idx < (uint)str.Length) 2730charsWritten = copied ? result.Length : 0; 3467original = original.Slice(0, original.Length - 1); 3474if ((uint)pathLength >= (uint)original.Length || original[pathLength] == '#') 3490if ((uint)fragmentOffset >= (uint)original.Length) 3606switch (scheme.Length) 3646if (scheme.Length == 0 || 3654if (scheme.Length > SchemeLengthLimit) 3677Debug.Assert((uint)startOffset <= (uint)str.Length); 3692if ((uint)startOffset >= (uint)str.Length || ((ch = str[startOffset]) == '/' || (ch == '\\' && (syntaxFlags & UriSyntaxFlags.FileLikeUri) != 0) || ch == '#' || ch == '?')) 3717if ((uint)userInfoLength < (uint)slice.Length && slice[userInfoLength] == '@' && (uint)(++userInfoLength) < (uint)slice.Length) 3741if ((uint)delimiterIdx < (uint)str.Length && 3824char hostDelimiter = (uint)endOfHost < (uint)str.Length ? str[endOfHost] : '\0'; 3848for (i = endOfHost + 1; (uint)i < (uint)str.Length; i++) 3912endOfHost = basicHostEnd >= 0 ? i + basicHostEnd : str.Length; 3935for (endOfHost = i; (uint)endOfHost < (uint)str.Length; endOfHost++) 4021for (i = 0; (uint)i < (uint)span.Length; i++) 4045if ((uint)(i + 1) < (uint)span.Length) 4100if ((uint)(i + 1) < (uint)span.Length && (span[i + 1] == '/' || span[i + 1] == '\\')) 4107if (((uint)(i + 1) >= (uint)span.Length || span[i + 1] == '.' || span[i + 1] == '/' || span[i + 1] == '\\' || span[i + 1] == '?' || span[i + 1] == '#')) 4135if ((uint)(i + 2) < (uint)span.Length && (c = UriHelper.DecodeHexChars(span[i + 1], span[i + 2])) != c_DummyChar)
System\UriExt.cs (5)
509Debug.Assert(backingString is null || backingString.Length == charsToUnescape.Length); 521vsb.EnsureCapacity(charsToUnescape.Length - indexOfFirstToUnescape); 543charsWritten = charsToUnescape.Length; 568vsb.EnsureCapacity(charsToUnescape.Length - indexOfFirstToUnescape); 578Debug.Assert(newLength <= charsToUnescape.Length);
System\UriHelper.cs (19)
16return string.Create(span.Length, span, static (buffer, span) => 66for (; i < self.Length && i < other.Length; ++i) 119for (; i < self.Length; ++i) 136if (destination.Length < charsToEscape.Length) 147charsWritten = charsToEscape.Length; 160vsb.EnsureCapacity(charsToEscape.Length); 170Debug.Assert(newLength > charsToEscape.Length); 207Debug.Assert(backingString is null || backingString.Length == charsToEscape.Length); 221vsb.EnsureCapacity(charsToEscape.Length); 291if (stringToEscape.Length > 2 && char.IsAsciiHexDigit(stringToEscape[1]) && char.IsAsciiHexDigit(stringToEscape[2])) 310charsToCopy = stringToEscape.Length; 321for (int i = 0; (uint)i < (uint)chars.Length;) 323if (chars[i] == '%' && (uint)(i + 2) < (uint)chars.Length) 383for (i = 0; (uint)i < (uint)chars.Length; i++) 394else if ((uint)(i + 2) < (uint)chars.Length) 467if (i < chars.Length) 568Debug.Assert(backingString is null || strToClean.Length == backingString.Length); 602stripped = string.Create(strToClean.Length - charsToRemove, strToClean, static (buffer, strToClean) =>
System.Private.Windows.Core (56)
_generated\12\Windows.Win32.byte.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\130\Windows.Win32.IDispatch.g.cs (2)
103 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 104 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\131\Windows.Win32.IDispatchEx.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\157\Windows.Win32.IPictureDisp.g.cs (2)
87 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 88 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\160\Windows.Win32.ISequentialStream.g.cs (2)
126 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 137 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\162\Windows.Win32.IStorage.g.cs (1)
274 winmdroot.Foundation.HRESULT __result = this.CopyTo((uint )rgiidExclude.Length, rgiidExcludeLocal, snbExcludeLocal, pstgDest);
_generated\163\Windows.Win32.IStream.g.cs (2)
112 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 123 winmdroot.Foundation.HRESULT __result = this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\165\Windows.Win32.ITypeInfo.g.cs (2)
368 if (!rgszNames.IsEmpty && !pMemId.IsEmpty && rgszNames.Length != pMemId.Length) throw new ArgumentException(); 369 winmdroot.Foundation.HRESULT __result = this.GetIDsOfNames(rgszNamesLocal, (uint )(pMemId.IsEmpty ? rgszNames.Length : pMemId.Length), pMemIdLocal);
_generated\206\Windows.Win32.PInvokeCore.USER32.dll.g.cs (1)
855 int __result = PInvokeCore.MapWindowPoints(hWndFrom, hWndTo, lpPointsLocal, (uint )lpPoints.Length);
_generated\215\Windows.Win32.RECT.InlineArrays.g.cs (1)
53 int initLength = value.Length;
_generated\249\Windows.Win32.System_Com_ISequentialStream_Extensions.g.cs (2)
55 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 66 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\251\Windows.Win32.System_Com_IStream_Extensions.g.cs (2)
55 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 66 winmdroot.Foundation.HRESULT __result = @this.Write((void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\253\Windows.Win32.System_Com_ITypeInfo_Extensions.g.cs (2)
95 if (!rgszNames.IsEmpty && !pMemId.IsEmpty && rgszNames.Length != pMemId.Length) throw new ArgumentException(); 96 winmdroot.Foundation.HRESULT __result = @this.GetIDsOfNames(rgszNamesLocal, (uint )(pMemId.IsEmpty ? rgszNames.Length : pMemId.Length), pMemIdLocal);
_generated\256\Windows.Win32.System_Com_StructuredStorage_IStorage_Extensions.g.cs (1)
75 winmdroot.Foundation.HRESULT __result = @this.CopyTo((uint )rgiidExclude.Length, rgiidExcludeLocal, snbExcludeLocal, pstgDest);
_generated\37\Windows.Win32.char.InlineArrays.g.cs (4)
55 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 78 int initLength = value.Length; 119 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 142 int initLength = value.Length;
System\IO\Compression\RunLengthEncoder.cs (1)
44for (int i = 0; i < encoded.Length; i += 2)
System\SpanHelpers.cs (2)
17if (source.Length >= destination.Length) 25destination[source.Length] = '\0';
System\SpanReader.cs (14)
26readonly get => Span.Length - _unread.Length; 99if (count > _unread.Length) 136if (sizeof(TValue) > _unread.Length * sizeof(T)) 170if (sizeof(TValue) * count > _unread.Length * sizeof(T)) 206UnsafeAdvance(next.Length); 225count = _unread.Length; 246public void Rewind(int count) => _unread = Span[(Span.Length - _unread.Length - count)..]; 260Debug.Assert((uint)count <= (uint)_unread.Length); 261UncheckedSlice(ref _unread, count, _unread.Length - count); 267Debug.Assert((uint)length <= (uint)span.Length); 278Debug.Assert((uint)start <= (uint)span.Length && (uint)length <= (uint)(span.Length - start));
System\SpanWriter.cs (2)
46if (_unwritten.Length >= values.Length) 50UnsafeAdvance(values.Length);
System\Text\ValueStringBuilder.cs (3)
294if (pos > _chars.Length - value.Length) 296Grow(value.Length); 300_pos += value.Length;
System\TypeExtensions.cs (5)
253if (publicKey1.Length == publicKey2.Length) 258if (publicKey1.Length == 0 || publicKey2.Length == 0) 265return publicKey1.Length == PublicKeyTokenLength
Windows\Win32\Graphics\Gdi\ARGB.cs (2)
47Color[] colors = new Color[argbColors.Length]; 48for (int i = 0; i < argbColors.Length; i++)
System.Private.Windows.GdiPlus (4)
_generated\25\Windows.Win32.float.InlineArrays.g.cs (1)
60 int initLength = value.Length;
System\Drawing\CoreImageExtensions.cs (1)
21if (format == PInvokeCore.ImageFormatGIF && image.Data is { } rawData && rawData.Length > 0)
System\Drawing\ImageCodecInfoHelper.cs (2)
52s_encoders = new (Guid Format, Guid Encoder)[codecInfo.Length]; 54for (int i = 0; i < codecInfo.Length; i++)
System.Private.Xml (109)
_generated\0\RegexGenerator.g.cs (70)
337base.runtextpos != inputSpan.Length) 355if (pos <= inputSpan.Length - 7) 368base.runtextpos = inputSpan.Length; 381if ((uint)slice.Length < 6 || 393if ((uint)slice.Length < 7) 406if ((uint)slice.Length < 11 || 470base.runtextpos != inputSpan.Length) 488if (pos <= inputSpan.Length - 6) 501base.runtextpos = inputSpan.Length; 528if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] != '_') 540if ((uint)slice.Length < 5 || 552if ((uint)slice.Length < 6) 565if ((uint)slice.Length < 10 || 629base.runtextpos = inputSpan.Length; 641if ((uint)pos < (uint)inputSpan.Length) 651base.runtextpos = inputSpan.Length; 678while (iteration < 8 && (uint)iteration < (uint)slice.Length && char.IsAsciiLetter(slice[iteration])) 732while (iteration1 < 8 && (uint)iteration1 < (uint)slice.Length && char.IsAsciiLetterOrDigit(slice[iteration1])) 763if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n')) 815base.runtextpos != inputSpan.Length) 833if (pos <= inputSpan.Length - 4) 846base.runtextpos = inputSpan.Length; 895iteration = slice.Length; 952iteration1 = slice.Length; 986iteration2 = slice.Length; 1040if ((uint)slice.Length > (uint)1 && slice[1] == ')') 1105base.runtextpos != inputSpan.Length) 1123if (pos <= inputSpan.Length - 6) 1136base.runtextpos = inputSpan.Length; 1169iteration = slice.Length; 1203iteration1 = slice.Length; 1284base.runtextpos != inputSpan.Length) 1302if (pos <= inputSpan.Length - 35) 1315base.runtextpos = inputSpan.Length; 1344iteration = slice.Length; 1376iteration1 = slice.Length; 1401(charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, Math.Min(inputSpan.Length, charloop_ending_pos + 16) - charloop_starting_pos).LastIndexOf("EnsureArrayIndex(")) < 0) 1431iteration2 = slice.Length; 1463iteration3 = slice.Length; 1489iteration4 = slice.Length - 1; 1502if ((uint)slice.Length < 2 || slice[1] != ';') 1518iteration5 = slice.Length; 1550iteration6 = slice.Length; 1629base.runtextpos != inputSpan.Length) 1647if (pos <= inputSpan.Length - 4) 1660base.runtextpos = inputSpan.Length; 1686iteration = slice.Length; 1722iteration1 = slice.Length; 1834base.runtextpos != inputSpan.Length) 1852if (pos <= inputSpan.Length - 23) 1865base.runtextpos = inputSpan.Length; 1897iteration = slice.Length; 1972base.runtextpos != inputSpan.Length) 1990if (pos <= inputSpan.Length - 28) 2003base.runtextpos = inputSpan.Length; 2036iteration = slice.Length; 2070iteration1 = slice.Length; 2145base.runtextpos != inputSpan.Length) 2163if (pos <= inputSpan.Length - 29) 2176base.runtextpos = inputSpan.Length; 2208iteration = slice.Length; 2289base.runtextpos != inputSpan.Length) 2307if (pos <= inputSpan.Length - 23) 2320base.runtextpos = inputSpan.Length; 2352iteration = slice.Length; 2433base.runtextpos != inputSpan.Length) 2451if (pos <= inputSpan.Length - 13) 2464base.runtextpos = inputSpan.Length; 2496iteration = slice.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Xml\Base64Decoder.cs (5)
123while ((uint)iChar < (uint)chars.Length) 145if (ch >= mapBase64.Length || (digit = mapBase64[ch]) == Invalid) 166if ((uint)iChar < (uint)chars.Length && chars[iChar] == '=') 173} while ((uint)iChar < (uint)chars.Length && chars[iChar] == '='); 176while ((uint)iChar < (uint)chars.Length)
System\Xml\BinaryXml\XmlBinaryReader.cs (1)
3491Debug.Assert(data.Length % 2 == 0, "Data size should not be odd");
System\Xml\BinHexDecoder.cs (2)
107int len = chars.Length; 144for (; iChar < chars.Length; iChar++)
System\Xml\Core\ReadOnlyTernaryTree.cs (1)
194if (stringPos == stringToFind.Length)
System\Xml\Core\XmlEncodedRawTextWriter.cs (1)
170if (bom.Length != 0)
System\Xml\Core\XmlTextEncoder.cs (1)
252int len = text.Length;
System\Xml\Core\XmlTextReaderImpl.cs (4)
3199_ps.bytePos = preamble.Length; 9591for (int i = 0; i < chars.Length; i++) 9607if ((uint)nextIdx < (uint)chars.Length && chars[nextIdx] == '\n') 9617lineInfo.linePos = chars.Length - lastNewLinePos;
System\Xml\Core\XmlUtf8RawTextWriter.cs (3)
115if (bom.Length != 0) 118_bufPos += bom.Length; 119_textPos += bom.Length;
System\Xml\XmlCharType.cs (2)
149for (; (uint)i < (uint)str.Length; i++) 154if ((uint)(i + 1) >= (uint)str.Length || !char.IsSurrogatePair(c, str[i + 1]))
System\Xml\XmlConvert.cs (3)
1058if (value.Length != 0 && value[0] != '+') 1721charsWritten = valueSpan.Length; 1745charsWritten = valueSpan.Length;
System\Xml\XPath\Internal\XPathScanner.cs (2)
337for (i = 1; i < span.Length && XmlCharType.IsNCNameSingleChar(span[i]); i++); 339if ((uint)i < (uint)span.Length)
System\Xml\Xsl\Runtime\NumberFormatter.cs (1)
112for (int idx = RomanDigitValue.Length; idx-- != 0;)
System.Reflection.Emit (3)
System\Reflection\Emit\CustomAttributeWrapper.cs (2)
42if (binaryAttribute.Length < 2) 44throw new ArgumentException(SR.Format(SR.Argument_InvalidCustomAttributeLength, ctor.DeclaringType, binaryAttribute.Length), nameof(binaryAttribute));
System\Reflection\Emit\FieldBuilderImpl.cs (1)
59Debug.Assert(binaryAttribute.Length >= 6);
System.Reflection.Metadata (41)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (1)
108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (2)
66Debug.Assert(input.Length > 0); 347if (_index < _input.Length)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Reflection\Internal\Utilities\Hash.cs (1)
42for (int i = 0; i < data.Length; i++)
System\Reflection\Internal\Utilities\MemoryBlock.cs (1)
328numberOfBytesRead = length = span.Length;
System\Reflection\Metadata\BlobBuilder.cs (3)
680int bytesToCurrent = Math.Min(FreeBytes, buffer.Length); 689Expand(remaining.Length); 692AddLength(remaining.Length);
System\Reflection\Metadata\BlobContentId.cs (3)
49if (id.Length != Size) 56var reader = new BlobReader(ptr, id.Length); 88if (hashCode.Length < minHashSize)
System\Reflection\Metadata\BlobWriter.cs (1)
153int start = Advance(buffer.Length);
System\Reflection\Metadata\Ecma335\MetadataBuilder.cs (1)
106builder.WriteBytes(0, sizeOfStreamHeader - (8 + streamName.Length));
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (2)
225_blobHeapSize += BlobWriterImpl.GetCompressedIntegerSize(value.Length) + value.Length;
System\Reflection\Metadata\Ecma335\MetadataSizes.cs (1)
393BitArithmetic.Align(streamName.Length + 1, 4); // zero-terminated name, padding
System\Reflection\Metadata\TypeNameParser.cs (3)
57int errorIndex = typeName.Length - parser._inputString.Length; 255_inputString = _inputString.Slice(candidate.Length);
System\Reflection\Metadata\TypeNameParserHelpers.cs (5)
40return input.Length; // no type name end chars were found, the whole input is the type name 48isNestedType = offset > 0 && offset < input.Length && input[offset] == '+'; 54for (; offset < input.Length; offset++) 61if (offset == input.Length || // invalid name that ends with escape character 146for (; offset < input.Length; offset++)
System\Reflection\PortableExecutable\ManagedTextSection.cs (2)
113CorEntryPointName.Length + 117CorEntryPointDll.Length + 1 + sizeof(ushort);
System\Reflection\PortableExecutable\PEBuilder.cs (1)
536while (segment.Length >= sizeof(ushort))
System\Reflection\PortableExecutable\PEHeaderBuilder.cs (1)
111PEBuilder.DosHeader.Length +
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\Modules\GetTypeCoreCache.cs (1)
50for (int i = 0; i < name.Length; i++)
System.Resources.Extensions (7)
System\Resources\Extensions\TypeNameComparer.cs (7)
80typeSpan1 = typeSpan1.Length > type1.Length ? typeSpan1.Slice(type1.Length + 1).TrimStart(s_whiteSpaceChars) : ReadOnlySpan<char>.Empty; 81typeSpan2 = typeSpan2.Length > type2.Length ? typeSpan2.Slice(type2.Length + 1).TrimStart(s_whiteSpaceChars) : ReadOnlySpan<char>.Empty; 127for (int i = 0; i < typeName.Length; i++)
System.Runtime.InteropServices.JavaScript (1)
System\Runtime\InteropServices\JavaScript\JSHostImplementation.cs (1)
111int argsCount = types.Length - 1;
System.Runtime.Numerics (513)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\Common\src\System\Number.Formatting.Common.cs (29)
58if (format.Length > 0) 66if (format.Length == 1) 72if (format.Length == 2) 82else if (format.Length == 3) 98while ((uint)i < (uint)format.Length && char.IsAsciiDigit(format[i])) 110if ((uint)i >= (uint)format.Length || format[i] == '\0') 120return format.Length == 0 || c == '\0' ? // For compat, treat '\0' as the end of the specifier, even if the specifier extends beyond it. 330while (src < format.Length && (ch = pFormat[src++]) != 0 && ch != ';') 381while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch) ; 385if (src < format.Length && pFormat[src] != 0) 393if ((src < format.Length && pFormat[src] == '0') || 394(src + 1 < format.Length && (pFormat[src] == '+' || pFormat[src] == '-') && pFormat[src + 1] == '0')) 396while (++src < format.Length && pFormat[src] == '0') ; 539while (src < format.Length && (ch = pFormat[src++]) != 0 && ch != ';') 630while (src < format.Length && pFormat[src] != 0 && pFormat[src] != ch) 635if (src < format.Length && pFormat[src] != 0) 642if (src < format.Length && pFormat[src] != 0) 655if (src < format.Length && pFormat[src] == '0') 660else if (src + 1 < format.Length && pFormat[src] == '+' && pFormat[src + 1] == '0') 665else if (src + 1 < format.Length && pFormat[src] == '-' && pFormat[src + 1] == '0') 676while (++src < format.Length && pFormat[src] == '0') 693if (src < format.Length) 700while (src < format.Length && pFormat[src] == '0') 784bufferSize += sGroup.Length; 813for (int j = sGroup.Length - 1; j >= 0; j--) 1153if (src >= format.Length) 1162while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch) ; 1166if (src < format.Length && pFormat[src] != 0) 1178if (src < format.Length && pFormat[src] != 0 && pFormat[src] != ';')
src\runtime\src\libraries\Common\src\System\Number.Parsing.Common.cs (3)
289if ((index == value.Length) || ((styles & AllowTrailingInvalidCharacters) != 0)) 308bool succeeded = TryParseNumber(stringPointer, stringPointer + value.Length, styles, ref number, info, out elementsConsumed); 321return index + ((nullsToConsume >= 0) ? nullsToConsume : remainder.Length);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder_1.cs (5)
179int count = text.Length; 217if (text.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 231if (pos > _chars.Length - text.Length) 233Grow(text.Length); 237_pos += text.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (3)
25Debug.Assert(log2ToPow10.Length == 64); 54Debug.Assert((elementOffset + 1) <= powersOf10.Length); 102Debug.Assert(table.Length == 32, "Every result of uint.Log2(value) needs a long entry in the table.");
System\Number.BigInteger.cs (62)
105if (value.Length == 0) 112if (value.Length < 255) 114buffer = stackalloc byte[value.Length + 1 + 1]; 118buffer = arrayFromPool = ArrayPool<byte>.Shared.Rent(value.Length + 1 + 1); 173for (index = 0; index < value.Length; index++) 188while ((validLength < value.Length) && TParser.IsValidDigit(TChar.CastToUInt32(value[validLength]))) 200while ((trailingStart < value.Length) && IsWhite(TChar.CastToUInt32(value[trailingStart]))) 210if ((trailingStart != value.Length) && ((style & AllowTrailingInvalidCharacters) == 0)) 226int leadingBitsCount = value.Length % TParser.DigitsPerBlock; 287int wholeBlockCount = value.Length / TParser.DigitsPerBlock; 305index += value.Length; 398ReadOnlySpan<byte> fracDigitsSpan = number.Digits.Slice(intDigits.Length); 418int base1E9Length = (intDigits.Length + PowersOf1e9.MaxPartialDigits - 1) / PowersOf1e9.MaxPartialDigits; 422ReadOnlySpan<byte> leadingDigits = intDigits[..(intDigits.Length % PowersOf1e9.MaxPartialDigits)]; 423if (leadingDigits.Length != 0) 429intDigits = intDigits.Slice(leadingDigits.Length); 430Debug.Assert(intDigits.Length % PowersOf1e9.MaxPartialDigits == 0); 439Debug.Assert(intDigits.Length == 0); 467int valueDigits = (base1E9.Length - 1) * PowersOf1e9.MaxPartialDigits + FormattingHelpers.CountDigits(base1E9[^1]); 475int leadingLength = checked((int)(digitRatio * PowersOf1e9.MaxPartialDigits * base1E9.Length) + 3); 497if (base1E9.Length < BigIntegerParseNaiveThresholdInRecursive) 504while (base1E9.Length <= multiplier1E9Length) 512Debug.Assert(multiplier1E9Length < base1E9.Length && base1E9.Length <= multiplier1E9Length * 2); 521Span<nuint> bitsUpper = bits.Slice(multiplierTrailingZeroCount, buffer2.Length + multiplier.Length); 535if (base1E9.Length == 0) 568if (base1E9.Length == 0) 575for (int i = base1E9.Length - 2; i >= 0; i--) 819Debug.Assert(formatString == null || formatString.Length == formatSpan.Length); 886int valueDigits = (base1E9Value.Length - 1) * PowersOf1e9.MaxPartialDigits + FormattingHelpers.CountDigits(base1E9Value[^1]); 894int strLength = strDigits + sNegative.Length; 1017for (int i = 0; i < base1E9Value.Length - 1; i++) 1037if (bits.Length <= ToStringNaiveThreshold) 1043PowersOf1e9.FloorBufferSize(bits.Length, out int powersOf1e9BufferLength, out int maxIndex); 1050Debug.Assert(bits.Length == 0 || bits[^1] != 0); 1053if (bits.Length <= ToStringNaiveThreshold) 1062while (bits.Length < powOfTen.Length + omittedLength || BigIntegerCalculator.Compare(bits.Slice(omittedLength), powOfTen) < 0) 1069int upperLength = bits.Length - powOfTen.Length - omittedLength + 1; 1072int lowerLength = bits.Length; 1109for (int iuSrc = bits.Length; --iuSrc >= 0;) 1177if (buffer.Length > LeadingPowers1E9.Length && 1369Debug.Assert(Indexes[6] == LeadingPowers1E9.Length); 1370if (pow1E9.Length <= LeadingPowers1E9.Length) 1376LeadingPowers1E9.CopyTo(pow1E9.Slice(0, LeadingPowers1E9.Length)); 1381for (int i = 6; i + 1 < Indexes.Length; i++) 1383Debug.Assert(2 * src.Length - (Indexes[i + 1] - Indexes[i]) is 0 or 1); 1384if (pow1E9.Length - toExclusive < (src.Length << 1)) 1389Span<nuint> dst = pow1E9.Slice(toExclusive, src.Length << 1); 1416if ((uint)index < (uint)Indexes.Length) 1422maxIndex = Indexes.Length - 2; 1450int hi = Indexes.Length - 1; 1471if (trailingZeroCount < UInt32PowersOfTen.Length) 1473BigIntegerCalculator.Multiply(left, UInt32PowersOfTen[trailingZeroCount], bits.Slice(0, left.Length + 1)); 1487int curLength = first.Length; 1502Debug.Assert(fi + 1 < Indexes.Length); 1509Span<nuint> dst = powersOfTen2.Slice(0, curLength += power.Length); 1527Span<nuint> bits2 = bits.Slice(omittedLength, curLength += left.Length); 1599Debug.Assert(destination.Length * TParser.DigitsPerBlock == input.Length); 1603int blockStart = input.Length - (i + 1) * TParser.DigitsPerBlock;
System\Number.Polyfill.cs (2)
92for (int i = 0; i < span.Length; i += elemsConsumed) 107elementsConsumed = span.Length;
System\Numerics\BigInteger.cs (44)
335int byteCount = value.Length; 350byteCount = value.Length; 545if (value.Length > MaxLength) 550if (value.Length == 0) 554else if (value.Length == 1 && value[0] < UInt32HighBit) 559else if (value.Length == 1 && negative && value[0] == UInt32HighBit) 1087if (rightBits.Length == 1) 1092else if (nint.Size == 4 && rightBits.Length == 2) 1094Span<nuint> bits = RentedBuffer.Create(leftBits.Length, out RentedBuffer bitsBuffer); 1106Span<nuint> bits = RentedBuffer.Create(leftBits.Length, out RentedBuffer bitsBuffer); 1668curByte = length - srcBytes.Length; 1669Span<byte> destBytes = destination.Slice(curByte, srcBytes.Length); 1676curByte = srcBytes.Length; 1902int size = rightBits.Length + 1; 1913int size = leftBits.Length + 1; 1920else if (leftBits.Length < rightBits.Length) 1924int size = rightBits.Length + 1; 1935int size = leftBits.Length + 1; 1971int size = rightBits.Length; 1982int size = leftBits.Length; 1991int size = rightBits.Length; 2002int size = leftBits.Length; 2785Debug.Assert(bits.Length > 0); 2793int zLength = bits.Length + digitShift; 2804Span<nuint> zd = z.AsSpan(digitShift, bits.Length); 2886Debug.Assert(bits.Length > 0); 2888int zLength = bits.Length - digitShift + 1; 3048int size = right.Length + 1; 3059int size = left.Length + 1; 3068int size = left.Length + right.Length; 3079int size = left.Length + right.Length; 3493Debug.Assert(bits.Length > 0); 3508int wordCount = bits.Length * 2; 3527? ((uint)bits[^1] == UInt32HighBit && firstNonZeroLimb == bits.Length - 1) 3528: (bits[^1] == ((nuint)UInt32HighBit << BitsPerUInt32) && firstNonZeroLimb == bits.Length - 1); 3540zd.Slice(bits.Length).Clear(); 3707int zLength = bits.Length; 3711&& (leadingZeroCount != bits.Length - 1 || bits[^1] != ((nuint)1 << (BigIntegerCalculator.BitsPerLimb - 1)))) 5433Debug.Assert(bits.Length > 0); 5435int zLength = bits.Length - digitShift; 5457if (bits[^1] == signBit && negLeadingZeroCount == bits.Length - 1)
System\Numerics\BigIntegerCalculator.AddSub.cs (42)
26Debug.Assert(left.Length >= 1); 27Debug.Assert(bits.Length == left.Length + 1); 34Debug.Assert(right.Length >= 1); 35Debug.Assert(left.Length >= right.Length); 36Debug.Assert(bits.Length == left.Length + 1); 40_ = left[right.Length - 1]; 41_ = bits[right.Length]; 45for (int i = 0; i < right.Length; i++) 50Add(left, bits, startIndex: right.Length, initialCarry: carry); 55Debug.Assert(left.Length >= right.Length); 60if (right.Length != 0) 62_ = left[right.Length - 1]; 65for (; i < right.Length; i++) 82Debug.Assert(left.Length >= 1); 83Debug.Assert(left[0] >= right || left.Length >= 2); 84Debug.Assert(bits.Length == left.Length); 91Debug.Assert(right.Length >= 1); 92Debug.Assert(left.Length >= right.Length); 94Debug.Assert(bits.Length == left.Length); 96_ = left[right.Length - 1]; 97_ = bits[right.Length - 1]; 101for (int i = 0; i < right.Length; i++) 106Subtract(left, bits, startIndex: right.Length, initialBorrow: borrow); 111Debug.Assert(left.Length >= right.Length); 116if (right.Length != 0) 118_ = left[right.Length - 1]; 121for (; i < right.Length; i++) 144_ = bits[left.Length]; 146if (left.Length <= CopyToThreshold) 148for (; i < left.Length; i++) 155bits[left.Length] = carry; 159for (; i < left.Length;) 174bits[left.Length] = carry; 176if (i < left.Length) 191if (left.Length != 0) 193_ = bits[left.Length - 1]; 196if (left.Length <= CopyToThreshold) 198for (; i < left.Length; i++) 208for (; i < left.Length;) 224if (i < left.Length)
System\Numerics\BigIntegerCalculator.Bitwise.cs (6)
48int xLen = left.Length > 0 ? left.Length : 1; 49int yLen = right.Length > 0 ? right.Length : 1; 76if (bits.Length > 0) 78mag = (uint)i < (uint)bits.Length ? bits[i] : 0;
System\Numerics\BigIntegerCalculator.DivRem.cs (106)
35Debug.Assert(left.Length >= 1); 36Debug.Assert(quotient.Length == left.Length); 43for (int i = left.Length - 1; i >= 0; i--) 52Debug.Assert(left.Length >= 1); 56for (int i = left.Length - 1; i >= 0; i--) 66Debug.Assert(left.Length >= 1); 67Debug.Assert(right.Length >= 1); 68Debug.Assert(left.Length >= right.Length); 69Debug.Assert(quotient.Length == left.Length - right.Length + 1); 70Debug.Assert(remainder.Length == left.Length); 74if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold) 87Debug.Assert(left.Length >= 1); 88Debug.Assert(right.Length >= 1); 89Debug.Assert(left.Length >= right.Length); 90Debug.Assert(quotient.Length == left.Length - right.Length + 1); 93if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold) 99Span<nuint> leftCopy = BigInteger.RentedBuffer.Create(left.Length, out BigInteger.RentedBuffer leftCopyBuffer); 114Debug.Assert(left.Length >= 1); 115Debug.Assert(right.Length >= 1); 116Debug.Assert(left.Length >= right.Length); 117Debug.Assert(remainder.Length == left.Length); 120if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold) 129int quotientLength = left.Length - right.Length + 1; 149Debug.Assert(right.Length >= 1); 150Debug.Assert(left.Length >= right.Length); 151Debug.Assert(quotient.Length == left.Length - right.Length + 1 155if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold) 166int quotientLength = quotient.Length > 0 ? 0 : left.Length - right.Length + 1; 180Debug.Assert(right.Length >= 1); 181Debug.Assert(left.Length >= right.Length); 184|| quotient.Length == left.Length - right.Length + 1 185|| (CompareActual(left.Slice(left.Length - right.Length), right) < 0 && quotient.Length == left.Length - right.Length)); 193nuint divLo = right.Length > 1 ? right[^2] : 0; 202nuint divNx = right.Length > 2 ? right[^3] : 0; 210for (int i = left.Length; i >= right.Length; i--) 212int n = i - right.Length; 270Debug.Assert(left.Length >= right.Length); 276for (int i = 0; i < right.Length; i++) 287Debug.Assert(left.Length >= right.Length); 315Debug.Assert(left.Length >= 1); 316Debug.Assert(right.Length >= 1); 317Debug.Assert(left.Length >= right.Length); 318Debug.Assert(quotient.Length == left.Length - right.Length + 1); 319Debug.Assert(remainder.Length == left.Length || remainder.Length == 0); 327int m = (int)BitOperations.RoundUpToPowerOf2((uint)right.Length / (uint)DivideBurnikelZieglerThreshold + 1); 329int j = (right.Length + m - 1) / m; // Ceil(right.Length/m) 333int sigmaDigit = n - right.Length; 338int aLength = left.Length + sigmaDigit; 354Debug.Assert(src.Length + sigmaDigit <= bits.Length); 359dst.Slice(src.Length).Clear(); 459Debug.Assert(left.Length == 2 * right.Length); 460Debug.Assert(CompareActual(left.Slice(right.Length), right) < 0); 461Debug.Assert(quotient.Length == right.Length); 462Debug.Assert(remainder.Length >= right.Length + 1); 464Debug.Assert(right.Length < DivideBurnikelZieglerThreshold); 468if (left.Length < right.Length) 472remainder.Slice(left.Length).Clear(); 474else if (right.Length == 1) 478if (quotient.Length < left.Length) 480Debug.Assert(quotient.Length + 1 == left.Length); 489quotient.Slice(left.Length).Clear(); 501Span<nuint> r1 = BigInteger.RentedBuffer.Create(left.Length, out BigInteger.RentedBuffer r1Buffer); 504int quotientLength = Math.Min(left.Length - right.Length + 1, quotient.Length); 527Debug.Assert(left.Length == 2 * right.Length); 528Debug.Assert(CompareActual(left.Slice(right.Length), right) < 0); 529Debug.Assert(quotient.Length == right.Length); 530Debug.Assert(remainder.Length >= right.Length + 1); 533if ((right.Length & 1) != 0 || right.Length < DivideBurnikelZieglerThreshold) 539int halfN = right.Length >> 1; 541Span<nuint> r1 = BigInteger.RentedBuffer.Create(right.Length + 1, out BigInteger.RentedBuffer r1Buffer); 543BurnikelZieglerD3n2n(left.Slice(right.Length), left.Slice(halfN, halfN), right, quotient.Slice(halfN), r1); 544BurnikelZieglerD3n2n(r1.Slice(0, right.Length), left.Slice(0, halfN), right, quotient.Slice(0, halfN), remainder); 552Debug.Assert(right.Length % 2 == 0); 553Debug.Assert(left12.Length == right.Length); 554Debug.Assert(2 * left3.Length == right.Length); 555Debug.Assert(2 * quotient.Length == right.Length); 556Debug.Assert(remainder.Length >= right.Length + 1); 560int n = right.Length >> 1; 566Span<nuint> d = BigInteger.RentedBuffer.Create(right.Length, out BigInteger.RentedBuffer dBuffer); 609Debug.Assert(bits.Length == left.Length + right.Length); 613bits = bits.Slice(0, left.Length + right.Length);
System\Numerics\BigIntegerCalculator.FastReducer.cs (19)
26Debug.Assert(r.Length == modulus.Length * 2 + 1); 27Debug.Assert(mu.Length == r.Length - modulus.Length + 1); 28Debug.Assert(q1.Length == modulus.Length * 2 + 2); 29Debug.Assert(q2.Length == modulus.Length * 2 + 2); 47Debug.Assert(value.Length <= _modulus.Length * 2); 50if (value.Length < _modulus.Length) 57int l1 = DivMul(value, _mu, _q1, _modulus.Length - 1); 61int l2 = DivMul(_q1.Slice(0, l1), _modulus, _q2, _modulus.Length + 1); 64int length = SubMod(value, _q2.Slice(0, l2), _modulus, _modulus.Length + 1); 75Debug.Assert(bits.Length + k >= left.Length + right.Length); 82if (left.Length > k) 85bits = bits.Slice(0, left.Length + right.Length); 107if (right.Length > k) 118Debug.Assert(left.Length >= right.Length); 123if (right.Length != 0) 125_ = left[right.Length - 1]; 128for (; i < right.Length; i++)
System\Numerics\BigIntegerCalculator.GcdInv.cs (17)
78Debug.Assert(left.Length >= 1); 90Debug.Assert(left.Length >= 2); 91Debug.Assert(right.Length >= 2); 93Debug.Assert(result.Length == left.Length); 97Span<nuint> rightCopy = BigInteger.RentedBuffer.Create(right.Length, out BigInteger.RentedBuffer rightCopyBuffer); 293Debug.Assert(xBuffer.Length >= 3); 294Debug.Assert(yBuffer.Length >= 3); 295Debug.Assert(xBuffer.Length >= yBuffer.Length); 304switch (xBuffer.Length - yBuffer.Length) 339Debug.Assert(xBuffer.Length >= 2); 340Debug.Assert(yBuffer.Length >= 2); 341Debug.Assert(xBuffer.Length >= yBuffer.Length); 349switch (xBuffer.Length - yBuffer.Length)
System\Numerics\BigIntegerCalculator.PowMod.cs (30)
23Debug.Assert(bits.Length == PowBound(power, value.Length)); 29valueCopy.Slice(value.Length).Clear(); 31Span<nuint> result = PowCore(valueCopy, value.Length, temp, power, bits); 71int resultLength = leftLength + right.Length; 172for (int i = 0; i < power.Length - 1; i++) 261Debug.Assert(bits.Length == modulus.Length + modulus.Length); 266int size = Math.Max(value.Length, bits.Length); 272valueCopy.Slice(value.Length).Clear(); 274if (value.Length > modulus.Length) 276Remainder(value, modulus, valueCopy.Slice(0, value.Length)); 301Debug.Assert(bits.Length == modulus.Length + modulus.Length); 306int size = Math.Max(value.Length, bits.Length); 312valueCopy.Slice(value.Length).Clear(); 314if (value.Length > modulus.Length) 316Remainder(value, modulus, valueCopy.Slice(0, value.Length)); 351if (modulus.Length < ReducerThreshold) 375if (modulus.Length < ReducerThreshold) 391int size = modulus.Length * 2 + 1; 394size = r.Length - modulus.Length + 1; 397size = modulus.Length * 2 + 2; 483Debug.Assert(bits.Length >= modulus.Length * 2); 490int k = modulus.Length; 499if (shifted.Length >= modulus.Length) 678int k = modulus.Length; 750for (int i = 0; i < power.Length - 1; i++) 812for (int i = 0; i < power.Length - 1; i++)
System\Numerics\BigIntegerCalculator.SquMul.cs (107)
29Debug.Assert(bits.Length == value.Length + value.Length); 41if (value.Length < SquareKaratsubaThreshold) 45else if (value.Length < SquareToom3Threshold) 56Debug.Assert(value.Length >= 3); 57Debug.Assert(bits.Length >= value.Length + value.Length); 65int n = (value.Length + 2) / 3; 94Debug.Assert(bits.Length == value.Length + value.Length); 105int n = value.Length >> 1; 122int foldLength = valueHigh.Length + 1; 146Debug.Assert(bits.Length == value.Length + value.Length); 162for (int i = 0; i < value.Length; i++) 184for (int i = 0; i < value.Length; i++) 206Debug.Assert(bits.Length == left.Length + 1); 209bits[left.Length] = carry; 215if (left.Length < right.Length) 222Debug.Assert(left.Length >= right.Length); 223Debug.Assert(right.Length >= 0); 224Debug.Assert(right.IsEmpty || bits.Length >= left.Length + right.Length); 239if (right.Length < MultiplyKaratsubaThreshold) 243else if ((left.Length + 1) >> 1 is int n && right.Length <= n) 247else if (right.Length < MultiplyToom3Threshold) 258Debug.Assert(left.Length >= 3); 259Debug.Assert(left.Length >= right.Length); 260Debug.Assert(bits.Length >= left.Length + right.Length); 268int n = (left.Length + 2) / 3; 270Debug.Assert(right.Length > n); 271if (((uint)right.Length << 1) <= (uint)n) 306Debug.Assert(3 * n - left.Length is 0 or 1 or 2); 307Debug.Assert(right.Length > n); 308Debug.Assert(right.Length <= 2 * n); 309Debug.Assert(bits.Length >= left.Length + right.Length); 319Span<nuint> z0 = bits.Slice(0, left0.Length + right0.Length); 341if (left0.Length < left2.Length) 421Debug.Assert(left.Length >= right.Length); 422Debug.Assert(bits.Length >= left.Length + right.Length); 426Debug.Assert(2 * n - left.Length is 0 or 1); 427Debug.Assert(right.Length > n); 441Debug.Assert(leftLow.Length >= leftHigh.Length); 442Debug.Assert(rightLow.Length >= rightHigh.Length); 475Debug.Assert(ActualLength(core) <= left.Length + 1); 485Debug.Assert(left.Length >= right.Length); 486Debug.Assert(2 * n - left.Length is 0 or 1); 487Debug.Assert(right.Length <= n); 488Debug.Assert(bits.Length >= left.Length + right.Length); 494Debug.Assert(leftLow.Length >= leftHigh.Length); 497Span<nuint> bitsLow = bits.Slice(0, n + right.Length); 503int carryLength = right.Length; 506Span<nuint> carryOrig = bitsHigh.Slice(0, right.Length); 511Multiply(leftHigh, right, bitsHigh.Slice(0, leftHigh.Length + right.Length)); 520Debug.Assert(right.Length < MultiplyKaratsubaThreshold); 529for (int i = 0; i < right.Length; i++) 532bits[i + left.Length] = carry; 559Debug.Assert(value.Length > n); 567if (value.Length <= n + n) 637Debug.Assert(cInf.Length >= right.cInf.Length); 657Span<nuint> r0 = bits.Slice(0, p0.Length + q0.Length); 660? bits.Slice(4 * n, pInf.Length + qInf.Length) 663Span<nuint> r1 = buffer.Slice(0, p1.Length + q1.Length); 664Span<nuint> rm1 = buffer.Slice(rLength, pm1.Length + qm1.Length); 665Span<nuint> rm2 = buffer.Slice(rLength * 2, pm2.Length + qm2.Length); 701Span<nuint> r0 = bits.Slice(0, p0.Length << 1); 702Span<nuint> rInf = bits.Slice(4 * n, pInf.Length << 1); 704Span<nuint> r1 = buffer.Slice(0, p1.Length << 1); 705Span<nuint> rm1 = buffer.Slice(rLength, pm1.Length << 1); 706Span<nuint> rm2 = buffer.Slice(rLength * 2, pm2.Length << 1); 865Debug.Assert(left.Length >= right.Length); 866Debug.Assert(core.Length >= left.Length); 877if (right.Length != 0) 879_ = left[right.Length - 1]; 880_ = core[left.Length - 1]; 887for (; i < right.Length; i++) 894for (; i < left.Length; i++) 912for (; i < right.Length; i++) 919for (; i < left.Length; i++) 938Debug.Assert(left.Length >= right.Length); 956Debug.Assert(left.Length >= right.Length); 988left = left.Slice(0, right.Length); 1002Debug.Assert(left.Length >= right.Length); 1032left = left.Slice(0, right.Length);
System\Numerics\BigIntegerCalculator.Utils.cs (28)
22Debug.Assert(left.Length <= right.Length || left.Slice(right.Length).ContainsAnyExcept(0u)); 23Debug.Assert(left.Length >= right.Length || right.Slice(left.Length).ContainsAnyExcept(0u)); 25if (left.Length != right.Length) 27return left.Length < right.Length ? -1 : 1; 30int iv = left.Length; 43if (left.Length != right.Length) 45if (left.Length < right.Length) 47if (ActualLength(right.Slice(left.Length)) > 0) 52right = right.Slice(0, left.Length); 56if (ActualLength(left.Slice(right.Length)) > 0) 61left = left.Slice(0, right.Length); 73int length = value.Length; 87if (bits.Length >= modulus.Length) 91return ActualLength(bits.Slice(0, modulus.Length)); 220Debug.Assert(result.Length >= left.Length); 222int length = left.Length; 271Debug.Assert(result.Length >= left.Length); 273int length = left.Length; 326Debug.Assert(result.Length >= right.Length); 328int length = right.Length;
System\Numerics\Complex.Generic.cs (2)
1934if ((text.Length < 5) || (openBracket == -1) || (semicolon == -1) || (closeBracket == -1) || (openBracket > semicolon) || (openBracket > closeBracket) || (semicolon > closeBracket)) 1992if (closeBracket != (text.Length - 1))
System.Security.Cryptography (669)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (3)
46spanLen = password.Length + 1; 54dest[password.Length] = '\0'; 57Length = password.Length;
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (3)
68consumed != source.Length) 105if (encodedOid.Length == 2 && encodedOid[0] == 0x06 && encodedOid[1] == 0x00) 118if (consumed != encodedOid.Length)
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptDecapsulateEncapsulate.cs (1)
47(uint)cipherText.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptEncryptDecrypt.cs (2)
23NTSTATUS ntStatus = BCryptEncrypt(hKey, pbInput, input.Length, IntPtr.Zero, iv, iv == null ? 0 : iv.Length, pbOutput, output.Length, out cbResult, 0); 44NTSTATUS ntStatus = BCryptDecrypt(hKey, pbInput, input.Length, IntPtr.Zero, iv, iv == null ? 0 : iv.Length, pbOutput, output.Length, out cbResult, 0);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptEncryptDecrypt.RSA.cs (2)
78source.Length, 113source.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptImportKey.cs (1)
17int keySize = key.Length;
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptImportKeyPair.cs (1)
41keyBlob.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptSignHash.cs (7)
45hash.Length, 66paddingInfo.cbSalt = hash.Length; 72hash.Length, 95paddingInfo.cbCtx = context.Length; 101data.Length, 135paddingInfo.cbCtx = context.Length; 142hash.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptVerifySignature.cs (11)
52hash.Length, 54signature.Length, 76paddingInfo.cbSalt = hash.Length; 82hash.Length, 84signature.Length, 105paddingInfo.cbCtx = context.Length; 111data.Length, 113signature.Length, 136paddingInfo.cbCtx = context.Length; 143hash.Length, 145signature.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDecapsulateEncapsulate.cs (1)
48(uint)cipherText.Length,
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDeriveKeyMaterial.cs (1)
142parameterDesc.cBuffers = parameters.Length;
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.SignVerify.cs (1)
22return NCryptSignHash(hKey, pPaddingInfo, pHash, pbHashValue.Length, pSignature, pbSignature.Length, out pcbResult, dwFlags);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeUnicodeStringHandle.cs (2)
34int cch = checked(s.Length + 1); 40dest[s.Length] = (char)0;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AeadCommon.Windows.cs (9)
30authInfo.cbNonce = nonce.Length; 34authInfo.cbAuthData = associatedData.Length; 39plaintext.Length, 48Debug.Assert(plaintext.Length == ciphertextBytesWritten); 75authInfo.cbNonce = nonce.Length; 77authInfo.cbTag = tag.Length; 79authInfo.cbAuthData = associatedData.Length; 84ciphertext.Length, 93Debug.Assert(ciphertext.Length == plaintextBytesWritten);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AesGcm.cs (7)
82AesAEAD.CheckKeySize(key.Length); 89KeySizeInBytes = key.Length; 304if (plaintext.Length != ciphertext.Length) 307if (!nonce.Length.IsLegalSize(NonceByteSizes)) 315if (tag.Length != tagSizeInBytes) 320else if (!tag.Length.IsLegalSize(TagByteSizes))
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.manual.cs (2)
49if (span.Length != 2) 117if (span.Length != 2)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml.cs (1)
101decoded.Parameters = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AttributeAsn.xml.cs (1)
111tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\DigestInfoAsn.xml.cs (1)
81decoded.Digest = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\DirectoryStringAsn.xml.cs (1)
175decoded.UniversalString = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs (1)
81decoded.EncryptedData = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\GeneralNameAsn.xml.cs (3)
243decoded.X400Address = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 249decoded.DirectoryName = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 268decoded.IPAddress = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\OtherNameAsn.xml.cs (1)
98decoded.Value = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\CertBagAsn.xml.cs (1)
98decoded.CertValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml.cs (1)
118decoded.MacSalt = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml.cs (1)
114decoded.BagValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\SecretBagAsn.xml.cs (1)
98decoded.SecretValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\CertificateChoiceAsn.xml.cs (4)
215decoded.Certificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 220decoded.ExtendedCertificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 225decoded.AttributeCertificateV1 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 230decoded.AttributeCertificateV2 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml.cs (1)
98decoded.Content = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\EncapsulatedContentInfoAsn.xml.cs (1)
105decoded.Content = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml.cs (1)
99decoded.EncryptedContent = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\IssuerAndSerialNumberAsn.xml.cs (2)
99decoded.Issuer = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 101decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\OtherCertificateFormat.xml.cs (1)
93decoded.OtherCert = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignedDataAsn.xml.cs (1)
189tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignerIdentifierAsn.xml.cs (1)
127decoded.SubjectKeyIdentifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignerInfoAsn.xml.cs (2)
134decoded.SignedAttributes = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 141decoded.SignatureValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml.cs (1)
105decoded.PrivateKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs (1)
86decoded.Iv = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml.cs (1)
81decoded.SubjectPublicKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\X509ExtensionAsn.xml.cs (1)
131decoded.ExtnValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AsymmetricAlgorithmHelpers.Der.cs (7)
31Debug.Assert(input.Length % 2 == 0); 32Debug.Assert(input.Length > 1); 36int halfLength = input.Length / 2; 87if (signatureField.Length > response.Length) 89if (signatureField.Length != response.Length + 1 || 94Debug.Fail($"A signature field was longer ({signatureField.Length}) than expected ({response.Length})"); 103int writeOffset = response.Length - signatureField.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.cs (2)
252cbBuffer = checked(2 * (password.Length + 1)), 264cbBuffer = pkcs12TripleDesOidBytes.Length,
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.SignVerify.cs (4)
106ErrorCode errorCode = Interop.NCrypt.NCryptVerifySignature(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, paddingMode); 110errorCode = Interop.NCrypt.NCryptVerifySignature(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, paddingMode);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngPkcs8.cs (2)
46if (passwordBytes.Length == 0) 63if (passwordBytes.Length == 0)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsa.cs (15)
195/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 208if (context.Length > MaxContextLength) 212context.Length, 312/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 323if (context.Length > MaxContextLength) 327context.Length, 333if (!Algorithm.IsValidSignatureSize(signature.Length)) 670Debug.Assert(read == source.Length); 682if (!algorithm.IsValidPublicKeySize(key.Length)) 865Debug.Assert(read == source.Length); 880if (!algorithm.IsValidPrivateKeySize(privateKeyContents.Length)) 931if (!algorithm.IsValidPublicKeySize(source.Length)) 981if (!algorithm.IsValidPrivateKeySize(source.Length)) 1886AsnWriter writer = new(AsnEncodingRules.BER, initialCapacity: pkcs8.Length); 1917int capacity = checked(32 + publicKey.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsaCng.Windows.cs (7)
79paddingInfo.cbCtx = context.Length; 113paddingInfo.cbCtx = context.Length; 144Debug.Fail($"Private key size too large for buffer: {privateKey.Length} / {destination.Length}"); 148return privateKey.Length; 217keyBytes.Length > maxKeySize || 223$"{nameof(keyBytes)}.Length: {keyBytes.Length} / {destination.Length}"); 229return keyBytes.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsaImplementation.Windows.cs (3)
175keyBytes.Length > destination.Length || 181$"{nameof(keyBytes)}.Length: {keyBytes.Length} / {destination.Length}"); 187return keyBytes.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.SignVerify.cs (5)
31return CngHelpers.SignHash(keyHandle, source, AsymmetricPaddingMode.None, null, source.Length * 2); 92int fieldSizeBits = source.Length * 8; 128if (qLength == hash.Length) 133if (qLength < hash.Length) 138int zeroByteCount = qLength - hash.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSAKeyFormatHelper.cs (2)
37if (consumed != xBytes.Length) 103if (consumed != yBytes.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.NamedCurve.cs (5)
99if (ecBlob.Length < sizeof(BCRYPT_ECCKEY_BLOB)) 111if (offset < ecBlob.Length) 121Debug.Assert(offset == ecBlob.Length); 136Debug.Assert(offset == ecBlob.Length); 176keyBlob.Length,
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Helpers.cs (3)
109bytesWritten = source.Length; 152if (hash.Length != outputSize) 270if (bytesRead != data.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyBlobHelpers.cs (8)
13if (span.Length > 1 && span[0] == 0) 35if (span.Length == length) 41if (span.Length == length + 1) 50if (span.Length > length) 55destination.Slice(0, destination.Length - span.Length).Clear(); 56span.CopyTo(destination.Slice(length - span.Length)); 67while (newStart < integer.Length) 83if (newStart == integer.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.cs (4)
43read = reader.PeekEncodedValue().Length; 73read = reader.PeekEncodedValue().Length; 121int read = reader.PeekEncodedValue().Length; 148int read = reader.PeekEncodedValue().Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (6)
138read = reader.PeekEncodedValue().Length; 148byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 370localRead = reader.PeekEncodedValue().Length; 380byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 415if (bytesRead != current.Length) 451if (bytesRead != current.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (31)
109/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 124if (context.Length > MaxContextLength) 128context.Length, 192/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 205if (context.Length > MaxContextLength) 209context.Length, 215if (signature.Length != Algorithm.SignatureSizeInBytes) 286/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 307if (context.Length > MaxContextLength) 311context.Length, 333if (hashLengthInBytes != hash.Length) 401/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 419if (context.Length > MaxContextLength) 423context.Length, 433signature.Length != Algorithm.SignatureSizeInBytes) 438if (hashLengthInBytes != hash.Length) 577if (externalMu.Length != Algorithm.MuSizeInBytes) 634if (externalMu.Length != Algorithm.MuSizeInBytes || signature.Length != Algorithm.SignatureSizeInBytes) 1363Debug.Assert(read == source.Length); 1370if (key.Length != algorithm.PublicKeySizeInBytes) 1426Debug.Assert(read == source.Length); 1805if (source.Length != algorithm.PublicKeySizeInBytes) 1855if (source.Length != algorithm.PrivateKeySizeInBytes) 1905if (source.Length != algorithm.PrivateSeedSizeInBytes) 2086AsnWriter writer = new(AsnEncodingRules.BER, initialCapacity: pkcs8.Length); 2115AsnWriter writer = new(AsnEncodingRules.BER, initialCapacity: pkcs8.Length); 2186if (dsaKey.Seed.Length != algorithm.PrivateSeedSizeInBytes) 2195if (dsaKey.ExpandedKey.Length != algorithm.PrivateKeySizeInBytes) 2206if (dsaKey.Both.Seed.Length != algorithm.PrivateSeedSizeInBytes || 2207dsaKey.Both.ExpandedKey.Length != privateKeySize)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaCng.Windows.cs (11)
132if (seedValue.Length != algorithm.PrivateSeedSizeInBytes) 177if (expandedKeyValue.Length != algorithm.PrivateKeySizeInBytes) 190if (seedValue.Length != algorithm.PrivateSeedSizeInBytes) 255paddingInfo.cbCtx = context.Length; 275paddingInfo.cbCtx = context.Length; 300Debug.Assert(hashLengthInBytes == hash.Length); 309paddingInfo.cbCtx = context.Length; 335Debug.Assert(hashLengthInBytes == hash.Length); 344paddingInfo.cbCtx = context.Length; 459keyBytes.Length != expectedKeySize || 465$"{nameof(keyBytes)}.Length: {keyBytes.Length} / {expectedKeySize}");
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.Windows.cs (4)
77Debug.Assert(hashLengthInBytes == hash.Length); 95Debug.Assert(hashLengthInBytes == hash.Length); 242keyBytes.Length != expectedKeySize || 248$"{nameof(keyBytes)}.Length: {keyBytes.Length} / {expectedKeySize}");
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (11)
203if (ciphertext.Length != Algorithm.CiphertextSizeInBytes) 354if (source.Length != algorithm.PrivateSeedSizeInBytes) 413if (source.Length != algorithm.DecapsulationKeySizeInBytes) 470if (source.Length != algorithm.EncapsulationKeySizeInBytes) 1189Debug.Assert(read == source.Length); 1196if (key.Length != algorithm.EncapsulationKeySizeInBytes) 1251Debug.Assert(read == source.Length); 1700if (kemKey.Seed.Length != algorithm.PrivateSeedSizeInBytes) 1709if (kemKey.ExpandedKey.Length != algorithm.DecapsulationKeySizeInBytes) 1720if (kemKey.Both.Seed.Length != algorithm.PrivateSeedSizeInBytes || 1721kemKey.Both.ExpandedKey.Length != decapsulationKeySize)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemCng.Windows.cs (1)
96Debug.Assert(ciphertext.Length == Algorithm.CiphertextSizeInBytes);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.Windows.cs (4)
58Debug.Assert(source.Length == algorithm.PrivateSeedSizeInBytes); 66Debug.Assert(source.Length == algorithm.DecapsulationKeySizeInBytes); 74Debug.Assert(source.Length == algorithm.EncapsulationKeySizeInBytes); 82Debug.Assert(ciphertext.Length == Algorithm.CiphertextSizeInBytes);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (27)
64if (passwordBytes.Length > 0 && password.Length == 0) 103Debug.Assert(destination.Length >= encryptedData.Length); 183if (password.IsEmpty && passwordBytes.Length > 0) 204if (passwordBytes.Length > 0 || password.Length == 0) 361if (passwordBytes.Length == 0 && password.Length > 0) 365else if (passwordBytes.Length == 0) 371pwdTmpBytes = new byte[passwordBytes.Length]; 381Debug.Assert(password.Length > 0 || passwordBytes.IsEmpty); 404if (passwordBytes.Length > 0) 406Debug.Assert(pwdTmpBytes!.Length == passwordBytes.Length); 409else if (password.Length > 0) 489if (passwordBytes.Length > 0 || password.Length == 0) 690if (rc2Parameters.Iv.Length != 8) 700iv = iv.Slice(0, rc2Parameters.Iv.Length); 747if (!gotIv || bytesWritten != length || consumed != source.Length) 812byte[] tmpPassword = new byte[password.Length]; 813byte[] tmpSalt = new byte[saltSpan.Length]; 862if (pbeParameters.Salt.Length != 8) 964byte[] tmpKey = new byte[key.Length]; 965byte[] tmpIv = new byte[iv.Length]; 966byte[] rentedEncryptedData = CryptoPool.Rent(encryptedData.Length); 989encryptedData.Length, 1012CryptoPool.Return(rentedEncryptedData, encryptedData.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (1)
79int localRead = reader.PeekEncodedValue().Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (7)
115int SLen = ((salt.Length - 1 + vBytes) / vBytes) * vBytes; 118int passLen = checked((password.Length + 1) * 2); 238Debug.Assert(into.Length == addend.Length); 252Debug.Assert(bytes.Length > 0); 256if (destination.Length >= bytes.Length) 259destination = destination.Slice(bytes.Length); 271int fullCopyLen = password.Length * 2;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (7)
188int parameterSetLengthWithNullTerminator = checked(sizeof(char) * (parameterSet.Length + 1)); 192data.Length); // Key 214blobHeader.cbKey = data.Length; 220blobBodyChars[parameterSet.Length] = '\0'; 225index += data.Length; 318key.Length; 334blob->cbKey = (uint)key.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (5)
125if (!encrypt && data.Length != modulusSizeInBytes) 132data.Length > modulusSizeInBytes - Pkcs1PaddingOverhead) 140if (encrypt && data.Length == 0) 290Interop.NCrypt.NCryptEncrypt(key, input, input.Length, paddingInfo, output, output.Length, out bytesNeeded, paddingMode) : 291Interop.NCrypt.NCryptDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out bytesNeeded, paddingMode);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.SignVerify.cs (4)
92if (hash.Length != GetHashSizeInBytes(hashAlgorithm)) 107var pssPaddingInfo = new BCRYPT_PSS_PADDING_INFO() { pszAlgId = namePtr, cbSalt = hash.Length }; 140if (hash.Length != GetHashSizeInBytes(hashAlgorithm)) 155var pssPaddingInfo = new BCRYPT_PSS_PADDING_INFO() { pszAlgId = namePtr, cbSalt = hash.Length };
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSAKeyFormatHelper.cs (1)
46read = reader.PeekEncodedValue().Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RsaPaddingProcessor.cs (20)
124int mLen = source.Length; 134Span<byte> mInEM = destination.Slice(destination.Length - source.Length); 135Span<byte> ps = destination.Slice(2, destination.Length - source.Length - 3); 182Debug.Assert(source.Length > 11); 202int lenIfGood = afterPadding.Length - zeroPos - 1; 204int lenIfBad = ~Choose(hasLen, lenIfGood, source.Length - 11); 217for (int i = source.Length - 1; i >= 0; i--) 263if (source.Length != expectedLength) 268int tLen = digestInfoPrefix.Length + expectedLength; 285source.CopyTo(destination.Slice(paddingLength + 3 + digestInfoPrefix.Length)); 308if (source.Length > maxInput) 325Span<byte> mDest = db.Slice(db.Length - source.Length); 391if (mHash.Length != hLen) 481if (mHash.Length != hLen) 486Debug.Assert(em.Length >= emLen); 498if (em[em.Length - 1] != 0xBC) 519byte[] dbMaskRented = CryptoPool.Rent(maskedDb.Length); 520Span<byte> dbMask = new Span<byte>(dbMaskRented, 0, maskedDb.Length); 637if (a.Length != b.Length) 642for (int i = 0; i < b.Length; i++)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (22)
119/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 141if (context.Length > MaxContextLength) 145context.Length, 207/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 218if (context.Length > MaxContextLength) 222context.Length, 228if (signature.Length != Algorithm.SignatureSizeInBytes) 299/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 325if (context.Length > MaxContextLength) 329context.Length, 406/// <paramref name="context"/> has a <see cref="ReadOnlySpan{T}.Length"/> in excess of 423if (context.Length > MaxContextLength) 427context.Length, 434if (signature.Length != Algorithm.SignatureSizeInBytes) 1226Debug.Assert(read == source.Length); 1233if (key.Length != algorithm.PublicKeySizeInBytes) 1295if (key.Length != info.PrivateKeySizeInBytes) 1305Debug.Assert(read == source.Length); 1684if (source.Length != algorithm.PublicKeySizeInBytes) 1734if (source.Length != algorithm.PrivateKeySizeInBytes) 1898AsnWriter writer = new(AsnEncodingRules.BER, initialCapacity: pkcs8.Length); 1926AsnWriter writer = new(AsnEncodingRules.BER, initialCapacity: pkcs8.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdfImplementationCng.cs (2)
54buffers[0].cbBuffer = label.Length; 57buffers[1].cbBuffer = context.Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Utf8DataEncoding.cs (1)
17int maxLength = ThrowingUtf8Encoding.GetMaxByteCount(data.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellman.cs (11)
912if (source.Length != PrivateKeySizeInBytes) 968if (source.Length != PublicKeySizeInBytes) 1013Debug.Assert(read == source.Length); 1026if (key.Length != PublicKeySizeInBytes) 1081Debug.Assert(read == source.Length); 1450Debug.Assert(spkiPreamble.Length + PublicKeySizeInBytes == SpkiSizeInBytes); 1459writer(state, destination.Slice(spkiPreamble.Length, PublicKeySizeInBytes)); 1528Debug.Assert(pkcs8Preamble.Length + PrivateKeySizeInBytes == Pkcs8SizeInBytes); 1537Span<byte> privateKeyBuffer = destination.Slice(pkcs8Preamble.Length, PrivateKeySizeInBytes); 1597if (privateKey.Length != PrivateKeySizeInBytes) 1612if (publicKey.Length != PublicKeySizeInBytes)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellmanCng.Windows.cs (2)
54Debug.Assert(otherPartyPublicKey.Length == PublicKeySizeInBytes); 253if (ecKey.PrivateKey.Length != PrivateKeySizeInBytes)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellmanImplementation.Windows.cs (1)
59Debug.Assert(otherPartyPublicKey.Length == PublicKeySizeInBytes);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519WindowsHelpers.cs (3)
33if (exported.Length < blobHeaderSize + ElementSize * (privateKey ? 3 : 2)) 154Debug.Assert(publicKey.Length == PublicKeySizeInBytes); 185Debug.Assert(key.Length == PublicKeySizeInBytes);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.cs (2)
198using (PointerMemoryManager<byte> manager = new(pinned, data.Length)) 430using (PointerMemoryManager<byte> manager = new(pinned, data.Length))
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (3)
216bagState.PrepareDecryptBuffer(authSafeContents.Length); 846if (bytesRead != encodedAttribute.Length) 989Debug.Assert(_decryptBuffer.Length - _decryptBufferOffset >= encryptedContent.Length);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Security\Cryptography\Aes.cs (28)
106int outputLength = GetKeyWrapPaddedLength(plaintext.Length); 134int requiredLength = GetKeyWrapPaddedLength(plaintext.Length); 176/// <paramref name="ciphertext"/> has a <see cref="ReadOnlySpan{T}.Length"/> that does not correspond 181if (ciphertext.Length < 16 || ciphertext.Length % 8 != 0) 184using (CryptoPoolLease lease = CryptoPoolLease.Rent(ciphertext.Length - 8, skipClear: true)) 199/// <paramref name="ciphertext"/> has a <see cref="ReadOnlySpan{T}.Length"/> that does not correspond 218if (ciphertext.Length < 16 || ciphertext.Length % 8 != 0) 244/// <paramref name="ciphertext"/> has a <see cref="ReadOnlySpan{T}.Length"/> that does not correspond 256if (ciphertext.Length < 16 || ciphertext.Length % 8 != 0) 259int maxOutput = ciphertext.Length - 8; 372if (source.Length == 16) 395int maxOutput = source.Length - 8; 438Debug.Assert(destination.Length == GetKeyWrapPaddedLength(source.Length)); 441ulong iv = (AIV << 32) | (uint)source.Length; 443if (source.Length <= 8) 464else if (source.Length % 8 == 0) 470int n = checked((source.Length + 7) / 8); 476lease.Span.Slice(source.Length).Clear(); 490Debug.Assert(source.Length % 8 == 0); 491Debug.Assert(source.Length >= 16); 492Debug.Assert(destination.Length == GetKeyWrapPaddedLength(source.Length)); 506for (uint i = 0; i < source.Length; i += 8, t++, R = R.Slice(8)) 532int inlen = source.Length - 8; 533uint t = 6U * (uint)(source.Length / 8) - 6; 540for (int rOffset = source.Length - 16; rOffset >= 0; t--, rOffset -= 8)
System\Security\Cryptography\AesCcm.cs (6)
29AesAEAD.CheckKeySize(key.Length); 30KeySizeInBytes = key.Length; 93if (plaintext.Length != ciphertext.Length) 96if (!nonce.Length.IsLegalSize(NonceByteSizes)) 99if (!tag.Length.IsLegalSize(TagByteSizes))
System\Security\Cryptography\AesGcm.cs (2)
20AesAEAD.CheckKeySize(key.Length); 21KeySizeInBytes = key.Length;
System\Security\Cryptography\AesImplementation.cs (2)
271long keySize = rgbKey.Length * (long)BitsPerByte; 348KeySizeValue = checked(BitsPerByte * key.Length);
System\Security\Cryptography\AesImplementation.Windows.cs (1)
51Debug.Assert(destination.Length == GetKeyWrapPaddedLength(source.Length));
System\Security\Cryptography\Base64Transforms.cs (4)
54Debug.Assert(consumed == input.Length); 152int bytesToTransform = _inputIndex + inputBufferSpan.Length; 197int bytesToTransform = _inputIndex + inputBufferSpan.Length; 267return transformBuffer.Slice(0, index + inputBuffer.Length);
System\Security\Cryptography\BasicSymmetricCipherCsp.cs (5)
71Debug.Assert((input.Length % PaddingSizeInBytes) == 0); 75if (input.Length != 0) 78Debug.Assert(numBytesWritten == input.Length); // Our implementation of Transform() guarantees this. 94Debug.Assert(input.Length > 0); 95Debug.Assert((input.Length % PaddingSizeInBytes) == 0);
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (6)
47Debug.Assert(input.Length > 0); 48Debug.Assert((input.Length % PaddingSizeInBytes) == 0); 73if (numBytesWritten != input.Length) 101Debug.Assert((input.Length % PaddingSizeInBytes) == 0); 105if (input.Length != 0) 108Debug.Assert(numBytesWritten == input.Length); // Our implementation of Transform() guarantees this. See comment above.
System\Security\Cryptography\BasicSymmetricCipherLiteNCrypt.cs (9)
57Debug.Assert(input.Length > 0); 58Debug.Assert((input.Length % PaddingSizeInBytes) == 0); 83if (numBytesWritten != input.Length) 103Interop.NCrypt.NCryptEncrypt(keyHandle, input, input.Length, null, output, output.Length, out bytesWritten, AsymmetricPaddingMode.None) : 104Interop.NCrypt.NCryptDecrypt(keyHandle, input, input.Length, null, output, output.Length, out bytesWritten, AsymmetricPaddingMode.None); 130iv.Length, 144Debug.Assert((input.Length % PaddingSizeInBytes) == 0); 148if (input.Length != 0) 151Debug.Assert(numBytesWritten == input.Length); // Our implementation of Transform() guarantees this. See comment above.
System\Security\Cryptography\CapiHelper.Windows.cs (7)
911int cbEncryptedData = input.Length; 920Debug.Assert(cbEncryptedData >= input.Length); 926int encryptedDataLength = input.Length; 933int outputCount = isFinal ? input.Length : encryptedDataLength; 948byte[] dataToBeDecrypted = new byte[input.Length]; 951int decryptedDataLength = input.Length; 1466bool response = Interop.Advapi32.CryptImportKey(hProv, pbDataPtr, pbData.Length, hPubKey, dwFlags, out phKey);
System\Security\Cryptography\ChaCha20Poly1305.cs (5)
28CheckKeySize(key.Length); 98if (plaintext.Length != ciphertext.Length) 101if (nonce.Length != NonceSizeInBytes) 104if (tag.Length != TagSizeInBytes)
System\Security\Cryptography\CngHelpers.cs (1)
246if (rsaBlob.Length < sizeof(BCRYPT_RSAKEY_BLOB))
System\Security\Cryptography\CngKey.Import.cs (3)
64cbBuffer = checked(2 * (password.Length + 1)), 87keyBlob.Length, 138keyBlob.Length,
System\Security\Cryptography\CngSymmetricAlgorithmCore.cs (2)
171if (!iv.IsEmpty && iv.Length != AsymmetricAlgorithmHelpers.BitsToBytes(_outer.BlockSize)) 311long keySize = rgbKey.Length * (long)BitsPerByte;
System\Security\Cryptography\ConcurrentSafeKmac.cs (8)
74if (hash.Length > MaxKmacStackAlloc) 76hashBuffer = new byte[hash.Length]; 80hashBuffer = hashBuffer.Slice(0, hash.Length); 88Debug.Assert(written == hash.Length); 103if (hash.Length > MaxKmacStackAlloc) 105hashBuffer = new byte[hash.Length]; 109hashBuffer = hashBuffer.Slice(0, hash.Length); 117Debug.Assert(written == hash.Length);
System\Security\Cryptography\CryptographicOperations.cs (7)
24/// values for <see cref="ReadOnlySpan{T}.Length"/> and the same contents, <c>false</c> 44if (left.Length != right.Length) 49int length = left.Length; 87int length = source.Length; 835if (hash.Length != hashSizeInBytes) 926if (hash.Length != hashSizeInBytes)
System\Security\Cryptography\CryptoStream.cs (3)
508byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 516Write(sharedBuffer, 0, buffer.Length); 520CryptographicOperations.ZeroMemory(sharedBuffer.AsSpan(0, buffer.Length));
System\Security\Cryptography\DSA.cs (3)
898byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 903byte[] ret = HashData(array, 0, data.Length, hashAlgorithm); 909Array.Clear(array, 0, data.Length);
System\Security\Cryptography\EccKeyFormatHelper.cs (10)
118if (publicKeyBytes.Length == 0) 131if (publicKeyBytes.Length != 2 * key.PrivateKey.Length + 1) 136x = publicKeyBytes.Slice(1, key.PrivateKey.Length).ToArray(); 137y = publicKeyBytes.Slice(1 + key.PrivateKey.Length).ToArray(); 180if (publicKeyBytes.Length == 0) 193if ((publicKeyBytes.Length & 0x01) != 1) 198int fieldWidth = publicKeyBytes.Length / 2; 311if (primeValue.Length > (MaxFieldBitSize / 8)) 424if (baseSpan[0] != 0x04 || baseSpan.Length != 2 * primeOrPoly.Length + 1)
System\Security\Cryptography\ECDsa.cs (7)
909hashSpan = HashData(data.ToArray(), 0, data.Length, hashAlgorithm); 1009byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 1015byte[] hash = HashData(array, 0, data.Length, hashAlgorithm); 1032Array.Clear(array, 0, data.Length); 1218byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 1223byte[] ret = HashData(array, 0, data.Length, hashAlgorithm); 1229Array.Clear(array, 0, data.Length);
System\Security\Cryptography\FixedMemoryKeyBox.cs (3)
14void* memory = NativeMemory.Alloc((nuint)key.Length); 15key.CopyTo(new Span<byte>(memory, key.Length)); 17_length = key.Length;
System\Security\Cryptography\HashAlgorithm.cs (3)
254byte[] array = ArrayPool<byte>.Shared.Rent(source.Length); 256HashCore(array, 0, source.Length); 257Array.Clear(array, 0, source.Length);
System\Security\Cryptography\HashProviderCng.cs (2)
39NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out _hHash, IntPtr.Zero, 0, key, key.Length, BCryptCreateHashFlags.BCRYPT_HASH_REUSABLE_FLAG); 68NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hHash, source, source.Length, 0);
System\Security\Cryptography\HashProviderDispenser.Windows.cs (4)
279NTSTATUS ntStatus = Interop.BCrypt.BCryptHash((uint)algHandle, pKey, key.Length, pSrc, source.Length, pDest, digestSizeInBytes); 303key.Length, 314ntStatus = Interop.BCrypt.BCryptHashData(hHash, source, source.Length, 0);
System\Security\Cryptography\Helpers.cs (15)
100for (int i = 0; i < s.Length; i++) 106uint cbHex = (uint)(s.Length - whitespaceCount) / 2; 112for (int i = 0; i < s.Length; i++) 173if (consumed != input.Length) 180return encodedOctetString.Slice(offset, primitive.Length); 188if (consumed != input.Length) 284stack[stackCount++] = (0, encodedValue.Length); 331if (content.Length > 0) 346stack[stackCount++] = (contentOffset, content.Length); 370return ref buffer.Length != 0 ? ref MemoryMarshal.GetReference(buffer) : ref Unsafe.AsRef<byte>((void*)1); 559context.Length + // Context 561hash.Length); // Hash 578message[1] = checked((byte)context.Length); 585message.Slice(2 + context.Length), 589hash.CopyTo(message.Slice(2 + context.Length + encodedOidLength));
System\Security\Cryptography\HKDF.cs (1)
125if (prk.Length < hashLength)
System\Security\Cryptography\HKDF.Windows.cs (5)
133rented = CryptoPool.Rent(info.Length); 135infoBlob = rented.AsSpan(0, info.Length); 156secret.Length, 174(uint)salt.Length, 199infoBuffer.cbBuffer = infoBlob.Length;
System\Security\Cryptography\HKDFManagedImplementation.cs (4)
34if (info.Length > MaxStackInfoBuffer) 36rentedTempInfoBuffer = CryptoPool.Rent(info.Length); 40tempInfoBuffer = tempInfoBuffer.Slice(0, info.Length); 81CryptoPool.Return(rentedTempInfoBuffer, clearSize: info.Length);
System\Security\Cryptography\HMACCommon.cs (1)
68if (key.Length > _blockSize && _blockSize > 0)
System\Security\Cryptography\HMACStatic.cs (2)
26if (hash.Length != THMAC.HashSizeInBytes) 174if (hash.Length != THMAC.HashSizeInBytes)
System\Security\Cryptography\IncrementalHash.cs (1)
476if (hash.Length != ih.HashLengthInBytes)
System\Security\Cryptography\KeyBlobHelpers.cs (4)
17if (span.Length == length) 22if (span.Length == length + 1) 30if (span.Length > length) 36span.CopyTo(target.AsSpan(length - span.Length));
System\Security\Cryptography\KmacStatic.cs (3)
170if (hash.Length > MaxStackKmacSize) 172hashBuffer = new byte[hash.Length]; 176hashBuffer = hashBuffer.Slice(0, hash.Length);
System\Security\Cryptography\LiteHash.Windows.cs (7)
61key.Length, 76customizationString.Length, 128CheckStatus(Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0)); 237NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 350NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 404key.Length, 423NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0);
System\Security\Cryptography\Pbkdf2Implementation.Windows.cs (4)
56else if (password.Length <= hashBlockSizeBytes) 60symmetricKeyMaterialLength = password.Length; 86Debug.Assert(symmetricKeyMaterial.Length > 0); 163buffers[1].cbBuffer = salt.Length;
System\Security\Cryptography\PemEncoding.cs (45)
137if (pemData.Length < T.PreEBPrefix.Length + T.Ending.Length * 2 + T.PostEBPrefix.Length) 149int labelStartIndex = preebIndex + T.PreEBPrefix.Length; 180int contentStartIndex = preebEndIndex + T.Ending.Length; 181int postebLength = T.PostEBPrefix.Length + label.Length + T.Ending.Length; 198if (pemEndIndex < pemData.Length - 1 && 234int size = T.PostEBPrefix.Length + label.Length + T.Ending.Length; 237label.CopyTo(destination.Slice(T.PostEBPrefix.Length)); 238T.Ending.CopyTo(destination.Slice(T.PostEBPrefix.Length + label.Length)); 246Debug.Assert(startPosition <= str.Length); 267for (int index = 0; index < data.Length; index++) 309int end = str.Length - 1; 310for (; start < str.Length && IsWhiteSpaceCharacter(str[start], T.Whitespace); start++); 389Debug.Assert(Utf16PemEncoder.PostEBPrefix.Length == Utf8PemEncoder.PostEBPrefix.Length); 390Debug.Assert(Utf16PemEncoder.PreEBPrefix.Length == Utf8PemEncoder.PreEBPrefix.Length); 391Debug.Assert(Utf16PemEncoder.Ending.Length == Utf8PemEncoder.Ending.Length); 395int preebLength = Utf16PemEncoder.PreEBPrefix.Length + labelLength + Utf16PemEncoder.Ending.Length; 396int postebLength = Utf16PemEncoder.PostEBPrefix.Length + labelLength + Utf16PemEncoder.Ending.Length; 463int encodedSize = GetEncodedSize(label.Length, data.Length); 526int encodedSize = GetEncodedSize(utf8Label.Length, data.Length); 580int encodedSize = GetEncodedSize(utf8Label.Length, data.Length); 595return str.Length; 607while (remainingData.Length >= BytesPerLine) 614Debug.Assert(remainingData.Length < BytesPerLine); 616if (remainingData.Length > 0) 664int encodedSize = GetEncodedSize(label.Length, data.Length); 707int encodedSize = GetEncodedSize(label.Length, data.Length); 792Debug.Assert(bytesConsumed == bytes.Length);
System\Security\Cryptography\RandomNumberGenerator.cs (7)
351Debug.Assert(choices.Length > 0); 356if (choices.Length <= 256) 362if (BitOperations.IsPow2(choices.Length)) 368int mask = choices.Length - 1; 394int mask = (int)BitOperations.RoundUpToPowerOf2((uint)choices.Length) - 1; 417if (masked < (uint)choices.Length) 433destination[i] = choices[GetInt32(choices.Length)];
System\Security\Cryptography\RC2Implementation.Windows.cs (1)
37using (SafeAlgorithmHandle algorithm = RC2BCryptModes.GetHandle(cipherMode, key.Length * 8))
System\Security\Cryptography\Rfc2898DeriveBytes.cs (1)
115_salt = new byte[salt.Length + sizeof(uint)];
System\Security\Cryptography\Rfc2898DeriveBytes.OneShot.cs (1)
279int maxEncodedSize = s_throwingUtf8Encoding.GetMaxByteCount(password.Length);
System\Security\Cryptography\RSA.cs (3)
318byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 322result = HashData(array, 0, data.Length, hashAlgorithm); 326Array.Clear(array, 0, data.Length);
System\Security\Cryptography\RSABCrypt.cs (4)
190if (data.Length != modulusSizeInBytes) 235if (modulusSizeInBytes - Pkcs1PaddingOverhead < data.Length) 272if (hash.Length != RSACng.GetHashSizeInBytes(hashAlgorithm)) 331if (hash.Length != RSACng.GetHashSizeInBytes(hashAlgorithm))
System\Security\Cryptography\SP800108HmacCounterKdfImplementationCng.cs (2)
19if (key.Length > hashAlgorithmBlockSize) 29symmetricKeyMaterialLength = key.Length;
System\Security\Cryptography\SymmetricAlgorithm.cs (9)
228long bitLength = key.Length * 8L; 522byte[] decryptBuffer = GC.AllocateUninitializedArray<byte>(ciphertext.Length); 638int ciphertextLength = GetCiphertextLengthEcb(plaintext.Length, paddingMode); 772byte[] decryptRent = ArrayPool<byte>.Shared.Rent(ciphertext.Length); 773Span<byte> decryptBuffer = decryptRent.AsSpan(0, ciphertext.Length); 925int ciphertextLength = GetCiphertextLengthCbc(plaintext.Length, paddingMode); 1124byte[] decryptBuffer = GC.AllocateUninitializedArray<byte>(ciphertext.Length); 1361int ciphertextLength = GetCiphertextLengthCfb(plaintext.Length, paddingMode, feedbackSizeInBits); 1673if (iv.Length != BlockSize >> 3)
System\Security\Cryptography\SymmetricPadding.cs (5)
38int count = block.Length; 167if (block.Slice(block.Length - padBytes, padBytes - 1).ContainsAnyExcept((byte)0)) 194for (int i = block.Length - padBytes; i < block.Length - 1; i++) 213return block.Length - padBytes;
System\Security\Cryptography\UniversalCryptoDecryptor.cs (10)
54Debug.Assert(inputBuffer.Length >= _heldoverCipher.Length); 55inputBuffer.Slice(inputBuffer.Length - _heldoverCipher.Length).CopyTo(_heldoverCipher); 56inputBuffer = inputBuffer.Slice(0, inputBuffer.Length - _heldoverCipher.Length); 57Debug.Assert(inputBuffer.Length % InputBlockSize == 0, "Did not remove whole blocks for depadding"); 60if (inputBuffer.Length > 0) 71if (inputBuffer.Length % PaddingSizeBytes != 0) 88rentedCiphertextSize = inputBuffer.Length; 89rentedCiphertext = CryptoPool.Rent(inputBuffer.Length); 90ciphertext = rentedCiphertext.AsSpan(0, inputBuffer.Length); 95rentedCiphertextSize = _heldoverCipher.Length + inputBuffer.Length;
System\Security\Cryptography\UniversalCryptoOneShot.cs (10)
20if (input.Length % cipher.PaddingSizeInBytes != 0) 38if (output.Length >= input.Length) 69if (!depaddingRequired || input.Length - cipher.BlockSizeInBytes > output.Length) 84if (input.Length <= MaxInStackDecryptionBuffer) 116Debug.Assert(input.Length > cipher.BlockSizeInBytes); 129Debug.Assert(paddedBlock.Length % cipher.BlockSizeInBytes == 0); 130Debug.Assert(paddedBlock.Length <= MaxInStackDecryptionBuffer); 167byte[] rentedBuffer = CryptoPool.Rent(input.Length); 168Span<byte> buffer = rentedBuffer.AsSpan(0, input.Length); 210int ciphertextLength = SymmetricPadding.GetCiphertextLength(input.Length, cipher.PaddingSizeInBytes, paddingMode);
System\Security\Cryptography\X509Certificates\Asn1\CertificateAsn.xml.cs (1)
84decoded.SignatureValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\X509Certificates\Asn1\CertificationRequestAsn.xml.cs (1)
84decoded.SignatureValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\X509Certificates\Asn1\CertificationRequestInfoAsn.xml.cs (1)
113decoded.Subject = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\X509Certificates\Asn1\PolicyInformationAsn.xml.cs (1)
101decoded.PolicyQualifiers = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\X509Certificates\Asn1\TbsCertificateAsn.xml.cs (5)
213decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 221decoded.Issuer = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 229decoded.Subject = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 237decoded.IssuerUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 252decoded.SubjectUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.Import.cs (1)
44Interop.Crypt32.DATA_BLOB certBlob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)(loadFromFile ? 0 : rawData.Length));
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (5)
1018if (serialNumber.Length < 1) 1114newSerialNumber = CryptoPool.Rent(serialNumber.Length + 1); 1117return new ArraySegment<byte>(newSerialNumber, 0, serialNumber.Length + 1); 1122while (leadingZeros < serialNumber.Length - 1 && serialNumber[leadingZeros] == 0 && serialNumber[leadingZeros + 1] < 0x80) 1127int contentLength = serialNumber.Length - leadingZeros;
System\Security\Cryptography\X509Certificates\CertificateRequest.Load.cs (1)
142int encodedLength = outer.PeekEncodedValue().Length;
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.cs (1)
140if (serialNumber.Length > 1)
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (1)
95payloadLength = reader.PeekEncodedValue().Length;
System\Security\Cryptography\X509Certificates\PublicKey.cs (1)
463read = reader.PeekEncodedValue().Length;
System\Security\Cryptography\X509Certificates\StorePal.Windows.Import.cs (1)
35Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)(fromFile ? 0 : rawData!.Length));
System\Security\Cryptography\X509Certificates\WindowsInterop.crypt32.cs (1)
95return Interop.Crypt32.CryptDecodeObjectPointer(dwCertEncodingType, (IntPtr)lpszStructType, pEncoded, encoded.Length, dwFlags, pvStructInfo, ref pcbStructInfo);
System\Security\Cryptography\X509Certificates\X500DistinguishedName.cs (1)
148var rdn = new X500RelativeDistinguishedName(rawDataMemory.Slice(offset, encodedValue.Length));
System\Security\Cryptography\X509Certificates\X500RelativeDistinguishedName.cs (1)
67_singleElementValue = rawData.Slice(offset, firstValue.Length);
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (4)
412if (rawData.Length == 0) 1770match = match.Slice(0, match.Length - 1); 1801embeddedSpan = embeddedSpan.Slice(0, embeddedSpan.Length - 1); 1804if (allowWildcards && embeddedSpan.StartsWith("*.") && embeddedSpan.Length > 2)
System\Security\Cryptography\X509Certificates\X509Certificate2Collection.cs (1)
731int maxDecodedLength = checked(thumbprintHex.Length + 1) / 2;
System\Security\Cryptography\X509Certificates\X509CertificateLoader.netcore.cs (1)
54using (PointerMemoryManager<byte> manager = new(pinned, data.Length))
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Windows.cs (5)
21(uint)data.Length); 242if (password.Length >= MaxStackPasswordLength) 244szPassword = new char[password.Length + 1]; 255szPassword[password.Length] = '\0'; 257Interop.Crypt32.DATA_BLOB blob = new((IntPtr)dataPtr, (uint)data.Length);
System\Security\Cryptography\X509Certificates\X509Pal.Windows.GetCertContentType.cs (1)
23Interop.Crypt32.DATA_BLOB certBlob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)rawData.Length);
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (1)
179Debug.Assert(ecBlob.Length >= sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB));
System\Security\Cryptography\X509Certificates\X509SubjectAlternativeNameExtension.cs (1)
100Debug.Assert(value.Length is 4 or 16);
System\Security\Cryptography\X509Certificates\X509SubjectKeyIdentifierExtension.cs (1)
127if (subjectKeyIdentifier.Length == 0)
System\Security\Cryptography\XmlKeyHelper.cs (2)
125Debug.Assert(value.Length > 0); 133int length = value.Length;
System.Security.Cryptography.Cose (17)
System\Security\Cryptography\Cose\CoseMessage.cs (8)
112using (MemoryManager<byte> manager = new PointerMemoryManager<byte>(ptr, cborPayload.Length)) 197using (MemoryManager<byte> manager = new PointerMemoryManager<byte>(ptr, cborPayload.Length)) 447CoseHelpers.WriteByteStringLength(toBeSignedBuilder, (ulong)contentBytes.Length); 521Debug.Assert(signProtected.Length == 0); 532Debug.Assert(bytesWritten == ComputeToBeSignedEncodedSize(context, bodyProtected.Length, signProtected.Length, associatedData.Length, content.Length));
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (3)
211int expectedSize = ComputeEncodedSize(signer, protectedHeaders, unprotectedHeaders, content.Length, isDetached); 349int expectedSize = ComputeEncodedSize(signer, protectedHeaders, unprotectedHeaders, content.Length, isDetached); 775associatedData.Length,
System\Security\Cryptography\Cose\CoseSign1Message.cs (5)
169Debug.Assert(contentStream == null || (isDetached && contentBytes.Length == 0)); 173int expectedSize = ComputeEncodedSize(signer, contentBytes.Length, isDetached); 280int expectedSize = ComputeEncodedSize(signer, content.Length, isDetached); 773Debug.Assert(contentStream == null || contentBytes.Length == 0); 782associatedData.Length,
System\Security\Cryptography\Cose\CoseSignature.cs (1)
656associatedData.Length,
System.Security.Cryptography.Pkcs (138)
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.Decode.cs (1)
38encodedMessage.Length,
Internal\Cryptography\Pal\Windows\PkcsPalWindows.cs (1)
36if (!Interop.Crypt32.CryptMsgUpdate(hCryptMsg, ref MemoryMarshal.GetReference(encodedMessage), encodedMessage.Length, fFinal: true))
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (6)
68consumed != source.Length) 105if (encodedOid.Length == 2 && encodedOid[0] == 0x06 && encodedOid[1] == 0x00) 118if (consumed != encodedOid.Length) 183if (consumed != input.Length) 190return encodedOctetString.Slice(offset, primitive.Length); 198if (consumed != input.Length)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.manual.cs (2)
49if (span.Length != 2) 117if (span.Length != 2)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml.cs (1)
101decoded.Parameters = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\AttributeAsn.xml.cs (1)
111tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\DigestInfoAsn.xml.cs (1)
81decoded.Digest = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\DirectoryStringAsn.xml.cs (1)
175decoded.UniversalString = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs (1)
81decoded.EncryptedData = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\GeneralNameAsn.xml.cs (3)
243decoded.X400Address = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 249decoded.DirectoryName = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 268decoded.IPAddress = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\OtherNameAsn.xml.cs (1)
98decoded.Value = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\CertBagAsn.xml.cs (1)
98decoded.CertValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml.cs (1)
118decoded.MacSalt = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml.cs (1)
114decoded.BagValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\SecretBagAsn.xml.cs (1)
98decoded.SecretValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\CertificateChoiceAsn.xml.cs (4)
215decoded.Certificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 220decoded.ExtendedCertificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 225decoded.AttributeCertificateV1 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 230decoded.AttributeCertificateV2 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml.cs (1)
98decoded.Content = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\EncapsulatedContentInfoAsn.xml.cs (1)
105decoded.Content = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml.cs (1)
99decoded.EncryptedContent = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\IssuerAndSerialNumberAsn.xml.cs (2)
99decoded.Issuer = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 101decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\OtherCertificateFormat.xml.cs (1)
93decoded.OtherCert = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignedDataAsn.xml.cs (1)
189tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignerIdentifierAsn.xml.cs (1)
127decoded.SubjectKeyIdentifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs7\SignerInfoAsn.xml.cs (2)
134decoded.SignedAttributes = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 141decoded.SignatureValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml.cs (1)
105decoded.PrivateKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs (1)
86decoded.Iv = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml.cs (1)
81decoded.SubjectPublicKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\X509ExtensionAsn.xml.cs (1)
131decoded.ExtnValue = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Helpers.cs (2)
109bytesWritten = source.Length; 270if (bytesRead != data.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.cs (4)
43read = reader.PeekEncodedValue().Length; 73read = reader.PeekEncodedValue().Length; 121int read = reader.PeekEncodedValue().Length; 148int read = reader.PeekEncodedValue().Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (6)
138read = reader.PeekEncodedValue().Length; 148byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 370localRead = reader.PeekEncodedValue().Length; 380byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 415if (bytesRead != current.Length) 451if (bytesRead != current.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (27)
64if (passwordBytes.Length > 0 && password.Length == 0) 103Debug.Assert(destination.Length >= encryptedData.Length); 183if (password.IsEmpty && passwordBytes.Length > 0) 204if (passwordBytes.Length > 0 || password.Length == 0) 361if (passwordBytes.Length == 0 && password.Length > 0) 365else if (passwordBytes.Length == 0) 371pwdTmpBytes = new byte[passwordBytes.Length]; 381Debug.Assert(password.Length > 0 || passwordBytes.IsEmpty); 404if (passwordBytes.Length > 0) 406Debug.Assert(pwdTmpBytes!.Length == passwordBytes.Length); 409else if (password.Length > 0) 489if (passwordBytes.Length > 0 || password.Length == 0) 690if (rc2Parameters.Iv.Length != 8) 700iv = iv.Slice(0, rc2Parameters.Iv.Length); 747if (!gotIv || bytesWritten != length || consumed != source.Length) 812byte[] tmpPassword = new byte[password.Length]; 813byte[] tmpSalt = new byte[saltSpan.Length]; 862if (pbeParameters.Salt.Length != 8) 964byte[] tmpKey = new byte[key.Length]; 965byte[] tmpIv = new byte[iv.Length]; 966byte[] rentedEncryptedData = CryptoPool.Rent(encryptedData.Length); 989encryptedData.Length, 1012CryptoPool.Return(rentedEncryptedData, encryptedData.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (1)
79int localRead = reader.PeekEncodedValue().Length;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (7)
115int SLen = ((salt.Length - 1 + vBytes) / vBytes) * vBytes; 118int passLen = checked((password.Length + 1) * 2); 238Debug.Assert(into.Length == addend.Length); 252Debug.Assert(bytes.Length > 0); 256if (destination.Length >= bytes.Length) 259destination = destination.Slice(bytes.Length); 271int fullCopyLen = password.Length * 2;
System\Security\Cryptography\Pkcs\Asn1\CadesIssuerSerial.xml.cs (1)
103decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\EssCertId.xml.cs (1)
85decoded.Hash = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\EssCertIdV2.xml.cs (1)
128decoded.Hash = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\KeyAgreeRecipientInfoAsn.xml.cs (1)
120decoded.Ukm = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\KeyTransRecipientInfoAsn.xml.cs (1)
92decoded.EncryptedKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\MessageImprint.xml.cs (1)
81decoded.HashedMessage = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\OriginatorIdentifierOrKeyAsn.xml.cs (1)
138decoded.SubjectKeyIdentifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\OriginatorInfoAsn.xml.cs (1)
144tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\OriginatorPublicKeyAsn.xml.cs (1)
81decoded.PublicKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\OtherKeyAttributeAsn.xml.cs (1)
101decoded.KeyAttr = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\PkiStatusInfo.xml.cs (1)
115decoded.StatusString = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\PolicyQualifierInfo.xml.cs (1)
93decoded.Qualifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\RecipientEncryptedKeyAsn.xml.cs (1)
81decoded.EncryptedKey = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\RecipientIdentifierAsn.xml.cs (1)
127decoded.SubjectKeyIdentifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\RecipientKeyIdentifier.xml.cs (1)
92decoded.SubjectKeyIdentifier = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\Rfc3161TimeStampReq.xml.cs (1)
163decoded.Nonce = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\Rfc3161TimeStampResp.xml.cs (1)
94decoded.TimeStampToken = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\Asn1\Rfc3161TstInfo.xml.cs (2)
171decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); 197decoded.Nonce = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\Pkcs\CmsSignature.cs (11)
196if (val.Length > fieldSize && val[0] == 0) 201if (val.Length <= fieldSize) 203val.CopyTo(ieeeSignature.Slice(fieldSize - val.Length, val.Length)); 208if (val.Length > fieldSize && val[0] == 0) 213if (val.Length <= fieldSize) 215val.CopyTo(ieeeSignature.Slice(fieldSize + fieldSize - val.Length, val.Length)); 232int fieldSize = ieeeSignature.Length / 2; 235fieldSize * 2 == ieeeSignature.Length, 236$"ieeeSignature.Length ({ieeeSignature.Length}) must be even");
System\Security\Cryptography\Pkcs\CmsSignature.RSA.cs (1)
72valueHash.Length);
System\Security\Cryptography\Pkcs\Rfc3161TimestampRequest.cs (6)
88int localBytesRead = reader.PeekEncodedValue().Length; 270if (nonceSpan.Length == 0 || nonceSpan[0] >= 0x80) 272byte[] temp = new byte[nonceSpan.Length + 1]; 281while (slice < nonceSpan.Length && nonceSpan[slice] == 0) 287if (slice == nonceSpan.Length || nonceSpan[slice] >= 0x80) 367bytesConsumed = firstElement.Length;
System\Security\Cryptography\Pkcs\Rfc3161TimestampToken.cs (1)
298int bytesActuallyRead = reader.PeekEncodedValue().Length;
System\Security\Cryptography\Pkcs\SubjectIdentifier.cs (1)
61for (int i = 0; i < serial.Length; i++)
System.Security.Cryptography.ProtectedData (3)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
System\Security\Cryptography\ProtectedData.cs (2)
339DATA_BLOB userDataBlob = new DATA_BLOB((IntPtr)pInputData, (uint)(inputData.Length)); 343optionalEntropyBlob = new DATA_BLOB((IntPtr)pOptionalEntropy, (uint)(optionalEntropy.Length));
System.Security.Cryptography.Xml (10)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
System.Security.Principal.Windows (5)
_generated\0\LibraryImports.g.cs (1)
461for (int __i0 = 0; __i0 < __names_native__managedSpan.Length; ++__i0, ++__names_native__lastIndexMarshalled)
System\Security\Principal\SID.cs (2)
322if (subAuthorities.Length > MaxSubAuthorities) 326subAuthorities.Length,
System\Security\Principal\WindowsIdentity.cs (2)
185ushort sourceNameLength = checked((ushort)(sourceName.Length)); 188sourceName.CopyTo(new Span<byte>((void*)sourceNameBuffer.DangerousGetHandle(), sourceName.Length));
System.ServiceModel.NetFramingBase (2)
System\ServiceModel\Channels\Connection.cs (2)
203byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 204Memory<byte> memBuffer = new Memory<byte>(sharedBuffer, 0, buffer.Length);
System.ServiceProcess.ServiceController (3)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System.Text.Encoding.CodePages (11)
System\Text\EncodingTable.cs (10)
61int right = encodingNameIndices.Length - 2; 65Debug.Assert(encodingNameIndices.Length == CodePagesByName.Length + 1); 66Debug.Assert(encodingNameIndices[encodingNameIndices.Length - 1] == EncodingNames.Length); 76Debug.Assert(index < encodingNameIndices.Length - 1); 98Debug.Assert(left < encodingNameIndices.Length - 1); 137Debug.Assert(MappedCodePages.Length + 1 == indices.Length); 138Debug.Assert(indices[indices.Length - 1] == names.Length); 156Debug.Assert(i < indices.Length - 1);
System\Text\ISO2022Encoding.cs (1)
403if (bTrailByte < 0x21 || bTrailByte >= 0x21 + HalfToFullWidthKanaTable.Length)
System.Text.Encodings.Web (42)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Text\Encodings\Web\AllowedBmpCodePointsBitmap.cs (1)
70Debug.Assert(definedCharsBitmapAsLittleEndian.Length == thisAllowedCharactersBitmap.Length * sizeof(uint));
System\Text\Encodings\Web\OptimizedInboxTextEncoder.cs (9)
142if ((uint)source.Length <= (uint)srcIdx) 190if ((uint)source.Length > (uint)srcIdxTemp) 261if ((uint)source.Length <= (uint)srcIdx) 368if ((uint)asciiBytesSkipped >= (uint)data.Length || UnicodeUtility.IsAsciiCodePoint(data[asciiBytesSkipped])) 375int dataOriginalLength = data.Length; 392return (data.IsEmpty) ? -1 : dataOriginalLength - data.Length; 404if (data.Length >= 8) 408if ((uint)idx >= (uint)data.Length || char.IsAscii(data[idx])) 419while (data.Length >= 8)
System\Text\Encodings\Web\TextEncoder.cs (19)
166Span<char> destBuffer = stringBuilder.AppendSpan(Math.Max(remainingInput.Length, minBufferBumpEachIteration)); 293if (utf8Destination.Length < utf8Source.Length) 301idxOfFirstByteToEncode = sourceSearchSpace.Length; 305if (idxOfFirstByteToEncode == utf8Source.Length) 307bytesConsumed = utf8Source.Length; 308bytesWritten = utf8Source.Length; 329int originalUtf8SourceLength = utf8Source.Length; 382bytesConsumed = originalUtf8SourceLength - utf8Source.Length; 423if (destination.Length < source.Length) 431idxOfFirstCharToEncode = sourceSearchSpace.Length; 435if (idxOfFirstCharToEncode == source.Length) 437charsConsumed = source.Length; 438charsWritten = source.Length; 454int originalSourceLength = source.Length; 498charsConsumed = originalSourceLength - source.Length; 521char[] rentedArray = ArrayPool<char>.Shared.Rent(Math.Max(value.Length, minBufferBumpEachIteration)); 545return FindFirstCharacterToEncode(pText, text.Length); 561int utf8TextOriginalLength = utf8Text.Length; 573return (utf8Text.IsEmpty) ? -1 : utf8TextOriginalLength - utf8Text.Length;
System.Text.Json (895)
_generated\0\RegexGenerator.g.cs (8)
73base.runtextpos = inputSpan.Length; 85if ((uint)pos < (uint)inputSpan.Length) 95base.runtextpos = inputSpan.Length; 119while ((uint)iteration < (uint)slice.Length && char.IsWhiteSpace(slice[iteration])) 142iteration1 = slice.Length; 159while ((uint)iteration2 < (uint)slice.Length && char.IsWhiteSpace(slice[iteration2])) 185if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\n'))
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.cs (1)
23public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed) => ComputeHash32(ref MemoryMarshal.GetReference(data), (uint)data.Length, (uint)seed, (uint)(seed >> 32));
src\runtime\src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (3)
45int initialBufferLength = (int)(1.2 * chars.Length); 53for (int i = 0; i < chars.Length; i++) 90if (i + 1 < chars.Length && char.IsLower(chars[i + 1]))
System\Text\Json\Document\JsonDocument.cs (24)
311int length = checked(otherText.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); 353if (otherUtf8Text.Length > segment.Length || (!shouldUnescape && otherUtf8Text.Length != segment.Length)) 360if (otherUtf8Text.Length < segment.Length / JsonConstants.MaxExpansionFactorWhileEscaping) 428consumed == segment.Length) 450consumed == segment.Length) 472consumed == segment.Length) 494consumed == segment.Length) 516consumed == segment.Length) 538consumed == segment.Length) 560consumed == segment.Length) 582consumed == segment.Length) 604segment.Length == bytesConsumed) 626segment.Length == bytesConsumed) 648segment.Length == bytesConsumed) 927database.Append(tokenType, tokenStart, reader.ValueSpan.Length); 974database.Append(tokenType, tokenStart, reader.ValueSpan.Length); 990database.Append(tokenType, tokenStart + 1, reader.ValueSpan.Length); 1015database.Append(tokenType, tokenStart + 1, reader.ValueSpan.Length); 1024database.Append(tokenType, tokenStart, reader.ValueSpan.Length); 1031Debug.Assert(reader.BytesConsumed == utf8JsonSpan.Length);
System\Text\Json\Document\JsonDocument.Parse.cs (12)
177byte[] owned = new byte[utf8Json.Length]; 578int payloadLength = reader.ValueSpan.Length + 2; 603payloadLength += reader.ValueSpan.Length; 644int length = valueSpan.IsEmpty ? checked((int)valueSequence.Length) : valueSpan.Length; 810long expectedLength = Math.Max(utf8Bom.Length, stream.Length - stream.Position) + 1; 824Debug.Assert(rented.Length >= utf8Bom.Length); 829utf8Bom.Length - written); 832} while (lastRead > 0 && written < utf8Bom.Length); 835if (written == utf8Bom.Length && 836utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) 887int utf8BomLength = JsonConstants.Utf8Bom.Length; 907Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length);
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (6)
26int maxBytes = JsonReaderHelper.s_utf8Encoding.GetMaxByteCount(propertyName.Length); 50int minBytes = propertyName.Length; 172if (currentPropertyName.Length > propertyName.Length) 178if (propertyName.Length > idx && 181int remaining = currentPropertyName.Length - idx;
System\Text\Json\JsonEncodedText.cs (2)
68if (value.Length == 0) 115if (utf8Value.Length == 0)
System\Text\Json\JsonHelpers.cs (25)
206Span<char> charBuffer = utf8Key.Length <= JsonConstants.StackallocCharThreshold ? 208(rentedBuffer = ArrayPool<char>.Shared.Rent(utf8Key.Length)); 277Debug.Assert(left.Length > 0 && right.Length > 0); 294(nDigits = (leftIntegral.Length + leftFractional.Length)) != 295rightIntegral.Length + rightFractional.Length) 310int diff = leftIntegral.Length - rightIntegral.Length; 317int rightOffset = rightIntegral.Length + diff; 333int leftOffset = leftIntegral.Length - diff; 343Debug.Assert(leftFirst.Length == rightFirst.Length); 344Debug.Assert(leftMiddle.Length == rightMiddle.Length); 345Debug.Assert(leftLast.Length == rightLast.Length); 372Debug.Assert(span.Length > 0); 417Debug.Assert(span.Length >= 10); 432Debug.Assert(intg.Length == 1, "Leading zeros not permitted in JSON numbers."); 452exp += intg.Length - fz; 458exp -= frac.Length; 477return firstNonZero < 0 ? span.Length - 1 : firstNonZero - 1; 495return lastNonZero == span.Length - 1 ? -1 : lastNonZero + 1;
System\Text\Json\JsonHelpers.Date.cs (19)
146Debug.Assert(source.Length >= 10); 183if (source.Length == 10) 225if (source.Length < 16) 240Debug.Assert(source.Length >= 16); 241if (source.Length == 16) 254return sourceIndex == source.Length; 266if (source.Length < 19 273Debug.Assert(source.Length >= 19); 274if (source.Length == 19) 287return sourceIndex == source.Length; 300if (source.Length < 21) 308int fractionEnd = Math.Min(sourceIndex + JsonConstants.DateTimeParseNumFractionDigits, source.Length); 332Debug.Assert(sourceIndex <= source.Length); 333if (sourceIndex == source.Length) 345return sourceIndex == source.Length; 357if (offsetData.Length < 2 365if (offsetData.Length == 2) 372if (offsetData.Length != 5 386Debug.Assert(source.Length == 2);
System\Text\Json\JsonHelpers.Escaping.cs (7)
33Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 34Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < utf8Value.Length); 38int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal); 61Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 62Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < utf8Value.Length); 66int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal); 86int length = utf8Value.Length;
System\Text\Json\Nodes\JsonArray.cs (1)
163List<JsonNode?> list = new(items.Length);
System\Text\Json\Reader\JsonReaderHelper.cs (18)
48for (; i < span.Length; i++) 84for (; i < span.Length; i++) 155if (!JsonHelpers.IsValidDateTimeOffsetParseLength(segment.Length)) 181Debug.Assert(source.Length <= JsonConstants.MaximumEscapedDateTimeOffsetParseLength); 203if (!JsonHelpers.IsValidDateTimeOffsetParseLength(segment.Length)) 229Debug.Assert(source.Length <= JsonConstants.MaximumEscapedDateTimeOffsetParseLength); 251if (segment.Length > JsonConstants.MaximumEscapedGuidLength) 265if (segment.Length == JsonConstants.MaximumFormatGuidLength 278Debug.Assert(source.Length <= JsonConstants.MaximumEscapedGuidLength); 301if (span.Length == 3) 309else if (span.Length == 8) 317else if (span.Length == 9) 333if (span.Length == 3) 341else if (span.Length == 8) 349else if (span.Length == 9) 364if (span.Length == 3) 372else if (span.Length == 8) 380else if (span.Length == 9)
System\Text\Json\Reader\JsonReaderHelper.net8.cs (1)
37return index < 0 ? span.Length : index;
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (29)
18Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ? 20(unescapedArray = ArrayPool<byte>.Shared.Rent(utf8Source.Length)); 45int length = utf8Source.Length; 72int length = utf8Source.Length; 96Debug.Assert(utf8Source.Length >= other.Length && utf8Source.Length / JsonConstants.MaxExpansionFactorWhileEscaping <= other.Length); 100Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ? 102(unescapedArray = ArrayPool<byte>.Shared.Rent(utf8Source.Length)); 124Debug.Assert(utf8Source.Length >= other.Length && utf8Source.Length / JsonConstants.MaxExpansionFactorWhileEscaping <= other.Length); 173Span<byte> utf8Unescaped1 = utf8Source1.Length <= JsonConstants.StackallocByteThreshold ? 175(unescapedArray1 = ArrayPool<byte>.Shared.Rent(utf8Source1.Length)); 177Span<byte> utf8Unescaped2 = utf8Source2.Length <= JsonConstants.StackallocByteThreshold ? 179(unescapedArray2 = ArrayPool<byte>.Shared.Rent(utf8Source2.Length)); 222Span<byte> byteSpan = utf8Unescaped.Length <= JsonConstants.StackallocByteThreshold ? 224(pooledArray = ArrayPool<byte>.Shared.Rent(utf8Unescaped.Length)); 240Debug.Assert(bytesConsumed == utf8Unescaped.Length); 358Debug.Assert(destination.Length >= source.Length); 369Debug.Assert(idx >= 0 && idx < source.Length); 371Debug.Assert(destination.Length >= source.Length); 393Debug.Assert(idx >= 0 && idx < source.Length); 444Debug.Assert(source.Length >= idx + 5); 462if (source.Length < idx + 7 || source[idx + 1] != '\\' || source[idx + 2] != 'u') 499if (++idx == source.Length) 510nextUnescapedSegmentLength = remaining.Length; 540Debug.Assert(idx == source.Length || source[idx] == JsonConstants.BackSlash); 542if (idx == source.Length)
System\Text\Json\Reader\Utf8JsonReader.cs (52)
55internal readonly int ValueLength => HasValueSequence ? checked((int)ValueSequence.Length) : ValueSpan.Length; 531if (MatchNotPossible(text.Length)) 540int length = checked(text.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); 587if (localSequence.Length != other.Length) 600matchedSoFar += span.Length; 615if (localSpan.Length < other.Length || localSpan.Length / JsonConstants.MaxExpansionFactorWhileEscaping > other.Length) 641if (sequenceLength < other.Length || sequenceLength / JsonConstants.MaxExpansionFactorWhileEscaping > other.Length) 682matchedSoFar += span.Length; 703int sourceLength = ValueSpan.Length; 919if (_consumed >= (uint)_buffer.Length) 949if (_consumed >= (uint)_buffer.Length) 1045for (; _consumed < localBuffer.Length; _consumed++) 1128if (_consumed >= (uint)_buffer.Length) 1170Debug.Assert(span.Length > 0); 1178ValueSpan = span.Slice(0, literal.Length); 1180_consumed += literal.Length; 1181_bytePositionInLine += literal.Length; 1187Debug.Assert(span.Length > 0 && span[0] == literal[0]); 1191for (int i = 1; i < literal.Length; i++) 1193if (span.Length > i) 1208Debug.Assert(indexOfFirstMismatch > 0 && indexOfFirstMismatch < literal.Length); 1250if (_consumed >= (uint)_buffer.Length) 1264((_consumed < _buffer.Length) && 1267|| (_isNotPrimitive ^ (_consumed >= (uint)_buffer.Length))); 1315Debug.Assert(_buffer.Length >= _consumed + 1); 1348_bytePositionInLine += localBuffer.Length + 1; // Account for the start quote 1360Debug.Assert(idx >= 0 && idx < data.Length); 1370for (; idx < data.Length; idx++) 1404idx = data.Length; 1419if (idx >= data.Length) 1441for (int j = idx; j < data.Length; j++) 1462Debug.Assert(data.Length > 0); 1579if (i >= data.Length) 1604if (i < data.Length) 1641for (; i < data.Length; i++) 1649if (i >= data.Length) 1673if (i >= data.Length) 1695if (i >= data.Length) 1709if (i >= data.Length) 1794if (_consumed >= (uint)_buffer.Length) 1931if (_consumed >= (uint)_buffer.Length) 2263if (_consumed >= (uint)_buffer.Length) 2353if (localBuffer.Length > 0) 2392if (idx < localBuffer.Length - 1) 2415idx = localBuffer.Length; 2418_bytePositionInLine += 2 + localBuffer.Length; 2469if (localBuffer.Length < 2) 2530if (localBuffer.Length > 0)
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (65)
68bool firstSegmentIsEmpty = _buffer.Length == 0; 252if (_consumed >= (uint)_buffer.Length) 280if (_consumed >= (uint)_buffer.Length) 384if (_consumed < _buffer.Length) 461if (_consumed >= (uint)_buffer.Length) 513Debug.Assert(span.Length > 0); 516int consumed = literal.Length; 529ValueSpan = span.Slice(0, literal.Length); 540Debug.Assert(span.Length > 0 && span[0] == literal[0] && literal.Length <= JsonConstants.MaximumLiteralLength); 547if (span.Length >= literal.Length || IsLastSpan) 567ReadOnlySpan<byte> leftToMatch = literal.Slice(span.Length); 571int alreadyMatched = literal.Length - leftToMatch.Length; 588int amountToWrite = Math.Min(span.Length, readSoFar.Length - written); 598SequencePosition end = new SequencePosition(_currentPosition.GetObject(), _currentPosition.GetInteger() + leftToMatch.Length); 600consumed = leftToMatch.Length; 615leftToMatch = leftToMatch.Slice(span.Length); 616alreadyMatched = span.Length; 623readSoFar.Length - written, 624Math.Min(span.Length, (int)bytePositionInLine + 1)); 635Debug.Assert(span.Length > 0); 652Debug.Assert(indexOfFirstMismatch >= 0 && indexOfFirstMismatch < literal.Length); 688if (_consumed >= (uint)_buffer.Length) 702((_consumed < _buffer.Length) && 705|| (_isNotPrimitive ^ (_consumed >= (uint)_buffer.Length))); 753Debug.Assert(_buffer.Length >= _consumed + 1); 787_bytePositionInLine += localBuffer.Length + 1; // Account for the start quote 800int leftOver = _buffer.Length - _consumed; 841for (; idx < localBuffer.Length; idx++) 874for (; j < localBuffer.Length; j++) 905_totalConsumed += localBuffer.Length; 933_totalConsumed += localBuffer.Length; 947_totalConsumed += localBuffer.Length; 948_bytePositionInLine += localBuffer.Length; 962Debug.Assert(idx >= 0 && idx < data.Length); 970int leftOverFromConsumed = _buffer.Length - _consumed; 978for (; idx < data.Length; idx++) 1011for (; j < data.Length; j++) 1045_totalConsumed += data.Length; 1078_totalConsumed += data.Length; 1127Debug.Assert(data.Length > 0); 1266if (i >= data.Length) 1306if (i < data.Length) 1359for (; i < data.Length; i++) 1368if (i >= data.Length) 1397for (; i < data.Length; i++) 1406if (i >= data.Length) 1435if (i >= data.Length) 1469if (i >= data.Length) 1497if (i >= data.Length) 1599if (_consumed >= (uint)_buffer.Length) 1745if (_consumed >= (uint)_buffer.Length) 2092if (_consumed >= (uint)_buffer.Length) 2245if (localBuffer.Length == 0) 2278if (localBuffer.Length == 0) 2359if (idx < localBuffer.Length - 1) 2375_consumed += localBuffer.Length; 2376_bytePositionInLine += localBuffer.Length; 2427Debug.Assert(dangerousLineSeparatorBytesConsumed >= 1 && dangerousLineSeparatorBytesConsumed <= 2 && localBuffer.Length <= 1); 2458Debug.Assert(localBuffer.Length < 2); 2521Debug.Assert(localBuffer.Length > 0); 2576_consumed += localBuffer.Length; 2577_bytePositionInLine += localBuffer.Length;
System\Text\Json\Reader\Utf8JsonReader.TryGet.cs (19)
106bytesWritten = valueSpan.Length; 188new Span<byte>(rentedBuffer, 0, unescapedSource.Length).Clear(); 224new Span<byte>(rentedBuffer, 0, source.Length).Clear(); 228Debug.Assert(bytesWritten < source.Length, "source buffer must contain at least one escape sequence"); 262Debug.Assert((HasValueSequence ? ValueSequence.ToArray() : ValueSpan).Length == 4); 271Debug.Assert((HasValueSequence ? ValueSequence.ToArray() : ValueSpan).Length == 5); 607&& span.Length == bytesConsumed 664&& span.Length == bytesConsumed 870&& span.Length == bytesConsumed) 906&& span.Length == bytesConsumed) 941&& span.Length == bytesConsumed) 976&& span.Length == bytesConsumed) 1011&& span.Length == bytesConsumed) 1047&& span.Length == bytesConsumed) 1083&& span.Length == bytesConsumed) 1119&& span.Length == bytesConsumed) 1149&& span.Length == bytesConsumed) 1179&& span.Length == bytesConsumed) 1214&& span.Length == bytesConsumed)
System\Text\Json\Schema\JsonSchemaExporter.cs (1)
581using ValueStringBuilder sb = new(initialCapacity: path.Length * 10);
System\Text\Json\Serialization\Converters\Collection\ReadOnlyMemoryConverter.cs (2)
61for (; index < value.Length; index++) 68for (; index < value.Length; index++)
System\Text\Json\Serialization\Converters\Object\ObjectDefaultConverter.cs (2)
393while (state.Current.EnumeratorIndex < propertyCache.Length) 422if (state.Current.EnumeratorIndex == propertyCache.Length)
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (3)
366ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 562argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 595if (jsonTypeInfo.ParameterCount != jsonTypeInfo.ParameterCache.Length)
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.Large.cs (1)
56object?[] arguments = ArrayPool<object>.Shared.Rent(typeInfo.ParameterCache.Length);
System\Text\Json\Serialization\Converters\Value\BooleanConverter.cs (1)
28&& propertyName.Length == bytesConsumed))
System\Text\Json\Serialization\Converters\Value\TimeOnlyConverter.cs (1)
70if (!result || source.Length != bytesConsumed)
System\Text\Json\Serialization\Converters\Value\TimeSpanConverter.cs (1)
69if (!result || source.Length != bytesConsumed)
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (3)
362(propertyName.Length > 0 && propertyName[0] == '$') || 368if (propertyName.Length > 0 && propertyName[0] == '$') 370switch (propertyName.Length)
System\Text\Json\Serialization\JsonSerializer.Read.Span.cs (2)
148Debug.Assert(reader.BytesConsumed == (actualByteCount ?? utf8Json.Length) || reader.CurrentState.Options.AllowMultipleValues); 165Debug.Assert(reader.BytesConsumed == (actualByteCount ?? utf8Json.Length) || reader.CurrentState.Options.AllowMultipleValues);
System\Text\Json\Serialization\JsonSerializer.Read.String.cs (6)
389json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 391json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 420json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 422json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) :
System\Text\Json\Serialization\JsonSerializer.Read.Utf8JsonReader.cs (3)
403bytePositionInLine -= valueSpan.Length; 416int payloadLength = reader.ValueSpan.Length + 2; 438: reader.ValueSpan.Length + 2;
System\Text\Json\Serialization\Metadata\JsonTypeInfo.Cache.cs (1)
96int count = utf8PropertyCacheSpan.Length;
System\Text\Json\Serialization\Metadata\PropertyRef.cs (10)
45return key == Key && (propertyName.Length <= PropertyNameKeyLength || propertyName.SequenceEqual(Utf8PropertyName)); 55int length = name.Length; 77(name.Length < 1 || name[0] == ((key & ((ulong)0xFF << BitsInByte * 0)) >> BitsInByte * 0)) && 78(name.Length < 2 || name[1] == ((key & ((ulong)0xFF << BitsInByte * 1)) >> BitsInByte * 1)) && 79(name.Length < 3 || name[2] == ((key & ((ulong)0xFF << BitsInByte * 2)) >> BitsInByte * 2)) && 80(name.Length < 4 || name[3] == ((key & ((ulong)0xFF << BitsInByte * 3)) >> BitsInByte * 3)) && 81(name.Length < 5 || name[4] == ((key & ((ulong)0xFF << BitsInByte * 4)) >> BitsInByte * 4)) && 82(name.Length < 6 || name[5] == ((key & ((ulong)0xFF << BitsInByte * 5)) >> BitsInByte * 5)) && 83(name.Length < 7 || name[6] == ((key & ((ulong)0xFF << BitsInByte * 6)) >> BitsInByte * 6)) && 85(key & ((ulong)0xFF << BitsInByte * 7)) >> BitsInByte * 7 == (byte)name.Length,
System\Text\Json\Serialization\PipeReadBufferState.cs (7)
105if (_sequence.First.Length >= JsonConstants.Utf8Bom.Length) 109_sequence = _sequence.Slice((byte)JsonConstants.Utf8Bom.Length); 117while (matched < JsonConstants.Utf8Bom.Length && _sequence.TryGet(ref pos, out ReadOnlyMemory<byte> mem, advance: true)) 120for (int i = 0; i < span.Length && matched < JsonConstants.Utf8Bom.Length; i++, matched++) 130if (matched == JsonConstants.Utf8Bom.Length) 132_sequence = _sequence.Slice(JsonConstants.Utf8Bom.Length);
System\Text\Json\Serialization\StreamReadBufferState.cs (4)
46_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length)); 180Debug.Assert(_buffer.Length >= JsonConstants.Utf8Bom.Length); 183_offset = (byte)JsonConstants.Utf8Bom.Length; 184_count -= JsonConstants.Utf8Bom.Length;
System\Text\Json\ThrowHelper.cs (22)
142if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 144ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 148Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize); 149ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 156if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 158ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 162Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize); 163ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 170if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 172ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 176Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize); 177ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 184if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 186ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 190Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize); 191ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 205Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize); 206ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 258Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize); 259ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 534int printFirst10 = Math.Min(value.Length, 10); 549if (printFirst10 < value.Length)
System\Text\Json\ThrowHelper.Node.cs (2)
58Debug.Assert(supportedTypeNames.Length > 0); 59string concatenatedNames = supportedTypeNames.Length == 1 ? supportedTypeNames[0] : string.Join(", ", supportedTypeNames.ToArray());
System\Text\Json\ThrowHelper.Serialization.cs (1)
377if (str.Length <= MaxLength)
System\Text\Json\Writer\JsonWriterHelper.cs (35)
66if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 67ThrowHelper.ThrowArgumentException_PropertyNameTooLarge(propertyName.Length); 73if (value.Length > JsonConstants.MaxUnescapedTokenSize) 74ThrowHelper.ThrowArgumentException_ValueTooLarge(value.Length); 98if (propertyName.Length > JsonConstants.MaxCharacterTokenSize) 99ThrowHelper.ThrowArgumentException_PropertyNameTooLarge(propertyName.Length); 105if (value.Length > JsonConstants.MaxCharacterTokenSize) 106ThrowHelper.ThrowArgumentException_ValueTooLarge(value.Length); 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) 141ThrowHelper.ThrowPropertyNameTooLargeArgumentException(propertyName.Length); 147if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize) 148ThrowHelper.ThrowPropertyNameTooLargeArgumentException(propertyName.Length); 166if (utf8FormattedNumber.Length <= i) 178while (i < utf8FormattedNumber.Length && JsonHelpers.IsDigit(utf8FormattedNumber[i])) 184if (i == utf8FormattedNumber.Length) 196if (utf8FormattedNumber.Length <= i) 201while (i < utf8FormattedNumber.Length && JsonHelpers.IsDigit(utf8FormattedNumber[i])) 206if (i == utf8FormattedNumber.Length) 211Debug.Assert(i < utf8FormattedNumber.Length); 219if (utf8FormattedNumber.Length <= i) 238if (utf8FormattedNumber.Length <= i) 243while (i < utf8FormattedNumber.Length && JsonHelpers.IsDigit(utf8FormattedNumber[i])) 248if (i != utf8FormattedNumber.Length) 282Debug.Assert(charsRead == source.Length || status is not OperationStatus.Done); 310int quotedLength = utf8Value.Length + 2; 335Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 337int length = checked(2 + JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstByteToEscape));
System\Text\Json\Writer\JsonWriterHelper.Escaping.cs (7)
114return (encoder ?? JavaScriptEncoder.Default).FindFirstCharacterToEncode(ptr, value.Length); 140Debug.Assert(encoderBytesConsumed == value.Length || (result == OperationStatus.NeedMoreData && !isFinalBlock)); 151Debug.Assert(indexOfFirstByteToEscape >= 0 && indexOfFirstByteToEscape < value.Length); 167while (indexOfFirstByteToEscape < value.Length) 264Debug.Assert(encoderBytesConsumed == value.Length || (result == OperationStatus.NeedMoreData && !isFinalBlock)); 275Debug.Assert(indexOfFirstByteToEscape >= 0 && indexOfFirstByteToEscape < value.Length); 291while (indexOfFirstByteToEscape < value.Length)
System\Text\Json\Writer\Utf8JsonWriter.cs (18)
128Debug.Assert(partialStringDataBytes.Length == 3); 138Debug.Assert(value.Length <= 3); 143_partialStringDataLength = (byte)value.Length; 157Debug.Assert(partialStringDataBytes.Length == 3); 166Debug.Assert(value.Length <= 1); 171_partialStringDataLength = (byte)(2 * value.Length); 185Debug.Assert(partialStringDataBytes.Length == 3); 194Debug.Assert(value.Length < 3); 199_partialStringDataLength = (byte)value.Length; 769Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 833Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 861Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 862Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 866int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 982Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 1010Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 1011Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 1015int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (23)
23Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 106Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 122Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 136Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 137Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 141int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 159Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 160Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 164int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 208int encodedLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 210Debug.Assert(escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding < int.MaxValue - encodedLength - 6); 214int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + encodedLength + 6; 243int encodedLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 245Debug.Assert(escapedPropertyName.Length < int.MaxValue - encodedLength - 6); 249int maxRequired = escapedPropertyName.Length + encodedLength + 6; 265BytesPending += escapedPropertyName.Length; 282int encodedLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 284Debug.Assert(escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding < int.MaxValue - indent - encodedLength - 7 - _newLineLength); 288int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + encodedLength + 7 + _newLineLength; 332int encodedLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 334Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - encodedLength - 7 - _newLineLength); 338int maxRequired = indent + escapedPropertyName.Length + encodedLength + 7 + _newLineLength; 365BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (19)
27Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 113Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 129Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 143Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 144Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 148int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 166Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 167Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 171int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 215Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 219int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; 249Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 251int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 268BytesPending += escapedPropertyName.Length; 286Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 290int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 7 + _newLineLength; 335Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 337int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 365BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 112Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 128Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 142Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 143Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 147int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 165Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 166Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 170int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 214Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 218int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; 248Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDateTimeOffsetLength - 6); 250int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 267BytesPending += escapedPropertyName.Length; 285Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 289int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDateTimeOffsetLength + 7 + _newLineLength; 334Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDateTimeOffsetLength - 7 - _newLineLength); 336int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDateTimeOffsetLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 364BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 112Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 128Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 142Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 143Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 147int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 165Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 166Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 170int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 214Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDecimalLength - 4); 218int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDecimalLength + 4; 245Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDecimalLength - 4); 247int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDecimalLength + 3; // 2 quotes for property name, and 1 colon 264BytesPending += escapedPropertyName.Length; 279Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDecimalLength - 5 - _newLineLength); 283int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDecimalLength + 5 + _newLineLength; 325Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDecimalLength - 5 - _newLineLength); 327int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDecimalLength + 4; // 2 quotes for property name, 1 colon, and 1 space 355BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 116Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 132Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 146Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 147Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 151int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 169Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 170Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 174int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 218Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatDoubleLength - 4); 222int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDoubleLength + 4; 249Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatDoubleLength - 4); 251int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatDoubleLength + 3; // 2 quotes for property name, and 1 colon 268BytesPending += escapedPropertyName.Length; 283Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatDoubleLength - 5 - _newLineLength); 287int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatDoubleLength + 5 + _newLineLength; 329Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatDoubleLength - 5 - _newLineLength); 331int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatDoubleLength + 4; // 2 quotes for property name, 1 colon, and 1 space 359BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 116Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 132Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 146Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 147Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 151int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 169Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 170Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 174int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 218Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatSingleLength - 4); 222int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatSingleLength + 4; 249Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatSingleLength - 4); 251int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatSingleLength + 3; // 2 quotes for property name, and 1 colon 268BytesPending += escapedPropertyName.Length; 283Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatSingleLength - 5 - _newLineLength); 287int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatSingleLength + 5 + _newLineLength; 329Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatSingleLength - 5 - _newLineLength); 331int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatSingleLength + 4; // 2 quotes for property name, 1 colon, and 1 space 359BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.FormattedNumber.cs (8)
86Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 102Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 116Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 117Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 121int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 139Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 140Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 144int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 112Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 128Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 142Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 143Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 147int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 165Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 166Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 170int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 214Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatGuidLength - 6); 218int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatGuidLength + 6; 249Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatGuidLength - 6); 251int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatGuidLength + 5; // 2 quotes for property name, 2 quotes for date, and 1 colon 268BytesPending += escapedPropertyName.Length; 287Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatGuidLength - 7 - _newLineLength); 291int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatGuidLength + 7 + _newLineLength; 337Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatGuidLength - 7 - _newLineLength); 339int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatGuidLength + 6; // 2 quotes for property name, 2 quotes for date, 1 colon, and 1 space 367BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (12)
17if (propertyName.Length > JsonConstants.MaxCharacterTokenSize || CurrentDepth >= _options.MaxDepth) 24if (utf8PropertyName.Length > JsonConstants.MaxUnescapedTokenSize || CurrentDepth >= _options.MaxDepth) 77Debug.Assert(escapedPropertyName.Length < int.MaxValue - 5); 79int minRequired = escapedPropertyName.Length + 4; // 2 quotes, 1 colon, and 1 start token 96BytesPending += escapedPropertyName.Length; 108Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - 6 - _newLineLength); 110int minRequired = indent + escapedPropertyName.Length + 5; // 2 quotes, 1 colon, 1 space, and 1 start token 138BytesPending += escapedPropertyName.Length; 149Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - 5); 153int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 5; 180Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - 6 - _newLineLength); 184int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 6 + _newLineLength;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (44)
31escapedPropertyNameSection.Slice(1, escapedPropertyNameSection.Length - 3); 38Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxUnescapedTokenSize - 3); 51Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 231Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 247Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 261Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 262Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 266int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 284Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 285Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 289int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 333Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 334Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - value.Length - 4); 338int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + value.Length + 4; 359BytesPending += value.Length; 364Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 365Debug.Assert(escapedPropertyName.Length < int.MaxValue - value.Length - 4); 367int minRequired = escapedPropertyName.Length + value.Length + 3; // 2 quotes for property name, and 1 colon 384BytesPending += escapedPropertyName.Length; 390BytesPending += value.Length; 397Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 398Debug.Assert(escapedPropertyNameSection.Length < int.MaxValue - value.Length - 1); 400int minRequired = escapedPropertyNameSection.Length + value.Length; 415BytesPending += escapedPropertyNameSection.Length; 418BytesPending += value.Length; 426Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 427Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - value.Length - 5 - _newLineLength); 431int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + value.Length + 5 + _newLineLength; 464BytesPending += value.Length; 472Debug.Assert(value.Length <= JsonConstants.MaxUnescapedTokenSize); 473Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - value.Length - 5 - _newLineLength); 475int minRequired = indent + escapedPropertyName.Length + value.Length + 4; // 2 quotes for property name, 1 colon, and 1 space 503BytesPending += escapedPropertyName.Length; 510BytesPending += value.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (19)
26Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 185Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 201Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 215Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 216Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 220int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 238Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 239Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 243int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 287Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatInt64Length - 4); 291int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatInt64Length + 4; 318Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatInt64Length - 4); 320int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatInt64Length + 3; // 2 quotes for property name, and 1 colon 337BytesPending += escapedPropertyName.Length; 352Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatInt64Length - 5 - _newLineLength); 356int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatInt64Length + 5 + _newLineLength; 398Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatInt64Length - 5 - _newLineLength); 400int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatInt64Length + 4; // 2 quotes for property name, 1 colon, and 1 space 428BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (121)
27escapedPropertyNameSection.Slice(1, escapedPropertyNameSection.Length - 3); 33Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxUnescapedTokenSize - 3); 45Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 95Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2); 112Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 119int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 158Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 159Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 4) / JsonConstants.MaxExpansionFactorWhileTranscoding); 163int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4; 189Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 190Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 5 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding); 194int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 5 + _newLineLength; 244Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2); 271Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 278int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 319Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 320Debug.Assert(escapedPropertyName.Length < int.MaxValue - 4); 322int minRequired = escapedPropertyName.Length + 3; // 2 quotes for property name, and 1 colon 339BytesPending += escapedPropertyName.Length; 349Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxEscapedTokenSize - 3); 350Debug.Assert(escapedPropertyNameSection.Length < int.MaxValue - 4); 352int maxRequired = escapedPropertyNameSection.Length + 1; // Optionally, 1 list separator 367BytesPending += escapedPropertyNameSection.Length; 377Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize); 378Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - 5 - _newLineLength); 380int minRequired = indent + escapedPropertyName.Length + 4; // 2 quotes for property name, 1 colon, and 1 space 408BytesPending += escapedPropertyName.Length; 428Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize && utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 595Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 601Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2); 682Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 688Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2); 769Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 775Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2); 841Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 847Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2); 896Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 897Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < utf8Value.Length); 901int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndex); 919Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 920Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < value.Length); 924int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndex); 942Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 943Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < propertyName.Length); 947int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndex); 965Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 966Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < utf8PropertyName.Length); 970int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndex); 991Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2); 992Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2); 1010Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2); 1011Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2); 1029Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2); 1030Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2); 1048Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2); 1049Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2); 1064Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 1065Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 1073int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal); 1093int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 1124Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 1125Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 1133int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal); 1153int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 1184Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 1185Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 1193int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal); 1213int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 1244Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 1245Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 1253int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal); 1273int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 1357Debug.Assert(escapedValue.Length <= JsonConstants.MaxUnescapedTokenSize); 1358Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 6) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length); 1362int maxRequired = ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 6; 1392Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1393Debug.Assert(escapedPropertyName.Length < int.MaxValue - escapedValue.Length - 6); 1395int minRequired = escapedPropertyName.Length + escapedValue.Length + 5; // 2 quotes for property name, 2 quotes for value, and 1 colon 1412BytesPending += escapedPropertyName.Length; 1420BytesPending += escapedValue.Length; 1428Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1429Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6); 1433int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 6; 1456BytesPending += escapedValue.Length; 1464Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1465Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6); 1469int maxRequired = (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 6; 1485BytesPending += escapedPropertyName.Length; 1503Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1504Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 7 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length); 1508int maxRequired = indent + ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 7 + _newLineLength; 1553Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1554Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - escapedValue.Length - 7 - _newLineLength); 1556int minRequired = indent + escapedPropertyName.Length + escapedValue.Length + 6; // 2 quotes for property name, 2 quotes for value, 1 colon, and 1 space 1584BytesPending += escapedPropertyName.Length; 1593BytesPending += escapedValue.Length; 1604Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1605Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength); 1609int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 7 + _newLineLength; 1644BytesPending += escapedValue.Length; 1655Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize); 1656Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength); 1660int maxRequired = indent + (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 7 + _newLineLength; 1687BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (19)
27Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize); 194Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length); 210Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length); 224Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length); 225Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < propertyName.Length); 229int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp); 247Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length); 248Debug.Assert(firstEscapeIndexProp >= 0 && firstEscapeIndexProp < utf8PropertyName.Length); 252int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp); 296Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - JsonConstants.MaximumFormatUInt64Length - 4); 300int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatUInt64Length + 4; 327Debug.Assert(escapedPropertyName.Length < int.MaxValue - JsonConstants.MaximumFormatUInt64Length - 4); 329int minRequired = escapedPropertyName.Length + JsonConstants.MaximumFormatUInt64Length + 3; // 2 quotes for property name, and 1 colon 346BytesPending += escapedPropertyName.Length; 361Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - JsonConstants.MaximumFormatUInt64Length - 5 - _newLineLength); 365int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + JsonConstants.MaximumFormatUInt64Length + 5 + _newLineLength; 407Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - JsonConstants.MaximumFormatUInt64Length - 5 - _newLineLength); 409int minRequired = indent + escapedPropertyName.Length + JsonConstants.MaximumFormatUInt64Length + 4; // 2 quotes for property name, 1 colon, and 1 space 437BytesPending += escapedPropertyName.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Bytes.cs (6)
56if (bytes.Length > MaxLengthAllowed) 58ThrowHelper.ThrowArgumentException_ValueTooLarge(bytes.Length); 61int encodingLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 99if (bytes.Length > maxLengthAllowed) 101ThrowHelper.ThrowArgumentException_ValueTooLarge(bytes.Length); 104int encodingLength = Base64.GetMaxEncodedToUtf8Length(bytes.Length);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Comment.cs (10)
80Debug.Assert(value.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - 4); 84int maxRequired = (value.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4; 114Debug.Assert(value.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - indent - 4 - _newLineLength); 118int maxRequired = indent + (value.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4 + _newLineLength; 195Debug.Assert(utf8Value.Length < int.MaxValue - 4); 197int maxRequired = utf8Value.Length + 4; // /*...*/ 210BytesPending += utf8Value.Length; 221Debug.Assert(utf8Value.Length < int.MaxValue - indent - 4 - _newLineLength); 223int minRequired = indent + utf8Value.Length + 4; // /*...*/ 245BytesPending += utf8Value.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.FormattedNumber.cs (5)
49int maxRequired = utf8Value.Length + 1; // Optionally, 1 list separator 64BytesPending += utf8Value.Length; 72Debug.Assert(utf8Value.Length < int.MaxValue - indent - 1 - _newLineLength); 74int maxRequired = indent + utf8Value.Length + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 99BytesPending += utf8Value.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Helpers.cs (1)
133Debug.Assert(consumed == bytes.Length);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Literal.cs (6)
66Debug.Assert(utf8Value.Length <= 5); 68int maxRequired = utf8Value.Length + 1; // Optionally, 1 list separator 83BytesPending += utf8Value.Length; 90Debug.Assert(utf8Value.Length <= 5); 92int maxRequired = indent + utf8Value.Length + 1 + _newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line 117BytesPending += utf8Value.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (7)
105if (utf8Json.Length == int.MaxValue) 195if (json.Length > JsonConstants.MaxUtf16RawValueLength) 197ThrowHelper.ThrowArgumentException_ValueTooLarge(json.Length); 205json.Length <= (JsonConstants.StackallocByteThreshold / JsonConstants.MaxExpansionFactorWhileTranscoding) ? stackalloc byte[JsonConstants.StackallocByteThreshold] : 207json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 230int len = utf8Json.Length;
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (17)
21Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize); 86Debug.Assert(valueIdx >= -1 && valueIdx < value.Length); 95WriteStringByOptions(value, value.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); 183Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 184Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < value.Length); 188int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal); 198int requiredBytes = value.Length * JsonConstants.MaxExpansionFactorWhileEscaping; 235Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length); 267Debug.Assert(escapedValue.Length < int.MaxValue - 3); 269int minRequired = escapedValue.Length + 2; // 2 quotes 286BytesPending += escapedValue.Length; 297Debug.Assert(escapedValue.Length < int.MaxValue - indent - 3 - _newLineLength); 299int minRequired = indent + escapedValue.Length + 2; // 2 quotes 327BytesPending += escapedValue.Length; 334Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 335Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < utf8Value.Length); 339int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (45)
77Debug.Assert(value.Length + partialStringDataBuffer.Length < 2); 78Debug.Assert(charsConsumed == value.Length + partialStringDataBuffer.Length); 84Debug.Assert(charsConsumed > partialStringDataBuffer.Length); 87value = value.Slice(charsConsumed - partialStringDataBuffer.Length); 91Debug.Assert(charsConsumed >= partialStringDataBuffer.Length); 93value = value.Slice(charsConsumed - partialStringDataBuffer.Length); 135Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length); 136Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < value.Length); 140int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal); 150Debug.Assert(consumed == value.Length || !isFinalSegment); 151if (value.Length != consumed) 154Debug.Assert(value.Length - consumed < 2); 166Debug.Assert(escapedValue.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding)); 168int requiredBytes = escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding; 245Debug.Assert(utf8Value.Length + partialStringDataBuffer.Length < 4); 246Debug.Assert(bytesConsumed == utf8Value.Length + partialStringDataBuffer.Length); 252Debug.Assert(bytesConsumed > partialStringDataBuffer.Length); 255utf8Value = utf8Value.Slice(bytesConsumed - partialStringDataBuffer.Length); 259Debug.Assert(bytesConsumed >= partialStringDataBuffer.Length); 261utf8Value = utf8Value.Slice(bytesConsumed - partialStringDataBuffer.Length); 304Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length); 305Debug.Assert(firstEscapeIndexVal >= 0 && firstEscapeIndexVal < utf8Value.Length); 307int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal); 316Debug.Assert(consumed == utf8Value.Length || !isFinalSegment); 317if (utf8Value.Length != consumed) 320Debug.Assert(utf8Value.Length - consumed < 4); 332Debug.Assert(escapedValue.Length < int.MaxValue - 3); 334int requiredBytes = escapedValue.Length; 344BytesPending += escapedValue.Length; 361if (value.Length > Base64.GetMaxDecodedFromUtf8Length(int.MaxValue)) 363ThrowHelper.ThrowArgumentException_ValueTooLarge(value.Length); 411bytes = bytes.Slice(3 - partialStringDataBuffer.Length); 418Debug.Assert(bytes.Length + partialStringDataBuffer.Length < 3); 435if (!isFinalSegment && (leftoverSize = bytes.Length % 3) != 0) 438PartialBase64StringData = bytes.Slice(bytes.Length - leftoverSize); 439bytes = bytes.Slice(0, bytes.Length - leftoverSize); 442if (bytes.Length == 0) 447int requiredBytes = Base64.GetMaxEncodedToUtf8Length(bytes.Length); 541for (int i = 0; i < srcLeft.Length; i++) 552for (int i = 0; i < srcRight.Length; i++)
System.Text.Json.SourceGeneration (15)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
src\runtime\src\libraries\Common\src\SourceGenerators\SourceWriter.cs (2)
93lineLength = remainingText.Length; 118builder.Append(ptr, span.Length);
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (3)
45int initialBufferLength = (int)(1.2 * chars.Length); 53for (int i = 0; i < chars.Length; i++) 90if (i + 1 < chars.Length && char.IsLower(chars[i + 1]))
System.Text.RegularExpressions (150)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Text\RegularExpressions\Regex.Count.cs (1)
38Count(input, RightToLeft ? input.Length : 0);
System\Text\RegularExpressions\Regex.cs (5)
585int stoppos = span.Length; 617Debug.Assert(startat <= input.Length); 638if (runner.runtextstart == input.Length) 680Debug.Assert((uint)startat <= (uint)inputSpan.Length); 727int stoppos = inputSpan.Length;
System\Text\RegularExpressions\Regex.EnumerateMatches.cs (1)
80new ValueMatchEnumerator(this, input, RightToLeft ? input.Length : 0);
System\Text\RegularExpressions\Regex.EnumerateSplits.cs (5)
136EnumerateSplits(input, count, startat: RightToLeft ? input.Length : 0); 166if ((uint)startat > (uint)input.Length) 202_lastMatch = (rtl ? input.Length : 0, -1); 225_currentSplit = !_regex.RightToLeft ? (_lastMatch.Index + _lastMatch.Length).._input.Length : 0.._lastMatch.Index; 244_currentSplit = start.._input.Length;
System\Text\RegularExpressions\Regex.Match.cs (1)
263IsMatch(input, RightToLeft ? input.Length : 0);
System\Text\RegularExpressions\Regex.Replace.cs (1)
690dest = dest.Slice(segment.Length);
System\Text\RegularExpressions\RegexCharClass.cs (13)
287for (i = 0; i < set.Length - 1; i += 2) 292if (i < set.Length) 1191return (uint)chDiv8 < (uint)ascii.Length ? 1210return (uint)chDiv8 < (uint)ascii.Length ? 1368for (int i = 0; i < categorySetSegment.Length; i++) 1539for (int index = 0; index < chars.Length - 1; index++) 1545switch (chars.Length) 1576int count = chars.Length * 2; 1577if (chars[chars.Length - 1] == LastChar) 1982Span<char> invertedGroup = group.Length <= scratch.Length ? scratch.Slice(0, group.Length) : new char[group.Length]; 1983for (int i = 0; i < group.Length; i++)
System\Text\RegularExpressions\RegexCompiler.cs (3)
6480Debug.Assert(chars.Length > 3, $"chars.Length == {chars.Length}"); 6484if (chars.Length is 4 or 5 && !Ascii.IsValid(chars))
System\Text\RegularExpressions\RegexFindOptimizations.cs (33)
439if (pos < textSpan.Length - 1 || ((uint)pos < (uint)textSpan.Length && textSpan[pos] != '\n')) 449if (pos < textSpan.Length) 496for (int i = span.Length - 1; i >= 0; i--) 525if (pos > textSpan.Length - MinRequiredLength) 527pos = textSpan.Length; 541if ((uint)posm1 < (uint)textSpan.Length && textSpan[posm1] != '\n') 544if ((uint)newline > textSpan.Length - 1 - pos) 546pos = textSpan.Length; 552if (pos > textSpan.Length - MinRequiredLength) 554pos = textSpan.Length; 571pos = textSpan.Length; 580pos = textSpan.Length; 584if (pos < textSpan.Length - 1) 588pos = textSpan.Length - 1; 593if (pos < textSpan.Length) 597pos = textSpan.Length; 602if (pos < textSpan.Length - MinRequiredLength - 1) 604pos = textSpan.Length - MinRequiredLength - 1; 609if (pos < textSpan.Length - MinRequiredLength) 611pos = textSpan.Length - MinRequiredLength; 626pos = textSpan.Length; 641pos = textSpan.Length; 675for (int i = 0; i < span.Length; i++) 685pos = textSpan.Length; 702pos = textSpan.Length; 717pos = textSpan.Length; 734pos = textSpan.Length; 745int endMinusRequiredLength = textSpan.Length - Math.Max(1, MinRequiredLength); 812pos = textSpan.Length; 841while ((uint)--prev < (uint)slice.Length && RegexCharClass.CharInClass(slice[prev], loopNode.Str!, ref _asciiLookups![0])) ; 858pos = textSpan.Length; 898if (c >= frequency.Length)
System\Text\RegularExpressions\RegexInterpreter.cs (8)
217if (inputSpan.Length - runtextpos < c) 257if (inputSpan.Length - runtextpos < length) 355if (TryMatchAtCurrentPosition(text) || runtextpos == text.Length) 742if ((uint)m1 < (uint)inputSpan.Length && inputSpan[m1] != '\n') 753if ((uint)runtextpos < (uint)inputSpan.Length && inputSpan[runtextpos] != '\n') 812if (runtextpos < inputSpan.Length - 1 || ((uint)runtextpos < (uint)inputSpan.Length && inputSpan[runtextpos] != '\n')) 821if (runtextpos < inputSpan.Length)
System\Text\RegularExpressions\RegexNode.cs (9)
1419Debug.Assert(startingSpan.Length > 0); 1441if (startingSpan.Length != 1) 1451int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1472Debug.Assert(startingSpan.Length > 0); 1478var prefix = startingSpan.Length == 1 ? 1495Debug.Assert(startingSpan.Length == 1); 1504if (node.Str!.Length == startingSpan.Length) 1509else if (node.Str.Length - 1 == startingSpan.Length) 1517node.Str = node.Str.Substring(startingSpan.Length);
System\Text\RegularExpressions\RegexParser.cs (3)
166ValueStringBuilder vsb = input.Length <= (EscapeMaxBufferSize / 3) ? 168new ValueStringBuilder(input.Length + 200); 205indexOfMetachar = input.Length;
System\Text\RegularExpressions\RegexReplacement.cs (1)
275for (int i = 0; i < span.Length; i += 2)
System\Text\RegularExpressions\RegexRunner.cs (12)
143if (s == null || text != s.AsSpan(beginning, text.Length)) 160InternalScan(runregex!, beginning, beginning + text.Length); 286runtextend = text.Length; 294new Match(runregex, runregex.capsize, runtext, text.Length) : 295new MatchSparse(runregex, runregex.caps, runregex.capsize, runtext, text.Length); 299m.Reset(runtext, text.Length); 420return ((uint)indexM1 < (uint)inputSpan.Length && RegexCharClass.IsBoundaryWordChar(inputSpan[indexM1])) != 421((uint)index < (uint)inputSpan.Length && RegexCharClass.IsBoundaryWordChar(inputSpan[index])); 430return (uint)indexMinus1 >= (uint)inputSpan.Length || !RegexCharClass.IsBoundaryWordChar(inputSpan[indexMinus1]); 437(uint)index >= (uint)inputSpan.Length || !RegexCharClass.IsBoundaryWordChar(inputSpan[index]); 452return ((uint)indexM1 < (uint)inputSpan.Length && RegexCharClass.IsECMAWordChar(inputSpan[indexM1])) != 453((uint)index < (uint)inputSpan.Length && RegexCharClass.IsECMAWordChar(inputSpan[index]));
System\Text\RegularExpressions\Symbolic\BDD.cs (3)
341Debug.Assert(bytes.Length > 1, "All inputs are expected to be larger than a single byte, which would map to False or True."); 347int n = (bytes.Length - 1) / bytesPerLong; 350Debug.Assert((bytes.Length - 1) % bytesPerLong == 0);
System\Text\RegularExpressions\Symbolic\CharSetSolver.cs (4)
153if (sets.Length == 0) 159for (int i = 1; i < sets.Length; i++) 172if (sets.Length == 0) 178for (int i = 1; i < sets.Length; i++)
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.cs (22)
356Debug.Assert(startat >= 0 && startat <= input.Length, $"{nameof(startat)} == {startat}, {nameof(input.Length)} == {input.Length}"); 497int lengthMinus1 = input.Length - 1; 515innerLoopLength = _checkTimeout && input.Length - pos > NfaCharsPerTimeoutCheck ? pos + NfaCharsPerTimeoutCheck : input.Length; 523if (done || pos >= input.Length) 581innerLoopLength = _checkTimeout && input.Length - pos > DfaCharsPerTimeoutCheck ? pos + DfaCharsPerTimeoutCheck : input.Length; 589innerLoopLength = _checkTimeout && input.Length - pos > NfaCharsPerTimeoutCheck ? pos + NfaCharsPerTimeoutCheck : input.Length; 596if (done || pos >= input.Length) 638if (pos == input.Length) 663if (pos == input.Length) 696if (pos + 1 < input.Length) 866Debug.Assert(matchStartBoundary >= 0 && matchStartBoundary <= input.Length, $"{nameof(matchStartBoundary)} == {matchStartBoundary}"); 1484if ((uint)pos < (uint)input.Length) 1488return c == '\n' && pos == input.Length - 1 && matcher._containsEndZAnchor ? 1502(uint)pos < (uint)input.Length ? 1560Debug.Assert(pos == input.Length); 1591Debug.Assert(pos == input.Length); 1621Debug.Assert(pos == input.Length);
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Dgml.cs (3)
152Debug.Assert(deltas.Length == matcher._minterms.Length); 153for (int i = 0; i < deltas.Length; ++i) 167if (nfaDeltas.Length > 0 && nfaDeltas[i] is int[] nfaTargets)
System\Text\RegularExpressions\Symbolic\SymbolicRegexRunnerFactory.cs (1)
108runtextpos = text.Length;
System.Text.RegularExpressions.Generator (70)
RegexGenerator.Emitter.cs (3)
522Debug.Assert(chars.Length > 3); 528return chars.Length > 5 || Ascii.IsValid(chars) 5739if ((uint)cat < (uint)categoryDescriptions.Length &&
src\runtime\src\libraries\Common\src\Polyfills\EncodingPolyfills.cs (6)
17return encoding.GetByteCount(charsPtr, chars.Length); 25return encoding.GetCharCount(bytesPtr, bytes.Length); 39return encoding.GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length); 48return encoding.GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length); 56return encoding.GetString(bytesPtr, bytes.Length); 79return ref buffer.Length != 0 ? ref MemoryMarshal.GetReference(buffer) : ref Unsafe.AsRef<T>((void*)1);
src\runtime\src\libraries\Common\src\Polyfills\MemoryExtensionsPolyfills.cs (4)
16for (int i = 0; i < span.Length; i++) 33for (int i = 0; i < span.Length; i++) 46int length = Math.Min(span.Length, other.Length);
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
162switch (span.Length) 170var builder = ImmutableArray.CreateBuilder<T>(span.Length);
src\runtime\src\libraries\Common\src\System\Buffers\SearchValuesPolyfills.cs (2)
100for (int i = 0; i < span.Length; i++) 113for (int i = 0; i < span.Length; i++)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (8)
69if (source.Length == 1 && (uint)pos < (uint)span.Length) 83if ((uint)(_pos + source.Length) > (uint)_span.Length) 85Grow(source.Length); 89_pos += source.Length; 96if ((uint)(_pos + source.Length) > (uint)_span.Length) 98Grow(source.Length); 101_span.Slice(0, _pos).CopyTo(_span.Slice(source.Length)); 103_pos += source.Length;
src\runtime\src\libraries\Common\src\System\HexConverter.cs (12)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 228Span<char> result = (bytes.Length > 16) ? 229new char[bytes.Length * 2].AsSpan() : 230stackalloc char[bytes.Length * 2]; 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\AsciiPolyfills.cs (1)
21int length = value.Length;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (13)
287for (i = 0; i < set.Length - 1; i += 2) 292if (i < set.Length) 1191return (uint)chDiv8 < (uint)ascii.Length ? 1210return (uint)chDiv8 < (uint)ascii.Length ? 1368for (int i = 0; i < categorySetSegment.Length; i++) 1539for (int index = 0; index < chars.Length - 1; index++) 1545switch (chars.Length) 1576int count = chars.Length * 2; 1577if (chars[chars.Length - 1] == LastChar) 1982Span<char> invertedGroup = group.Length <= scratch.Length ? scratch.Slice(0, group.Length) : new char[group.Length]; 1983for (int i = 0; i < group.Length; i++)
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
898if (c >= frequency.Length)
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (9)
1419Debug.Assert(startingSpan.Length > 0); 1441if (startingSpan.Length != 1) 1451int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1472Debug.Assert(startingSpan.Length > 0); 1478var prefix = startingSpan.Length == 1 ? 1495Debug.Assert(startingSpan.Length == 1); 1504if (node.Str!.Length == startingSpan.Length) 1509else if (node.Str.Length - 1 == startingSpan.Length) 1517node.Str = node.Str.Substring(startingSpan.Length);
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexParser.cs (3)
166ValueStringBuilder vsb = input.Length <= (EscapeMaxBufferSize / 3) ? 168new ValueStringBuilder(input.Length + 200); 205indexOfMetachar = input.Length;
Stubs.cs (3)
22return stringBuilder.Append(ptr, span.Length); 48int length = Math.Min(span.Length, other.Length);
System.Threading.AccessControl (1)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
80int length = buffer.Length;
System.Web.HttpUtility (18)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (10)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 198for (int pos = 0; pos < source.Length; pos++) 206Debug.Assert(destination.Length >= (source.Length * 2)); 215for (int pos = 0; pos < source.Length; pos++) 225return string.Create(bytes.Length * 2, args, static (chars, args) => 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 529return (c >= CharToHexLookup.Length) ? 0xFF : CharToHexLookup[c];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (3)
212if (pos > _chars.Length - value.Length) 214Grow(value.Length); 218_pos += value.Length;
System\Web\Util\HttpEncoder.cs (5)
76for (int i = 0; i < remaining.Length; i++) 211int count = bytes.Length; 324int count = value.Length; 415byte[] expandedBytes = new byte[bytes.Length + cUnsafe * 2]; 570byte[] bytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(toEncode.Length));
System.Windows.Forms (22)
_generated\2\RegexGenerator.g.cs (4)
69base.runtextpos != inputSpan.Length) 87if ((uint)pos < (uint)inputSpan.Length) 100base.runtextpos = inputSpan.Length; 116while ((uint)iteration < (uint)slice.Length && !char.IsWhiteSpace(slice[iteration]))
System\Windows\Forms\ActiveX\AxHost.VBFormat.cs (3)
53if (format.Length >= buffer.Length) 60buffer[format.Length] = '\0'; 61*rcb = (ushort)(format.Length * sizeof(char));
System\Windows\Forms\ActiveX\DataStreamFromComStream.cs (2)
141_comStream->Write(b, (uint)buffer.Length, &bytesWritten); 144if (bytesWritten < buffer.Length)
System\Windows\Forms\Controls\ImageList\ImageListStreamer.cs (2)
39int length = RunLengthEncoder.GetEncodedLength(input) + HeaderMagic.Length; 44Debug.Assert(written == length - HeaderMagic.Length, "RLE compression failure");
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\MultiSelectRootGridEntry.PropertyMerger.cs (3)
137var objectProperties = new PropertyDescriptorCollection[objects.Length]; 145for (int i = 0; i < objects.Length; i++) 168var matchArray = new PropertyDescriptor[objects.Length];
System\Windows\Forms\Dialogs\CommonDialogs\FileDialog.cs (7)
459var fileNames = fileBuffer[(directory.Length + 1)..]; 463if (fileNames.Length == 0 || fileNames[0] == '\0') 470while (fileName.Length > 0) 476fileNames = fileNames[(fileName.Length + 1)..]; 634Debug.Assert(currentExtension.Length == 0 || currentExtension[0] == '.', 639? $"{fileName[..^currentExtension.Length]}.{extensions[j]}" 640: fileName[..^currentExtension.Length];
System\Windows\Forms\SendKeys\SendKeys.cs (1)
322if (keystate.Length < 256)
System.Windows.Forms.Design (10)
_generated\2\RegexGenerator.g.cs (4)
90base.runtextpos != inputSpan.Length) 108if (pos <= inputSpan.Length - 4) 121base.runtextpos = inputSpan.Length; 134if ((uint)slice.Length < 4 ||
System\ComponentModel\Design\ByteViewer.cs (5)
185Debug.Assert(charsBuffer.Length >= lineBuffer.Length); 186Span<char> charsToDraw = charsBuffer[..lineBuffer.Length]; 187for (int i = 0; i < lineBuffer.Length; i++) 207Debug.Assert(charsBuffer.Length >= lineBuffer.Length * 3 + 1); 209for (int i = 0; i < lineBuffer.Length; i++)
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (1)
1305for (int i = 0; i < compatibleTypes.Length; i++)
System.Windows.Forms.Primitives (145)
_generated\107\Windows.Win32.IAccessible.g.cs (2)
93 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 94 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\12\Windows.Win32.byte.InlineArrays.g.cs (2)
60 int initLength = value.Length; 106 int initLength = value.Length;
_generated\130\Windows.Win32.IFileDialog.g.cs (1)
87 this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
_generated\133\Windows.Win32.IFileOpenDialog.g.cs (1)
87 this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
_generated\135\Windows.Win32.IFileSaveDialog.g.cs (1)
87 this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
_generated\137\Windows.Win32.IFontDisp.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\142\Windows.Win32.IHTMLCurrentStyle.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\143\Windows.Win32.IHTMLDataTransfer.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\144\Windows.Win32.IHTMLDocument.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\145\Windows.Win32.IHTMLDocument2.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\146\Windows.Win32.IHTMLDocument3.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\147\Windows.Win32.IHTMLDocument4.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\148\Windows.Win32.IHTMLDOMNode.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\149\Windows.Win32.IHTMLElement.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\150\Windows.Win32.IHTMLElement2.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\151\Windows.Win32.IHTMLElement3.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\152\Windows.Win32.IHTMLElementCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\153\Windows.Win32.IHTMLEventObj.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\154\Windows.Win32.IHTMLFiltersCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\155\Windows.Win32.IHTMLFormElement.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\156\Windows.Win32.IHTMLFrameBase.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\157\Windows.Win32.IHTMLFramesCollection2.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\158\Windows.Win32.IHTMLImageElementFactory.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\159\Windows.Win32.IHTMLImgElement.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\160\Windows.Win32.IHTMLLocation.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\161\Windows.Win32.IHTMLMimeTypesCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\162\Windows.Win32.IHTMLOpsProfile.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\163\Windows.Win32.IHTMLOptionElement.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\164\Windows.Win32.IHTMLOptionElementFactory.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\165\Windows.Win32.IHTMLPluginsCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\166\Windows.Win32.IHTMLRect.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\167\Windows.Win32.IHTMLRectCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\168\Windows.Win32.IHTMLRenderStyle.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\169\Windows.Win32.IHTMLRuleStyle.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\170\Windows.Win32.IHTMLScreen.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\171\Windows.Win32.IHTMLSelectionObject.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\172\Windows.Win32.IHTMLStyle.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\173\Windows.Win32.IHTMLStyleSheet.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\174\Windows.Win32.IHTMLStyleSheetRule.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\175\Windows.Win32.IHTMLStyleSheetRulesCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\176\Windows.Win32.IHTMLStyleSheetsCollection.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\177\Windows.Win32.IHTMLWindow2.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\178\Windows.Win32.IHTMLWindow3.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\179\Windows.Win32.IHTMLWindow4.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\182\Windows.Win32.ILockBytes.g.cs (2)
122 this.WriteAt(ulOffset, (void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 132 this.WriteAt(ulOffset, (void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\19\Windows.Win32.char.InlineArrays.g.cs (10)
55 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 78 int initLength = value.Length; 119 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 142 int initLength = value.Length; 183 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 206 int initLength = value.Length; 247 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 270 int initLength = value.Length; 311 internal readonly bool Equals(ReadOnlySpan<char> value) => value.Length == SpanLength ? AsReadOnlySpan().SequenceEqual(value) : AsReadOnlySpan().SliceAtNull().SequenceEqual(value); 334 int initLength = value.Length;
_generated\197\Windows.Win32.int.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\216\Windows.Win32.IOmHistory.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\217\Windows.Win32.IOmNavigator.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\252\Windows.Win32.ITextDocument.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\253\Windows.Win32.ITextFont.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\254\Windows.Win32.ITextPara.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\257\Windows.Win32.ITextRange.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\259\Windows.Win32.ITextSelection.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\260\Windows.Win32.ITextStoryRanges.g.cs (2)
86 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 87 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\262\Windows.Win32.IUIAutomation.g.cs (2)
1241 this.AddPropertyChangedEventHandlerNativeArray(element, scope, cacheRequest, handler, propertyArrayLocal, propertyArray.Length); 1589 winmdroot.System.Com.SAFEARRAY* __result = this.IntNativeArrayToSafeArray(arrayLocal, array.Length);
_generated\280\Windows.Win32.IWebBrowser.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\281\Windows.Win32.IWebBrowser2.g.cs (2)
97 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 98 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\282\Windows.Win32.IWebBrowserApp.g.cs (2)
85 if (!rgszNames.IsEmpty && !rgDispId.IsEmpty && rgszNames.Length != rgDispId.Length) throw new ArgumentException(); 86 this.GetIDsOfNames(riidLocal, rgszNamesLocal, (uint )(rgDispId.IsEmpty ? rgszNames.Length : rgDispId.Length), lcid, rgDispIdLocal);
_generated\413\Windows.Win32.PInvoke.dwmapi.dll.g.cs (1)
64 winmdroot.Foundation.HRESULT __result = PInvoke.DwmSetWindowAttribute(hwnd, dwAttribute, (void* )pvAttributeLocal, (uint )pvAttribute.Length);
_generated\415\Windows.Win32.PInvoke.GDI32.dll.g.cs (2)
113 winmdroot.Foundation.BOOL __result = PInvoke.ExtTextOut(hdc, x, y, options, lprect.HasValue ? &lprectLocal : null, lpStringLocal, (uint )lpDx.Length, lpDxLocal); 544 winmdroot.Foundation.BOOL __result = PInvoke.LPtoDP(hdc, lpptLocal, lppt.Length);
_generated\426\Windows.Win32.PInvoke.USER32.dll.g.cs (4)
396 winmdroot.UI.WindowsAndMessaging.HACCEL __result = PInvoke.CreateAcceleratorTable(paccelLocal, paccel.Length); 2693 winmdroot.Foundation.WAIT_EVENT __result = PInvoke.MsgWaitForMultipleObjectsEx((uint )pHandles.Length, pHandlesLocal, dwMilliseconds, dwWakeMask, dwFlags); 3169 uint __result = PInvoke.SendInput((uint )pInputs.Length, pInputsLocal, cbSize); 3449 if (lpKeyState.Length < 256) throw new ArgumentException();
_generated\486\Windows.Win32.System_Com_StructuredStorage_ILockBytes_Extensions.g.cs (2)
55 winmdroot.Foundation.HRESULT __result = @this.WriteAt(ulOffset, (void* )pvLocal, (uint )pv.Length, pcbWrittenLocal); 66 winmdroot.Foundation.HRESULT __result = @this.WriteAt(ulOffset, (void* )pvLocal, (uint )pv.Length, default(uint* ));
_generated\565\Windows.Win32.uint.InlineArrays.g.cs (1)
60 int initLength = value.Length;
_generated\587\Windows.Win32.UI_Accessibility_IUIAutomation_Extensions.g.cs (2)
49 winmdroot.Foundation.HRESULT __result = @this.AddPropertyChangedEventHandlerNativeArray(element, scope, cacheRequest, handler, propertyArrayLocal, propertyArray.Length); 62 winmdroot.Foundation.HRESULT __result = @this.IntNativeArrayToSafeArray(arrayLocal, array.Length, safeArrayLocal);
_generated\603\Windows.Win32.UI_Shell_IFileDialog_Extensions.g.cs (1)
29 winmdroot.Foundation.HRESULT __result = @this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
_generated\604\Windows.Win32.UI_Shell_IFileOpenDialog_Extensions.g.cs (1)
29 winmdroot.Foundation.HRESULT __result = @this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
_generated\606\Windows.Win32.UI_Shell_IFileSaveDialog_Extensions.g.cs (1)
29 winmdroot.Foundation.HRESULT __result = @this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
System\Windows\Forms\DeviceContextExtensions.cs (2)
82Debug.Assert((lines.Length % 4) == 0); 90for (int i = 0; i < lines.Length; i += 4)
System\Windows\Forms\SystemDrawingExtensions.cs (2)
56Debug.Assert((lines.Length % 4) == 0); 58for (int i = 0; i < lines.Length; i += 4)
Windows\Win32\PInvoke.DrawTextEx.cs (1)
20return DrawTextEx(hdc, (PWSTR)c, lpchText.Length, lprc, format, lpdtp);
Windows\Win32\UI\Controls\LVITEMW.cs (3)
15if (cchTextMax <= text.Length) 21cchTextMax = text.Length + 1; 27pszText.Value[text.Length] = '\0';
System.Xaml (7)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ReflectionUtils.cs (5)
66fullName = fullName.Slice(0, fullName.Length - nameSlice.Length + commaIndex); 108int tokenLength = tokenEnding == 0 ? assemblyName.Slice(versionIndex).Length : tokenEnding; 118int tokenLength = tokenEnding == 0 ? assemblyName.Slice(tokenIndex).Length : tokenEnding; 123if (assemblyToken.Length != 16)
System\Xaml\Parser\GenericTypeNameScanner.cs (1)
146while (pos < subscript.Length);
System\Xaml\Schema\XamlNamespace.cs (1)
144while (pos < subscript.Length);
UIAutomationClientSideProviders (5)
MS\Internal\AutomationProxies\ProxyHwnd.cs (2)
85if (aEvents.Length > 0) 114if (aEvents.Length > 0)
MS\Internal\AutomationProxies\WindowsComboBox.cs (2)
307if (editPortionEvents.Length > 0) 343if (editPortionEvents.Length > 0)
MS\Internal\AutomationProxies\WinEventTracker.cs (1)
586private static Hashtable[] _ahp = new Hashtable[EventIdToIndex.Length];
VBCSCompiler (1)
src\roslyn\src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
261if (parsedLogFilePath.Length == 0)