581 references to Length
Aspire.Dashboard (2)
Otlp\Model\OtlpHelpers.cs (2)
71if (bytes.Length == 0) 78return string.Create(bytes.Length * 2, bytes, static (chars, bytes) =>
GenerateDocumentationAndConfigFiles (2)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
509if (!chunk.Span.Equals(array.AsSpan().Slice(chunkOffset, chunk.Length), StringComparison.Ordinal)) 512chunkOffset += chunk.Length;
Microsoft.Agents.AI.ProjectTemplates.Tests (1)
WebApiAgentTemplateExecutionTests.cs (1)
108if (options.Length == 0)
Microsoft.AspNetCore.Components (1)
NavigationManagerExtensions.cs (1)
761newQueryStringBuilder = new(uriWithoutQueryStringAndHash, query.Length + hash.Length);
Microsoft.AspNetCore.Components.Endpoints (2)
FormMapping\PrefixResolver.cs (2)
30if (currentPrefixBuffer.Length == 0) 32return _length > 0 && !(_length == 1 && _sortedKeys[0].Value.Length == 0);
Microsoft.AspNetCore.Components.Forms (2)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
149next.RunningIndex = tail.RunningIndex + tail.Memory.Length; 153var sequence = new ReadOnlySequence<char>(this, startIndex, tail, tail.Memory.Length);
Microsoft.AspNetCore.Components.Server (6)
BlazorPack\SequenceOfT.cs (1)
423Requires.Range(count >= 0 && this.End + count <= this.Memory.Length, nameof(count));
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (5)
92this.length = memory.Length; 93this.moreData = memory.Length > 0; 280if (memory.Length == 0) 312if (memory.Length > 0) 481if (nextSegment.Length > 0)
Microsoft.AspNetCore.Components.Web (2)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
149next.RunningIndex = tail.RunningIndex + tail.Memory.Length; 153var sequence = new ReadOnlySequence<char>(this, startIndex, tail, tail.Memory.Length);
Microsoft.AspNetCore.Http.Connections (5)
ServerSentEventsMessageFormatter.cs (4)
55if (offset + memory.Length >= totalLength) 60offset += memory.Length; 88if (memory.Span[memory.Length - 1] == '\r') 90lineSegment = lineSegment.Slice(lineSegment.Start, offset + memory.Length - 1);
src\SignalR\common\Shared\PipeWriterStream.cs (1)
75_length += source.Length;
Microsoft.AspNetCore.Http.Connections.Client (1)
src\SignalR\common\Shared\PipeWriterStream.cs (1)
75_length += source.Length;
Microsoft.AspNetCore.Http.Connections.Tests (2)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
Microsoft.AspNetCore.Http.Extensions (2)
src\Components\Endpoints\src\FormMapping\PrefixResolver.cs (2)
30if (currentPrefixBuffer.Length == 0) 32return _length > 0 && !(_length == 1 && _sortedKeys[0].Value.Length == 0);
Microsoft.AspNetCore.Http.Results (2)
FileContentHttpResult.cs (1)
63FileLength = fileContents.Length;
Utf8ContentHttpResult.cs (1)
67httpContext.Response.ContentLength = ResponseContent.Length;
Microsoft.AspNetCore.Identity (9)
Passkeys\AttestedCredentialData.cs (2)
56if (data.Length < MinLength) 58throw PasskeyException.InvalidAttestedCredentialDataLength(data.Length);
Passkeys\AuthenticatorData.cs (4)
100if (bytes.Length < MinLength) 102throw PasskeyException.InvalidAuthenticatorDataLength(bytes.Length); 129offset += extensions.Value.Length; 132if (offset != bytes.Length)
Passkeys\BufferSource.cs (1)
27public int Length => _bytes.Length;
Passkeys\CredentialPublicKey.cs (2)
80var keyLength = bytes.Length - reader.BytesRemaining; 103bytesRead = key._bytes.Length;
Microsoft.AspNetCore.Identity.Test (9)
Passkeys\CredentialHelpers.cs (9)
15var length = AaguidLength + CredentialIdLengthLength + args.CredentialId.Length + args.CredentialPublicKey.Length; 22BinaryPrimitives.WriteUInt16BigEndian(result.AsSpan(offset, CredentialIdLengthLength), (ushort)args.CredentialId.Length); 26offset += args.CredentialId.Length; 29offset += args.CredentialPublicKey.Length; 48(args.AttestedCredentialData?.Length ?? 0) + 49(args.Extensions?.Length ?? 0); 65offset += attestedCredentialData.Length; 71offset += extensions.Length;
Microsoft.AspNetCore.OutputCaching (6)
FormatterBinaryReader.cs (1)
30_length = content.Length;
OutputCacheEntryFormatter.cs (1)
139writer.Write7BitEncodedInt(entry.Headers.Length);
RecyclableReadOnlySequenceSegment.cs (1)
21public int Length => Memory.Length;
RecyclableSequenceBuilder.cs (2)
75Debug.Assert(_currentSegmentIndex >= 0 && _currentSegmentIndex <= current.Length); 77if (_currentSegmentIndex == current.Length)
Streams\OutputCacheStream.cs (1)
174if (_segmentWriteStream.Length + buffer.Length > _maxBufferSize)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (2)
EndToEndBenchmarks.cs (2)
111var bytes = Math.Min(rand.Next(4, 1024), value.Length); 217if (value.Headers.Length != _headers.Count - 2)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
272var len = tags.Length;
Microsoft.AspNetCore.OutputCaching.Tests (1)
OutputCacheEntryFormatterTests.cs (1)
81Assert.Equal(3, result.Headers.Length);
Microsoft.AspNetCore.ResponseCaching (1)
Streams\ResponseCachingStream.cs (1)
148if (_segmentWriteStream.Length + buffer.Length > _maxBufferSize)
Microsoft.AspNetCore.Server.IIS (2)
Core\IO\AsyncIOEngine.cs (1)
75length += segment.Length;
Core\IO\AsyncWriteOperationBase.cs (1)
113chunk.Anonymous.FromMemory.BufferLength = (uint)readOnlyMemory.Length;
Microsoft.AspNetCore.Server.Kestrel.Core (7)
Internal\Http\HttpParser.cs (2)
354var headerLength = memory.Length; 368headerLength += memory.Length;
Internal\Http\HttpProtocol.cs (5)
1599VerifyAndUpdateWrite(data.Length); 1608if (data.Length == 0) 1648var responseHeaders = InitializeResponseFirstWrite(data.Length); 1657if (data.Length == 0) 1705if (data.Length == 0)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (8)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
src\Shared\test\Shared.Tests\runtime\Http3\VariableLengthIntegerHelperTests.cs (6)
163RunningIndex = RunningIndex + Memory.Length 178memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 194memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 210memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 225memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 240memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
HttpParserBenchmark.cs (1)
29_multispanHeader = new ReadOnlySequence<byte>(segment, 0, next, next.Memory.Length);
Microsoft.AspNetCore.Shared.Tests (7)
Buffers\PooledArrayBufferWriterTests.cs (1)
133Assert.Equal(2, writtenMemory.Length);
runtime\Http3\VariableLengthIntegerHelperTests.cs (6)
163RunningIndex = RunningIndex + Memory.Length 178memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 194memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 210memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 225memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length); 240memorySegment1, 0, memorySegment2, memorySegment2.Memory.Length);
Microsoft.AspNetCore.SignalR.Client.Core (4)
src\SignalR\common\Shared\MessageBuffer.cs (3)
165_bufferedByteCount += messageBytes.Length; 379returnCredit += linkedBuffer._messages[i].Length; 499if (_linkedBuffer._messages[firstMessageIndex + _index].Length == 0)
src\SignalR\common\Shared\PipeWriterStream.cs (1)
75_length += source.Length;
Microsoft.AspNetCore.SignalR.Common.Tests (2)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
Microsoft.AspNetCore.SignalR.Core (3)
src\SignalR\common\Shared\MessageBuffer.cs (3)
165_bufferedByteCount += messageBytes.Length; 379returnCredit += linkedBuffer._messages[i].Length; 499if (_linkedBuffer._messages[firstMessageIndex + _index].Length == 0)
Microsoft.AspNetCore.SignalR.Microbenchmarks (8)
HubProtocolBenchmark.cs (2)
73if (bytes.Length != _binaryInput.Length)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
src\SignalR\common\Http.Connections\src\ServerSentEventsMessageFormatter.cs (4)
55if (offset + memory.Length >= totalLength) 60offset += memory.Length; 88if (memory.Span[memory.Length - 1] == '\r') 90lineSegment = lineSegment.Slice(lineSegment.Start, offset + memory.Length - 1);
Microsoft.AspNetCore.WebUtilities (8)
FileBufferingWriteStream.cs (2)
151if (_bufferLimit.HasValue && _bufferLimit - Length < buffer.Length) 158var allowMemoryBuffer = (_memoryThreshold - buffer.Length) >= PagedByteBuffer.Length;
HttpResponseStreamWriter.cs (5)
330if (remaining >= value.Length) 344Debug.Assert(value.Length > 0); 345Debug.Assert(_charBufferSize - _charBufferCount < value.Length); 347var remaining = value.Length; 382if (remaining >= value.Length + NewLine.Length)
PagedByteBuffer.cs (1)
53var copyLength = Math.Min(memory.Length, currentPage.Length - _currentPageIndex);
Microsoft.AspNetCore.WebUtilities.Microbenchmarks (2)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
Microsoft.AspNetCore.WebUtilities.Tests (2)
src\Shared\Buffers.Testing\BufferSegment.cs (1)
17RunningIndex = RunningIndex + Memory.Length
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (1)
146return new ReadOnlySequence<byte>(first, 0, last, last.Memory.Length);
Microsoft.CodeAnalysis (13)
CommandLine\CommandLineParser.cs (6)
228if (parts.Count == 0 || parts[0].Length == 0) 244if (parts.Count > 1 && parts[1].Length > 0) 845for (; offset < length && parts[offset].Length == 0; offset++) 1033int end = arg.Length; 1101if (current.Length > 0 || !removeEmptyEntries) 1111if (last.Length > 0 || !removeEmptyEntries)
InternalUtilities\StringTable.cs (2)
509if (!chunk.Span.Equals(array.AsSpan().Slice(chunkOffset, chunk.Length), StringComparison.Ordinal)) 512chunkOffset += chunk.Length;
MemoryExtensions.cs (3)
72memory is not { Length: > 0 }; 91internal static bool StartsWith(this ReadOnlyMemory<char> memory, char c) => memory.Length > 0 && memory.Span[0] == c; 98return memory.Slice(1, memory.Length - 2);
MetadataReader\MetadataHelpers.cs (2)
578Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 613if (nameMemory.Length == 0)
Microsoft.CodeAnalysis.CSharp (13)
CommandLine\CSharpCommandLineParser.cs (12)
242if (valueMemory.Value.Length == 0) 364if (valueMemory is not { Length: > 0 }) 563if (valueMemory is not { Length: > 0 }) 929if (valueMemory.Value.Length == 0) 950if (valueMemory is not { Length: > 0 }) 1293if (valueMemory is not { Length: > 0 }) 1335if (valueMemory is not { Length: > 0 }) 1350if (valueMemory is not { Length: > 0 }) 1635if (switchValue is not { Length: > 0 }) 1909else if (value.Length == 0) 1919if (path.Length == 0) 1938if (value.Length == 0)
Compilation\CSharpCompilation.cs (1)
1145Debug.Assert(contentHash.Length == InterceptableLocation1.ContentHashLength);
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.DocCommentFormatter.cs (1)
231if (source.Length > 0)
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Host\AssetProvider.cs (1)
299Contract.ThrowIfTrue(missingChecksumsMemory.Length == 0);
Host\SolutionAssetSource.cs (1)
35(pipeReader, cancellationToken) => new RemoteHostAssetReader<T, TArg>(pipeReader, solutionChecksum, checksums.Length, serializerService, assetCallback, arg).ReadDataAsync(cancellationToken),
Microsoft.CodeAnalysis.Remote.Workspaces (1)
RemoteHostAssetWriter.cs (1)
114Contract.ThrowIfTrue(foundChecksumCount != _checksums.Length);
Microsoft.CodeAnalysis.Test.Utilities (1)
FX\PinnedBlob.cs (1)
31this.Size = blob.Length;
Microsoft.CodeAnalysis.Workspaces (8)
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (3)
131offsetOfReferenceInToken = prefix.Length; 133if (expectedDocCommentId.Length < docCommentId.Length) 290id = docCommentId.AsMemory()[prefix.Length..];
FindSymbols\SymbolTree\SymbolTreeInfo_Serialization.cs (3)
112writer.WriteInt32(group.Length); 177for (var i = 1; i < sortedNodes.Length; i++) 187yield return sortedNodes[startIndex..sortedNodes.Length];
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
509if (!chunk.Span.Equals(array.AsSpan().Slice(chunkOffset, chunk.Length), StringComparison.Ordinal)) 512chunkOffset += chunk.Length;
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
509if (!chunk.Span.Equals(array.AsSpan().Slice(chunkOffset, chunk.Length), StringComparison.Ordinal)) 512chunkOffset += chunk.Length;
Microsoft.Data.Analysis (6)
DataFrameBuffer.cs (2)
53_memory = new byte[buffer.Length]; 83var doubledSize = (int)Math.Min((long)ReadOnlyBuffer.Length * 2, ArrayUtility.ArrayMaxSize);
DataFrameColumns\ArrowStringDataFrameColumn.cs (2)
49ReadOnlyDataFrameBuffer<byte> dataBuffer = new ReadOnlyDataFrameBuffer<byte>(values, values.Length); 51ReadOnlyDataFrameBuffer<byte> nullBitMapBuffer = new ReadOnlyDataFrameBuffer<byte>(nullBits, nullBits.Length);
PrimitiveColumnContainer.cs (1)
90if (nullBitMap.Length < bitMapBufferLength)
ReadOnlyDataFrameBuffer.cs (1)
37protected int Capacity => ReadOnlyBuffer.Length / Size;
Microsoft.Extensions.AI.Abstractions (5)
Contents\DataContent.cs (1)
160"data:".Length + MediaType.Length + ";base64,".Length + Base64.GetMaxEncodedToUtf8Length(data.Length));
Contents\DataUriParser.cs (1)
53metadata = metadata.Slice(0, metadata.Length - ";base64".Length);
Embeddings\Embedding{T}.cs (1)
26public override int Dimensions => Vector.Length;
Functions\AIFunctionFactory.cs (2)
1316EnsureCapacity(_position + buffer.Length); 1319_position += buffer.Length;
Microsoft.Extensions.AI.OpenAI (1)
OpenAIResponsesContinuationToken.cs (1)
65if (data.Length == 0)
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAIEmbeddingGeneratorTests.cs (4)
145Assert.Equal(1536, e.Vector.Length); 214Assert.Equal(1536, e.Vector.Length); 257Assert.Equal(1, e.Vector.Length); 300Assert.Equal(1, e.Vector.Length);
OpenAIResponseClientTests.cs (1)
5226Assert.True(imageData.Data.Length > 0);
Microsoft.Extensions.AI.Templates.Tests (1)
AIChatWebExecutionTests.cs (1)
187if (options.Length == 0)
Microsoft.Extensions.Caching.Hybrid.Tests (5)
DistributedCacheTests.cs (3)
184Assert.Equal(size, expected.Length); 246Assert.Equal(size, expected.Length); 363RunningIndex = previous.RunningIndex + previous.Memory.Length;
SerializerTests.cs (2)
316var result = new ReadOnlySequence<byte>(first, 0, second, chunk.Length - 1); 327RunningIndex = previous.RunningIndex + previous.Memory.Length;
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Linux\OSFileSystem.cs (1)
96if (destination.WrittenMemory.Length > 0)
Microsoft.Extensions.ServiceDiscovery.Dns (9)
Resolver\DnsDataWriter.cs (2)
50Debug.Assert(label.Length <= 63, "Label length must not exceed 63 bytes."); 52if (!TryWriteByte((byte)label.Length) ||
Resolver\DnsPrimitives.cs (3)
181if (offset < 0 || offset >= messageBuffer.Length) 202if (currentOffset + 1 + length >= messageBuffer.Length) 228if (!allowPointer || currentOffset + 1 >= messageBuffer.Length)
Resolver\DnsResolver.cs (4)
76if (!DnsPrimitives.TryReadService(answer.Data, out ushort priority, out ushort weight, out ushort port, out EncodedDomainName target, out int bytesRead) || bytesRead != answer.Data.Length) 317bool result = DnsPrimitives.TryReadQName(segment.Array.AsMemory(messageOffset, segment.Offset + segment.Count - messageOffset), segment.Offset - messageOffset, out EncodedDomainName targetName, out int bytesRead) && bytesRead == record.Data.Length; 331if (record.Type == QueryType.A && record.Data.Length != IPv4Length || 332record.Type == QueryType.AAAA && record.Data.Length != IPv6Length)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Resolver\DnsPrimitivesTests.cs (1)
95for (int i = 0; i < data.Length; i++)
Resolver\LoopbackDnsServer.cs (2)
316if (label.Length > 63) 321if (!writer.TryWriteByte((byte)label.Length) ||
Microsoft.ML.AutoML (1)
ColumnInference\PurposeInference.cs (1)
131sumLength += span.Length;
Microsoft.ML.Core (12)
Data\ModelHeader.cs (1)
153offset += ns.Value.Length * sizeof(char);
Data\ReadOnlyMemoryUtils.cs (7)
26return memory.Length == 0; 28if (s.Length != memory.Length) 111right = memory.Slice(index + 1, memory.Length - index - 1); 146right = memory.Slice(index + 1, memory.Length - index - 1); 159int ichLim = memory.Length; 181int ichLim = memory.Length; 202int ichLim = memory.Length;
Utilities\NormStr.cs (4)
129if ((int)Utils.GetLo(meta) == str.Length) 214Contracts.Assert(str.Length >= 0); 235_rgmeta[_cns] = Utils.MakeUlong((uint)_rgins[iins], (uint)ns.Value.Length); 272_rgmeta[ins] = Utils.MakeUlong((uint)_rgins[iins], (uint)ns.Value.Length);
Microsoft.ML.Data (10)
Data\Combiner.cs (1)
37public override bool IsDefault(ReadOnlyMemory<char> value) { return value.Length == 0; }
Data\Conversion.cs (3)
1053if (src.Length != 34 || span[0] != '0' || (span[1] != 'x' && span[1] != 'X')) 1088Contracts.Assert(offset == src.Length); 1535switch (src.Length)
DataLoadSave\Text\TextLoaderParser.cs (2)
590IchLimBuf = text.Length; 850int ichLim = memory.Length;
Evaluators\EvaluatorUtils.cs (1)
1597int maxNameLen = confusionMatrix.PredictedClassesIndicators.Max(name => name.Length);
Transforms\InvertHashUtils.cs (3)
433Utils.EnsureSize(ref buffer, text.Length); 436for (int i = 0; i < text.Length; i++) 439writer.WriteLine(buffer, 0, text.Length);
Microsoft.ML.ImageAnalytics (2)
ImageLoader.cs (2)
244if (src.Length > 0) 275if (src.Length > 0)
Microsoft.ML.Tests (1)
ExpressionLanguageTests\ExpressionLanguageTests.cs (1)
605for (int ich = 0; ich < a.Length; ich++)
Microsoft.ML.Tokenizers (12)
Model\TiktokenTokenizer.cs (10)
819if ((uint)utf8ByteCount + (uint)tokenBytes.Length > (uint)utf8Bytes.Length) 821ArrayPoolGrow(ref utf8Bytes, ref arrayPoolArray, utf8ByteCount + tokenBytes.Length); 825utf8ByteCount += tokenBytes.Length; 893if (utf8BytesIncompleteCount + tokenBytes.Length > utf8Bytes.Length) 899if (Encoding.UTF8.GetMaxCharCount(utf8BytesIncompleteCount + tokenBytes.Length) > tempBuffer.Length) 925if (bytesConsumed == tokenBytes.Length) 935utf8BytesIncompleteCount = tokenBytes.Length - bytesConsumed; 945if (!Helpers.ConvertUtf8ToUtf16(utf8Bytes.Slice(utf8BytesIncompleteIndex, utf8BytesIncompleteCount + tokenBytes.Length), tempBuffer, out int bytesConsumed, out int charsConsumed)) 958if (bytesConsumed == utf8BytesIncompleteCount + tokenBytes.Length) 972utf8BytesIncompleteCount = utf8BytesIncompleteCount + tokenBytes.Length - bytesConsumed;
Utils\BytePairEncoder.cs (2)
18if (mergingBytes.Length == 1) 24int requiredLength = mergingBytes.Length + 1;
Microsoft.ML.TorchSharp (1)
Roberta\QATrainer.cs (1)
415var answerEnd = answerIndex + answer.Length - 1;
Microsoft.ML.Transforms (32)
Expression\BuiltinFunctions.cs (19)
721var dst = new char[a.Length]; 740var dst = new char[a.Length + b.Length]; 742b.Span.CopyTo(new Span<char>(dst, a.Length, b.Length)); 749var dst = new char[a.Length + b.Length + c.Length]; 751b.Span.CopyTo(new Span<char>(dst, a.Length, b.Length)); 752c.Span.CopyTo(new Span<char>(dst, a.Length + b.Length, c.Length)); 763len += a[i].Length; 776return a.Length; 809return a.Slice(NormalizeIndex(min, a.Length)); 817return a.Slice(0, NormalizeIndex(lim, a.Length)); 825int im = NormalizeIndex(min, a.Length); 826int il = NormalizeIndex(lim, a.Length);
Expression\Printer.cs (2)
280int len = str.Length; 294if (len < str.Length)
SvmLight\SvmLightLoader.cs (1)
262right = memory.Slice(index + 1, memory.Length - index - 1);
Text\TextNormalizing.cs (3)
398while (i < src.Length) 438Host.Assert(i == src.Length); 442Host.Assert(src.Length == len);
Text\TokenizingByCharacters.cs (7)
485var len = !src.IsEmpty ? (_parent._useMarkerChars ? src.Length + TextMarkersCount : src.Length) : 0; 493for (int ich = 0; ich < src.Length; ich++) 524len += srcValues[i].Length; 541for (int ich = 0; ich < srcValues[i].Length; ich++) 563len += srcValues[i].Length; 596for (int ich = 0; ich < srcValues[i].Length; ich++)
Sockets.FunctionalTests (2)
src\Servers\Kestrel\test\FunctionalTests\Http2\HandshakeTests.cs (2)
74"ALPN: " + tlsFeature.ApplicationProtocol.Length); 102"ALPN: " + tlsFeature.ApplicationProtocol.Length);
System.Drawing.Common.Tests (8)
System\Drawing\Imaging\Effects\EffectsTests.cs (8)
187effect.AlphaLookupTable.Length.Should().Be(256); 190effect.BlueLookupTable.Length.Should().Be(256); 193effect.GreenLookupTable.Length.Should().Be(256); 196effect.RedLookupTable.Length.Should().Be(256); 206effect2.RedLookupTable.Length.Should().Be(256); 209effect2.GreenLookupTable.Length.Should().Be(256); 212effect2.BlueLookupTable.Length.Should().Be(256); 215effect2.AlphaLookupTable.Length.Should().Be(256);
System.Formats.Asn1 (5)
System\Formats\Asn1\AsnDecoder.cs (1)
886_data = _data.Slice(encodedValue.Length);
System\Formats\Asn1\AsnWriter.cs (4)
749positions.Add((pos, encoded.Length)); 750pos += encoded.Length; 755positions.Add((pos, encoded.Length)); 756pos += encoded.Length;
System.Formats.Cbor (6)
System\Formats\Cbor\Reader\CborReader.cs (5)
48public int BytesRemaining => _data.Length - _offset; 119if (_offset == _data.Length) 257Debug.Assert(_offset + length <= _data.Length); 266Debug.Assert(position <= _data.Length); 275if (_data.Length - _offset < length)
System\Formats\Cbor\Reader\CborReader.PeekState.cs (1)
43if (_offset == _data.Length)
System.IO.Compression (8)
System\IO\Compression\DeflateZLib\Deflater.cs (1)
73_zlibStream.AvailIn = (uint)inputBuffer.Length;
System\IO\Compression\DeflateZLib\Inflater.cs (1)
194_zlibStream.AvailIn = (uint)inputBuffer.Length;
System\IO\Compression\PositionPreservingWriteOnlyStreamWrapper.cs (1)
66_position += buffer.Length;
System\IO\Compression\ZipArchiveEntry.cs (1)
1545_position += buffer.Length;
System\IO\Compression\ZipBlocks.Async.cs (1)
181int remainingBufferLength = buffer.Length - FieldLocations.DynamicData;
System\IO\Compression\ZipCustomStreams.cs (1)
646_position += buffer.Length;
System\IO\Compression\ZipHelper.Async.cs (2)
21Debug.Assert(signatureToFind.Length != 0); 43int overlap = totalBytesRead == 0 ? 0 : signatureToFind.Length;
System.IO.Pipelines (4)
System\IO\Pipelines\Pipe.cs (2)
1078if (source.Length <= _writingHeadMemory.Length) 1082AdvanceCore(source.Length);
System\IO\Pipelines\StreamPipeWriter.cs (2)
336if (data.Length > 0) 341if (_bytesBuffered > 0 || data.Length > 0)
System.IO.Pipes (3)
System\IO\Pipes\PipeStream.Unix.cs (3)
171if (buffer.Length == 0) 319while (source.Length > 0) 322Debug.Assert(bytesWritten > 0 && bytesWritten <= source.Length);
System.IO.Ports (3)
System\IO\Ports\SerialStream.Unix.cs (3)
834if (writeRequest.Buffer.Length == 0) 1131Debug.Assert(Buffer.Length == 0); 1132Complete(Buffer.Length);
System.Memory (18)
System\Buffers\ReadOnlySequence.cs (6)
99(uint)startSegment.Memory.Length < (uint)startIndex || 100(uint)endSegment.Memory.Length < (uint)endIndex || 208int currentLength = startSegment.Memory.Length - startIndex; 319int currentLength = startSegment.Memory.Length - (int)startIndex; 402int currentLength = sliceStartSegment.Memory.Length - (int)sliceStartIndex; 562if (((ReadOnlySequenceSegment<T>)positionSequenceObject).Memory.Length - positionIndex < 0)
System\Buffers\ReadOnlySequence.Helpers.cs (4)
247int currentLength = startSegment.Memory.Length - startIndex; 283int currentLength = startSegment.Memory.Length - startIndex; 314int memoryLength = currentSegment.Memory.Length; 425int currentLength = startSegment.Memory.Length - startIndex;
System\Buffers\SequenceReader.cs (6)
167if (currentMemory.Length > 0) 169if (remainingOffset >= currentMemory.Length) 172remainingOffset -= currentMemory.Length; 263if (memory.Length == 0) 293if (memory.Length > 0) 441if (nextSegment.Length > 0)
System\Buffers\SequenceReader.Search.cs (1)
835if (nextSegment.Length > 0)
System\ThrowHelper.cs (1)
72else if ((uint)startSegment.Memory.Length < (uint)startIndex)
System.Memory.Data (9)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (8)
39return _content.Length; 68origin == SeekOrigin.End ? _content.Length + offset : 106int remaining = _content.Length - _position; 115_position = _content.Length; 159if (_content.Length > _position) 162_position = _content.Length; 170if (_content.Length > _position) 173_position = _content.Length;
System\BinaryData.cs (1)
41public int Length => _bytes.Length;
System.Net.Http (63)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (8)
39return _content.Length; 68origin == SeekOrigin.End ? _content.Length + offset : 106int remaining = _content.Length - _position; 115_position = _content.Length; 159if (_content.Length > _position) 162_position = _content.Length; 170if (_content.Length > _position) 173_position = _content.Length;
System\Net\Http\ReadOnlyMemoryContent.cs (1)
30length = _content.Length;
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (11)
71Debug.Assert(_connection.RemainingBuffer.Length == 0); 187Debug.Assert(_connection.RemainingBuffer.Length == 0); 263if (ReadChunkFromConnectionBuffer(int.MaxValue, ctr) is not ReadOnlyMemory<byte> bytesRead || bytesRead.Length == 0) 300if (ReadChunkFromConnectionBuffer(buffer.Length, cancellationRegistration) is not ReadOnlyMemory<byte> bytesRead || bytesRead.Length == 0) 305Debug.Assert(bytesRead.Length <= buffer.Length); 306totalBytesRead += bytesRead.Length; 308buffer = buffer.Slice(bytesRead.Length); 362if (connectionBuffer.Length == 0) 367int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _chunkBytesRemaining)); 479drainedBytes += _connection.RemainingBuffer.Length; 482if (ReadChunkFromConnectionBuffer(int.MaxValue, ctr) is not ReadOnlyMemory<byte> bytesRead || bytesRead.Length == 0)
System\Net\Http\SocketsHttpHandler\ChunkedEncodingWriteStream.cs (3)
47BytesWritten += buffer.Length; 56ValueTask task = buffer.Length == 0 ? 67await connection.WriteHexInt32Async(buffer.Length, async: true).ConfigureAwait(false);
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (2)
179if (connectionBuffer.Length == 0) 184int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _contentBytesRemaining));
System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs (1)
39BytesWritten += buffer.Length;
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (19)
1347buffer.Length > maxSize ? 1646Debug.Assert(headerBytes.Length > 0); 1649int frameCount = ((headerBytes.Length - 1) / FrameHeader.MaxPayloadLength) + 1; 1650int totalSize = headerBytes.Length + (frameCount * FrameHeader.Size); 1664if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.http2Stream.StreamId, $"Started writing. Total header bytes={s.headerBytes.Length}"); 1671FrameFlags flags = (remaining.Length == 0 ? FrameFlags.EndHeaders : FrameFlags.None); 1673FrameHeader.WriteTo(span, current.Length, FrameType.Headers, flags, s.http2Stream.StreamId); 1676span = span.Slice(current.Length); 1677if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.http2Stream.StreamId, $"Wrote HEADERS frame. Length={current.Length}, flags={flags}"); 1680while (remaining.Length > 0) 1683flags = remaining.Length == 0 ? FrameFlags.EndHeaders : FrameFlags.None; 1685FrameHeader.WriteTo(span, current.Length, FrameType.Continuation, flags, s.http2Stream.StreamId); 1688span = span.Slice(current.Length); 1689if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.http2Stream.StreamId, $"Wrote CONTINUATION frame. Length={current.Length}, flags={flags}"); 1716while (remaining.Length > 0) 1719int frameSize = Math.Min(remaining.Length, FrameHeader.MaxPayloadLength); 1726if (finalFlush && remaining.Length == 0) 1739await PerformWriteAsync(FrameHeader.Size + current.Length, (thisRef: this, streamId, current, flush), static (s, writeBuffer) => 1744FrameHeader.WriteTo(writeBuffer.Span, s.current.Length, FrameType.Data, FrameFlags.None, s.streamId);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (4)
1277while (buffer.Length > 0) 1285sendSize = Math.Min(buffer.Length, _availableCredit); 1304_creditWaiter.Amount = buffer.Length; 1533BytesWritten += buffer.Length;
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (6)
535if (buffer.Length == 0) 545if (buffer.Length > _requestContentLengthRemaining) 549_requestContentLengthRemaining -= buffer.Length; 575BufferFrameEnvelope(Http3FrameType.Data, buffer.Length); 587_sendBuffer.Discard(toSend.Length); 1574BytesWritten += buffer.Length;
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (7)
1416if (source.Length <= remaining) 1435if (source.Length <= _writeBuffer.Capacity) 1456if (source.Length <= _writeBuffer.Capacity) 1499if (source.Length <= _writeBuffer.AvailableLength) 1560if (bytes.Length > 0) 1562_writeBuffer.Discard(bytes.Length); 1576if (NetEventSource.Log.IsEnabled()) Trace($"Writing {source.Length} bytes.");
System\Net\Http\SocketsHttpHandler\RawConnectionStream.cs (1)
177if (buffer.Length == 0)
System.Net.Mail (5)
System\Net\Base64Stream.cs (1)
248if (written < buffer.Length)
System\Net\BufferBuilder.cs (2)
39EnsureBuffer(value.Length); 41_offset += value.Length;
System\Net\Mime\QEncodedStream.cs (1)
251if (written < buffer.Length)
System\Net\Mime\QuotedPrintableStream.cs (1)
365if (written < buffer.Length)
System.Net.Quic (5)
src\libraries\Common\src\System\Net\StreamBuffer.cs (2)
158if (buffer.Length == 0) 168Debug.Assert(bytesWritten == buffer.Length);
System\Net\Quic\Internal\MsQuicBuffers.cs (2)
56_buffers[index].Buffer = (byte*)NativeMemory.Alloc((nuint)buffer.Length, (nuint)sizeof(byte)); 57_buffers[index].Length = (uint)buffer.Length;
System\Net\Quic\QuicStream.cs (1)
374NetEventSource.Info(this, $"{this} Stream writing memory of '{buffer.Length}' bytes while {(completeWrites ? "completing" : "not completing")} writes.");
System.Net.Security (11)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (5)
242if (protocol.Protocol.Length == 0 || protocol.Protocol.Length > byte.MaxValue) 247protocolSize += protocol.Protocol.Length + 1; 261buffer[offset++] = (byte)protocol.Protocol.Length; 263offset += protocol.Protocol.Length;
System\Net\Security\NegotiateStream.cs (1)
520int chunkBytes = Math.Min(buffer.Length, MaxWriteDataSize);
System\Net\Security\SslStream.IO.cs (4)
642int chunkBytes = Math.Min(buffer.Length, MaxDataSize); 645} while (buffer.Length != 0); 997if (buffer.Length == 0 && !SslStreamPal.CanEncryptEmptyMessage) 1019ValueTask t = buffer.Length < MaxDataSize ?
System\Net\Security\TlsFrameHelper.cs (1)
716else if (protocolLength == SslApplicationProtocol.Http11.Protocol.Length &&
System.Net.Sockets (1)
System\Net\Sockets\SendPacketsElement.cs (1)
88Initialize(null, null, null, buffer, 0, buffer.Length, endOfPacket);
System.Net.WebSockets (3)
System\Net\WebSockets\ManagedWebSocket.cs (1)
474if (NetEventSource.Log.IsEnabled()) NetEventSource.SendFrameAsyncStarted(this, opcode.ToString(), payloadBuffer.Length);
System\Net\WebSockets\WebSocket.cs (2)
72byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 76await SendAsync(new ArraySegment<byte>(array, 0, buffer.Length), messageType, endOfMessage, cancellationToken).ConfigureAwait(false);
System.Private.CoreLib (34)
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.ThreadPoolValueTaskSource.cs (3)
126_strategy.OnIncompleteOperation(_singleSegment.Length, 0); 128else if (_operation == Operation.Read && result != _singleSegment.Length) 130_strategy.OnIncompleteOperation(_singleSegment.Length, (int)result);
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (8)
1031completeSynchronously = buffer.Length < _bufferSize - _writePos; 1035Debug.Assert(bytesWritten == buffer.Length); 1080totalUserBytes = _writePos + buffer.Length; 1081useBuffer = (totalUserBytes + buffer.Length < (_bufferSize + _bufferSize)); 1090Debug.Assert(buffer.Length == 0); 1094Debug.Assert(buffer.Length >= 0); 1102Debug.Assert(bytesWritten == buffer.Length); 1119buffer.Span.CopyTo(new Span<byte>(_buffer, _writePos, buffer.Length));
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (5)
1586int preambleSize = preamble.Length; 1601byte[] bytes = ArrayPool<byte>.Shared.Rent(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1617ReadOnlyMemory<char> toEncode = contents.Slice(0, Math.Min(contents.Length, ChunkSize)); 1618contents = contents.Slice(toEncode.Length); 1624fileOffset += toStore.Length;
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (2)
180totalBytesToWrite += buffer.Length; 183vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length };
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (8)
620if (_writePos == 0 && buffer.Length >= _bufferSize) 634else if (_bufferSize - _writePos >= buffer.Length) 639_writePos += buffer.Length; 700if (spaceLeft >= source.Length) 703_writePos += source.Length; 719if (source.Length >= _bufferSize) 725else if (source.Length == 0) 733_writePos = source.Length;
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs (2)
259long writeOffset = CanSeek ? Interlocked.Add(ref _filePosition, source.Length) - source.Length : -1;
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (2)
737byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 739return new ValueTask(FinishWriteAsync(WriteAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer));
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (2)
781while (copied < source.Length) 788int n = Math.Min(_charLen - _charPos, source.Length - copied);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (1)
431for (int i = 0; i < memory.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (1)
560int rentalLength = Math.Clamp(remainingOuterEncodedBytes.Length, MinWriteRentedArraySize, MaxWriteRentedArraySize);
System.Security.Cryptography (66)
src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (1)
89if (consumed != encodedOctets.Length)
src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.manual.cs (1)
53if (MacData.Value.Mac.Digest.Length != expectedOutputSize)
src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsa.cs (2)
677if (!algorithm.IsValidPublicKeySize(key.Length)) 870if (!algorithm.IsValidPrivateKeySize(privateKeyContents.Length))
src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsaManaged.ECDsa.cs (1)
86byte[] d = new byte[ecPrivateKey.PrivateKey.Length];
src\libraries\Common\src\System\Security\Cryptography\DSAKeyFormatHelper.cs (2)
37if (consumed != xBytes.Length) 103if (consumed != yBytes.Length)
src\libraries\Common\src\System\Security\Cryptography\KeyBlobHelpers.cs (6)
13if (memory.Length > 1 && memory.Span[0] == 0) 25if (memory.Length == length) 31if (memory.Length == length + 1) 40if (memory.Length > length) 45destination.Slice(0, destination.Length - memory.Length).Clear(); 46memory.Span.CopyTo(destination.Slice(length - memory.Length));
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (4)
118byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 361byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 396if (bytesRead != current.Length) 432if (bytesRead != current.Length)
src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (4)
2220if (seed.Length != algorithm.PrivateSeedSizeInBytes) 2229if (expandedKey.Length != algorithm.PrivateKeySizeInBytes) 2240if (both.Seed.Length != algorithm.PrivateSeedSizeInBytes || 2241both.ExpandedKey.Length != privateKeySize)
src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (5)
1214if (key.Length != algorithm.EncapsulationKeySizeInBytes) 1732if (seed.Length != algorithm.PrivateSeedSizeInBytes) 1741if (expandedKey.Length != algorithm.DecapsulationKeySizeInBytes) 1752if (both.Seed.Length != algorithm.PrivateSeedSizeInBytes || 1753both.ExpandedKey.Length != decapsulationKeySize)
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (4)
653if (rc2Parameters.Iv.Length != 8) 663iv = iv.Slice(0, rc2Parameters.Iv.Length); 773byte[] tmpSalt = new byte[saltMemory.Length]; 822if (pbeParameters.Salt.Length != 8)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
356if (destination.Length < _sealedData.Length) 363bytesWritten = _sealedData.Length;
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12CertBag.cs (1)
110consumed != encodedCertificate.Length)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (1)
237int encryptedValueLength = encryptedData.EncryptedContentInfo.EncryptedContent.Value.Length;
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
33if (algorithmParameters?.Length > 0) 246if (AlgorithmParameters?.Length > 0)
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (4)
389Debug.Assert(read == spki.Length); 400Debug.Assert(read == spki.Length); 443Debug.Assert(read == spki.Length); 812Debug.Assert(read == pkcs8.Length);
src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (1)
1233if (key.Length != algorithm.PublicKeySizeInBytes)
src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (3)
1091spaceRequired += bag.BagValue.Length; 1179_keyDecryptBufferOffset += newBagValue.Length; 1181if (contentRead != bag.BagValue.Length)
System\Security\Cryptography\CryptographicOperations.cs (2)
983if (hash.Length != hashSizeInBytes) 1000byte[] mac = new byte[hash.Length];
System\Security\Cryptography\CryptoStream.cs (7)
537int bytesToWrite = buffer.Length; 544if (buffer.Length >= _inputBlockSize - _inputBufferIndex) 558_inputBufferIndex += buffer.Length; 655return transform.TransformBlock(segment.Array, segment.Offset, inputBuffer.Length, outputBuffer, outputOffset); 660byte[]? rentedBuffer = ArrayPool<byte>.Shared.Rent(inputBuffer.Length); 669result = transform.TransformBlock(rentedBuffer, 0, inputBuffer.Length, outputBuffer, outputOffset); 673CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, inputBuffer.Length));
System\Security\Cryptography\EccKeyFormatHelper.cs (3)
147if (publicKeyBytes.Length != 2 * key.PrivateKey.Length + 1) 152x = publicKeyBytes.Slice(1, key.PrivateKey.Length).ToArray(); 153y = publicKeyBytes.Slice(1 + key.PrivateKey.Length).ToArray();
System\Security\Cryptography\HMACStatic.cs (1)
207if (hash.Length != THMAC.HashSizeInBytes)
System\Security\Cryptography\KeyBlobHelpers.cs (2)
12if (memory.Length == length) 19if (memory.Length == length + 1)
System\Security\Cryptography\KmacStatic.cs (1)
124byte[] mac = new byte[hash.Length];
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (1)
831Debug.Assert(resource.Length > 0);
System\Security\Cryptography\X509Certificates\X500NameEncoder.ManagedDecode.cs (1)
188return string.Create(1 + data.Length * 2, data, static (buff, state) =>
System\Security\Cryptography\X509Certificates\X509Certificate2Collection.cs (2)
610int certSize = PemEncoding.GetEncodedSize(PemLabels.X509Certificate.Length, certData.Length); 808size += PemEncoding.GetEncodedSize(PemLabels.X509Certificate.Length, this[i].RawDataMemory.Length);
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Unix.cs (1)
274ExtractPublicKey(ref _rentedSpki[_keyCount], key, safeBag.BagValue.Length);
System\Security\Cryptography\X509Certificates\X509SubjectAlternativeNameExtension.cs (1)
124switch (item.IPAddress.GetValueOrDefault().Length)
System.Security.Cryptography.Cose (7)
System\Security\Cryptography\Cose\CoseHeaderMap.cs (1)
404encodedSize += label.EncodedSize + value.EncodedValue.Length;
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
475int start = bodyProtected.Length; 851associatedData.Length,
System\Security\Cryptography\Cose\CoseSign1Message.cs (1)
946associatedData.Length,
System\Security\Cryptography\Cose\CoseSignature.cs (3)
620Message.RawProtectedHeaders.Length, 622associatedData.Length, 651Message.RawProtectedHeaders.Length,
System.Security.Cryptography.Pkcs (24)
Internal\Cryptography\Pal\AnyOS\AsnHelpers.cs (1)
112saltLen = contents.Length;
src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (1)
89if (consumed != encodedOctets.Length)
src\libraries\Common\src\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.manual.cs (1)
53if (MacData.Value.Mac.Digest.Length != expectedOutputSize)
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (4)
118byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 361byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 396if (bytesRead != current.Length) 432if (bytesRead != current.Length)
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (4)
653if (rc2Parameters.Iv.Length != 8) 663iv = iv.Slice(0, rc2Parameters.Iv.Length); 773byte[] tmpSalt = new byte[saltMemory.Length]; 822if (pbeParameters.Salt.Length != 8)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
356if (destination.Length < _sealedData.Length) 363bytesWritten = _sealedData.Length;
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12CertBag.cs (1)
110consumed != encodedCertificate.Length)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (1)
237int encryptedValueLength = encryptedData.EncryptedContentInfo.EncryptedContent.Value.Length;
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
33if (algorithmParameters?.Length > 0) 246if (AlgorithmParameters?.Length > 0)
System\Security\Cryptography\Pkcs\Rfc3161TimestampTokenInfo.cs (1)
295bytesConsumed = firstElement.Length;
System\Security\Cryptography\Pkcs\SignedCms.cs (3)
185_hasPkcs7Content = content.Value.Length == contentValue.Length; 266rented = CryptoPool.Rent(wrappedContent.Length);
System\Security\Cryptography\Pkcs\SignerInfo.cs (3)
790int contentToVerifyLength = content.Length + additionalContent.Value.Length; 795content.Span.CopyTo(rented.AsSpan(additionalContent.Value.Length));
System.ServiceModel.NetFramingBase (12)
System\ServiceModel\Channels\BufferedConnection.cs (7)
112throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(buffer.Length), buffer.Length, SR.Format( 138if (buffer.Length <= remainingSize) 141_pendingWriteSize += buffer.Length; 169while (buffer.Length > 0) 171if (buffer.Length >= _writeBufferSize && _pendingWriteSize == 0) 184int copySize = buffer.Length;
System\ServiceModel\Channels\FramingChannels.cs (3)
168int startSize = ClientDuplexEncoder.ModeBytes.Length + SessionEncoder.CalcStartSize(encodedVia, encodedContentType); 173startSize += SessionEncoder.PreambleEndBytes.Length; 178SessionEncoder.EncodeStart(startBytes.Slice(ClientDuplexEncoder.ModeBytes.Length), encodedVia, encodedContentType);
System\ServiceModel\Channels\SingletonConnectionReader.cs (1)
642await WriteChunkSizeAsync(buffer.Length);
System\ServiceModel\Channels\StreamedFramingRequestChannel.cs (1)
54startSize += SessionEncoder.PreambleEndBytes.Length;
System.ServiceModel.NetTcp (4)
System\ServiceModel\Channels\SocketConnection.cs (4)
259if (buffer.Length <= 0) 261throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(buffer.Length), buffer.Length, SR.ValueMustBePositive)); 267WcfEventSource.Instance.SocketAsyncWriteStart(_socket.GetHashCode(), buffer.Length, RemoteEndpointAddress);
System.ServiceModel.Primitives (1)
System\ServiceModel\Channels\MaxMessageSizeStream.cs (1)
68PrepareWrite(buffer.Length);
System.ServiceModel.UnixDomainSocket (4)
System\ServiceModel\Channels\SocketConnection.cs (4)
241if (buffer.Length <= 0) 243throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(buffer.Length), buffer.Length, SR.ValueMustBePositive)); 249WcfEventSource.Instance.SocketAsyncWriteStart(_socket.GetHashCode(), buffer.Length, RemoteEndpointAddress);
System.Text.Json (9)
System\Text\Json\Document\JsonDocument.cs (1)
63int length = _utf8Json.Length;
System\Text\Json\Document\JsonDocument.Parse.cs (3)
724var database = MetadataDb.CreateRented(utf8Json.Length, convertToAlloc: false); 771database = MetadataDb.CreateLocked(utf8Json.Length); 777database = MetadataDb.CreateRented(utf8Json.Length, convertToAlloc: true);
System\Text\Json\Document\JsonDocument.PropertyNameSet.cs (2)
149left.Length == right.Length && left.Span.SequenceEqual(right.Span);
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (2)
78if (memory.Length != 0) 313if (memory.Length != 0)
System\Text\Json\Serialization\PipeReadBufferState.cs (1)
105if (_sequence.First.Length >= JsonConstants.Utf8Bom.Length)
System.Text.RegularExpressions (3)
System\Text\RegularExpressions\Regex.Replace.cs (1)
226length += span[i].Length;
System\Text\RegularExpressions\RegexReplacement.cs (2)
146if (segment.Length != 0) 178if (segment.Length != 0)
Test.Utilities (2)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
509if (!chunk.Span.Equals(array.AsSpan().Slice(chunkOffset, chunk.Length), StringComparison.Ordinal)) 512chunkOffset += chunk.Length;