502 references to Length
Aspire.Hosting.Browsers.Tests (1)
BrowserLogsCdpConnectionTests.cs (1)
607var count = (int)Math.Min(readableBuffer.Length, buffer.Length);
Aspire.Hosting.Tests (1)
Dcp\GatedReadStream.cs (1)
69var count = Math.Min(buffer.Length, content.Length - _offset);
dotnet (2)
Commands\Test\MTP\IPC\NamedPipeServer.cs (2)
121if (remainingBytesToProcess.Length > 0) 125remainingBytesToReadOfWholeMessage -= remainingBytesToProcess.Length;
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.AspNetCore.Components.Endpoints (11)
FormMapping\FormDataReader.cs (11)
122if (key.Length <= prefix.Length || 123!key.Span[..prefix.Length].Equals(prefix.Span, StringComparison.OrdinalIgnoreCase)) 129if (key.Span[prefix.Length] != '[') 135var remaining = key[prefix.Length..]; 199Debug.Assert(_currentPrefixBuffer.Length >= keyLength); 200if (_currentPrefixBuffer.Length == keyLength || _currentPrefixBuffer.Span[^(keyLength + 1)] != '.') 220var separator = _currentPrefixBuffer.Length > 0 && key[0] != '[' 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length)); 230separator.CopyTo(_prefixBuffer.Span[_currentPrefixBuffer.Length..]); 232var startingPoint = _currentPrefixBuffer.Length + separator.Length;
Microsoft.AspNetCore.Components.Server (1)
BlazorPack\SequenceOfT.cs (1)
347internal int WritableBytes => this.AvailableMemory.Length - this.End;
Microsoft.AspNetCore.Components.Web (1)
Forms\InputFile\BrowserFileStream.cs (1)
73var maxBytesToRead = (int)Math.Min(bytesAvailableToRead, buffer.Length);
Microsoft.AspNetCore.Components.WebAssembly (1)
src\aspnetcore\src\Components\Shared\src\PullFromJSDataStream.cs (1)
81var bytesRead = await RequestDataFromJSAsync(buffer.Length);
Microsoft.AspNetCore.Components.WebView (1)
src\aspnetcore\src\Components\Shared\src\PullFromJSDataStream.cs (1)
81var bytesRead = await RequestDataFromJSAsync(buffer.Length);
Microsoft.AspNetCore.Http (1)
Internal\ReferenceReadStream.cs (1)
108var toRead = (int)Math.Min(buffer.Length, _length - _position);
Microsoft.AspNetCore.Http.Connections.Common (3)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (3)
150return _memory.Span.Slice(_memoryUsed, _memory.Length - _memoryUsed); 159var remaining = _memory.Length - _memoryUsed; 205_memory = _memory.Slice(_memoryUsed, _memory.Length - _memoryUsed);
Microsoft.AspNetCore.Http.Extensions (11)
src\aspnetcore\src\Components\Endpoints\src\FormMapping\FormDataReader.cs (11)
122if (key.Length <= prefix.Length || 123!key.Span[..prefix.Length].Equals(prefix.Span, StringComparison.OrdinalIgnoreCase)) 129if (key.Span[prefix.Length] != '[') 135var remaining = key[prefix.Length..]; 199Debug.Assert(_currentPrefixBuffer.Length >= keyLength); 200if (_currentPrefixBuffer.Length == keyLength || _currentPrefixBuffer.Span[^(keyLength + 1)] != '.') 220var separator = _currentPrefixBuffer.Length > 0 && key[0] != '[' 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length)); 230separator.CopyTo(_prefixBuffer.Span[_currentPrefixBuffer.Length..]); 232var startingPoint = _currentPrefixBuffer.Length + separator.Length;
Microsoft.AspNetCore.HttpLogging (4)
BufferingStream.cs (2)
108if ((uint)bytes > (uint)_tailMemory.Length) 143var bytesLeftInBuffer = _tailMemory.Length;
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (2)
27Debug.Assert(value <= AvailableMemory.Length); 97get => AvailableMemory.Length - End;
Microsoft.AspNetCore.OpenApi (3)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (3)
150return _memory.Span.Slice(_memoryUsed, _memory.Length - _memoryUsed); 159var remaining = _memory.Length - _memoryUsed; 205_memory = _memory.Slice(_memoryUsed, _memory.Length - _memoryUsed);
Microsoft.AspNetCore.Razor.Utilities.Shared (11)
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\MemoryBuilder`1.cs (11)
59Debug.Assert(value <= _memory.Length); 84if ((uint)index < (uint)memory.Length) 101if (source.Length == 1 && (uint)index < (uint)memory.Length) 115Debug.Assert(_length == _memory.Length); 125if ((uint)(_length + source.Length) > (uint)_memory.Length) 127Grow(_memory.Length - _length + source.Length); 142_memory.Length != 0 ? _memory.Length * 2 : 4, 143_memory.Length + additionalCapacityRequired); 156nextCapacity = Math.Max(_memory.Length + 1, ArrayMaxLength); 159Debug.Assert(nextCapacity > _memory.Length);
Microsoft.AspNetCore.Server.HttpSys (10)
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticMemoryPool.cs (1)
176byte* endPooledMemoryPtr = beginPooledMemoryPtr + block.Memory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (3)
59return CreateMemory(_memory.Length); 142if ((uint)byteOffset >= (uint)_memory.Length) 144MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException(_memory.Length, byteOffset);
src\aspnetcore\src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (5)
105_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 106_metrics?.AddRentedMemory(block.Memory.Length, _owner); 143_metrics?.UpdatePooledMemory(block.Memory.Length, _owner); 217_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 218_metrics?.AddEvictedMemory(block.Memory.Length, _owner);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
172return (uint)_backingBuffer.Memory.Length - AlignmentPadding;
Microsoft.AspNetCore.Server.IIS (14)
Core\IISHttpContext.IO.cs (1)
36var actual = Math.Min(readableBuffer.Length, memory.Length);
Core\IO\AsyncIOEngine.Read.cs (1)
40_memory.Length,
Core\IO\WebSocketsAsyncIOEngine.Read.cs (1)
49_memory.Length,
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticMemoryPool.cs (1)
176byte* endPooledMemoryPtr = beginPooledMemoryPtr + block.Memory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (3)
59return CreateMemory(_memory.Length); 142if ((uint)byteOffset >= (uint)_memory.Length) 144MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException(_memory.Length, byteOffset);
src\aspnetcore\src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (5)
105_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 106_metrics?.AddRentedMemory(block.Memory.Length, _owner); 143_metrics?.UpdatePooledMemory(block.Memory.Length, _owner); 217_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 218_metrics?.AddEvictedMemory(block.Memory.Length, _owner);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
172return (uint)_backingBuffer.Memory.Length - AlignmentPadding;
src\aspnetcore\src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
136var count = (int)Math.Min(readableBuffer.Length, destination.Length);
Microsoft.AspNetCore.Server.Kestrel.Core (28)
Internal\Http\Http1OutputProducer.cs (10)
257if (_currentSegment.Length - bytes < _position) 267if (_advancedBytesForChunk > _currentChunkMemory.Length - _currentMemoryPrefixBytes - EndChunkLength - bytes) 617else if (_advancedBytesForChunk >= _currentChunkMemory.Length - _currentMemoryPrefixBytes - EndChunkLength - sizeHint && _advancedBytesForChunk > 0) 630_currentChunkMemory.Length - _currentMemoryPrefixBytes - EndChunkLength - _advancedBytesForChunk); 638_currentMemoryPrefixBytes = ChunkWriter.GetPrefixBytesForChunk(_currentChunkMemory.Length, out var sliceOne); 641_currentChunkMemory = _currentChunkMemory.Slice(0, _currentChunkMemory.Length - 1); 648Debug.Assert(_advancedBytesForChunk <= _currentChunkMemory.Length); 674if (_fakeMemoryOwner.Memory.Length < minSize) 723var remainingSize = _currentSegment.Length - _position; 738if (_currentSegment.Length != 0)
Internal\Http\HttpRequestStream.cs (1)
134var actual = (int)Math.Min(length, destination.Length);
Internal\Http2\Http2Connection.cs (1)
1907var copyAmount = (int)Math.Min(outputBuffer.Length, readResult.Buffer.Length);
Internal\Http2\Http2OutputProducer.cs (1)
664if (_fakeMemoryOwner.Memory.Length < minSize)
Internal\Http3\Http3OutputProducer.cs (1)
231if (_fakeMemoryOwner.Memory.Length < minSize)
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (2)
98if ((uint)bytes > (uint)_tailMemory.Length) 334int bytesLeftInBuffer = _tailMemory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticMemoryPool.cs (1)
176byte* endPooledMemoryPtr = beginPooledMemoryPtr + block.Memory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (3)
59return CreateMemory(_memory.Length); 142if ((uint)byteOffset >= (uint)_memory.Length) 144MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException(_memory.Length, byteOffset);
src\aspnetcore\src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (5)
105_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 106_metrics?.AddRentedMemory(block.Memory.Length, _owner); 143_metrics?.UpdatePooledMemory(block.Memory.Length, _owner); 217_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 218_metrics?.AddEvictedMemory(block.Memory.Length, _owner);
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (2)
27Debug.Assert(value <= AvailableMemory.Length); 97get => AvailableMemory.Length - End;
src\aspnetcore\src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
136var count = (int)Math.Min(readableBuffer.Length, destination.Length);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (9)
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticMemoryPool.cs (1)
176byte* endPooledMemoryPtr = beginPooledMemoryPtr + block.Memory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (3)
59return CreateMemory(_memory.Length); 142if ((uint)byteOffset >= (uint)_memory.Length) 144MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException(_memory.Length, byteOffset);
src\aspnetcore\src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (5)
105_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 106_metrics?.AddRentedMemory(block.Memory.Length, _owner); 143_metrics?.UpdatePooledMemory(block.Memory.Length, _owner); 217_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 218_metrics?.AddEvictedMemory(block.Memory.Length, _owner);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (9)
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticMemoryPool.cs (1)
176byte* endPooledMemoryPtr = beginPooledMemoryPtr + block.Memory.Length;
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (3)
59return CreateMemory(_memory.Length); 142if ((uint)byteOffset >= (uint)_memory.Length) 144MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException(_memory.Length, byteOffset);
src\aspnetcore\src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (5)
105_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 106_metrics?.AddRentedMemory(block.Memory.Length, _owner); 143_metrics?.UpdatePooledMemory(block.Memory.Length, _owner); 217_metrics?.UpdatePooledMemory(-block.Memory.Length, _owner); 218_metrics?.AddEvictedMemory(block.Memory.Length, _owner);
Microsoft.AspNetCore.SignalR.Common (3)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (3)
150return _memory.Span.Slice(_memoryUsed, _memory.Length - _memoryUsed); 159var remaining = _memory.Length - _memoryUsed; 205_memory = _memory.Slice(_memoryUsed, _memory.Length - _memoryUsed);
Microsoft.AspNetCore.SignalR.Protocols.Json (3)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (3)
150return _memory.Span.Slice(_memoryUsed, _memory.Length - _memoryUsed); 159var remaining = _memory.Length - _memoryUsed; 205_memory = _memory.Slice(_memoryUsed, _memory.Length - _memoryUsed);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (3)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (3)
150return _memory.Span.Slice(_memoryUsed, _memory.Length - _memoryUsed); 159var remaining = _memory.Length - _memoryUsed; 205_memory = _memory.Slice(_memoryUsed, _memory.Length - _memoryUsed);
Microsoft.AspNetCore.TestHost (1)
ResponseBodyReaderStream.cs (1)
102var actual = Math.Min(readableBuffer.Length, buffer.Length);
Microsoft.AspNetCore.WebUtilities (6)
BufferedReadStream.cs (1)
231int toCopy = Math.Min(_bufferCount, buffer.Length);
FileBufferingReadStream.cs (1)
388else if (buffer.Length > 0)
HttpRequestStreamReader.cs (1)
239var count = buffer.Length;
MultipartReaderStream.cs (3)
271var slice = buffer[..Math.Min(buffer.Length, index)]; 294var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)]; 308read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
Microsoft.Build (6)
Logging\BinaryLogger\Postprocessing\SubStream.cs (1)
95buffer = buffer.Slice(0, Math.Min((int)Math.Max(Length - _position, 0), buffer.Length));
Logging\BinaryLogger\Postprocessing\TransparentReadStream.cs (1)
145if (_position + buffer.Length > _maxAllowedPosition)
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.Analyzers (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.CodeStyle (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.Extensions.Package (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.CodeAnalysis.Workspaces (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
Microsoft.Extensions.ServiceDiscovery.Dns (4)
Resolver\DnsDataWriter.cs (4)
76if (_buffer.Length - _position < 1) 88if (_buffer.Length - _position < 2) 100if (_buffer.Length - _position < 4) 112if (_buffer.Length - _position < value.Length)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Resolver\DnsPrimitivesTests.cs (3)
108Assert.True(DnsPrimitives.TryReadQName(data, data.Length - 6, out EncodedDomainName actual, out int bytesRead)); 120for (int i = 0; i < data.Length; i++) 122Assert.False(DnsPrimitives.TryReadQName(data.Slice(0, i), data.Length - 6, out _, out _));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Fuzzers\DnsResponseFuzzer.cs (1)
31_buffer.AsSpan(0, Math.Min(_length, buffer.Length - 2)).CopyTo(buffer.Span.Slice(2));
Microsoft.ML.Tokenizers (2)
Normalizer\SentencePieceNormalizer.cs (2)
439ReadOnlySpan<byte> normalizedByte = normalizedPrefix.Length == 0 ? input.Slice(0, p) : normalizedPrefix.Span; 470ReadOnlySpan<byte> sp = normalizedPrefix.Length == 0 ? input.Slice(0, p) : normalizedPrefix.Span;
Roslyn.Diagnostics.Analyzers (4)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (4)
739_completed = _current.Length; 746_completed += _current.Length; 788_completed = _current.Length; 795_completed += _current.Length;
System.Formats.Tar (2)
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (1)
234buffer = buffer[..LimitByRemaining(buffer.Length)];
System\Formats\Tar\GnuSparseStream.cs (1)
219int toRead = (int)Math.Min(buffer.Length, _realSize - _virtualPosition);
System.IO.Compression (18)
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (1)
234buffer = buffer[..LimitByRemaining(buffer.Length)];
System\IO\Compression\DeflateManaged\InputBuffer.cs (5)
28public int AvailableBytes => _buffer.Length + (_bitsInBuffer / 8); 77if (_buffer.Length > 1) 85else if (_buffer.Length != 0) 149int length = Math.Min(output.Length, _buffer.Length);
System\IO\Compression\WinZipAesStream.cs (1)
443int bytesToRead = GetBytesToRead(buffer.Length);
System\IO\Compression\ZipBlocks.Async.cs (1)
218Debug.Assert(bytesToRead == collatedHeader.Length - remainingBufferLength);
System\IO\Compression\ZipCustomStreams.cs (1)
607if (buffer.Length > 0)
System\IO\Compression\ZipHelper.Async.cs (9)
45if (maxBytesToRead - totalBytesRead + overlap < bufferMemory.Length) 53outOfBytes = bytesRead < bufferMemory.Length; 54if (bytesRead < bufferMemory.Length) 60Debug.Assert(bufferPointer < bufferMemory.Length); 97if (stream.Position >= buffer.Length) 99Debug.Assert(overlap <= buffer.Length); 100stream.Seek(-(buffer.Length - overlap), SeekOrigin.Current); 101bytesRead = await stream.ReadAtLeastAsync(buffer, buffer.Length, throwOnEndOfStream: true, cancellationToken).ConfigureAwait(false); 102stream.Seek(-buffer.Length, SeekOrigin.Current);
System.IO.Pipelines (13)
System\IO\Pipelines\BufferSegment.cs (2)
27Debug.Assert(value <= AvailableMemory.Length); 104get => AvailableMemory.Length - End;
System\IO\Pipelines\Pipe.cs (8)
174_writingHeadMemory.Length == 0 || _writingHeadMemory.Length < sizeHint) 199if (_writingHeadMemory.Length == 0 || _writingHeadMemory.Length < sizeHint) 208int bytesLeftInBuffer = _writingHeadMemory.Length; 428if ((uint)bytes > (uint)_writingHeadMemory.Length) 447if ((uint)bytes > (uint)_writingHeadMemory.Length) 1189if (source.Length <= _writingHeadMemory.Length)
System\IO\Pipelines\StreamPipeReader.cs (1)
271Debug.Assert(length + reader._readTail.End <= reader._readTail.AvailableMemory.Length);
System\IO\Pipelines\StreamPipeWriter.cs (2)
73if ((uint)bytes > (uint)_tailMemory.Length) 133int bytesLeftInBuffer = _tailMemory.Length;
System.IO.Pipes (1)
System\IO\Pipes\PipeStream.Unix.cs (1)
96if (buffer.Length == 0)
System.Net.Http (28)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (4)
397destination = destination.Slice(block.Length); 413if (source.Length <= block.Length) 419source.Slice(0, block.Length).CopyTo(block.Span); 420source = source.Slice(block.Length);
System\Net\Http\MultipartContent.cs (1)
527if (buffer.Length == 0)
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (6)
133if (buffer.Length == 0) 180buffer.Length >= _connection.ReadBufferSize && 188Debug.Assert(buffer.Length != 0); 189int bytesRead = await _connection.ReadAsync(buffer.Slice(0, (int)Math.Min((ulong)buffer.Length, _chunkBytesRemaining))).ConfigureAwait(false); 202if (buffer.Length == 0) 217if (buffer.Length == 0)
System\Net\Http\SocketsHttpHandler\ConnectionCloseReadStream.cs (1)
72if (bytesRead == 0 && buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (2)
69if ((ulong)buffer.Length > _contentBytesRemaining) 97if (bytesRead == 0 && buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (1)
406if (buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
1799if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.streamId, $"Started writing. {nameof(writeBuffer.Length)}={writeBuffer.Length}");
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
1177else if (buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (4)
1289int copyLen = (int)Math.Min(buffer.Length, Math.Min(_responseDataPayloadRemaining, _recvBuffer.ActiveLength)); 1309int copyLen = (int)Math.Min(buffer.Length, _responseDataPayloadRemaining); 1312if (bytesRead == 0 && buffer.Length != 0) 1326while (buffer.Length != 0);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (2)
1858return destination.Length >= _readBuffer.Capacity || destination.Length == 0 ?
System\Net\Http\SocketsHttpHandler\RawConnectionStream.cs (1)
80if (bytesRead == 0 && buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\SocksHelper.cs (3)
358? await stream.ReadAtLeastAsync(buffer, buffer.Length, throwOnEndOfStream: false).ConfigureAwait(false) 359: stream.ReadAtLeast(buffer.Span, buffer.Length, throwOnEndOfStream: false); 361if (bytesRead < buffer.Length)
System.Net.Mail (2)
System\Net\BufferedReadStream.cs (2)
58int read = Math.Min(buffer.Length, _storedLength - _storedOffset); 61if (read == buffer.Length || !_readMore)
System.Net.NameResolution (1)
System\Net\DnsResolverPal.Managed.cs (1)
767while (totalReceived < buffer.Length)
System.Net.Quic (7)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (4)
397destination = destination.Slice(block.Length); 413if (source.Length <= block.Length) 419source.Slice(0, block.Length).CopyTo(block.Span); 420source = source.Slice(block.Length);
System\Net\Quic\Internal\ReceiveBuffers.cs (1)
77copied = Math.Min(buffer.Length, activeBuffer.Length);
System\Net\Quic\QuicConnection.SslConnectionOptions.cs (1)
129if (certData.Length > 0)
System\Net\Quic\QuicStream.cs (1)
314NetEventSource.Info(this, $"{this} Stream reading into memory of '{buffer.Length}' bytes.");
System.Net.Requests (1)
System\Net\HttpWebResponse.cs (1)
415int readBytes = await innerStream.ReadAsync(buffer.Slice(0, (int)Math.Min(buffer.Length, _maxRemainingLength)), cancellationToken)
System.Net.Security (8)
System\Net\Security\NegotiateStream.cs (5)
351int copyBytes = Math.Min(_readBufferCount, buffer.Length); 429if (_readBufferCount == 0 && buffer.Length != 0) 435int copyBytes = Math.Min(_readBufferCount, buffer.Length); 455stream, buffer, buffer.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false); 456if (read < buffer.Length)
System\Net\Security\SslStream.IO.cs (3)
911if (processedLength == buffer.Length || !HaveFullTlsFrame(out nextTlsFrameLength)) 995if (copyLength == buffer.Length) 1094int copyBytes = Math.Min(_buffer.DecryptedLength, buffer.Length);
System.Net.Sockets (43)
System\Net\Sockets\SocketAsyncContext.Unix.cs (26)
460if (Buffer.Length == 0 && Flags == SocketFlags.None && SocketAddress.Length == 0) 471Debug.Assert(SocketAddress.Length == 0); 660if (result && ErrorCode == SocketError.Success && Buffer.Length > 0) 662SocketError error = context.SendToAsync(Buffer, 0, Buffer.Length, SocketFlags.None, Memory<byte>.Empty, ref BytesTransferred, Callback!, default); 679if (buffer.Length == 0 || ec != SocketError.Success) 1472Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1490socketAddressLen = operation.SocketAddress.Length; 1497Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1518socketAddressLen = operation.SocketAddress.Length; 1535Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1562Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1581int remains = buffer.Length - sentBytes; 1610if (buffer.Length == 0 || operation.ErrorCode != SocketError.Success) 1665socketAddressLen = operation.SocketAddress.Length; 1698socketAddressLen = operation.SocketAddress.Length; 1759socketAddressLen = operation.SocketAddress.Length; 1807socketAddressLen = operation.SocketAddress.Length; 1834socketAddressLen = operation.SocketAddress.Length; 1879socketAddressLen = operation.SocketAddress.Length; 1918socketAddressLen = operation.SocketAddress.Length; 1951socketAddressLen = operation.SocketAddress.Length;
System\Net\Sockets\SocketAsyncEventArgs.cs (4)
337ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)offset, (uint)_buffer.Length, nameof(offset)); 338ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)count, (long)(_buffer.Length - offset), nameof(count)); 413if (buffer.Length != 0 && _bufferList != null) 420_count = buffer.Length;
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (6)
38_acceptAddressBufferCount = socketAddress.Length; 106CompleteTransferOperation(socketAddress, socketAddress.Length, receivedFlags); 182CompleteReceiveMessageFromOperation(socketAddress, socketAddress.Length, receivedFlags, ipPacketInformation); 189Debug.Assert(socketAddress.Length == socketAddressSize); 191_socketAddressSize = socketAddress.Length; 205int socketAddressSize = _socketAddress!.Buffer.Length;
System\Net\Sockets\SocketPal.Unix.cs (7)
630int sockAddrLen = socketAddress.Length; 673Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 688err = Interop.Sys.Connectx(socket, rawSocketAddress, socketAddress.Length, data, data.Length, tfo ? 1 : 0, &sentBytes); 693err = Interop.Sys.Connect(socket, rawSocketAddress, socketAddress.Length); 915if (socketAddress.Length > 0 && receivedSocketAddressLength == 0) 918receivedSocketAddressLength = socketAddress.Length;
System.Net.WebSockets (8)
System\Net\WebSockets\ManagedWebSocket.cs (6)
785if (NetEventSource.Log.IsEnabled()) NetEventSource.ReceiveAsyncPrivateStarted(this, payloadBuffer.Length); 893if (header.Processed || payloadBuffer.Length == 0) 916_inflater.Prepare(header.PayloadLength, payloadBuffer.Length); 920int limit = (int)Math.Min(header.Compressed ? _inflater!.Span.Length : payloadBuffer.Length, header.PayloadLength); 1605Debug.Assert(minimumRequiredBytes <= _receiveBuffer.Length, $"Requested number of bytes {minimumRequiredBytes} must not exceed {_receiveBuffer.Length}");
System\Net\WebSockets\WebSocket.cs (2)
43byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 46WebSocketReceiveResult r = await ReceiveAsync(new ArraySegment<byte>(array, 0, buffer.Length), cancellationToken).ConfigureAwait(false);
System.Net.WebSockets.Client (2)
System\Net\WebSockets\BrowserWebSockets\BrowserWebSocket.cs (2)
396sendTask = BrowserInterop.UnsafeSend(_innerWebSocket!, pinBuffer.Value, bufferMemory.Length, messageType, endOfMessage); 440receiveTask = BrowserInterop.ReceiveUnsafe(_innerWebSocket!, pinBuffer.Value, bufferMemory.Length);
System.Private.CoreLib (27)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (3)
647completeSynchronously = bytesFromBuffer == buffer.Length; 688if (bytesFromBuffer == buffer.Length) 709if (buffer.Length >= _bufferSize)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (1)
71vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length };
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (10)
319if (_readLen == _readPos && buffer.Length >= _bufferSize) 327else if (_readLen - _readPos >= buffer.Length) 330_buffer.AsSpan(_readPos, buffer.Length).CopyTo(buffer.Span); 331_readPos += buffer.Length; 332return new ValueTask<int>(buffer.Length); 373int n = Math.Min(_readLen - _readPos, destination.Length); 408bytesFromBuffer = Math.Min(buffer.Length, _readLen - _readPos); 416if (bytesFromBuffer == buffer.Length) 439if (buffer.Length >= _bufferSize) 448bytesFromBuffer = Math.Min(_readLen, buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs (2)
288long readOffset = Interlocked.Add(ref _filePosition, destination.Length) - destination.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (5)
316byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 317return FinishReadAsync(ReadAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer, buffer); 349ValueTask<int> vt = ReadAtLeastAsyncCore(buffer, buffer.Length, throwOnEndOfStream: true, cancellationToken); 420ValidateReadAtLeastArguments(buffer.Length, minimumBytes); 430Debug.Assert(minimumBytes <= buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (1)
1149int count = buffer.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (1)
320} while (i > 0 && n < buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\WritableMemoryStream.cs (3)
31_length = buffer.Length; 320if (value > _memory.Length) 356if (count != 0 && _position > _memory.Length - count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (1)
432int bytesToReturn = Math.Min(_readBufferCount, buffer.Length);
System.Security.Cryptography (9)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
170if (innerRead != decryptedMemory.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
190if (decoded != decryptedMemory.Length) 221if (decoded != decryptedMemory.Length)
System\Security\Cryptography\CryptographicOperations.cs (2)
355CheckDestinationSize(hashSizeInBytes, destination.Length); 747CheckDestinationSize(hashSizeInBytes, destination.Length);
System\Security\Cryptography\CryptoStream.cs (2)
315int bytesToCopy = Math.Min(_outputBufferIndex, buffer.Length); 340int blocksToProcess = buffer.Length / _outputBlockSize;
System\Security\Cryptography\HashStatic.cs (1)
108if (destination.Length < THash.HashSizeInBytes)
System\Security\Cryptography\HMACStatic.cs (1)
146if (destination.Length < THMAC.HashSizeInBytes)
System.Security.Cryptography.Pkcs (3)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
170if (innerRead != decryptedMemory.Length)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
190if (decoded != decryptedMemory.Length) 221if (decoded != decryptedMemory.Length)
System.ServiceModel.NetFramingBase (25)
System\ServiceModel\Channels\Connection.cs (5)
58_preReadData = Fx.AllocateByteArray(initialData.Length + _preReadData.Length); 60initialData.CopyTo(_preReadData.Slice(tempBuffer.Length)); 72int bytesToCopy = Math.Min(buffer.Length, _preReadData.Length);
System\ServiceModel\Channels\FramingEncoders.cs (11)
76(EncodedBytes.Span[EncodedBytes.Length / 2] << 8) | 77EncodedBytes.Span[EncodedBytes.Length - 1]; 103if (EncodedBytes.Length != otherBytes.Length) 108for (int i = 0; i < EncodedBytes.Length; i++) 214return via.EncodedBytes.Length + contentType.EncodedBytes.Length; 220contentType.EncodedBytes.CopyTo(buffer.Slice(via.EncodedBytes.Length)); 348return via.EncodedBytes.Length + contentType.EncodedBytes.Length; 354contentType.EncodedBytes.CopyTo(buffer.Slice(via.EncodedBytes.Length));
System\ServiceModel\Channels\SingletonConnectionReader.cs (7)
538byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 539return FinishReadAsync(ReadAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer, buffer); 591int.MaxValue, settings.BufferManager, envelopeStartBytes.Length + IntEncoder.MaxEncodedSize); 593envelopeStartBytes.CopyTo(new Memory<byte>(messageData.Array, messageData.Offset - envelopeStartBytes.Length, envelopeStartBytes.Length)); 594await connection.WriteAsync(new Memory<byte>(messageData.Array, messageData.Offset - envelopeStartBytes.Length, 595messageData.Count + envelopeStartBytes.Length), true, timeoutHelper.RemainingTime());
System\ServiceModel\Channels\StreamedFramingRequestChannel.cs (2)
49int startSize = ClientSingletonEncoder.ModeBytes.Length + ClientSingletonEncoder.CalcStartSize(encodedVia, encodedContentType); 58ClientSingletonEncoder.EncodeStart(Preamble.Slice(ClientSingletonEncoder.ModeBytes.Length), encodedVia, encodedContentType);
System.ServiceModel.NetTcp (3)
System\ServiceModel\Channels\SocketConnection.cs (3)
176if (buffer.Length < 0) 178throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(buffer.Length), buffer.Length, SR.ValueMustBeNonNegative));
System.ServiceModel.Primitives (2)
System\ServiceModel\Channels\MaxMessageSizeStream.cs (2)
33int readCount = PrepareRead(buffer.Length); 34if (readCount < buffer.Length)
System.ServiceModel.UnixDomainSocket (3)
System\ServiceModel\Channels\SocketConnection.cs (3)
158if (buffer.Length < 0) 160throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(buffer.Length), buffer.Length, SR.ValueMustBeNonNegative));
System.Text.Json (106)
System\Text\Json\Writer\Utf8JsonWriter.cs (10)
638if (_memory.Length - BytesPending < 2) // 1 start token, and optionally, 1 list separator 717if (_memory.Length - BytesPending < maxRequired) 1076if (_memory.Length - BytesPending < 1) // 1 end token 1157if (_memory.Length - BytesPending < maxRequired) 1210if (_memory.Length == 0) 1229Debug.Assert(_memory.Length >= sizeHint); 1241if (_memory.Length < sizeHint) 1250Debug.Assert(_memory.Length == 0); 1259Debug.Assert(_memory.Length >= sizeHint); 1266if (_memory.Length < sizeHint)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (4)
216if (_memory.Length - BytesPending < maxRequired) 251if (_memory.Length - BytesPending < maxRequired) 290if (_memory.Length - BytesPending < maxRequired) 340if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (4)
221if (_memory.Length - BytesPending < maxRequired) 254if (_memory.Length - BytesPending < maxRequired) 292if (_memory.Length - BytesPending < maxRequired) 340if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (4)
220if (_memory.Length - BytesPending < maxRequired) 253if (_memory.Length - BytesPending < maxRequired) 291if (_memory.Length - BytesPending < maxRequired) 339if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (4)
220if (_memory.Length - BytesPending < maxRequired) 250if (_memory.Length - BytesPending < maxRequired) 285if (_memory.Length - BytesPending < maxRequired) 330if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (4)
224if (_memory.Length - BytesPending < maxRequired) 254if (_memory.Length - BytesPending < maxRequired) 289if (_memory.Length - BytesPending < maxRequired) 334if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (4)
224if (_memory.Length - BytesPending < maxRequired) 254if (_memory.Length - BytesPending < maxRequired) 289if (_memory.Length - BytesPending < maxRequired) 334if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (4)
220if (_memory.Length - BytesPending < maxRequired) 254if (_memory.Length - BytesPending < maxRequired) 293if (_memory.Length - BytesPending < maxRequired) 342if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (4)
82if (_memory.Length - BytesPending < maxRequired) 113if (_memory.Length - BytesPending < maxRequired) 155if (_memory.Length - BytesPending < maxRequired) 186if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (5)
340if (_memory.Length - BytesPending < maxRequired) 370if (_memory.Length - BytesPending < maxRequired) 403if (_memory.Length - BytesPending < maxRequired) 433if (_memory.Length - BytesPending < maxRequired) 478if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (4)
293if (_memory.Length - BytesPending < maxRequired) 323if (_memory.Length - BytesPending < maxRequired) 358if (_memory.Length - BytesPending < maxRequired) 403if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (13)
165if (_memory.Length - BytesPending < maxRequired) 196if (_memory.Length - BytesPending < maxRequired) 325if (_memory.Length - BytesPending < maxRequired) 354if (_memory.Length - BytesPending < maxRequired) 383if (_memory.Length - BytesPending < maxRequired) 1364if (_memory.Length - BytesPending < maxRequired) 1398if (_memory.Length - BytesPending < maxRequired) 1435if (_memory.Length - BytesPending < maxRequired) 1471if (_memory.Length - BytesPending < maxRequired) 1510if (_memory.Length - BytesPending < maxRequired) 1559if (_memory.Length - BytesPending < maxRequired) 1611if (_memory.Length - BytesPending < maxRequired) 1662if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (4)
302if (_memory.Length - BytesPending < maxRequired) 332if (_memory.Length - BytesPending < maxRequired) 367if (_memory.Length - BytesPending < maxRequired) 412if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Bytes.cs (2)
69if (_memory.Length - BytesPending < maxRequired) 109if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Comment.cs (4)
86if (_memory.Length - BytesPending < maxRequired) 120if (_memory.Length - BytesPending < maxRequired) 199if (_memory.Length - BytesPending < maxRequired) 226if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTime.cs (2)
46if (_memory.Length - BytesPending < maxRequired) 74if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.DateTimeOffset.cs (2)
47if (_memory.Length - BytesPending < maxRequired) 75if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Decimal.cs (2)
46if (_memory.Length - BytesPending < maxRequired) 70if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Double.cs (2)
50if (_memory.Length - BytesPending < maxRequired) 74if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Float.cs (2)
50if (_memory.Length - BytesPending < maxRequired) 74if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.FormattedNumber.cs (2)
51if (_memory.Length - BytesPending < maxRequired) 76if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Guid.cs (2)
46if (_memory.Length - BytesPending < maxRequired) 75if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Literal.cs (2)
70if (_memory.Length - BytesPending < maxRequired) 94if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (2)
175if (_memory.Length - BytesPending < maxRequired) 263if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.SignedNumber.cs (2)
59if (_memory.Length - BytesPending < maxRequired) 83if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (4)
124if (_memory.Length - BytesPending < maxRequired) 152if (_memory.Length - BytesPending < maxRequired) 272if (_memory.Length - BytesPending < maxRequired) 302if (_memory.Length - BytesPending < maxRequired)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (6)
170if (_memory.Length - BytesPending < requiredBytes) 336if (_memory.Length - BytesPending < requiredBytes) 449if (_memory.Length - BytesPending < requiredBytes) 480if (_memory.Length - BytesPending < bytesRequired) 509if (_memory.Length - BytesPending < bytesRequired) 526if (_memory.Length == BytesPending)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.UnsignedNumber.cs (2)
61if (_memory.Length - BytesPending < maxRequired) 85if (_memory.Length - BytesPending < maxRequired)