15162 references to Length
AndroidAppBuilder (5)
AppleAppBuilder (5)
ApplicationModelWebSite (1)
AssemblyStripper (113)
.packages\microsoft.dotnet.cilstrip.sources\9.0.0-beta.24256.1\contentFiles\cs\netstandard2.0\Mono.Cecil.Metadata\StringsHeap.cs (1)
58 int heap_length = data.Length;
BasicTestApp (5)
Benchmarks (2)
BlazorServerApp (1)
BlazorUnitedApp (1)
ClientSample (4)
CodeGenerator (30)
Diagnostics.EFCore.FunctionalTests (1)
Diagnostics.FunctionalTests (1)
dotnet-dev-certs (15)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
dotnet-getdocument (6)
dotnet-openapi (12)
dotnet-razorpagegenerator (3)
dotnet-sql-cache (5)
dotnet-user-jwts (11)
dotnet-user-secrets (7)
GetDocument.Insider (8)
HeaderPropagationSample (1)
HostedBlazorWebassemblyApp.Server (1)
HostFilteringSample (1)
http2cat (22)
HttpStress (10)
Identity.DefaultUI.WebSite (1)
IIS.Common.TestLib (2)
IIS.FunctionalTests (29)
IIS.LongTests (27)
IIS.Microbenchmarks (1)
IIS.NewHandler.FunctionalTests (27)
IIS.NewShim.FunctionalTests (27)
IIS.ShadowCopy.Tests (7)
IIS.Tests (2)
IISExpress.FunctionalTests (32)
ILCompiler.DependencyAnalysisFramework (1)
illink (52)
ILLink.RoslynAnalyzer (2)
ILLink.Tasks (2)
InMemory.FunctionalTests (226)
ChunkedRequestTests.cs (9)
32var count = await request.Body.ReadAsync(buffer, 0, buffer.Length);
69response.Headers["Content-Length"] = bytes.Length.ToString(CultureInfo.InvariantCulture);
70await response.Body.WriteAsync(bytes, 0, bytes.Length);
264while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
501while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
545while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
590while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
672while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
716while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
Http2\Http2ConnectionTests.cs (50)
778withLength: _maxData.Length,
825withLength: _maxData.Length,
840withLength: _maxData.Length,
852withLength: _maxData.Length,
867withLength: _maxData.Length,
886var updateSize = ((framesInStreamWindow / 2) + 1) * _maxData.Length;
888updateSize = ((framesInConnectionWindow / 2) + 1) * _maxData.Length;
929for (var i = 0; i < _helloWorldBytes.Length; i++)
1054withLength: _maxData.Length,
1069withLength: _maxData.Length,
1081withLength: _maxData.Length,
1102withLength: _maxData.Length,
1115withLength: _maxData.Length,
1130var updateSize = ((framesInStreamWindow / 2) + 1) * _maxData.Length;
1132updateSize = ((framesInConnectionWindow / 2) + 1) * _maxData.Length;
1242var maxDataMinusPadding = _maxData.AsMemory(0, _maxData.Length - padLength - 1);
1287withLength: _maxData.Length,
1302var updateSize = ((framesInWindow / 2) + 1) * _maxData.Length;
1340var updateSize = ((framesConnectionInWindow / 2) + 1) * _maxData.Length;
1363while (readResult.Buffer.Length != _maxData.Length * 4)
1372Assert.Equal(readResult.Buffer.Length, _maxData.Length * 5);
1412withLength: _maxData.Length,
1436var updateSize = ((framesInStreamWindow / 2) + 1) * _maxData.Length;
1438updateSize = ((framesInConnectionWindow / 2) + 1) * _maxData.Length;
1848var expectedFullFrameCountBeforeBackpressure = Http2PeerSettings.DefaultInitialWindowSize / _maxData.Length;
1849var remainingBytesBeforeBackpressure = (int)Http2PeerSettings.DefaultInitialWindowSize % _maxData.Length;
1850var remainingBytesAfterBackpressure = _maxData.Length - remainingBytesBeforeBackpressure;
1865await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
1889withLength: _maxData.Length,
3024var expectedFullFrameCountBeforeBackpressure = Http2PeerSettings.DefaultInitialWindowSize / _maxData.Length;
3025var remainingBytesBeforeBackpressure = (int)Http2PeerSettings.DefaultInitialWindowSize % _maxData.Length;
3055await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
3084withLength: _maxData.Length,
3117withLength: _maxData.Length,
3143var initialWindowSize = _helloWorldBytes.Length / 2;
3167await context.Response.Body.WriteAsync(_helloWorldBytes, 0, _helloWorldBytes.Length);
3253var updateSize = ((framesInConnectionWindow / 2) + 1) * _maxData.Length;
3992var expectedFullFrameCountBeforeBackpressure = Http2PeerSettings.DefaultInitialWindowSize / _maxData.Length;
3993var remainingBytesBeforeBackpressure = (int)Http2PeerSettings.DefaultInitialWindowSize % _maxData.Length;
4023await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4052withLength: _maxData.Length,
4095var initialWindowSize = _helloWorldBytes.Length / 2;
4119await context.Response.Body.WriteAsync(_helloWorldBytes, 0, _helloWorldBytes.Length);
4326var expectedFullFrameCountBeforeBackpressure = Http2PeerSettings.DefaultInitialWindowSize / _maxData.Length;
4348await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4352var lastWriteTask = context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4379withLength: _maxData.Length,
4384var remainingBytesBeforeBackpressure = (int)Http2PeerSettings.DefaultInitialWindowSize % _maxData.Length;
4385var remainingBytesAfterBackpressure = _maxData.Length - remainingBytesBeforeBackpressure;
4417var initialWindowSize = _helloWorldBytes.Length / 2;
Http2\Http2StreamTests.cs (23)
885var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
887read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
915var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
917read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
963var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
967read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
1057var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1061read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
1158while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1193while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1228while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1264while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1874var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1876read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1919while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1960var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1962read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2004while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2065while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2121var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2124read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
3090var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length));
3115var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length));
Http2\Http2TestBase.cs (9)
235while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
248while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
259while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
335received += await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
338var stalledReadTask = context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
791frame.PayloadLength = payload.Length;
866frame.PayloadLength = headerBlock.Length;
931frame.PayloadLength = payload.Length;
1294if (expectedErrorMessage?.Length > 0)
Http2\Http2TimeoutTests.cs (21)
165withLength: _helloWorldBytes.Length,
320while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
358AdvanceTime(TimeSpan.FromSeconds((_bytesReceived + _helloWorldBytes.Length) / limits.MinResponseDataRate.BytesPerSecond) +
369withLength: _helloWorldBytes.Length,
409var timeToWriteMaxData = TimeSpan.FromSeconds((_bytesReceived + _maxData.Length) / limits.MinResponseDataRate.BytesPerSecond) +
423withLength: _maxData.Length,
496_clientSettings.InitialWindowSize = (uint)_maxData.Length - 1;
549_clientSettings.InitialWindowSize = (uint)_maxData.Length - 1;
616await StartStreamAsync(1, ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
662await StartStreamAsync(1, ReadRateRequestHeaders(_maxData.Length), endStream: false);
677var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
712await StartStreamAsync(1, ReadRateRequestHeaders(_maxData.Length), endStream: false);
725await StartStreamAsync(3, ReadRateRequestHeaders(_maxData.Length), endStream: false);
737var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond);
778await StartStreamAsync(1, ReadRateRequestHeaders(_maxData.Length), endStream: false);
796await StartStreamAsync(3, ReadRateRequestHeaders(_maxData.Length), endStream: false);
810var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
850await StartStreamAsync(1, ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
919await StartStreamAsync(3, ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
949var expectedUpdateSize = ((framesConnectionInWindow / 2) + 1) * _maxData.Length + _helloWorldBytes.Length;
Http3\Http3StreamTests.cs (16)
564var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
566read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
593var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
597read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
731for (var i = 0; i < data.Length; i++)
742while (receivedData.Count < data.Length)
2484var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2486read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2522while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2557var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2559read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2594while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2647while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2695var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2698read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2829for (var i = 0; i < sourceData.Length; i++)
Http3\Http3TimeoutTests.cs (14)
347var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
428while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
464Http3Api.AdvanceTime(TimeSpan.FromSeconds((requestStream.BytesReceived + _helloWorldBytes.Length) / limits.MinResponseDataRate.BytesPerSecond) +
475Assert.Equal(_helloWorldBytes.Length, data.Length);
505var timeToWriteMaxData = TimeSpan.FromSeconds((requestStream.BytesReceived + _maxData.Length) / limits.MinResponseDataRate.BytesPerSecond) +
539var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
548var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
584var requestStream1 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
590var requestStream2 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
596var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond);
640var requestStream1 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
649var requestStream2 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
657var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
700var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
RequestTests.cs (9)
134var task = context.Request.Body.ReadAsync(data, 0, data.Length, cts.Token);
1129Assert.Equal(22, ms1.ToArray().Length);
1357await duplexStream.WriteAsync(data, 0, data.Length);
1412context.Response.ContentLength = request.Length;
1414await context.Response.Body.WriteAsync(request, 0, request.Length);
1597await duplexStream.WriteAsync(response, 0, response.Length);
1645await stream.WriteAsync(response, 0, response.Length);
2301var mask = Math.Pow(2, lines.Length) - 1;
2309for (var pos = 0; pos < lines.Length; pos++)
ResponseTests.cs (26)
157var writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout();
164writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout();
1021await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1056await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1701httpContext.Response.ContentLength = response.Length - 1;
1704await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1743httpContext.Response.ContentLength = response.Length - 1;
1746await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length));
1785httpContext.Response.ContentLength = response.Length - 1;
1788await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1789await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
1830httpContext.Response.ContentLength = response.Length - 1;
1833await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1834await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
1873httpContext.Response.ContentLength = response.Length - 1;
1876return httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)).AsTask();
1913httpContext.Response.ContentLength = response.Length - 1;
1916await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1917await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
2359await stream.WriteAsync(response, 0, response.Length);
src\Servers\Kestrel\shared\test\StreamExtensions.cs (7)
22read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
24} while (read != 0 && offset < buffer.Length);
41read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
43} while (read != 0 && offset < buffer.Length);
45Assert.True(offset >= buffer.Length);
57var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
84var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
InProcessWebSite (10)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (9)
631var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
635result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
644var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
649result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
719count += await ctx.Request.Body.ReadAsync(data, count, data.Length - count);
720} while (count != data.Length);
721await ctx.Response.Body.WriteAsync(data, 0, data.Length);
737var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
744result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
installer.tasks (21)
Interop.FunctionalTests (34)
HttpClientHttp2InteropTests.cs (10)
204for (var i = 0; i < Content.Length; i++)
216await stream.WriteAsync(Content, 0, Content.Length, timer.Token).DefaultTimeout();
236read = await stream.ReadAsync(buffer, 0, buffer.Length, timer.Token).DefaultTimeout();
242Assert.True(totalRead <= Repetitions * Content.Length, "Too Long");
246Assert.Equal(Content[patternOffset % Content.Length], buffer[offset]);
251read = await stream.ReadAsync(buffer, 0, buffer.Length, timer.Token).DefaultTimeout();
254Assert.True(totalRead == Repetitions * Content.Length, "Too Short");
1505read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length).DefaultTimeout();
1727var read = await stream.ReadAsync(responseBuffer, totalRead, responseBuffer.Length - totalRead).DefaultTimeout();
1733} while (totalRead < responseBuffer.Length);
src\Servers\Kestrel\shared\test\StreamExtensions.cs (7)
22read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
24} while (read != 0 && offset < buffer.Length);
41read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
43} while (read != 0 && offset < buffer.Length);
45Assert.True(offset >= buffer.Length);
57var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
84var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
KeyManagementSimulator (4)
LibraryBuilder (4)
Microsoft.AspNetCore (2)
Microsoft.AspNetCore.Analyzer.Testing (7)
Microsoft.AspNetCore.Antiforgery (16)
Microsoft.AspNetCore.Antiforgery.Test (3)
Microsoft.AspNetCore.App.Analyzers (4)
Microsoft.AspNetCore.App.Analyzers.Test (12)
Microsoft.AspNetCore.App.UnitTests (5)
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Abstractions (1)
Microsoft.AspNetCore.Authentication.Certificate (1)
Microsoft.AspNetCore.Authentication.Cookies (1)
Microsoft.AspNetCore.Authentication.Facebook (2)
Microsoft.AspNetCore.Authentication.Google (1)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (2)
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authentication.OpenIdConnect (3)
Microsoft.AspNetCore.Authentication.Test (3)
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Authentication.WsFederation (1)
Microsoft.AspNetCore.Authorization (3)
Microsoft.AspNetCore.Authorization.Policy (2)
Microsoft.AspNetCore.Components (63)
Microsoft.AspNetCore.Components.Analyzers (2)
Microsoft.AspNetCore.Components.Analyzers.Tests (18)
Microsoft.AspNetCore.Components.Authorization (2)
Microsoft.AspNetCore.Components.Endpoints (16)
Microsoft.AspNetCore.Components.Endpoints.Tests (18)
Binding\FormDataMapperTests.cs (8)
2031Assert.Equal(expectedString, Encoding.UTF8.GetString(buffer, 0, buffer.Length));
2066Assert.Equal(expectedString1, Encoding.UTF8.GetString(buffer1, 0, buffer1.Length));
2073Assert.Equal(expectedString1, Encoding.UTF8.GetString(buffer2, 0, buffer2.Length));
2248if (components.Length != 2)
2296if (components.Length != 2)
2343if (buffer.Count >= buffer.Data.Length)
2345var newBuffer = Rent(buffer.Data.Length * 2);
2346Array.Copy(buffer.Data, newBuffer, buffer.Data.Length);
Microsoft.AspNetCore.Components.Forms (1)
Microsoft.AspNetCore.Components.Forms.Tests (6)
Microsoft.AspNetCore.Components.Performance (1)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (18)
Microsoft.AspNetCore.Components.Server (41)
Microsoft.AspNetCore.Components.Server.Tests (23)
Microsoft.AspNetCore.Components.Tests (19)
Rendering\ArrayBuilderTest.cs (9)
87builder.Append(array, 0, array.Length);
90Assert.Equal(array.Length, builder.Count);
91Assert.Equal(array, builder.Buffer.Take(array.Length));
122builder.Append(array, 0, array.Length);
125Assert.Equal(array.Length, builder.Count);
126Assert.Equal(array, builder.Buffer.Take(array.Length));
313buffer => Assert.Equal(2, buffer.Length),
314buffer => Assert.Equal(4, buffer.Length),
315buffer => Assert.Equal(8, buffer.Length));
Microsoft.AspNetCore.Components.Web (1)
Microsoft.AspNetCore.Components.Web.Tests (6)
Microsoft.AspNetCore.Components.WebAssembly (7)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Components.WebAssembly.Tests (2)
Microsoft.AspNetCore.Components.WebView (22)
Microsoft.AspNetCore.Components.WebViewE2E.Test (1)
Microsoft.AspNetCore.Connections.Abstractions (6)
Microsoft.AspNetCore.CookiePolicy.Test (1)
Microsoft.AspNetCore.Cors (1)
Microsoft.AspNetCore.Cryptography.Internal (1)
Microsoft.AspNetCore.Cryptography.Internal.Tests (5)
Microsoft.AspNetCore.Cryptography.KeyDerivation (15)
Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests (5)
Microsoft.AspNetCore.DataProtection (86)
Cng\DpapiSecretSerializerHelper.cs (9)
55return ProtectWithDpapiCore(pbPlaintextSecret, (uint)plaintextSecret.Length, pbPurpose, (uint)_purpose.Length, fLocalMachine: protectToLocalMachine);
61Array.Clear(plaintextSecret, 0, plaintextSecret.Length);
134cbData: (uint)plaintextSecret.Length);
139Array.Clear(plaintextSecret, 0, plaintextSecret.Length);
204return UnprotectWithDpapiCore(pbProtectedSecret, (uint)protectedSecret.Length, pbPurpose, (uint)_purpose.Length);
268cbData: (uint)protectedData.Length);
329cbData: (uint)protectedData.Length);
Managed\AesGcmAuthenticatedEncryptor.cs (7)
134Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
135Array.Clear(derivedKey, 0, derivedKey.Length);
173Buffer.BlockCopy(keyModifier, 0, retVal, (int)preBufferSize, keyModifier.Length);
174Buffer.BlockCopy(nonceBytes, 0, retVal, (int)preBufferSize + keyModifier.Length, nonceBytes.Length);
210Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
211Array.Clear(derivedKey, 0, derivedKey.Length);
Managed\ManagedAuthenticatedEncryptor.cs (28)
118CryptoUtil.Assert(ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes, "ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes");
119Buffer.BlockCopy(ciphertext, 0, retVal, idx, ciphertext.Length);
129CryptoUtil.Assert(digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes, "digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes");
130Buffer.BlockCopy(digest, 0, retVal, idx, digest.Length);
134CryptoUtil.Assert(idx == retVal.Length, "idx == retVal.Length");
191Buffer.BlockCopy(protectedPayload.Array!, ivOffset, iv, 0, iv.Length);
199var derivedKeysBuffer = new byte[checked(decryptionSubkey.Length + validationSubkey.Length)];
217Buffer.BlockCopy(derivedKeysBuffer, 0, decryptionSubkey, 0, decryptionSubkey.Length);
218Buffer.BlockCopy(derivedKeysBuffer, decryptionSubkey.Length, validationSubkey, 0, validationSubkey.Length);
237if (!CryptoUtil.TimeConstantBuffersAreEqual(correctHash, 0, correctHash.Length, protectedPayload.Array!, macOffset, eofOffset - macOffset))
261Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
262Array.Clear(decryptionSubkey, 0, decryptionSubkey.Length);
263Array.Clear(validationSubkey, 0, validationSubkey.Length);
264Array.Clear(derivedKeysBuffer, 0, derivedKeysBuffer.Length);
297outputStream.Write(keyModifier, 0, keyModifier.Length);
298outputStream.Write(iv, 0, iv.Length);
308var derivedKeysBuffer = new byte[checked(encryptionSubkey.Length + validationSubkey.Length)];
326Buffer.BlockCopy(derivedKeysBuffer, 0, encryptionSubkey, 0, encryptionSubkey.Length);
327Buffer.BlockCopy(derivedKeysBuffer, encryptionSubkey.Length, validationSubkey, 0, validationSubkey.Length);
350outputStream.Write(mac, 0, mac.Length);
361Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
362Array.Clear(encryptionSubkey, 0, encryptionSubkey.Length);
363Array.Clear(validationSubkey, 0, validationSubkey.Length);
364Array.Clear(derivedKeysBuffer, 0, derivedKeysBuffer.Length);
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (9)
26prfInput[prfInput.Length - 4] = (byte)(outputSizeInBits >> 24);
27prfInput[prfInput.Length - 3] = (byte)(outputSizeInBits >> 16);
28prfInput[prfInput.Length - 2] = (byte)(outputSizeInBits >> 8);
29prfInput[prfInput.Length - 1] = (byte)(outputSizeInBits);
46CryptoUtil.Assert(prfOutputSizeInBytes == prfOutput.Length, "prfOutputSizeInBytes == prfOutput.Length");
49Array.Clear(prfOutput, 0, prfOutput.Length); // contains key material, so delete it
60var combinedContext = new byte[checked(contextHeader.Length + context.Count)];
61Buffer.BlockCopy(contextHeader, 0, combinedContext, 0, contextHeader.Length);
62Buffer.BlockCopy(context.Array!, context.Offset, combinedContext, contextHeader.Length, context.Count);
Microsoft.AspNetCore.DataProtection.Abstractions (7)
Microsoft.AspNetCore.DataProtection.Extensions (6)
Microsoft.AspNetCore.DataProtection.Tests (16)
SP800_108\SP800_108Tests.cs (11)
81for (int i = 0; i < kdk.Length; i++)
105for (int i = 0; i < kdk.Length; i++)
129for (int i = 0; i < kdk.Length; i++)
151ISP800_108_CTR_HMACSHA512Provider provider = factory(pbKdk, (uint)kdk.Length);
152provider.DeriveKeyWithContextHeader(pbLabel, (uint)label.Length, contextHeader, pbContext, (uint)context.Length, pbDerivedSubkey, (uint)derivedSubkey.Length);
160var labelSegment = new ArraySegment<byte>(new byte[label.Length + 10], 3, label.Length);
162var contextSegment = new ArraySegment<byte>(new byte[context.Length + 10], 5, context.Length);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (10)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Microsoft.AspNetCore.Diagnostics (7)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (3)
Microsoft.AspNetCore.Grpc.JsonTranscoding.IntegrationTests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (4)
Microsoft.AspNetCore.HostFiltering (2)
Microsoft.AspNetCore.Hosting (26)
Microsoft.AspNetCore.Hosting.Tests (4)
Microsoft.AspNetCore.Http (12)
Microsoft.AspNetCore.Http.Abstractions (48)
Microsoft.AspNetCore.Http.Abstractions.Microbenchmarks (4)
Microsoft.AspNetCore.Http.Abstractions.Tests (7)
Microsoft.AspNetCore.Http.Connections (10)
Microsoft.AspNetCore.Http.Connections.Client (7)
Microsoft.AspNetCore.Http.Connections.Tests (29)
HttpConnectionDispatcherTests.cs (8)
216requestBody.Write(bytes, 0, bytes.Length);
586requestBody.Write(bytes, 0, bytes.Length);
650requestBody.Write(bytes, 0, bytes.Length);
2576requestBody.Write(buffer, 0, buffer.Length);
2636requestBody.Write(buffer, 0, buffer.Length);
2640await connection.ApplicationStream.WriteAsync(buffer, 0, buffer.Length).DefaultTimeout();
2693requestBody.Write(buffer, 0, buffer.Length);
2697await connection.ApplicationStream.WriteAsync(buffer, 0, buffer.Length).DefaultTimeout();
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.AspNetCore.Http.Extensions (54)
src\Shared\PropertyAsParameterInfo.cs (16)
69if (parameters.Length == 0)
77for (var i = 0; i < parameters.Length; i++)
91List<ParameterInfo> list = new(parameters.Length);
107if (constructor is not null && constructorParameters is { Length: > 0 })
144if (constructorAttributes == null || constructorAttributes is { Length: 0 })
151var mergedAttributes = new Attribute[constructorAttributes.Length + propertyAttributes.Length];
152Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
153Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
162if (constructorAttributes == null || constructorAttributes is { Length: 0 })
171var mergedAttributes = new object[constructorAttributes.Length + propertyAttributes.Length];
172Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
173Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.Http.Extensions.Tests (37)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (18)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Results.Tests (9)
Microsoft.AspNetCore.Http.Tests (12)
Features\FormFeatureTests.cs (7)
620var toWrite = Math.Min(size - written, bytes.Length);
641stream.Write(bytes, 0, bytes.Length);
647stream.Write(bytes, 0, bytes.Length);
656var readA = streamA.Read(bytesA, 0, bytesA.Length);
657var readB = streamB.Read(bytesB, 0, bytesB.Length);
670readA = streamA.Read(bytesA, 0, bytesA.Length);
671readB = streamB.Read(bytesB, 0, bytesB.Length);
Microsoft.AspNetCore.HttpLogging (14)
Microsoft.AspNetCore.HttpLogging.Tests (11)
Microsoft.AspNetCore.HttpOverrides (33)
Microsoft.AspNetCore.Identity (5)
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (2)
Microsoft.AspNetCore.Identity.FunctionalTests (7)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
Microsoft.AspNetCore.Identity.Test (2)
Microsoft.AspNetCore.Identity.UI (3)
Microsoft.AspNetCore.InternalTesting (1)
Microsoft.AspNetCore.InternalTesting.Tests (1)
Microsoft.AspNetCore.JsonPatch (3)
Microsoft.AspNetCore.Localization (4)
Microsoft.AspNetCore.Localization.Tests (1)
Microsoft.AspNetCore.Mvc.Abstractions (15)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
Microsoft.AspNetCore.Mvc.ApiExplorer (16)
src\Shared\PropertyAsParameterInfo.cs (15)
69if (parameters.Length == 0)
77for (var i = 0; i < parameters.Length; i++)
91List<ParameterInfo> list = new(parameters.Length);
144if (constructorAttributes == null || constructorAttributes is { Length: 0 })
151var mergedAttributes = new Attribute[constructorAttributes.Length + propertyAttributes.Length];
152Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
153Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
162if (constructorAttributes == null || constructorAttributes is { Length: 0 })
171var mergedAttributes = new object[constructorAttributes.Length + propertyAttributes.Length];
172Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
173Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.Mvc.Core (114)
Microsoft.AspNetCore.Mvc.Core.Test (32)
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.DataAnnotations (1)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (2)
Microsoft.AspNetCore.Mvc.Formatters.Xml (1)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (48)
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
Microsoft.AspNetCore.Mvc.Localization (1)
Microsoft.AspNetCore.Mvc.Localization.Test (2)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (5)
Microsoft.AspNetCore.Mvc.Razor (9)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (8)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (3)
Microsoft.AspNetCore.Mvc.Razor.Test (3)
RazorPageTest.cs (3)
1032page.BeginAddHtmlAttributeValues(executionContext, "someattr", attributeValues.Length, HtmlAttributeValueStyle.SingleQuotes);
1078page.BeginAddHtmlAttributeValues(executionContext, "someattr", attributeValues.Length, HtmlAttributeValueStyle.SingleQuotes);
1246page.BeginWriteAttribute("someattr", prefix, 0, suffix, 0, attributeValues.Length);
Microsoft.AspNetCore.Mvc.RazorPages (20)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Microsoft.AspNetCore.Mvc.TagHelpers (14)
Cache\DistributedCacheTagHelperService.cs (10)
168var keyLength = BitConverter.GetBytes(serializedKey.Length);
170buffer.Write(keyLength, 0, keyLength.Length);
171buffer.Write(serializedKey, 0, serializedKey.Length);
172buffer.Write(value, 0, value.Length);
185buffer.Read(keyLengthBuffer, 0, keyLengthBuffer.Length);
189buffer.Read(serializedKeyBuffer, 0, serializedKeyBuffer.Length);
194decoded = new byte[value.Length - keyLengthBuffer.Length - serializedKeyBuffer.Length];
195buffer.Read(decoded, 0, decoded.Length);
Microsoft.AspNetCore.Mvc.Test (7)
Microsoft.AspNetCore.Mvc.Testing (6)
Microsoft.AspNetCore.Mvc.ViewFeatures (37)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (19)
Buffers\PagedCharBufferTest.cs (7)
339buffer.Append(laterChars, 0, laterChars.Length);
340buffer.Append(laterChars, 0, laterChars.Length);
369buffer.Append(laterChars, 0, laterChars.Length);
370buffer.Append(laterChars, 0, laterChars.Length);
398buffer.Append(laterChars, 0, laterChars.Length);
399buffer.Append(laterChars, 0, laterChars.Length);
418buffer.Append(arrayToAppend, 0, arrayToAppend.Length);
Microsoft.AspNetCore.OpenApi (42)
src\Shared\PropertyAsParameterInfo.cs (16)
69if (parameters.Length == 0)
77for (var i = 0; i < parameters.Length; i++)
91List<ParameterInfo> list = new(parameters.Length);
107if (constructor is not null && constructorParameters is { Length: > 0 })
144if (constructorAttributes == null || constructorAttributes is { Length: 0 })
151var mergedAttributes = new Attribute[constructorAttributes.Length + propertyAttributes.Length];
152Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
153Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
162if (constructorAttributes == null || constructorAttributes is { Length: 0 })
171var mergedAttributes = new object[constructorAttributes.Length + propertyAttributes.Length];
172Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
173Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.OutputCaching (17)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (1)
Microsoft.AspNetCore.OutputCaching.Tests (5)
Microsoft.AspNetCore.Owin (2)
Microsoft.AspNetCore.RateLimiting (1)
Microsoft.AspNetCore.RateLimiting.Tests (1)
Microsoft.AspNetCore.Razor (1)
Microsoft.AspNetCore.Razor.Runtime (3)
Microsoft.AspNetCore.Razor.Runtime.Test (1)
Microsoft.AspNetCore.RequestDecompression.Tests (5)
Microsoft.AspNetCore.ResponseCaching (10)
Microsoft.AspNetCore.ResponseCaching.Tests (2)
Microsoft.AspNetCore.ResponseCompression (5)
Microsoft.AspNetCore.ResponseCompression.Tests (8)
Microsoft.AspNetCore.Rewrite (5)
Microsoft.AspNetCore.Routing (89)
Microsoft.AspNetCore.Routing.Abstractions (6)
Microsoft.AspNetCore.Routing.Microbenchmarks (35)
Microsoft.AspNetCore.Routing.Tests (43)
Microsoft.AspNetCore.Server.HttpSys (15)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (118)
Listener\RequestBodyTests.cs (13)
31Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(input, 0, input.Length));
36var read = context.Request.Body.Read(input, 0, input.Length);
59Task<int> task = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
81int read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
84read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
106int read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
109read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
130int read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
132var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
155int read = await context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
158var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
182int read = await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken);
185var assertTask = Assert.ThrowsAsync<IOException>(async () => await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken));
Listener\ResponseBodyTests.cs (11)
72Assert.Equal(20, (await response.Content.ReadAsByteArrayAsync()).Length);
256context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
261Assert.Throws<ObjectDisposedException>(() => context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length));
292await context.Response.Body.WriteAsync(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
297await Assert.ThrowsAsync<ObjectDisposedException>(() => context.Response.Body.WriteAsync(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length));
325context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
352await context.Response.Body.WriteAsync(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
390context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
429await context.Response.Body.WriteAsync(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
466context.Response.Body.Write(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
500await context.Response.Body.WriteAsync(Utilities.WriteBuffer, 0, Utilities.WriteBuffer.Length);
RequestBodyLimitTests.cs (24)
31int read = httpContext.Request.Body.Read(input, 0, input.Length);
54int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
75int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
98int read = httpContext.Request.Body.Read(input, 0, input.Length);
121int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
142int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
165var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
168ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
190var ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
193ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
215var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
218ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
241var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
244ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
266var ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
269ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
291var ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null)));
294ex = Assert.Throws<BadHttpRequestException>(() => body.EndRead(body.BeginRead(input, 0, input.Length, null, null)));
318int read = httpContext.Request.Body.Read(input, 0, input.Length);
321var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
344int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
347var ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
370int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
394int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
RequestBodyTests.cs (17)
32int read = httpContext.Request.Body.Read(input, 0, input.Length);
54read = httpContext.Request.Body.Read(input, 0, input.Length);
73int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
93read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
110int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
131Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, input.Length + 1, 1));
133Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 1, input.Length));
134Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 0, input.Length + 1));
152int read = httpContext.Request.Body.Read(input, 0, input.Length);
155read = httpContext.Request.Body.Read(input, 0, input.Length);
173int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
176read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
192int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
194read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
202Assert.Equal(13, lines.Length);
229int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
322await stream.WriteAsync(requestBytes, 0, requestBytes.Length);
RequestTests.cs (5)
66httpContext.Response.Body.Write(body, 0, body.Length);
130httpContext.Response.Body.Write(body, 0, body.Length);
193httpContext.Response.Body.Write(body, 0, body.Length);
237httpContext.Response.Body.Write(body, 0, body.Length);
334httpContext.Response.Body.Write(body, 0, body.Length);
ResponseSendFileTests.cs (11)
75Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length);
94Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length);
113Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length);
133Assert.Equal(FileLength * 2, (await response.Content.ReadAsByteArrayAsync()).Length);
152Assert.Equal(FileLength / 2, (await response.Content.ReadAsByteArrayAsync()).Length);
230Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length);
251Assert.Equal(10, (await response.Content.ReadAsByteArrayAsync()).Length);
300Assert.Equal(10, (await response.Content.ReadAsByteArrayAsync()).Length);
323Assert.Equal(10, (await response.Content.ReadAsByteArrayAsync()).Length);
345Assert.Equal(FileLength * 2, (await response.Content.ReadAsByteArrayAsync()).Length);
363Assert.Equal(FileLength * 2, (await response.Content.ReadAsByteArrayAsync()).Length);
Microsoft.AspNetCore.Server.IIS (17)
Core\IISHttpContext.cs (4)
420(uint)buffer.Length,
614NativeMethods.HttpResponseSetUnknownHeader(_requestNativeHandle, pHeaderName, pHeaderValue, (ushort)headerValueBytes.Length, fReplace: isFirst);
619NativeMethods.HttpResponseSetKnownHeader(_requestNativeHandle, knownHeaderIndex, pHeaderValue, (ushort)headerValueBytes.Length, fReplace: isFirst);
653NativeMethods.HttpResponseSetTrailer(_requestNativeHandle, pHeaderName, pHeaderValue, (ushort)headerValueBytes.Length, replace: isFirst);
Microsoft.AspNetCore.Server.IntegrationTesting (2)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
Microsoft.AspNetCore.Server.Kestrel.Core (153)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (160)
MessageBodyTests.cs (27)
44var count = stream.Read(buffer, 0, buffer.Length);
48count = stream.Read(buffer, 0, buffer.Length);
170var count = await stream.ReadAsync(buffer, 0, buffer.Length);
174count = await stream.ReadAsync(buffer, 0, buffer.Length);
197var count = stream.Read(buffer, 0, buffer.Length);
203count = stream.Read(buffer, 0, buffer.Length);
222var task = stream.ReadAsync(buffer, 0, buffer.Length);
247var task = stream.ReadAsync(buffer, 0, buffer.Length);
280await stream.ReadAsync(buffer, 0, buffer.Length);
318var count = await stream.ReadAsync(buffer, 0, buffer.Length);
324count = await stream.ReadAsync(buffer, 0, buffer.Length);
344var readTask = stream.ReadAsync(buffer, 0, buffer.Length);
353var res = await stream.ReadAsync(buffer, 0, buffer.Length);
379await stream.ReadAsync(buffer, 0, buffer.Length));
403await stream.ReadAsync(buffer, 0, buffer.Length));
430var count = stream.Read(buffer, 0, buffer.Length);
457var count = await stream.ReadAsync(buffer, 0, buffer.Length);
485Assert.Equal(0, stream.Read(buffer, 0, buffer.Length));
507Assert.Equal(0, await stream.ReadAsync(buffer, 0, buffer.Length));
535Assert.Equal(8197, requestArray.Length);
536AssertASCII(largeInput + "Hello", new ArraySegment<byte>(requestArray, 0, requestArray.Length));
666Assert.Equal(5, await stream.ReadAsync(buffer, 0, buffer.Length));
693Assert.Equal(5, await stream.ReadAsync(buffer, 0, buffer.Length));
1404Assert.Equal(bytes.Length, actual.Count);
1405for (var index = 0; index < bytes.Length; index++)
1416Assert.Equal(bytes.Length, actual.Length);
1417for (var index = 0; index < bytes.Length; index++)
src\Servers\Kestrel\shared\test\StreamExtensions.cs (7)
22read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
24} while (read != 0 && offset < buffer.Length);
41read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
43} while (read != 0 && offset < buffer.Length);
45Assert.True(offset >= buffer.Length);
57var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
84var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (24)
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (5)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (34)
src\Servers\Kestrel\shared\test\StreamExtensions.cs (7)
22read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
24} while (read != 0 && offset < buffer.Length);
41read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
43} while (read != 0 && offset < buffer.Length);
45Assert.True(offset >= buffer.Length);
57var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
84var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (2)
Microsoft.AspNetCore.Session (13)
DistributedSession.cs (7)
146if (encodedKey.KeyBytes.Length > KeyLengthLimit)
157var copy = new byte[value.Length];
158Buffer.BlockCopy(src: value, srcOffset: 0, dst: copy, dstOffset: 0, count: value.Length);
326SerializeNumAs2Bytes(output, keyBytes.Length);
327output.Write(keyBytes, 0, keyBytes.Length);
328SerializeNumAs4Bytes(output, entry.Value.Length);
329output.Write(entry.Value, 0, entry.Value.Length);
Microsoft.AspNetCore.Shared.Tests (148)
SegmentWriteStreamTests.cs (12)
55Assert.Equal(WriteData.Length, stream.Length);
56Assert.Equal((WriteData.Length + segmentSize - 1) / segmentSize, segments.Count);
58for (var i = 0; i < WriteData.Length; i += segmentSize)
60var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i);
68Assert.Equal(expectedSegmentSize, segment.Length);
82for (var i = 0; i < WriteData.Length; i += writeSize)
84stream.Write(WriteData, i, Math.Min(writeSize, WriteData.Length - i));
88Assert.Equal(WriteData.Length, stream.Length);
89Assert.Equal((WriteData.Length + segmentSize - 1) / segmentSize, segments.Count);
91for (var i = 0; i < WriteData.Length; i += segmentSize)
93var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i);
101Assert.Equal(expectedSegmentSize, segment.Length);
Microsoft.AspNetCore.SignalR.Client.Core (14)
HubConnection.cs (11)
756var newArgsCount = args.Length;
758Span<bool> isStreaming = args.Length <= MaxStackSize
759? stackalloc bool[MaxStackSize].Slice(0, args.Length)
760: new bool[args.Length];
761for (var i = 0; i < args.Length; i++)
786if (newArgsCount == args.Length)
796for (var i = 0; i < args.Length; i++)
962Log.PreparingBlockingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName!, args.Length);
989Log.PreparingStreamingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName!, args.Length);
1046Log.PreparingNonBlockingInvocation(_logger, methodName, args.Length);
2210if (handlers.Length > 0)
Microsoft.AspNetCore.SignalR.Client.Tests (17)
Microsoft.AspNetCore.SignalR.Common (5)
Microsoft.AspNetCore.SignalR.Common.Tests (68)
Internal\Protocol\MemoryBufferWriterTests.cs (27)
22MinimumSegmentSize = buffer.Length;
86bufferWriter.Write(input, 0, input.Length);
105bufferWriter.Write(input, 0, input.Length);
125bufferWriter.Write(input, 0, input.Length);
146bufferWriter.Write(input, 0, input.Length);
169bufferWriter.Write(input, 0, input.Length);
170Assert.Equal(input.Length, bufferWriter.Length);
185bufferWriter.Write(input, 0, input.Length);
186Assert.Equal(input.Length, bufferWriter.Length);
203bufferWriter.Write(input, 0, input.Length);
204Assert.Equal(input.Length, bufferWriter.Length);
219bufferWriter.Write(input, 0, input.Length);
220Assert.Equal(input.Length, bufferWriter.Length);
236bufferWriter.Write(input, 0, input.Length);
237Assert.Equal(input.Length, bufferWriter.Length);
255bufferWriter.Write(input, 0, input.Length);
256Assert.Equal(input.Length, bufferWriter.Length);
273bufferWriter.Write(input, 0, input.Length);
274Assert.Equal(input.Length, bufferWriter.Length);
293bufferWriter.Write(input, 0, input.Length);
294Assert.Equal(input.Length, bufferWriter.Length);
304Array.Clear(data, 0, data.Length);
320bufferWriter.Write(input, 0, input.Length);
321Assert.Equal(input.Length, bufferWriter.Length);
340bufferWriter.Write(input, 0, input.Length);
341Assert.Equal(input.Length, bufferWriter.Length);
351Array.Clear(data, 0, data.Length);
Internal\Protocol\Utf8BufferTextReaderTests.cs (11)
23var read = reader.Read(chars, 0, chars.Length);
36var read = reader.Read(chars, 0, chars.Length);
41read = reader.Read(chars, 0, chars.Length);
54var read = reader.Read(chars, 10, chars.Length - 10);
68var read = reader.Read(chars, 0, chars.Length);
73read = reader.Read(chars, 0, chars.Length);
78read = reader.Read(chars, 0, chars.Length);
83read = reader.Read(chars, 0, chars.Length);
100var read = reader.Read(chars, 0, chars.Length);
105read = reader.Read(chars, 0, chars.Length);
110read = reader.Read(chars, 0, chars.Length);
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.AspNetCore.SignalR.Core (22)
Microsoft.AspNetCore.SignalR.Microbenchmarks (18)
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (8)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (5)
Microsoft.AspNetCore.SignalR.Specification.Tests (5)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (5)
Microsoft.AspNetCore.SignalR.Tests (16)
Microsoft.AspNetCore.SpaServices.Extensions (1)
Microsoft.AspNetCore.StaticFiles (4)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.AspNetCore.StaticFiles.Tests (7)
Microsoft.AspNetCore.TestHost (4)
Microsoft.AspNetCore.TestHost.Tests (17)
ResponseBodyTests.cs (6)
29Assert.Equal(length, bytes.Length);
46Assert.Equal(length, bytes.Length);
56httpContext.Response.Body.Write(contentBytes, 0, contentBytes.Length);
72httpContext.Response.Body.Write(contentBytes, 0, contentBytes.Length);
91await httpContext.Response.Body.WriteAsync(contentBytes, 0, contentBytes.Length);
110await httpContext.Response.Body.WriteAsync(contentBytes, 0, contentBytes.Length);
Microsoft.AspNetCore.Tests (3)
Microsoft.AspNetCore.WebSockets (3)
Microsoft.AspNetCore.WebSockets.ConformanceTests (1)
Microsoft.AspNetCore.WebSockets.Tests (20)
WebSocketMiddlewareTests.cs (18)
95var serverBuffer = new byte[originalData.Length];
98Assert.Equal(originalData.Length, result.Count);
120var serverBuffer = new byte[originalData.Length];
123Assert.Equal(originalData.Length, result.Count);
146var serverBuffer = new byte[originalData.Length];
177var serverBuffer = new byte[originalData.Length];
186new ArraySegment<byte>(serverBuffer, totalReceived, serverBuffer.Length - totalReceived), CancellationToken.None);
194new ArraySegment<byte>(serverBuffer, totalReceived, serverBuffer.Length - totalReceived), CancellationToken.None);
232var clientBuffer = new byte[originalData.Length];
235Assert.Equal(originalData.Length, result.Count);
257var clientBuffer = new byte[originalData.Length];
260Assert.Equal(originalData.Length, result.Count);
282var clientBuffer = new byte[originalData.Length];
287result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer, receivedCount, clientBuffer.Length - receivedCount), CancellationToken.None);
293Assert.Equal(originalData.Length, receivedCount);
317var clientBuffer = new byte[originalData.Length];
325new ArraySegment<byte>(clientBuffer, totalReceived, clientBuffer.Length - totalReceived), CancellationToken.None);
332new ArraySegment<byte>(clientBuffer, totalReceived, clientBuffer.Length - totalReceived), CancellationToken.None);
Microsoft.AspNetCore.WebUtilities (24)
BufferedReadStream.cs (7)
253_bufferCount = _inner.Read(_buffer, 0, _buffer.Length);
281if (minCount > _buffer.Length)
283throw new ArgumentOutOfRangeException(nameof(minCount), minCount, "The value must be smaller than the buffer size: " + _buffer.Length);
296int read = _inner.Read(_buffer, _bufferOffset + _bufferCount, _buffer.Length - _bufferCount - _bufferOffset);
314if (minCount > _buffer.Length)
316throw new ArgumentOutOfRangeException(nameof(minCount), minCount, "The value must be smaller than the buffer size: " + _buffer.Length);
329int read = await _inner.ReadAsync(_buffer.AsMemory(_bufferOffset + _bufferCount, _buffer.Length - _bufferCount - _bufferOffset), cancellationToken);
Microsoft.AspNetCore.WebUtilities.Microbenchmarks (14)
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.AspNetCore.WebUtilities.Tests (129)
FileBufferingReadStreamTests.cs (57)
54var read1 = stream.Read(bytes, 0, bytes.Length);
55Assert.Equal(bytes.Length, read1);
61var read2 = stream.Read(bytes, 0, bytes.Length);
68var read3 = stream.Read(bytes, 0, bytes.Length);
80var read0 = stream.Read(bytes, 0, bytes.Length);
81Assert.Equal(bytes.Length, read0);
87var read1 = stream.Read(bytes, 0, bytes.Length);
88Assert.Equal(bytes.Length, read1);
94var read2 = stream.Read(bytes, 0, bytes.Length);
101var read3 = stream.Read(bytes, 0, bytes.Length);
114var read0 = stream.Read(bytes, 0, bytes.Length);
115Assert.Equal(bytes.Length, read0);
121var read1 = stream.Read(bytes, 0, bytes.Length);
122Assert.Equal(bytes.Length, read1);
130var read2 = stream.Read(bytes, 0, bytes.Length);
138var read3 = stream.Read(bytes, 0, bytes.Length);
152var read0 = stream.Read(bytes, 0, bytes.Length);
153Assert.Equal(bytes.Length, read0);
159var exception = Assert.Throws<IOException>(() => stream.Read(bytes, 0, bytes.Length));
175var read0 = stream.Read(bytes, 0, bytes.Length);
176Assert.Equal(bytes.Length, read0);
182var read1 = stream.Read(bytes, 0, bytes.Length);
183Assert.Equal(bytes.Length, read1);
191var exception = Assert.Throws<IOException>(() => stream.Read(bytes, 0, bytes.Length));
216var read1 = await stream.ReadAsync(bytes, 0, bytes.Length);
217Assert.Equal(bytes.Length, read1);
223var read2 = await stream.ReadAsync(bytes, 0, bytes.Length);
230var read3 = await stream.ReadAsync(bytes, 0, bytes.Length);
242var read0 = await stream.ReadAsync(bytes, 0, bytes.Length);
243Assert.Equal(bytes.Length, read0);
249var read1 = await stream.ReadAsync(bytes, 0, bytes.Length);
250Assert.Equal(bytes.Length, read1);
256var read2 = await stream.ReadAsync(bytes, 0, bytes.Length);
263var read3 = await stream.ReadAsync(bytes, 0, bytes.Length);
276var read0 = await stream.ReadAsync(bytes, 0, bytes.Length);
277Assert.Equal(bytes.Length, read0);
283var read1 = await stream.ReadAsync(bytes, 0, bytes.Length);
284Assert.Equal(bytes.Length, read1);
292var read2 = await stream.ReadAsync(bytes, 0, bytes.Length);
300var read3 = await stream.ReadAsync(bytes, 0, bytes.Length);
328var read1 = await stream.ReadAsync(bytes, 0, bytes.Length);
329Assert.Equal(bytes.Length, read1);
332var read2 = await stream.ReadAsync(bytes, 0, bytes.Length);
333Assert.Equal(bytes.Length, read2);
336var read3 = await stream.ReadAsync(bytes, 0, bytes.Length);
341var read4 = await stream.ReadAsync(bytes, 0, bytes.Length);
355var read0 = await stream.ReadAsync(bytes, 0, bytes.Length);
356Assert.Equal(bytes.Length, read0);
362var exception = await Assert.ThrowsAsync<IOException>(() => stream.ReadAsync(bytes, 0, bytes.Length));
378var read0 = await stream.ReadAsync(bytes, 0, bytes.Length);
379Assert.Equal(bytes.Length, read0);
385var read1 = await stream.ReadAsync(bytes, 0, bytes.Length);
386Assert.Equal(bytes.Length, read1);
394var exception = await Assert.ThrowsAsync<IOException>(() => stream.ReadAsync(bytes, 0, bytes.Length));
612var read0 = stream.Read(bytes, 0, bytes.Length);
613Assert.Equal(bytes.Length, read0);
619var read1 = stream.Read(bytes, 0, bytes.Length);
FileBufferingWriteStreamTests.cs (19)
27bufferingStream.Write(input, 0, input.Length);
30Assert.Equal(input.Length, bufferingStream.Length);
54Assert.Equal(input.Length, bufferingStream.Length);
96bufferingStream.Write(input, 0, input.Length);
142await bufferingStream.WriteAsync(input, 0, input.Length);
207await bufferingStream.WriteAsync(input, 0, input.Length);
241Assert.Equal(input.Length, bufferingStream.Length);
255var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length));
269bufferingStream.Write(input, 0, input.Length);
270var exception = Assert.Throws<IOException>(() => bufferingStream.Write(input, 0, input.Length));
285bufferingStream.Write(input, 0, input.Length);
286bufferingStream.Write(input, 0, input.Length); // Should get to exactly the buffer limit, which is fine
299var exception = await Assert.ThrowsAsync<IOException>(() => bufferingStream.WriteAsync(input, 0, input.Length));
313await bufferingStream.WriteAsync(input, 0, input.Length);
314var exception = await Assert.ThrowsAsync<IOException>(() => bufferingStream.WriteAsync(input, 0, input.Length));
329await bufferingStream.WriteAsync(input, 0, input.Length);
330await bufferingStream.WriteAsync(input, 0, input.Length); // Should get to exactly the buffer limit, which is fine
341bufferingStream.Write(input, 0, input.Length);
358bufferingStream.Write(input, 0, input.Length);
MultipartReaderTests.cs (6)
293var read = section.Body.Read(buffer, 0, buffer.Length);
302read = section.Body.Read(buffer, 0, buffer.Length);
326stream.Write(bytes, 0, bytes.Length);
332stream.Write(bytes, 0, bytes.Length);
361stream.Write(bytes, 0, bytes.Length);
367stream.Write(bytes, 0, bytes.Length);
PagedByteBufferTest.cs (14)
20buffer.Add(input, 0, input.Length);
24Assert.Equal(input.Length, buffer.Length);
35buffer.Add(input1, 0, input1.Length);
38buffer.Add(input2, 0, input2.Length);
69buffer.Add(input1, 0, input1.Length);
88buffer.Add(input, 0, input.Length);
102buffer.Add(input, 0, input.Length);
113buffer.Add(newInput, 0, newInput.Length);
127buffer.Add(input, 0, input.Length);
138buffer.Add(newInput, 0, newInput.Length);
151buffer.Add(input, 0, input.Length);
181buffer.Add(input, 0, input.Length);
206buffer.Add(input, 0, input.Length);
229buffer.Add(input, 0, input.Length);
src\Shared\Buffers.Testing\ReadOnlySequenceFactory.cs (13)
36var startSegment = new byte[data.Length + 20];
37Array.Copy(data, 0, startSegment, 10, data.Length);
38return new ReadOnlySequence<byte>(startSegment, 10, data.Length);
51var startSegment = new byte[data.Length + 20];
52Array.Copy(data, 0, startSegment, 10, data.Length);
53return new ReadOnlySequence<byte>(new Memory<byte>(startSegment, 10, data.Length));
66var startSegment = new byte[data.Length + 20];
67Array.Copy(data, 0, startSegment, 10, data.Length);
68return new ReadOnlySequence<byte>(new CustomMemoryForTest<byte>(startSegment, 10, data.Length).Memory);
94var segments = new List<byte[]>((data.Length * 2) + 1);
109if (inputs == null || inputs.Length == 0)
122int length = s.Length;
144} while (i < inputs.Length);
Microsoft.Build (296)
BackEnd\Client\MSBuildClientPacketPump.cs (4)
196IAsyncResult result = localStream.BeginRead(headerByte, 0, headerByte.Length, null, null);
235if ((headerBytesRead != headerByte.Length) && !localPacketPumpShutdownEvent.WaitOne(0))
250ErrorUtilities.ThrowInternalError("Incomplete header read. {0} of {1} bytes read", headerBytesRead, headerByte.Length);
294result = localStream.BeginRead(headerByte, 0, headerByte.Length, null, null);
BackEnd\Components\RequestBuilder\TaskHost.cs (26)
291ErrorUtilities.VerifyThrowArgument((targetOutputsPerProject == null) || (projectFileNames.Length == targetOutputsPerProject.Length), "General.TwoVectorsMustHaveSameLength", projectFileNames.Length, targetOutputsPerProject?.Length ?? 0, "projectFileNames", "targetOutputsPerProject");
293BuildEngineResult result = BuildProjectFilesInParallel(projectFileNames, targetNames, globalProperties, new List<String>[projectFileNames.Length], toolsVersion, includeTargetOutputs);
299ErrorUtilities.VerifyThrow(targetOutputsPerProject.Length == result.TargetOutputsPerProject.Count, "{0} != {1}", targetOutputsPerProject.Length, result.TargetOutputsPerProject.Count);
301for (int i = 0; i < targetOutputsPerProject.Length; i++)
973if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
987for (int i = 0; i < targetNames.Length; i++)
1153if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
1166for (int i = 0; i < targetNames.Length; i++)
1178PropertyDictionary<ProjectPropertyInstance>[] propertyDictionaries = new PropertyDictionary<ProjectPropertyInstance>[projectFileNames.Length];
1180for (int i = 0; i < projectFileNames.Length; i++)
1214ErrorUtilities.VerifyThrow(results.Length == projectFileNames.Length, "{0}!={1}.", results.Length, projectFileNames.Length);
1218targetOutputsPerProject = new List<IDictionary<string, ITaskItem[]>>(results.Length);
1222for (int i = 0; i < results.Length; i++)
1233ITaskItem[] clonedTaskItem = new ITaskItem[resultEntry.Value.Items.Length];
1234for (int j = 0; j < resultEntry.Value.Items.Length; j++)
1259ErrorUtilities.VerifyThrow(results.Length == projectFileNames.Length || !overallSuccess, "The number of results returned {0} cannot be less than the number of project files {1} unless one of the results indicated failure.", results.Length, projectFileNames.Length);
Evaluation\Expander.cs (74)
2338ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2386ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2433ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2457ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2533ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2600ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2672ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2691ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2700ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2783ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2800ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2834ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2867ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2900ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3480args = new object[_arguments.Length];
3483for (int n = 0; n < _arguments.Length; n++)
3517if (objectInstance != null && args.Length == 1 && (String.Equals("Equals", _methodMethodName, StringComparison.OrdinalIgnoreCase) || String.Equals("CompareTo", _methodMethodName, StringComparison.OrdinalIgnoreCase)))
3533if (_methodMethodName.Equals("GetPathOfFileAbove") && args.Length == 1)
3707if (args.Length == 0)
3715if (args.Length == 0)
3731if (args.Length == 0)
3781if (args.Length == 0)
3964if (args.Length >= 4 &&
3967returnVal = IntrinsicFunctions.GetRegistryValueFromView(arg0, arg1, args[2], new ArraySegment<object>(args, 3, args.Length - 3));
3973if (args.Length == 0)
4040if (args.Length == 0)
4048if (args.Length == 0)
4056if (args.Length == 0)
4064if (args.Length == 0)
4072if (args.Length == 0)
4080if (args.Length == 0)
4088if (args.Length == 0)
4312switch (args.Length)
4355if (args.Length == 0)
4379if (args.Length == 0)
4417if (args.Length == 0)
4447if (args.Length == 0)
4463for (var i = 0; i < args.Length; i++)
4479if (enforceLength && args.Length != 2)
4502if (args.Length != 3)
4528if (args.Length != 4)
4554if (args.Length != 2)
4577if (args.Length != 3)
4599if (args.Length != 1)
4610if (args.Length != 1)
4727if (args.Length != 1)
4739if (args.Length != 2)
4769if (args.Length != 1)
4782if (args.Length != 2)
4796if (args.Length != 2)
4810if (args.Length != 2)
4835if (args.Length != 2)
4861if (args.Length != 2)
5227object[] coercedArguments = new object[args.Length];
5232for (int n = 0; n < parameters.Length; n++)
5397Type[] types = new Type[_arguments.Length];
5398for (int n = 0; n < _arguments.Length; n++)
5443if (parameters.Length == _arguments.Length)
5584return parameters.Length > 0
NodeEndpointOutOfProcBase.cs (5)
398for (int i = 0; i < handshakeComponents.Length; i++)
524IAsyncResult result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
566if (bytesRead != headerByte.Length)
586CommunicationsUtilities.Trace("Incomplete header read from server. {0} of {1} bytes read", bytesRead, headerByte.Length);
611result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
Microsoft.Build.CommandLine.UnitTests (11)
Microsoft.Build.Conversion.Core (4)
Microsoft.Build.Engine (205)
Microsoft.Build.Engine.OM.UnitTests (22)
Microsoft.Build.Engine.UnitTests (109)
Microsoft.Build.Framework (53)
Microsoft.Build.Framework.UnitTests (2)
Microsoft.Build.Tasks.Core (239)
AssemblyDependency\ResolveAssemblyReference.cs (29)
1314var buffer = new StringBuilder(a.Length * 2);
1315for (int i = 0; i < a.Length; ++i)
2055if (_cache == null && AssemblyInformationCachePaths != null && AssemblyInformationCachePaths.Length > 0)
2194for (int i = 0; i < _targetFrameworkDirectories.Length; i++)
2207if (installedAssemblyTableInfo?.Length > 0)
2218bool targetingProfile = !String.IsNullOrEmpty(ProfileName) && ((FullFrameworkFolders.Length > 0) || (FullFrameworkAssemblyTables.Length > 0));
2232if (inclusionListSubsetTableInfo.Length > 0 && (redistList?.Count > 0))
2286for (int i = 0; i < redistList.Errors.Length; ++i)
2648MSBuildEventSource.Log.RarOverallStop(_assemblyNames?.Length ?? -1, _assemblyFiles?.Length ?? -1, _resolvedFiles?.Length ?? -1, _resolvedDependencyFiles?.Length ?? -1, _copyLocalFiles?.Length ?? -1, _findDependencies);
2665MSBuildEventSource.Log.RarOverallStop(_assemblyNames?.Length ?? -1, _assemblyFiles?.Length ?? -1, _resolvedFiles?.Length ?? -1, _resolvedDependencyFiles?.Length ?? -1, _copyLocalFiles?.Length ?? -1, _findDependencies);
2771if (fullRedistAssemblyTableInfo.Length > 0)
2802for (int i = 0; i < fullFrameworkRedistList.Errors.Length; ++i)
2855bool targetFrameworkSubsetIsSet = TargetFrameworkSubsets.Length != 0 || InstalledAssemblySubsetTables.Length != 0;
2859bool fullFrameworkFoldersIsSet = FullFrameworkFolders.Length > 0;
2860bool fullFrameworkTableLocationsIsSet = FullFrameworkAssemblyTables.Length > 0;
2958if (IgnoreDefaultInstalledAssemblySubsetTables && _installedAssemblySubsetTables.Length == 0)
2965if (_targetFrameworkSubsets.Length == 0 && _installedAssemblySubsetTables.Length == 0)
3048if (TargetFrameworkDirectories?.Length == 1)
BootstrapperUtil\ResourceUpdater.cs (6)
74if (!NativeMethods.UpdateResourceW(hUpdate, (IntPtr)resource.Type, resource.Name, 0, data, data.Length))
86if (!NativeMethods.UpdateResourceW(hUpdate, (IntPtr)42, "COUNT", 0, countArray, countArray.Length))
119if (!NativeMethods.UpdateResourceW(hUpdate, (IntPtr)42, keyName, 0, data, data.Length))
147byte[] data = new byte[strBytes.Length + 2];
149data[data.Length - 2] = 0;
150data[data.Length - 1] = 0;
Microsoft.Build.Tasks.UnitTests (128)
GetSDKReference_Tests.cs (27)
432Assert.Equal(9, t.CopyLocalFiles.Length);
433Assert.Equal(8, t.References.Length);
508Assert.Equal(8, t.References.Length);
519Assert.Equal(8, t.References.Length);
557Assert.Equal(8, t.References.Length);
650Assert.Equal(2, allCacheFiles.Length);
675Assert.Equal(8, t.References.Length);
724Assert.Equal(5, t.References.Length);
816Assert.Equal(8, t.References.Length);
868Assert.Equal(8, t.References.Length);
919Assert.Equal(8, t.References.Length);
956Assert.Equal(8, t.References.Length);
957Assert.Equal(5, t.RedistFiles.Length);
1018Assert.Equal(5, t.RedistFiles.Length);
1049Assert.Equal(5, t.RedistFiles.Length);
1081Assert.Equal(5, t.RedistFiles.Length);
1112Assert.Equal(8, t.References.Length);
1141Assert.Equal(8, t.References.Length);
1169Assert.Equal(5, t.RedistFiles.Length);
1197Assert.Equal(5, t.RedistFiles.Length);
1234Assert.Equal(8, t.References.Length);
1235Assert.Equal(6, t.RedistFiles.Length);
1280Assert.Equal(8, t.References.Length);
1281Assert.Equal(6, t.RedistFiles.Length);
1323Assert.Equal(8, t.References.Length);
1324Assert.Equal(6, t.RedistFiles.Length);
1368Assert.Equal(7, t.RedistFiles.Length);
Microsoft.Build.UnitTests.Shared (37)
Microsoft.Build.Utilities.Core (76)
ToolLocationHelper.cs (10)
1051if (winmdPaths.Length > 0)
1053ErrorUtilities.DebugTraceMessage("GetLegacyTargetPlatformReferences", "Found {0} contract winmds in '{1}'", winmdPaths.Length, winmdLocation);
1138if (winmdPaths.Length > 0)
1140ErrorUtilities.DebugTraceMessage("GetApiContractReferences", "Found {0} contract winmds in '{1}'", winmdPaths.Length, contractPath);
2524ErrorUtilities.DebugTraceMessage("GatherExtensionSDKs", "Found '{0}' sdkName directories under '{1}'", sdkNameDirectories.Length, extensionSdksDirectory.FullName);
2530ErrorUtilities.DebugTraceMessage("GatherExtensionSDKs", "Found '{0}' sdkVersion directories under '{1}'", sdkVersionDirectories.Length, sdkNameFolders.FullName);
2946if (diskRoots?.Length > 0)
2971if (sdkDiskRoots.Count == 0 && diskRoots?.Length > 0)
3028ErrorUtilities.DebugTraceMessage("GatherPlatformsForSdk", "Found '{0}' platform identifier directories under '{1}'", platformIdentifiers.Length, platformsRoot);
3034ErrorUtilities.DebugTraceMessage("GatherPlatformsForSdk", "Found '{0}' platform version directories under '{1}'", platformVersions.Length, platformIdentifier.FullName);
Microsoft.Build.Utilities.UnitTests (10)
Microsoft.Cci.Extensions (10)
Microsoft.CSharp (126)
Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs (19)
76Debug.Assert(args.Length >= 1);
152int arity = callPayload.TypeArguments?.Length ?? 0;
177DynamicMetaObject[] newArgs = new DynamicMetaObject[args.Length - 1];
178Array.Copy(args, 1, newArgs, 0, args.Length - 1);
251ArgumentObject[] array = new ArgumentObject[parameters.Length];
252for (int i = 0; i < parameters.Length; i++)
335LocalVariableSymbol[] locals = new LocalVariableSymbol[parameterExpressions.Length];
337for (int i = 0; i < parameterExpressions.Length; i++)
601TypeArray typeArgumentsAsTypeArray = typeArguments?.Length > 0
732int arity = payload.TypeArguments?.Length ?? 0;
819BindingFlag.BIND_RVALUEREQUIRED | BindingFlag.BIND_STMTEXPRONLY, memGroup, CreateArgumentListEXPR(arguments, locals, 1, arguments.Length)) as ExprCall;
832if (conditions.Length > 0)
945Debug.Assert(arguments.Length == 1);
985Debug.Assert(arguments.Length == 2);
1193Debug.Assert(arguments.Length == 1);
1228Debug.Assert(arguments.Length == 1);
1251Debug.Assert(arguments.Length >= 2);
1264indexerArguments = CreateArgumentListEXPR(arguments, locals, 1, arguments.Length - 1);
1276int indexOfLast = arguments.Length - 1;
Microsoft.DotNet.Arcade.Sdk (5)
Microsoft.DotNet.Arcade.Sdk.Tests (1)
Microsoft.DotNet.AsmDiff (10)
Microsoft.DotNet.Build.Tasks.Feed (3)
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
Microsoft.DotNet.Build.Tasks.Installers (8)
Microsoft.DotNet.Build.Tasks.Packaging (33)
Microsoft.DotNet.Build.Tasks.Packaging.Tests (2)
Microsoft.DotNet.Build.Tasks.TargetFramework (2)
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Microsoft.DotNet.Build.Tasks.Workloads (5)
Microsoft.DotNet.Build.Tasks.Workloads.Tests (1)
Microsoft.DotNet.CodeAnalysis (3)
Microsoft.DotNet.GenFacades (1)
Microsoft.DotNet.Helix.Client (1)
Microsoft.DotNet.Helix.JobSender (1)
Microsoft.DotNet.Helix.Sdk (1)
Microsoft.DotNet.Helix.Sdk.Tests (11)
Microsoft.DotNet.Internal.DependencyInjection.Testing (2)
Microsoft.DotNet.NuGetRepack.Tasks (2)
Microsoft.DotNet.NuGetRepack.Tests (3)
Microsoft.DotNet.Open.Api.Tools.Tests (2)
Microsoft.DotNet.PackageTesting (6)
Microsoft.DotNet.RemoteExecutor (4)
Microsoft.DotNet.SharedFramework.Sdk (12)
Microsoft.DotNet.SignCheck (3)
Microsoft.DotNet.SignCheckLibrary (4)
Microsoft.DotNet.SignTool (16)
Microsoft.DotNet.SignTool.Tests (5)
Microsoft.DotNet.SourceBuild.Tasks (4)
Microsoft.DotNet.SourceBuild.Tasks.Tests (2)
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (5)
Microsoft.DotNet.VersionTools (12)
Microsoft.DotNet.VersionTools.Tests (19)
Microsoft.DotNet.XliffTasks (5)
Microsoft.DotNet.XUnitExtensions (5)
Microsoft.Extensions.ApiDescription.Client (2)
Microsoft.Extensions.ApiDescription.Client.Tests (2)
Microsoft.Extensions.Caching.Abstractions (2)
Microsoft.Extensions.Caching.Hybrid (12)
Microsoft.Extensions.Caching.Hybrid.Tests (5)
Microsoft.Extensions.Caching.Memory (1)
Microsoft.Extensions.Caching.MicroBenchmarks (17)
Microsoft.Extensions.Caching.SqlServer (2)
Microsoft.Extensions.Caching.StackExchangeRedis (6)
Microsoft.Extensions.Configuration.Binder (7)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
Microsoft.Extensions.DependencyInjection (34)
Microsoft.Extensions.DependencyInjection.Abstractions (46)
Microsoft.Extensions.DependencyModel (10)
Microsoft.Extensions.Diagnostics (1)
Microsoft.Extensions.Diagnostics.Abstractions (2)
Microsoft.Extensions.Diagnostics.HealthChecks (4)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (4)
Microsoft.Extensions.FileProviders.Embedded (3)
Microsoft.Extensions.FileProviders.Physical (6)
Microsoft.Extensions.FileSystemGlobbing (2)
Microsoft.Extensions.Hosting (1)
Microsoft.Extensions.Http (3)
Microsoft.Extensions.Http.Polly (1)
Microsoft.Extensions.Identity.Core (25)
PasswordHasher.cs (17)
80if (a == null || b == null || a.Length != b.Length)
85for (var i = 0; i < a.Length; i++)
148var outputBytes = new byte[13 + salt.Length + subkey.Length];
153Buffer.BlockCopy(salt, 0, outputBytes, 13, salt.Length);
154Buffer.BlockCopy(subkey, 0, outputBytes, 13 + saltSize, subkey.Length);
174if (decodedHashedPassword.Length == 0)
228if (hashedPassword.Length != 1 + SaltSize + Pbkdf2SubkeyLength)
234Buffer.BlockCopy(hashedPassword, 1, salt, 0, salt.Length);
237Buffer.BlockCopy(hashedPassword, 1 + salt.Length, expectedSubkey, 0, expectedSubkey.Length);
268Buffer.BlockCopy(hashedPassword, 13, salt, 0, salt.Length);
271int subkeyLength = hashedPassword.Length - 13 - salt.Length;
277Buffer.BlockCopy(hashedPassword, 13 + salt.Length, expectedSubkey, 0, expectedSubkey.Length);
Microsoft.Extensions.Localization (1)
Microsoft.Extensions.Localization.RootNamespace.Tests (1)
Microsoft.Extensions.Localization.Tests (2)
Microsoft.Extensions.Logging (9)
Microsoft.Extensions.Logging.Abstractions (9)
Microsoft.Extensions.Logging.Console (10)
Microsoft.Extensions.Logging.EventSource (3)
Microsoft.Extensions.ObjectPool.Tests (3)
Microsoft.Extensions.Options (1)
Microsoft.Extensions.Options.DataAnnotations (1)
Microsoft.Extensions.Options.SourceGeneration (5)
Microsoft.Extensions.Primitives (10)
Microsoft.Extensions.SecretManager.Tools.Tests (4)
Microsoft.Interop.ComInterfaceGenerator (1)
Microsoft.Interop.JavaScript.JSImportGenerator (41)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.Interop.SourceGeneration (2)
Microsoft.JSInterop (17)
Microsoft.Net.Http.Headers (3)
Microsoft.Net.Http.Headers.Tests (15)
Microsoft.NET.Sdk.WebAssembly.Pack.Tasks (11)
Microsoft.NET.StringTools.net35.UnitTests (3)
Microsoft.NET.StringTools.UnitTests (3)
Microsoft.NET.WebAssembly.Webcil (24)
WebcilReader.cs (17)
62if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
140if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
148return ReadDebugDirectoryEntries(new BlobReader(p, buffer.Length));
202if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
210return DecodeCodeViewDebugDirectoryData(new BlobReader(p, buffer.Length));
248if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
256return DecodeEmbeddedPortablePdbDirectoryData(new BlobReader(p, buffer.Length));
310if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
318return DecodePdbChecksumDebugDirectoryData(new BlobReader(p, buffer.Length));
327if (string.IsNullOrEmpty(algorithmName) || checksum == null || checksum.Length == 0)
361if (_stream.Read(buffer, 0, buffer.Length) != buffer.Length)
Microsoft.VisualBasic.Core (328)
Microsoft\VisualBasic\CompilerServices\NewLateBinding.vb (54)
124If members Is Nothing OrElse members.Length = 0 Then
179(Arguments IsNot Nothing AndAlso Arguments.Length > 0) _
245reportErrors OrElse arguments.Length <> 0 OrElse baseReference.IsArray,
296If argumentNames.Length > 0 Then
332reportErrors = reportErrors OrElse arguments.Length <> 0 OrElse baseReference.IsArray
344Return argumentNames.Length = 0
354For index As Integer = 0 To copyBack.Length - 1
433If typeArguments.Length > 0 Then
438If arguments.Length = 0 Then
447If argumentNames.Length > arguments.Length OrElse
448(copyBack IsNot Nothing AndAlso copyBack.Length <> arguments.Length) Then
468ElseIf arguments.Length > 0 AndAlso members.Length = 1 AndAlso IsZeroArgumentCall(members(0)) Then
534If members Is Nothing OrElse members.Length = 0 Then
560If arguments.Length > 0 AndAlso members.Length = 1 AndAlso IsZeroArgumentCall(members(0)) Then
590DirectCast(member, MethodInfo).GetParameters().Length = 0) OrElse
592DirectCast(member, PropertyInfo).GetIndexParameters().Length = 0))
649If argumentNames.Length > 0 Then
657If argumentNames.Length > arguments.Length Then
661If arguments.Length < 1 Then
743Return argumentNames.Length = 0
750If members Is Nothing OrElse members.Length = 0 Then
964If members.Length = 0 And OptimisticSet Then
970If TypeArguments.Length > 0 Then
974If Arguments.Length = 1 Then
995If ArgumentNames.Length > Arguments.Length Then
1002If TypeArguments.Length = 0 Then
1071If TypeArguments.Length = 0 Then
1108If members Is Nothing OrElse members.Length = 0 Then
1113If arguments.Length = 1 AndAlso rValueBase AndAlso baseReference.IsValueType Then
1189If argumentNames.Length > arguments.Length OrElse
1190(copyBack IsNot Nothing AndAlso copyBack.Length <> arguments.Length) Then
1200If HasFlag(invocationFlags, BindingFlagsSetProperty) AndAlso arguments.Length < 1 Then
1213If members Is Nothing OrElse members.Length = 0 Then
1295Debug.Assert(members IsNot Nothing AndAlso members.Length > 0, "expected members")
1299argumentNames.Length <= arguments.Length,
1320Dim argumentCount As Integer = arguments.Length
1324If arguments.Length = 0 Then
1337System.Array.Copy(savedArguments, arguments, arguments.Length)
1432Dim lastParameter As ParameterInfo = parameters(parameters.Length - 1)
1497Dim callArguments As Object() = New Object(parameters.Length - 1) {}
1500Dim argumentCount As Integer = arguments.Length
1504Debug.Assert(arguments.Length > 0, "must have an argument for property set Value")
1507System.Array.Copy(savedArguments, arguments, arguments.Length)
1517Dim lastParameter As ParameterInfo = parameters(parameters.Length - 1)
1518callArguments(parameters.Length - 1) =
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (74)
48If leftSignature.Length >= rightSignature.Length Then
59For index As Integer = shorterSignature.Length To longerSignature.Length - 1
65For i As Integer = 0 To shorterSignature.Length - 1
493Debug.Assert(arguments Is Nothing OrElse arguments.Length = argumentCount, "Inconsistency in arguments!!!")
728Debug.Assert(arguments Is Nothing OrElse arguments.Length = argumentCount, "Inconsistency in arguments!!!")
732typeArgumentCount = typeArguments.Length
735Dim candidates As List(Of Method) = New List(Of Method)(members.Length)
737If members.Length = 0 Then
793candidateSignature = New ParameterInfo(setParameters.Length - 2) {}
794System.Array.Copy(setParameters, candidateSignature, candidateSignature.Length)
894Loop While index < members.Length AndAlso members(index).DeclaringType Is currentScope
896Loop While keepSearching AndAlso index < members.Length
1171Debug.Assert(parameterTypeParameters.Length = argumentTypeArguments.Length,
1174For index As Integer = 0 To argumentTypeArguments.Length - 1
1385Do While paramIndex < parameters.Length
1432If typeArguments.Length = 0 Then
1449Debug.Assert(arguments.Length <= parameters.Length OrElse
1453Dim argIndex As Integer = argumentNames.Length
1458Do While argIndex < arguments.Length
1497If argIndex = arguments.Length - 1 AndAlso arguments(argIndex) Is Nothing Then
1503Do While argIndex < arguments.Length
1527Debug.Assert(arguments.Length - argIndex <= 1,
1531If arguments.Length - argIndex <> 1 Then
1570If argumentNames.Length > 0 OrElse paramIndex < parameters.Length Then
1571matchedParameters = CreateMatchTable(parameters.Length, paramIndex - 1)
1576If argumentNames.Length > 0 Then
1578Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1590Dim namedArgumentMapping As Integer() = New Integer(argumentNames.Length - 1) {}
1593Do While argIndex < argumentNames.Length
1646For index As Integer = 0 To matchedParameters.Length - 1
1672Debug.Assert(typeArguments.Length = targetProcedure.TypeParameters.Length, "expected length match")
1676For typeArgumentIndex As Integer = 0 To typeArguments.Length - 1
1717Debug.Assert(matchedArguments.Length = parameters.Length OrElse
1718matchedArguments.Length = parameters.Length + 1,
1720Debug.Assert(arguments.Length <= parameters.Length OrElse
1727If namedArgumentMapping IsNot Nothing Then argIndex = namedArgumentMapping.Length
1732Do While argIndex < arguments.Length
1754Dim remainingArgumentCount As Integer = arguments.Length - argIndex
1762Do While argIndex < arguments.Length
1775Debug.Assert(arguments.Length - argIndex = 1,
1795If namedArgumentMapping IsNot Nothing OrElse paramIndex < parameters.Length Then
1796matchedParameters = CreateMatchTable(parameters.Length, paramIndex - 1)
1803Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1816Do While argIndex < namedArgumentMapping.Length
1832For index As Integer = 0 To matchedParameters.Length - 1
1857Debug.Assert(arguments.Length <= parameters.Length OrElse
1861Dim argIndex As Integer = argumentNames.Length
1866Do While argIndex < arguments.Length
1895Do While argIndex < arguments.Length
1915Debug.Assert(arguments.Length - argIndex <= 1,
1918If arguments.Length - argIndex <> 1 Then
1940If argumentNames.Length > 0 Then
1942Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1945Do While argIndex < argumentNames.Length
1995For index As Integer = 0 To copyBack.Length - 1
2006Debug.Assert(copyBack.Length = arguments.Length, "array sizes must match")
2007Debug.Assert(parameterResults.Length = targetProcedure.Parameters.Length, "parameter arrays must match")
2013If namedArgumentMapping IsNot Nothing Then argIndex = namedArgumentMapping.Length
2018Do While argIndex < arguments.Length
2039Do While argIndex < namedArgumentMapping.Length
2166Dim argIndex As Integer = argumentNames.Length
2167Do While argIndex < arguments.Length
2231Do While argIndex < argumentNames.Length
2825arguments.Length,
Microsoft\VisualBasic\FileIO\FileSystem.vb (22)
756FileStream.Write(data, 0, data.Length)
1286ByteCount = FileStream.Read(ByteBuffer, 0, ByteBuffer.Length)
1311Dim AdditionalByteCount As Integer = FileStream.Read(ByteBuffer, ByteCount, ByteBuffer.Length - ByteCount)
1313Debug.Assert(ByteCount <= ByteBuffer.Length)
1323ByteCount = FileStream.Read(ByteBuffer, 0, ByteBuffer.Length)
1400If wildcards Is Nothing OrElse wildcards.Length = 0 Then
1497Debug.Assert(DInfo.GetFiles(IO.Path.GetFileName(FullPath)).Length = 1, "Must found exactly 1")
1500Debug.Assert(DInfo.GetDirectories(IO.Path.GetFileName(FullPath)).Length = 1,
2189ByteBufferStartIndex = m_Preamble.Length
2190Count -= m_Preamble.Length ' Reduce the valid byte count if ByteBuffer was shrunk.
2203Dim CharBuffer(m_PreviousCharBuffer.Length + ExpectedCharCount - 1) As Char
2206destinationArray:=CharBuffer, destinationIndex:=0, length:=m_PreviousCharBuffer.Length)
2210chars:=CharBuffer, charIndex:=m_PreviousCharBuffer.Length)
2214If CharBuffer.Length > m_SearchText.Length Then
2215If m_PreviousCharBuffer.Length <> m_SearchText.Length Then
2218Array.Copy(sourceArray:=CharBuffer, sourceIndex:=(CharBuffer.Length - m_SearchText.Length),
2245Debug.Assert(BigBuffer.Length > SmallBuffer.Length, "BigBuffer should be longer")
2246If BigBuffer.Length < SmallBuffer.Length Or SmallBuffer.Length = 0 Then
2249For i As Integer = 0 To SmallBuffer.Length - 1
MinimalSample (1)
MobileBuildTasks (4)
MonoAOTCompiler (13)
MonoTargetsTasks (17)
EmitBundleTask\EmitBundleBase.cs (5)
78List<ITaskItem> bundledResources = new(FilesToBundle.Length);
163Parallel.For(0, remainingDestinationFilesToBundle.Length, new ParallelOptions { MaxDegreeOfParallelism = allowedParallelism, CancellationToken = BuildTaskCancelled.Token }, (i, state) =>
174Log.LogMessage(MessageImportance.Low, "{0}/{1} Bundling {2} ...", count, remainingDestinationFilesToBundle.Length, registeredName);
413while ((bytesRead = inputStream.Read(buf, 0, buf.Length)) > 0)
419outputUtf8Writer.BaseStream.Write(NewLineAndIndentation, 0, NewLineAndIndentation.Length);
MSBuild (125)
NodeEndpointOutOfProcBase.cs (5)
398for (int i = 0; i < handshakeComponents.Length; i++)
524IAsyncResult result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
566if (bytesRead != headerByte.Length)
586CommunicationsUtilities.Trace("Incomplete header read from server. {0} of {1} bytes read", bytesRead, headerByte.Length);
611result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
XMake.cs (73)
357if (parameterSections.Length == 2 &&
788&& switchesNotFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
789&& switchesFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
805bool outputPropertiesItemsOrTargetResults = getProperty.Length > 0 || getItem.Length > 0 || getTargetResult.Length > 0;
817getProperty.Length > 0 ? "getProperty" :
818getItem.Length > 0 ? "getItem" :
821else if ((getProperty.Length > 0 || getItem.Length > 0) && (targets is null || targets.Length == 0))
900if (outputPropertiesItemsOrTargetResults && targets?.Length > 0 && result is not null)
1078if (getProperty.Length == 1 && getItem.Length == 0)
1111else if (getProperty.Length == 1 && getItem.Length == 0 && getTargetResult.Length == 0)
1317if (loggers.Length == 1 &&
1550bool restoreOnly = targets.Length == 1 && string.Equals(targets[0], MSBuildConstants.RestoreTargetName, StringComparison.OrdinalIgnoreCase);
2627bool minimizeStdOutOutput = getProperty.Length + getItem.Length + getTargetResult.Length > 0 && getResultOutputFile.Length == 0;
2837if (parameterAndValue[0].Equals("default", StringComparison.InvariantCultureIgnoreCase) && parameterAndValue.Length > 1)
2870terminalLoggerArg = switches[switches.Length - 1];
2937return terminalLoggerParameters?.Length > 0 ? MSBuildApp.AggregateParameters(string.Empty, terminalLoggerParameters) : string.Empty;
2987ErrorUtilities.VerifyThrow(projectSwitchParameters.Length <= 1, "Expect exactly one project at a time.");
2989if (projectSwitchParameters.Length == 1)
3054if (parameters.Length == 1 && bool.TryParse(parameters[0], out bool boolValue))
3088if (parameters.Length == 1 && bool.TryParse(parameters[0], out var boolValue))
3146if (parameters.Length > 0)
3151enableNodeReuse = bool.Parse(parameters[parameters.Length - 1]);
3155CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
3159CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
3179if (parameters.Length > 0)
3183writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
3187CommandLineSwitchException.Throw("InvalidPreprocessPath", parameters[parameters.Length - 1], ex.Message);
3198if (parameters.Length > 0)
3202writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
3206CommandLineSwitchException.Throw("TargetsCouldNotBePrinted", parameters[parameters.Length - 1], ex.Message);
3261if (parameters.Length > 0)
3265value = bool.Parse(parameters[parameters.Length - 1]);
3269CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
3273CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
3290if (parameters == null || parameters.Length == 0)
3297var profilerFile = parameters[parameters.Length - 1];
3312CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3317CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3322CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3341if (input.Length > 0)
3441if (parameters.Length > 0)
3445cpuCount = int.Parse(parameters[parameters.Length - 1], CultureInfo.InvariantCulture);
3449CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3453CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3456CommandLineSwitchException.VerifyThrow(cpuCount > 0 && cpuCount <= 1024, "InvalidMaxCPUCountValueOutsideRange", parameters[parameters.Length - 1]);
3474ErrorUtilities.VerifyThrow(parameters.Length <= 1, "Expect exactly one project at a time.");
3479if (parameters.Length == 1)
3606if (projectExtensionsToIgnore?.Length > 0)
3701if (parameters.Length > 0)
3705return parameters[parameters.Length - 1];
3726Debug.Assert((parameterSections.Length >= 1) && (parameterSections.Length <= 2),
3730CommandLineSwitchException.VerifyThrow((parameterSections[0].Length > 0) && (parameterSections.Length == 2),
3770if (verbositySwitchParameters.Length > 0)
3773originalVerbosity = ProcessVerbositySwitch(verbositySwitchParameters[verbositySwitchParameters.Length - 1]);
3825for (int i = 0; i < parametersToAggregate.Length; i++)
3850for (int i = 0; i < groupedFileLoggerParameters.Length; i++)
3870if (groupedFileLoggerParameters[i].Length > 0)
3905if (binaryLoggerParameters == null || binaryLoggerParameters.Length == 0)
3910string arguments = binaryLoggerParameters[binaryLoggerParameters.Length - 1];
3940if ((consoleLoggerParameters?.Length > 0))
4046if ((fileLoggerParameters?.Length > 0))
4134value = (nameValuePair.Length > 1) ? nameValuePair[1] : null;
4621if (features.Length == 1)
MSBuildTaskHost (71)
Concurrent\ConcurrentDictionary.cs (24)
112for (int i = 0; i < locks.Length; i++)
117int[] countPerLock = new int[locks.Length];
123_budget = buckets.Length / locks.Length;
133int bucketNo = GetBucket(hashcode, tables._buckets.Length);
169GetBucketAndLockNo(hashcode, out bucketNo, out lockNo, tables._buckets.Length, tables._locks.Length);
337for (int i = 0; i < tables._countPerLock.Length; i++)
345if (approxCount < tables._buckets.Length / 4)
365newLength = (tables._buckets.Length * 2) + 1;
400AcquireLocks(1, tables._locks.Length, ref locksAcquired);
405if (_growLockArray && tables._locks.Length < MaxLockNumber)
407newLocks = new object[tables._locks.Length * 2];
408Array.Copy(tables._locks, 0, newLocks, 0, tables._locks.Length);
409for (int i = tables._locks.Length; i < newLocks.Length; i++)
416int[] newCountPerLock = new int[newLocks.Length];
419for (int i = 0; i < tables._buckets.Length; i++)
426GetBucketAndLockNo(current._hashcode, out newBucketNo, out newLockNo, newBuckets.Length, newLocks.Length);
440_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
486AcquireLocks(1, _tables._locks.Length, ref locksAcquired);
487Debug.Assert(locksAcquired == _tables._locks.Length);
NodeEndpointOutOfProcBase.cs (5)
398for (int i = 0; i < handshakeComponents.Length; i++)
524IAsyncResult result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
566if (bytesRead != headerByte.Length)
586CommunicationsUtilities.Trace("Incomplete header read from server. {0} of {1} bytes read", bytesRead, headerByte.Length);
611result = localReadPipe.BeginRead(headerByte, 0, headerByte.Length, null, null);
Mvc.RoutingWebSite (2)
PlaintextApp (1)
PortableTask (1)
PresentationBuildTasks (137)
PresentationCore (723)
MS\Internal\IO\Packaging\NetStream.cs (4)
147if (offset + count > buffer.Length)
344while (Read(buf, 0, buf.Length) > 0)
491_responseStream.BeginRead(_readBuf, 0, _readBuf.Length, new AsyncCallback(ReadCallBack), this);
1022_responseStream.BeginRead(_readBuf, 0, _readBuf.Length, new AsyncCallback(ReadCallBack), this);
System\Windows\dataobject.cs (33)
1272for (int i=0; i<formats.Length; i++)
1294for (int i=0; i<ALLOWED_TYMEDS.Length; i++)
1398if (buffer != null && buffer.Length != 0)
1400hEnhancedMetafile = NativeMethods.SetEnhMetaFileBits((uint)buffer.Length, buffer);
1800if (files == null || files.Length < 1)
1821for (int i = 0; i < files.Length; i++)
1846Marshal.Copy(structData, 0, currentPtr, structData.Length);
1855for (int i = 0; i < files.Length; i++)
1922UnsafeNativeMethods.CopyMemoryW(ptr, chars, chars.Length * 2);
1931*(char*)(IntPtr)((ulong)ptr + (ulong)chars.Length * 2) = '\0';
1960Win32WideCharToMultiByte(str, str.Length, strBytes, strBytes.Length);
2269_formats = new FORMATETC[formats == null ? 0 : formats.Length];
2273for (int i = 0; i < formats.Length; i++)
2329for (int i = 0; i < celt && _current < _formats.Length; i++)
2350return (_current < _formats.Length) ? NativeMethods.S_OK : NativeMethods.S_FALSE;
2504for (int i=0; i<mappedFormats.Length; i++)
2517for (int formatetcIndex = 0; formatetcIndex < formatetc.Length; formatetcIndex++)
2607for (int i = 0; i < mappedFormats.Length; i++)
2654for (int i = 0; i < mappedFormats.Length; i++)
3000if (size > _serializedObjectID.Length)
3003for(int i = 0; i < _serializedObjectID.Length; i++)
3016index = _serializedObjectID.Length;
3024return new MemoryStream(bytes, index, bytes.Length - index);
3222for (int i=0; i<ALLOWED_TYMEDS.Length; i++)
3378for (int baseFormatIndex = 0; baseFormatIndex < baseVar.Length; baseFormatIndex++)
3386for (int dataStoreIndex = 0; dataStoreIndex < entries.Length; dataStoreIndex++)
3400for (int mappedFormatIndex = 0; mappedFormatIndex < cur.Length; mappedFormatIndex++)
3406dataStoreIndex < entries.Length;
3510for (int i = 0; i < mappedFormats.Length; i++)
3565for (int i = 0; i < entries.Length; i++)
3599for (int i = 0; i < formats.Length; i++)
3626newlist = (DataStoreEntry[])Array.CreateInstance(typeof(DataStoreEntry), datalist.Length + 1);
3648for (int i = 0; i < dataStoreEntries.Length; i++)
PresentationFramework (913)
System\Windows\Controls\Grid.cs (66)
396Array.Clear(_definitionIndices, 0, _definitionIndices.Length);
404Array.Clear(_roundingErrors, 0, _roundingErrors.Length);
424Debug.Assert(DefinitionsU.Length > 0 && DefinitionsV.Length > 0);
593bool canResolveStarsU = extData.CellGroup2 > PrivateCells.Length;
683Debug.Assert(DefinitionsU.Length > 0 && DefinitionsV.Length > 0);
694for (int currentCell = 0; currentCell < PrivateCells.Length; ++currentCell)
782value = definitions[(columnIndex + 1) % definitions.Length].FinalOffset;
804value = definitions[(rowIndex + 1) % definitions.Length].FinalOffset;
900for (int i = PrivateCells.Length - 1; i >= 0; --i)
917cell.ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1);
920cell.RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1);
925cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
929cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
931Debug.Assert(0 <= cell.ColumnIndex && cell.ColumnIndex < DefinitionsU.Length);
932Debug.Assert(0 <= cell.RowIndex && cell.RowIndex < DefinitionsV.Length);
1030Debug.Assert(ExtData.DefinitionsU != null && ExtData.DefinitionsU.Length > 0);
1077Debug.Assert(ExtData.DefinitionsV != null && ExtData.DefinitionsV.Length > 0);
1092for (int i = 0; i < definitions.Length; ++i)
1136double[] minSizes = isRows ? new double[DefinitionsV.Length] : new double[DefinitionsU.Length];
1138for (int j=0; j<minSizes.Length; j++)
1156} while (i < PrivateCells.Length);
1163for (int i=0; i<minSizes.Length; i++)
1208if (cellsHead >= PrivateCells.Length)
1261} while (i < PrivateCells.Length);
1390Debug.Assert(0 < count && 0 <= start && (start + count) <= definitions.Length);
1417Debug.Assert(0 < count && 0 <= start && (start + count) <= definitions.Length);
1445Debug.Assert(1 < count && 0 <= start && (start + count) <= definitions.Length);
1647for (int i = 0; i < definitions.Length; ++i)
1743int defCount = definitions.Length;
2041for (int i = 0; i < definitions.Length; ++i)
2077int nonStarIndex = definitions.Length; // traverses from the last entry down
2093for (int i = 0; i < definitions.Length; ++i)
2221Array.Sort(definitionIndices, 0, definitions.Length, new DistributionOrderIndexComparer(definitions));
2224for (int i = 0; i < definitions.Length; ++i)
2227double final = definitions[definitionIndex].SizeCache + (sizeToDistribute / (definitions.Length - i));
2252for (int i = 0; i < definitions.Length; ++i)
2259Array.Sort(definitionIndices, 0, definitions.Length, new RoundingErrorIndexComparer(roundingErrors));
2265int i = definitions.Length - 1;
2282while ((adjustedSize < finalSize && !_AreClose(adjustedSize, finalSize)) && i < definitions.Length)
2299for (int i = 0; i < definitions.Length; ++i)
2301definitions[(i + 1) % definitions.Length].FinalOffset = definitions[i].FinalOffset + definitions[i].SizeCache;
2322int defCount = definitions.Length;
2668for (int i = 0; i < definitions.Length; ++i)
2722for (int i = 0; i < definitions.Length; ++i)
2728Array.Sort(definitionIndices, 0, definitions.Length, new RoundingErrorIndexComparer(roundingErrors));
2734int i = definitions.Length - 1;
2751while ((adjustedSize < finalSize && !_AreClose(adjustedSize, finalSize)) && i < definitions.Length)
2769for (int i = 0; i < definitions.Length; ++i)
2771definitions[(i + 1) % definitions.Length].FinalOffset = definitions[i].FinalOffset + definitions[i].SizeCache;
2878Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3083int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3086|| extData.TempDefinitions.Length < requiredLength )
3098|| extData.TempDefinitions.Length < requiredLength )
3116int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3118if (_definitionIndices == null || _definitionIndices.Length < requiredLength)
3134int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3140else if (_roundingErrors == null || _roundingErrors.Length < requiredLength)
4008for (int i = 1; i < grid.DefinitionsU.Length; ++i)
4016for (int i = 1; i < grid.DefinitionsV.Length; ++i)
System\Windows\Documents\TextSchema.cs (22)
56_inheritableTextElementProperties = new DependencyProperty[textElementPropertyList.Length + Typography.TypographyPropertiesList.Length];
57Array.Copy(textElementPropertyList, 0, _inheritableTextElementProperties, 0, textElementPropertyList.Length);
58Array.Copy(Typography.TypographyPropertiesList, 0, _inheritableTextElementProperties, textElementPropertyList.Length, Typography.TypographyPropertiesList.Length);
68_inheritableBlockProperties = new DependencyProperty[blockPropertyList.Length + _inheritableTextElementProperties.Length];
69Array.Copy(blockPropertyList, 0, _inheritableBlockProperties, 0, blockPropertyList.Length);
70Array.Copy(_inheritableTextElementProperties, 0, _inheritableBlockProperties, blockPropertyList.Length, _inheritableTextElementProperties.Length);
79_inheritableTableCellProperties = new DependencyProperty[tableCellPropertyList.Length + _inheritableTextElementProperties.Length];
80Array.Copy(tableCellPropertyList, _inheritableTableCellProperties, tableCellPropertyList.Length);
81Array.Copy(_inheritableTextElementProperties, 0, _inheritableTableCellProperties, tableCellPropertyList.Length, _inheritableTextElementProperties.Length);
662for (int i = 0; i < _inheritableBlockProperties.Length; i++)
671for (int i = 0; i < _paragraphProperties.Length; i++)
687for (int i = 0; i < _inheritableTextElementProperties.Length; i++)
696for (int i = 0; i < _inlineProperties.Length; i++)
711for (int i = 0; i < _nonFormattingCharacterProperties.Length; i++)
742for (i = 0; i < _structuralCharacterProperties.Length; i++)
748return (i < _structuralCharacterProperties.Length);
PresentationFramework.Aero (1)
PresentationFramework.Aero2 (1)
PresentationFramework.AeroLite (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
36values.Length != 5 ||
PresentationFramework.Classic (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
36values.Length != 5 ||
PresentationFramework.Luna (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
36values.Length != 5 ||
PresentationFramework.Royale (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
36values.Length != 5 ||
PresentationFramework-SystemCore (5)
PresentationUI (7)
RazorWebSite (2)
ReachFramework (61)
PrintConfig\PTProvider.cs (9)
400IntPtr umDevMode = Marshal.AllocCoTaskMem(devMode.Length);
404Marshal.Copy(devMode, 0, umDevMode, devMode.Length);
410(uint)devMode.Length,
644CopyIStreamToArray(stream, result, (uint)result.Length);
660Invariant.Assert(src.Length >= byteCount);
684int bytesToWrite = Math.Min(data.Length, (int)(byteCount - totalBytesWritten));
718Invariant.Assert(dst.Length >= byteCount);
738int bytesToRead = Math.Min(data.Length, (int)(byteCount - totalBytesRead));
740Array.Clear(data, 0, data.Length);
ResultsOfTGenerator (4)
RoutingSandbox (3)
RoutingWebSite (4)
SignalR.Client.FunctionalTestApp (1)
SocialWeather (5)
Sockets.BindTests (1)
Sockets.FunctionalTests (63)
src\Servers\Kestrel\shared\test\StreamExtensions.cs (7)
22read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
24} while (read != 0 && offset < buffer.Length);
41read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken);
43} while (read != 0 && offset < buffer.Length);
45Assert.True(offset >= buffer.Length);
57var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
84var read = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (19)
63for (int i = 0; i < bytes.Length; i++)
68context.Response.ContentLength = bytes.Length * 1024;
72await context.Response.BodyWriter.WriteAsync(new Memory<byte>(bytes, 0, bytes.Length));
92var count = await responseBody.ReadAsync(bytes, 0, bytes.Length);
100count = await responseBody.ReadAsync(bytes, 0, bytes.Length);
309await context.Response.BodyWriter.WriteAsync(new Memory<byte>(scratchBuffer, 0, scratchBuffer.Length), context.RequestAborted);
331$"Content-Length: {scratchBuffer.Length}",
335var ignore = connection.Stream.WriteAsync(scratchBuffer, 0, scratchBuffer.Length);
372await context.Response.Body.WriteAsync(scratchBuffer, 0, scratchBuffer.Length);
390await connection.Stream.ReadAsync(scratchBuffer, 0, scratchBuffer.Length);
523await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
659await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
687await sslStream.WriteAsync(request, 0, request.Length);
807await connection.Stream.WriteAsync(buffer, 0, buffer.Length);
869await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
1030await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
1077var bytes = await stream.ReadAsync(receiveBuffer, 0, receiveBuffer.Length).DefaultTimeout();
1103var received = await stream.ReadAsync(receiveBuffer, 0, Math.Min(receiveBuffer.Length, expectedBytes - totalReceived));
1127received = await stream.ReadAsync(receiveBuffer, 0, receiveBuffer.Length);
StringTools.Benchmark (1)
Swaggatherer (4)
System.Collections (86)
System.Collections.Concurrent (69)
System\Collections\Concurrent\ConcurrentBag.cs (10)
295if (index > array.Length - count)
791var newArray = new T[_array.Length << 1];
795Array.Copy(_array, newArray, _array.Length);
799Array.Copy(_array, headIdx, newArray, 0, _array.Length - headIdx);
800Array.Copy(_array, 0, newArray, _array.Length - headIdx, headIdx);
1030Debug.Assert(arrayIndex >= 0 && arrayIndex <= array.Length);
1039Debug.Assert(arrayIndex <= array.Length - count);
1101if (_index < _array.Length)
1107_index = _array.Length + 1;
1117if (_index == 0 || _index == _array.Length + 1)
System\Collections\Concurrent\ConcurrentDictionary.cs (33)
182for (int i = 1; i < locks.Length; i++)
187var countPerLock = new int[locks.Length];
223_budget = buckets.Length / locks.Length;
302_budget = tables._buckets.Length / tables._locks.Length;
680var newTables = new Tables(new VolatileNode[HashHelpers.GetPrime(DefaultCapacity)], tables._locks, new int[tables._countPerLock.Length], tables._comparer);
682_budget = Math.Max(1, newTables._buckets.Length / newTables._locks.Length);
718if (array.Length - count < index)
872if ((uint)i < (uint)buckets.Length)
1854if (array.Length - count < index)
1936int newLength = tables._buckets.Length;
1951if (upgradeComparer is null && GetCountNoLocks() < tables._buckets.Length / 4)
1963if ((newLength = tables._buckets.Length * 2) < 0 ||
1980if (_growLockArray && tables._locks.Length < MaxLockNumber)
1982newLocks = new object[tables._locks.Length * 2];
1983Array.Copy(tables._locks, newLocks, tables._locks.Length);
1984for (int i = tables._locks.Length; i < newLocks.Length; i++)
1991var newCountPerLock = new int[newLocks.Length];
2020_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
2043CDSCollectionETWBCLProvider.Log.ConcurrentDictionary_AcquiringAllLocks(_tables._buckets.Length);
2049Debug.Assert(locksAcquired == _tables._locks.Length);
2082for (int i = 1; i < locks.Length; i++)
2088Debug.Assert(locksAcquired == locks.Length);
2212return buckets[HashHelpers.FastMod((uint)hashcode, (uint)buckets.Length, tables._fastModBucketsMultiplier)]._node;
2216return buckets[(uint)hashcode % (uint)buckets.Length]._node;
2229bucketNo = HashHelpers.FastMod((uint)hashcode, (uint)buckets.Length, tables._fastModBucketsMultiplier);
2233bucketNo = (uint)hashcode % (uint)buckets.Length;
2235lockNo = bucketNo % (uint)tables._locks.Length; // doesn't use FastMod, as it would require maintaining a different multiplier
2264_fastModBucketsMultiplier = HashHelpers.GetFastModMultiplier((uint)buckets.Length);
System.Collections.Immutable (134)
System\Collections\Immutable\ImmutableArray_1.Builder.cs (13)
55get { return _elements.Length; }
63if (value != _elements.Length)
229if (result.Length != _count)
369this.Count += items.Length;
371Array.Copy(items, 0, _elements, offset, items.Length);
384this.Count += items.Length;
386Array.Copy(items, 0, _elements, offset, items.Length);
397Requires.Range(length >= 0 && length <= items.Length, nameof(length));
702Requires.Range(index >= 0 && index + this.Count <= array.Length, nameof(index));
728Requires.Range(destinationIndex >= 0 && destinationIndex + length <= destination.Length, nameof(destinationIndex));
738if (_elements.Length < capacity)
740int newCapacity = Math.Max(_elements.Length * 2, capacity);
1093Array.Copy(_elements, copied + removed, _elements, copied, _elements.Length - (copied + removed));
System.Collections.NonGeneric (30)
System\Collections\Queue.cs (20)
87int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
91Array.Copy(_array, 0, q._array, _array.Length - _head, numToCopy);
113Array.Clear(_array, _head, _array.Length - _head);
136int arrayLen = array.Length;
143int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
147Array.Copy(_array, 0, array, index + _array.Length - _head, numToCopy);
154if (_size == _array.Length)
156int newcapacity = (int)((long)_array.Length * (long)_growFactor / 100);
157if (newcapacity < _array.Length + MinimumGrow)
159newcapacity = _array.Length + MinimumGrow;
165_tail = (_tail + 1) % _array.Length;
187_head = (_head + 1) % _array.Length;
234index = (index + 1) % _array.Length;
242return _array[(_head + i) % _array.Length];
261Array.Copy(_array, _head, arr, 0, _array.Length - _head);
262Array.Copy(_array, 0, arr, _array.Length - _head, _tail);
282Array.Copy(_array, _head, newarray, 0, _array.Length - _head);
283Array.Copy(_array, 0, newarray, _array.Length - _head, _tail);
System.Collections.Specialized (5)
System.ComponentModel.Annotations (10)
System.ComponentModel.Composition (71)
System.ComponentModel.Composition.Registration (3)
System.ComponentModel.TypeConverter (127)
System.Composition.Convention (4)
System.Composition.Hosting (9)
System.Composition.TypedParts (10)
System.Console (14)
System.Data.Common (684)
System\Data\DataTableReader.cs (23)
47if (dataTables.Length == 0)
52_tables = new DataTable[dataTables.Length];
53for (int i = 0; i < dataTables.Length; i++)
143if ((_tableCounter == _tables.Length - 1))
364return tempBuffer.Length;
368int byteCount = Math.Min(tempBuffer.Length - srcIndex, length);
371throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, nameof(dataIndex));
373else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
375throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, nameof(bufferIndex));
427return tempBuffer.Length;
431int charCount = Math.Min(tempBuffer.Length - srcIndex, length);
434throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, nameof(dataIndex));
436else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
438throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, nameof(bufferIndex));
680Array.Copy(_currentDataRow!.ItemArray, values, _currentDataRow.ItemArray.Length > values.Length ? values.Length : _currentDataRow.ItemArray.Length);
681return (_currentDataRow.ItemArray.Length > values.Length ? values.Length : _currentDataRow.ItemArray.Length);
826for (int j = 0; j < dependency.Length; j++)
System\Data\ProviderBase\SchemaMapping.cs (28)
201bool[] readOnly = new bool[mapped.Length];
202for (int i = 0; i < readOnly.Length; ++i)
212for (int i = 0; i < readOnly.Length; ++i)
220for (int i = 0; i < mapped.Length; ++i)
232for (int i = 0; i < readOnly.Length; ++i)
284Debug.Assert(_mappedLength == _indexMap!.Length, "incorrect precomputed length");
299Debug.Assert(_mappedLength == Math.Min(_readerDataValues!.Length, _mappedDataValues!.Length), "incorrect precomputed length");
314for (int i = 0; i < _xmlMap.Length; ++i)
390for (int i = 0; i < _readerDataValues!.Length; ++i)
439for (int i = 0; i < _chapterMap!.Length; ++i)
458int rowLength = _chapterMap!.Length;
513for (int i = 0; i < fieldNames.Length; ++i)
524Debug.Assert(len <= rgcol.Length, "invalid len passed to ResizeArray");
657for (int x = 0; x < _xmlMap.Length; ++x)
770Debug.Assert(_dataReader.FieldCount <= schemaRows.Length, "unexpected fewer rows in Schema than FieldCount");
772if (0 == schemaRows.Length)
780bool addPrimaryKeys = (((0 == _dataTable.PrimaryKey.Length) && ((4 <= (int)_loadOption) || (0 == _dataTable.Rows.Count)))
803for (int sortedIndex = 0; sortedIndex < schemaRows.Length; ++sortedIndex)
825chapterIndexMap = new bool[schemaRows.Length];
834_xmlMap = new int[schemaRows.Length];
843_xmlMap = new int[schemaRows.Length];
859columnIndexMap = CreateIndexMap(schemaRows.Length, unsortedIndex);
891for (int x = 0; x < _xmlMap.Length; ++x)
1022keys ??= new DataColumn[schemaRows.Length];
1039columnIndexMap = CreateIndexMap(schemaRows.Length, unsortedIndex);
1076if (keyCount < keys.Length)
1112dataValues = SetupMapping(schemaRows.Length, columnCollection, chapterColumn, chapterValue);
System\Data\SQLTypes\SQLChars.cs (17)
72_lCurLen = _rgchBuf.Length;
152_ => (_rgchBuf == null) ? -1L : _rgchBuf.Length,
274ArgumentOutOfRangeException.ThrowIfGreaterThan(value, _rgchBuf.Length);
300ArgumentOutOfRangeException.ThrowIfGreaterThan(offsetInBuffer, buffer.Length);
304ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offsetInBuffer);
348if (offset > _rgchBuf.Length)
352ArgumentOutOfRangeException.ThrowIfGreaterThan(offsetInBuffer, buffer.Length);
355ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offsetInBuffer);
357if (count > _rgchBuf.Length - offset)
433Debug.Assert(FStream() || (_rgchBuf != null && _lCurLen <= _rgchBuf.Length));
436Debug.Assert(_rgchWorkBuf == null || _rgchWorkBuf.Length == 1);
456if (_rgchBuf == null || _rgchBuf.Length < lStreamLen)
473_lCurLen = (_rgchBuf == null) ? x_lNull : _rgchBuf.Length;
650ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, buffer.Length);
652ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offset);
666ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, buffer.Length);
668ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offset);
System\Data\SQLTypes\SQLString.cs (5)
140: this(lcid, compareOptions, data, 0, data.Length, fUnicode)
156: this(lcid, compareOptions, data, 0, data.Length, true)
723int cbX = rgDataX.Length;
724int cbY = rgDataY.Length;
917return SqlBinary.HashByteArray(rgbSortKey, rgbSortKey.Length);
System.Diagnostics.DiagnosticSource (25)
System.Diagnostics.Process (18)
System.Diagnostics.TextWriterTraceListener (3)
System.Diagnostics.TraceSource (2)
System.Formats.Asn1 (11)
System.Formats.Cbor (1)
System.Formats.Tar (3)
System.IO.Compression (58)
System\IO\Compression\DeflateZLib\DeflateStream.cs (10)
279int n = _stream.Read(_buffer, 0, _buffer.Length);
293else if (n > _buffer.Length)
424int n = await _stream.ReadAsync(new Memory<byte>(_buffer, 0, _buffer.Length), cancellationToken).ConfigureAwait(false);
438else if (n > _buffer.Length)
905int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
918await _deflateStream._stream.CopyToAsync(this, _arrayPoolBuffer.Length, _cancellationToken).ConfigureAwait(false);
941int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
954_deflateStream._stream.CopyTo(this, _arrayPoolBuffer.Length);
975else if (count > buffer.Length - offset)
1024else if (count > buffer.Length - offset)
System.IO.Compression.Brotli (3)
System.IO.Compression.ZipFile (2)
System.IO.FileSystem.DriveInfo (2)
System.IO.FileSystem.Watcher (11)
System.IO.Hashing (1)
System.IO.IsolatedStorage (9)
System.IO.Pipelines (3)
System.IO.Pipes (1)
System.Linq (81)
System\Linq\OrderedEnumerable.SpeedOpt.cs (21)
18if (buffer.Length <= 1)
23TElement[] array = new TElement[buffer.Length];
32List<TElement> list = new(buffer.Length);
33if (buffer.Length >= 2)
35Fill(buffer, SetCountAndGetSpan(list, buffer.Length));
37else if (buffer.Length == 1)
67if (buffer.Length <= minIdx)
72if (buffer.Length <= maxIdx)
74maxIdx = buffer.Length - 1;
79return [GetEnumerableSorter().ElementAt(buffer, buffer.Length, minIdx)];
92if (buffer.Length <= minIdx)
97if (buffer.Length <= maxIdx)
99maxIdx = buffer.Length - 1;
104return new List<TElement>(1) { GetEnumerableSorter().ElementAt(buffer, buffer.Length, minIdx) };
154if (index < buffer.Length)
157return GetEnumerableSorter().ElementAt(buffer, buffer.Length, index);
222if (minIdx < buffer.Length)
225return (maxIdx < buffer.Length - 1) ?
226GetEnumerableSorter().ElementAt(buffer, buffer.Length, maxIdx) :
241for (int i = 1; i < items.Length; ++i)
483int count = buffer.Length;
System.Linq.Expressions (301)
System.Linq.Parallel (97)
System.Linq.Queryable (16)
System.Memory (12)
System.Net.Http (116)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (9)
48for (int i = 0; i < _blocks.Length; i++)
184Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
187uint blockArraySize = (uint)_blocks.Length;
255Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
272for (uint i = firstUnallocatedBlock; i < _blocks.Length; i++)
310Debug.Assert(start + length <= blocks.Length * BlockSize);
355Debug.Assert(0 <= startInBlock, $"Invalid startInBlock={startInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
356Debug.Assert(startInBlock < endInBlock, $"Invalid startInBlock={startInBlock}, endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
357Debug.Assert(endInBlock <= BlockSize, $"Invalid endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
System.Net.HttpListener (46)
System\Net\Managed\HttpResponseStream.Managed.cs (7)
72ms.Write(bytes, 0, bytes.Length);
80InternalWrite(bytes, 0, bytes.Length);
106ms.Write(bytes, 0, bytes.Length);
181ms.Write(bytes, 0, bytes.Length);
195InternalWrite(bytes, 0, bytes.Length);
225ms.Write(bytes, 0, bytes.Length);
235InternalWrite(bytes, 0, bytes.Length);
System.Net.Mail (42)
System.Net.NameResolution (7)
System.Net.NetworkInformation (28)
System.Net.Ping (7)
System.Net.Primitives (14)
System.Net.Quic (24)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (9)
48for (int i = 0; i < _blocks.Length; i++)
184Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
187uint blockArraySize = (uint)_blocks.Length;
255Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
272for (uint i = firstUnallocatedBlock; i < _blocks.Length; i++)
310Debug.Assert(start + length <= blocks.Length * BlockSize);
355Debug.Assert(0 <= startInBlock, $"Invalid startInBlock={startInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
356Debug.Assert(startInBlock < endInBlock, $"Invalid startInBlock={startInBlock}, endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
357Debug.Assert(endInBlock <= BlockSize, $"Invalid endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
System.Net.Requests (19)
System\Net\CommandStream.cs (9)
190while (_index < _commands!.Length)
215BeginWrite(sendBuffer, 0, sendBuffer.Length, s_writeCallbackDelegate, this);
219Write(sendBuffer, 0, sendBuffer.Length);
281if (index < 0 || index >= commands!.Length ||
291if (_index >= _commands!.Length)
520BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
525bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
630BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
635bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
System.Net.Security (71)
System.Net.Sockets (45)
System\Net\Sockets\Socket.cs (10)
898if (addresses.Length == 0)
1062return Send(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1067return Send(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1317return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, remoteEP);
1322return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, remoteEP);
1424return Receive(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1429return Receive(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1785return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, ref remoteEP);
1790return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, ref remoteEP);
2107int optionLength = optionValue != null ? optionValue.Length : 0;
System.Net.WebClient (24)
System\Net\WebClient.cs (21)
459_contentLength = data.Length;
526_contentLength = fs.Length + formHeaderBytes.Length + boundaryBytes.Length;
614_contentLength = buffer.Length;
841writeStream.SetLength(copyBuffer.Length);
849while ((bytesRead = readStream.Read(copyBuffer, 0, copyBuffer.Length)) != 0)
888writeStream.SetLength(copyBuffer.Length);
958writeStream.Write(header, 0, header.Length);
967int bytesRead = readStream.Read(buffer, 0, buffer.Length);
976for (int pos = 0; pos < buffer.Length;)
978int toWrite = buffer.Length - pos;
990writeStream.Write(footer, 0, footer.Length);
1026_progress.BytesSent += header.Length;
1047for (int pos = 0; pos < buffer.Length;)
1049int toWrite = buffer.Length - pos;
1064_progress.BytesSent += footer.Length;
1162return enc.GetString(data, bomLengthInData, data.Length - bomLengthInData);
1380_contentLength = requestData.Length;
1428_contentLength = data.Length;
1435chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, data.Length);
1511chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, buffer.Length);
System.Net.WebHeaderCollection (2)
System.Net.WebProxy (1)
System.Net.WebSockets (12)
System.Net.WebSockets.Client (6)
System.ObjectModel (3)
System.Private.CoreLib (1643)
src\libraries\System.Private.CoreLib\src\System\Array.cs (103)
38return array.Length == 0 ?
55if (larray.Length != newSize)
67(uint)Math.Min(newSize, larray.Length));
126if (lengths.Length == 0)
137for (int i = 0; i < lengths.Length; i++)
142return InternalCreate(t, lengths.Length, pLengths, null);
152if (lengths.Length != lowerBounds.Length)
154if (lengths.Length == 0)
165for (int i = 0; i < lengths.Length; i++)
171return InternalCreate(t, lengths.Length, pLengths, pLowerBounds);
179int[] intLengths = new int[lengths.Length];
181for (int i = 0; i < lengths.Length; ++i)
256if (t.GetArrayRank() != lengths.Length)
263for (int i = 0; i < lengths.Length; i++)
268return InternalCreateFromArrayType(t, lengths.Length, pLengths, null);
302if (lengths.Length != lowerBounds.Length)
312if (t.GetArrayRank() != lengths.Length)
322for (int i = 0; i < lengths.Length; i++)
328return InternalCreateFromArrayType(t, lengths.Length, pLengths, pLowerBounds);
428if (Rank != indices.Length)
486if (Rank != indices.Length)
534if (Rank != indices.Length)
537int[] intIndices = new int[indices.Length];
539for (int i = 0; i < indices.Length; ++i)
594if (Rank != indices.Length)
597int[] intIndices = new int[indices.Length];
599for (int i = 0; i < indices.Length; ++i)
626int ICollection.Count => Length;
702if (o == null || this.Length != o.Length)
710while (i < o.Length && c == 0)
734if (!(other is Array o) || o.Length != this.Length)
740while (i < o.Length)
762for (int i = (this.Length >= 8 ? this.Length - 8 : 0); i < this.Length; i++)
787return BinarySearch(array, array.GetLowerBound(0), array.Length, value, null);
826return BinarySearch(array, array.GetLowerBound(0), array.Length, value, comparer);
853if (array.Length - (index - lb) < length)
994return BinarySearch(array, 0, array.Length, value, null);
1001return BinarySearch(array, 0, array.Length, value, comparer);
1018if (array.Length - index < length)
1036TOutput[] newArray = new TOutput[array.Length];
1037for (int i = 0; i < array.Length; i++)
1056Copy(this, GetLowerBound(0), array!, index, Length);
1094for (int i = 0; i < array.Length; i++)
1112if ((uint)startIndex > (uint)array.Length)
1117if ((uint)count > (uint)(array.Length - startIndex))
1148for (int i = 0; i < array.Length; i++)
1171for (int i = 0; i < array.Length; i++)
1188return FindIndex(array, 0, array.Length, match);
1198return FindIndex(array, startIndex, array.Length - startIndex, match);
1208if (startIndex < 0 || startIndex > array.Length)
1213if (count < 0 || startIndex > array.Length - count)
1244for (int i = array.Length - 1; i >= 0; i--)
1261return FindLastIndex(array, array.Length - 1, array.Length, match);
1286if (array.Length == 0)
1297if (startIndex < 0 || startIndex >= array.Length)
1332for (int i = 0; i < array.Length; i++)
1346return IndexOf(array, value, array.GetLowerBound(0), array.Length);
1360return IndexOf(array, value, startIndex, array.Length - startIndex + lb);
1377if (startIndex < lb || startIndex > array.Length + lb)
1379if (count < 0 || count > array.Length - startIndex + lb)
1489return IndexOf(array, value, 0, array.Length);
1499return IndexOf(array, value, startIndex, array.Length - startIndex);
1509if ((uint)startIndex > (uint)array.Length)
1514if ((uint)count > (uint)(array.Length - startIndex))
1571return LastIndexOf(array, value, array.Length - 1 + lb, array.Length);
1598if (array.Length == 0)
1603if (startIndex < lb || startIndex >= array.Length + lb)
1715return LastIndexOf(array, value, array.Length - 1, array.Length);
1725return LastIndexOf(array, value, startIndex, (array.Length == 0) ? 0 : (startIndex + 1));
1735if (array.Length == 0)
1755if ((uint)startIndex >= (uint)array.Length)
1826Reverse(array, array.GetLowerBound(0), array.Length);
1845if (array.Length - (index - lowerBound) < length)
1907if (array.Length > 1)
1908SpanHelpers.Reverse(ref MemoryMarshal.GetArrayDataReference(array), (nuint)array.Length);
1919if (array.Length - index < length)
1936Sort(array, null, array.GetLowerBound(0), array.Length, null);
1949Sort(keys, items, keys.GetLowerBound(0), keys.Length, null);
1982Sort(array, null, array.GetLowerBound(0), array.Length, comparer);
1997Sort(keys, items, keys.GetLowerBound(0), keys.Length, comparer);
2033if (keys.Length - (index - keysLowerBound) < length || (items != null && (index - keysLowerBound) > items.Length - length))
2128if (array.Length > 1)
2130var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2139Sort(keys, items, 0, keys.Length, null);
2156Sort(array, 0, array.Length, comparer);
2163Sort(keys, items, 0, keys.Length, comparer);
2174if (array.Length - index < length)
2192if (keys.Length - index < length || (items != null && index > items.Length - length))
2221var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2237for (int i = 0; i < array.Length; i++)
2254/// <see cref="Length"/> property may return larger value than this property for multi-dimensional arrays.</para>
2692new Span<T>(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), array.Length).Slice(adjustedIndex, length);
src\libraries\System.Private.CoreLib\src\System\Buffers\ConfigurableArrayPool.cs (14)
43for (int i = 0; i < buckets.Length; i++)
70if (index < _buckets.Length)
84log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, _buckets[i].Id);
89while (++i < _buckets.Length && i != index + MaxBucketsToTry);
105log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
106log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, index >= _buckets.Length ?
118if (array.Length == 0)
126int bucket = Utilities.SelectBucketIndex(array.Length);
129bool haveBucket = bucket < _buckets.Length;
149log.BufferReturned(bufferId, array.Length, Id);
152log.BufferDropped(bufferId, array.Length, Id, ArrayPoolEventSource.NoBucketId, ArrayPoolEventSource.BufferDroppedReason.Full);
196if (_index < buffers.Length)
234if (array.Length != _bufferLength)
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (27)
61if (tlsBuckets is not null && (uint)bucketIndex < (uint)tlsBuckets.Length)
69log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
77if ((uint)bucketIndex < (uint)perCoreBuckets.Length)
87log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
114log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
115log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, bucketIndex >= _buckets.Length ?
130int bucketIndex = Utilities.SelectBucketIndex(array.Length);
140if ((uint)bucketIndex < (uint)tlsBuckets.Length)
151if (array.Length != Utilities.GetMaxSizeForBucket(bucketIndex))
171if (log.IsEnabled() && array.Length != 0)
173log.BufferReturned(array.GetHashCode(), array.Length, Id);
176log.BufferDropped(array.GetHashCode(), array.Length, Id,
197for (int i = 0; i < perCoreBuckets.Length; i++)
222for (int i = 0; i < buckets.Length; i++)
226log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
247for (int i = 0; i < buckets.Length; i++)
268log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
327for (int i = 0; i < partitions.Length; i++)
345for (int i = 0; i < partitions.Length; i++)
348if (++index == partitions.Length) index = 0;
365for (int i = 0; i < partitions.Length; i++)
368if (++index == partitions.Length) index = 0;
376for (int i = 0; i < partitions.Length; i++)
399if ((uint)count < (uint)arrays.Length)
423if ((uint)count < (uint)arrays.Length)
482log.BufferTrimmed(array.GetHashCode(), array.Length, id);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (26)
52if (_size != _array.Length) _tail = _size;
60public int Capacity => _array.Length;
80Array.Clear(_array, _head, _array.Length - _head);
99if (arrayIndex < 0 || arrayIndex > array.Length)
104if (array.Length - arrayIndex < _size)
112int firstPart = Math.Min(_array.Length - _head, numToCopy);
117Array.Copy(_array, 0, array, arrayIndex + _array.Length - _head, numToCopy);
135int arrayLen = array.Length;
151int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
157Array.Copy(_array, 0, array, index + _array.Length - _head, numToCopy);
169if (_size == _array.Length)
278Array.IndexOf(_array, item, _head, _array.Length - _head) >= 0 ||
301Array.Copy(_array, _head, arr, 0, _array.Length - _head);
302Array.Copy(_array, 0, arr, _array.Length - _head, _tail);
322Array.Copy(_array, _head, newarray, 0, _array.Length - _head);
323Array.Copy(_array, 0, newarray, _array.Length - _head, _tail);
340if (tmp == _array.Length)
355int threshold = (int)(_array.Length * 0.9);
372if (capacity == _array.Length)
387if (_array.Length < capacity)
392return _array.Length;
397Debug.Assert(_array.Length < capacity);
402int newcapacity = GrowFactor * _array.Length;
409newcapacity = Math.Max(newcapacity, _array.Length + MinimumGrow);
462uint capacity = (uint)array.Length;
src\libraries\System.Private.CoreLib\src\System\Collections\Hashtable.cs (39)
430for (int i = 0; i < _buckets.Length; i++)
454int bucket = lbuckets.Length;
483uint hashcode = InitHash(key, lbuckets.Length, out uint seed, out uint incr);
487int bucketNumber = (int)(seed % (uint)lbuckets.Length);
498bucketNumber = (int)(((long)bucketNumber + incr) % (uint)lbuckets.Length);
499} while (b.hash_coll < 0 && ++ntry < lbuckets.Length);
513for (int i = _buckets.Length; --i >= 0;)
521for (int i = _buckets.Length; --i >= 0;)
540for (int i = lbuckets.Length; --i >= 0;)
559for (int i = lbuckets.Length; --i >= 0;)
579if (array.Length - arrayIndex < Count)
590for (int i = lbuckets.Length; --i >= 0;)
611for (int i = lbuckets.Length; --i >= 0;)
632uint hashcode = InitHash(key, lbuckets.Length, out uint seed, out uint incr);
636int bucketNumber = (int)(seed % (uint)lbuckets.Length);
677bucketNumber = (int)(((long)bucketNumber + incr) % (uint)lbuckets.Length);
678} while (b.hash_coll < 0 && ++ntry < lbuckets.Length);
694int rawsize = HashHelpers.ExpandPrime(_buckets.Length);
701rehash(_buckets.Length);
726for (nb = 0; nb < _buckets.Length; nb++)
845uint hashcode = InitHash(key, _buckets.Length, out uint seed, out uint incr);
849int bucketNumber = (int)(seed % (uint)_buckets.Length);
912bucketNumber = (int)(((long)bucketNumber + incr) % (uint)_buckets.Length);
913} while (++ntry < _buckets.Length);
943uint incr = unchecked((uint)(1 + ((seed * HashHelpers.HashPrime) % ((uint)newBuckets.Length - 1))));
944int bucketNumber = (int)(seed % (uint)newBuckets.Length);
960bucketNumber = (int)(((long)bucketNumber + incr) % (uint)newBuckets.Length);
975uint hashcode = InitHash(key, _buckets.Length, out uint seed, out uint incr);
979int bn = (int)(seed % (uint)_buckets.Length); // bucketNumber
1003bn = (int)(((long)bn + incr) % (uint)_buckets.Length);
1004} while (b.hash_coll < 0 && ++ntry < _buckets.Length);
1065info.AddValue(HashSizeName, _buckets.Length); // This is the length of the bucket array.
1160if (serKeys.Length != serValues.Length)
1164for (int i = 0; i < serKeys.Length; i++)
1196if (array.Length - arrayIndex < _hashtable._count)
1231if (array.Length - arrayIndex < _hashtable._count)
1411_bucket = hashtable._buckets.Length;
1490_bucket = _hashtable._buckets.Length;
src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (60)
35if (match == null || match.Length == 0)
51int[][] paramOrder = new int[candidates.Length][];
53for (i = 0; i < candidates.Length; i++)
58paramOrder[i] = new int[(par.Length > args.Length) ? par.Length : args.Length];
76Type[] paramArrayTypes = new Type[candidates.Length];
78Type[] argTypes = new Type[args.Length];
83for (i = 0; i < args.Length; i++)
99for (i = 0; i < candidates.Length; i++)
113if (args.Length != 0)
126else if (par.Length > args.Length)
131for (j = args.Length; j < par.Length - 1; j++)
152else if (par.Length < args.Length)
187int argsToCheck = (paramArrayType != null) ? par.Length - 1 : args.Length;
200if (index < args.Length)
255for (; j < args.Length; j++)
283if (j == args.Length)
303state = new BinderState((int[])paramOrder[0].Clone(), args.Length, paramArrayTypes[0] != null);
311if (parms.Length == args.Length)
323else if (parms.Length > args.Length)
330if (k < args.Length)
356objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[0], args.Length - paramArrayPos);
357Array.Copy(args, paramArrayPos, (Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
394state = new BinderState((int[])paramOrder[currentMin].Clone(), args.Length, paramArrayTypes[currentMin] != null);
401if (parameters.Length == args.Length)
413else if (parameters.Length > args.Length)
417for (i = 0; i < args.Length; i++)
441objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[currentMin], args.Length - paramArrayPos);
442Array.Copy(args, paramArrayPos, (Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
469for (i = 0; i < candidates.Length; i++)
545Type[] realTypes = new Type[types.Length];
546for (i = 0; i < types.Length; i++)
555if (match == null || match.Length == 0)
563for (i = 0; i < candidates.Length; i++)
566if (par.Length != types.Length)
568for (j = 0; j < types.Length; j++)
598if (j == types.Length)
609int[] paramOrder = new int[types.Length];
610for (i = 0; i < types.Length; i++)
645if (match == null || match.Length == 0)
654int indexesLength = (indexes != null) ? indexes.Length : 0;
655for (i = 0; i < candidates.Length; i++)
660if (par.Length != indexesLength)
761int paramArrayPos = args.Length - 1;
762if (args.Length == binderState._originalSize)
769object[] newArgs = new object[args.Length];
771for (int i = paramArrayPos, j = 0; i < newArgs.Length; i++, j++)
780if (args.Length > binderState._originalSize)
795MethodBase[] aExactMatches = new MethodBase[match.Length];
798for (int i = 0; i < match.Length; i++)
806for (j = 0; j < types.Length; j++)
814if (j < types.Length)
838int typesLength = (types != null) ? types.Length : 0;
839for (int i = 0; i < match.Length; i++)
877for (int i = 0; i < types.Length; i++)
1162object?[] varsCopy = new object[vars.Length];
1163for (int i = 0; i < vars.Length; i++)
1168for (int i = 0, j = 0; i < vars.Length; j++)
1170if (paramOrder[j] < vars.Length)
1192for (int i = 0; i < names.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeMetadataGenerator.cs (10)
23EventParameterInfo[] eventParams = new EventParameterInfo[parameters.Length];
24for (int i = 0; i < parameters.Length; i++)
51EventParameterInfo[] eventParams = new EventParameterInfo[typeInfos.Length];
52for (int i = 0; i < typeInfos.Length; i++)
91if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(EmptyStruct)))
166WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (uint)parameters.Length);
195WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (uint)parameters.Length);
276EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
329EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
422EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (63)
390return (manifestBytes == null) ? null : Encoding.UTF8.GetString(manifestBytes, 0, manifestBytes.Length);
470for (int i = 0; i < m_traits.Length - 1; i += 2)
717int cnt = m_eventData.Length;
725uint metadataLength = (metadata != null) ? (uint)metadata.Length : 0;
1057if (arg1 == null || arg1.Length == 0)
1070int blobSize = arg1.Length;
1095if (arg2 == null || arg2.Length == 0)
1108int blobSize = arg2.Length;
1396var argValues = new object?[args.Length];
1397for (int i = 0; i < args.Length; i++)
1576if (m_traits != null && m_traits.Length % 2 != 0)
1704for (int i = 0; i < decodedObjects.Length; i++, data++)
1854Marshal.Copy(data->DataPointer, blob, 0, blob.Length);
2014int paramCount = Math.Min(eventTypes.typeInfos.Length, args.Length); // parameter count mismatch get logged in LogEventArgsMismatches
2015var eventData = new object?[eventTypes.typeInfos.Length];
2034if (args.Length != infos.Length)
2036ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventId, args.Length, infos.Length));
2040for (int i = 0; i < args.Length; i++)
2065ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventCallbackArgs.EventId, eventDataCount, metadata.Parameters.Length));
2075args = new object?[Math.Min(eventDataCount, metadata.Parameters.Length)];
2079for (int i = 0; i < args.Length; i++, data++)
2088for (int i = 0; i < args.Length; i++, data++)
2212uint metadataLength = (metadata != null) ? (uint)metadata.Length : 0;
2259for (int evtId = 0; evtId < dispatcher.m_EventEnabled.Length; ++evtId)
2311if (eventChannel != EventChannel.None && this.m_channelData != null && this.m_channelData.Length > (int)eventChannel)
2474var names = new string[parameters.Length];
2475for (int i = 0; i < names.Length; i++)
2494var types = new Type[parameters.Length];
2495for (int i = 0; i < types.Length; i++)
2613for (int i = 0; i < m_eventData.Length; i++)
2686for (int i = 0; i < m_eventData.Length; i++)
2755if (eventId >= m_eventData.Length)
2769if (eventId >= dispatcher.m_EventEnabled.Length)
2785for (int i = 0; i < m_eventData.Length; i++)
2827dispatcher.m_EventEnabled ??= new bool[m_eventData.Length];
2859int dataLeft = rawManifest.Length;
3087eventData = new EventMetadata[methods.Length + 1];
3161for (int i = 0; i < methods.Length; i++)
3252if (eventData != null && startEventId < eventData.Length)
3284for (int fieldIdx = 0; fieldIdx < args.Length; fieldIdx++)
3336bNeedsManifest = (flags & EventManifestOptions.OnlyIfNeededForRegistration) == 0 || manifest.GetChannelData().Length > 0;
3343res = (res.Length > 0) ? res : null;
3382if (args.Length > 0 && args[0].ParameterType == typeof(Guid) &&
3385var newargs = new ParameterInfo[args.Length - 1];
3386Array.Copy(args, 1, newargs, 0, args.Length - 1);
3434if (eventData.Length <= eventAttribute.EventId)
3436EventMetadata[] newValues = new EventMetadata[Math.Max(eventData.Length + 16, eventAttribute.EventId + 1)];
3437Array.Copy(eventData, newValues, eventData.Length);
3463int eventListenerParameterCount = eventParameters.Length;
3501int idx = eventData.Length;
3508if (eventData.Length - idx > 2) // allow one wasted slot.
3511Array.Copy(eventData, newValues, newValues.Length);
3524enabledArray = new bool[m_eventData.Length];
3544if (evtId < eventData.Length && eventData[evtId].Descriptor.EventId != 0)
3552for (int idx = 0; idx < eventData.Length; ++idx)
3643for (int idx = 0; idx < instrs.Length;)
3697for (int search = idx + 1; search < instrs.Length; search++)
3733if (idx >= instrs.Length || instrs[idx] >= 6)
4261for (int i = 0; i < eventDispatcher.m_EventEnabled.Length; ++i)
4468for (int i = 0; i < eventSourcesSnapshot.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs (11)
442descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
443descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
455for (int i = 0; i < eventTypes.typeInfos.Length; i++)
537int descriptorsLength = eventTypes.dataCount + eventTypes.typeInfos.Length * 2 + 3;
549descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
550descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
553for (int i = 0; i < eventTypes.typeInfos.Length; i++)
620descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
621descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
746for (int i = 0; i < m_traits.Length - 1; i += 2)
773int startPos = providerMetadata.Length - traitMetaData.Count;
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (65)
172Debug.Assert(abbreviatedDayNames.Length == 7, "[DateTimeFormatInfo.GetAbbreviatedDayOfWeekNames] Expected 7 day names in a week");
186Debug.Assert(m_superShortDayNames.Length == 7, "[DateTimeFormatInfo.InternalGetSuperShortDayNames] Expected 7 day names in a week");
200Debug.Assert(dayNames.Length == 7, "[DateTimeFormatInfo.GetDayOfWeekNames] Expected 7 day names in a week");
214Debug.Assert(abbreviatedMonthNames.Length == 12 || abbreviatedMonthNames.Length == 13,
229Debug.Assert(monthNames.Length == 12 || monthNames.Length == 13,
272Debug.Assert(allLongTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long time patterns");
275Debug.Assert(allShortTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short time patterns");
278Debug.Assert(allLongDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long date patterns");
281Debug.Assert(allShortDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short date patterns");
284Debug.Assert(allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
386for (int i = 0; i < OptionalCalendars.Length; i++)
482for (int i = 0; i < EraNames.Length; i++)
493for (int i = 0; i < AbbreviatedEraNames.Length; i++)
501for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
530if ((uint)era >= names.Length)
545if (AbbreviatedEraNames.Length == 0)
559if ((uint)era >= (uint)names.Length)
1038Debug.Assert(values.Length >= length);
1058if (value.Length != 7)
1063CheckNullValue(value, value.Length);
1083if (value.Length != 7)
1088CheckNullValue(value, value.Length);
1103if (value.Length != 7)
1108CheckNullValue(value, value.Length);
1125if (value.Length != 13)
1130CheckNullValue(value, value.Length - 1);
1146if (value.Length != 13)
1151CheckNullValue(value, value.Length - 1);
1177if ((uint)month >= (uint)monthNamesArray.Length)
1179ThrowHelper.ThrowArgumentOutOfRange_Range(nameof(month), month + 1, 1, monthNamesArray.Length);
1196Debug.Assert(m_genitiveAbbreviatedMonthNames.Length == 13,
1206Debug.Assert(genitiveMonthNames.Length == 13,
1224Debug.Assert(leapYearMonthNames.Length == 13,
1235if ((uint)dow >= (uint)names.Length)
1250if ((uint)dow >= (uint)names.Length)
1267string[] result = new string[patterns1.Length * patterns2.Length];
1271for (int i = 0; i < patterns1.Length; i++)
1273for (int j = 0; j < patterns2.Length; j++)
1362if ((uint)dow >= (uint)names.Length)
1374if ((uint)month >= (uint)names.Length)
1386if ((uint)month >= (uint)names.Length)
1405Debug.Assert(patterns != null && patterns.Length > 0,
1418for (i = 0; i < patterns.Length; i++)
1429if (i < patterns.Length)
1441newPatterns = new string[patterns.Length + 1];
1444Array.Copy(patterns, 0, newPatterns, 1, patterns.Length);
1485Debug.Assert(allYearMonthPatterns.Length > 0,
1506Debug.Assert(allShortDatePatterns.Length > 0,
1527Debug.Assert(allLongDatePatterns.Length > 0,
1547Debug.Assert(allShortTimePatterns.Length > 0,
1567Debug.Assert(allLongTimePatterns.Length > 0,
1629if (patterns.Length == 0)
1634for (int i = 0; i < patterns.Length; i++)
1691if (value.Length != 13)
1696CheckNullValue(value, value.Length - 1);
1712if (value.Length != 13)
1717CheckNullValue(value, value.Length - 1);
2064for (int i = 0; i < dateWords.Length; i++)
2143for (int i = 1; i <= eras.Length; i++)
2164for (int i = 1; i <= jaDtfi.Calendar.Eras.Length; i++)
2177for (int i = 1; i <= twDtfi.Calendar.Eras.Length; i++)
2212for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (16)
354if (buffer.Length - index < count)
433if (buffer.Length - index < count)
465_ = byteBuffer.Length; // allow JIT to prove object is not null
526int newMaxCharsPerBuffer = _encoding.GetMaxCharCount(byteBuffer.Length);
599int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
613_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
626_isBlocked = (_byteLen < _byteBuffer.Length);
703int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
717_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
730_isBlocked = (_byteLen < _byteBuffer.Length);
964else if ((arrayPoolBuffer.Length - arrayPoolBufferPos) < (charLen - charPos))
1055if (buffer.Length - index < count)
1142int len = await tmpStream.ReadAsync(new Memory<byte>(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos), cancellationToken).ConfigureAwait(false);
1192_isBlocked = (_byteLen < tmpByteBuffer.Length);
1266if (buffer.Length - index < count)
1364_isBlocked = (_byteLen < tmpByteBuffer.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (8)
176return Convert(srcEncoding, dstEncoding, bytes, 0, bytes.Length);
529return GetByteCount(chars, 0, chars.Length);
540return GetByteCount(chars, 0, chars.Length);
596return GetBytes(chars, 0, chars.Length);
761return GetCharCount(bytes, 0, bytes.Length);
798return GetChars(bytes, 0, bytes.Length);
1002return GetString(bytes, 0, bytes.Length);
1383_bytes -= byteBuffer.Length; // Didn't use how many ever bytes we're falling back
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (20)
68if (chars.Length - index < count)
209if (chars!.Length - charIndex < charCount)
214if ((uint)byteIndex > bytes!.Length)
222return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
276if ((uint)byteIndex > bytes!.Length)
284return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
355return bytes.Length;
370if (bytes.Length - index < count)
436if (bytes.Length == 0)
443char[] chars = new char[bytes.Length];
448GetCharsCommon(pBytes, bytes.Length, pChars, chars.Length);
470if (bytes.Length - byteIndex < byteCount)
475if ((uint)charIndex > (uint)chars.Length)
483return GetCharsCommon(pBytes + byteIndex, byteCount, pChars + charIndex, chars.Length - charIndex);
503if (bytes.Length - index < count)
515GetCharsCommon(pBytes + index, count, pChars, chars.Length);
556string result = string.FastAllocateString(bytes.Length);
560GetCharsCommon(pBytes, bytes.Length, pChars, result.Length);
581if (bytes.Length - index < count)
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (25)
238Debug.Assert(m_ChunkOffset + m_ChunkChars.Length >= m_ChunkOffset, "The length of the string is greater than int.MaxValue.");
248Debug.Assert(currentBlock.m_ChunkLength <= currentBlock.m_ChunkChars.Length);
266get => m_ChunkChars.Length + m_ChunkOffset;
334if ((uint)(chunkLength + chunkOffset) > (uint)result.Length || (uint)chunkLength > (uint)sourceArray.Length)
417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
419if (newLen > chunk.m_ChunkChars.Length)
431Debug.Assert(newLen == chunk.m_ChunkChars.Length, "The new chunk should be larger or equal to the one it is replacing.");
625if (_chunks.Length <= pos)
668if (((nuint)(uint)chunkLength + (nuint)(uint)repeatCount) <= (nuint)(uint)chunkChars.Length)
696int firstLength = chunkChars.Length - chunkLength;
700m_ChunkLength = chunkChars.Length;
733if (charCount > value.Length - startIndex)
845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
849length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
875if (destinationIndex > destination.Length - count)
1007if ((uint)chars.Length > (uint)nextCharIndex)
1087Append(ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1338Insert(index, ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1362if (startIndex > value.Length - charCount)
2274if (((uint)chunkLength + (uint)valueCount) <= (uint)chunkChars.Length)
2310int firstLength = m_ChunkChars.Length - m_ChunkLength;
2314m_ChunkLength = m_ChunkChars.Length;
2391Debug.Assert(gapStart < sourceChunk.m_ChunkChars.Length, "gap starts at end of buffer. Should not happen");
2522get => new Span<char>(m_ChunkChars, m_ChunkLength, m_ChunkChars.Length - m_ChunkLength);
2657if (!doNotMoveFollowingChars && chunk.m_ChunkLength <= DefaultCapacity * 2 && chunk.m_ChunkChars.Length - chunk.m_ChunkLength >= count)
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (12)
37var newQueues = new WorkStealingQueue[oldQueues.Length + 1];
38Array.Copy(oldQueues, newQueues, oldQueues.Length);
53if (oldQueues.Length == 0)
65var newQueues = new WorkStealingQueue[oldQueues.Length - 1];
68Array.Copy(oldQueues, 1, newQueues, 0, newQueues.Length);
70else if (pos == oldQueues.Length - 1)
72Array.Copy(oldQueues, newQueues, newQueues.Length);
77Array.Copy(oldQueues, pos + 1, newQueues, pos, newQueues.Length - pos);
137var newArray = new object?[m_array.Length << 1];
138for (int i = 0; i < m_array.Length; i++)
698int c = queues.Length;
1648for (int i = 0; i < items.Length; i++)
src\System\Array.CoreCLR.cs (10)
581return Length;
594return Length - 1;
655for (int i = 0; i < Length; i++)
713int length = @this.Length;
723Array.Copy(@this, 0, array, index, @this.Length);
731return @this.Length;
739if ((uint)index >= (uint)@this.Length)
752if ((uint)index >= (uint)@this.Length)
771return Array.IndexOf(@this, value, 0, @this.Length) >= 0;
792return Array.IndexOf(@this, value, 0, @this.Length);
System.Private.CoreLib.Generators (29)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (28)
254int arrayLen = decomposedLeft.Length + decomposedRight.Length;
258var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length];
259Array.Copy(decomposedLeft, retVal, decomposedLeft.Length);
260Array.Copy(decomposedRight, 0, retVal, decomposedLeft.Length, decomposedRight.Length);
325if (decomposedLeft.Length == 0)
327else if (decomposedRight.Length == 0)
330if ((decomposedLeft.Length > 1) || (decomposedRight.Length > 1))
339if (decomposedLeft.Length == 0 || decomposedRight.Length == 0)
341if (decomposedLeft.Length != 0 || decomposedRight.Length != 0)
347var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length][];
348Array.Copy(decomposedLeft, retVal, decomposedLeft.Length);
349Array.Copy(decomposedRight, 0, retVal, decomposedLeft.Length, decomposedRight.Length);
354if (decomposedLeft.Length != 0 || decomposedRight.Length != 0)
364if (decomposedOperand.Length != 0)
371if (decomposedTrue.Length != 0 || decomposedFalse.Length != 0)
602if (decomposedCondition.Length == 0)
621for (int andClauseIndex = 0; andClauseIndex < decomposedCondition.Length; andClauseIndex++)
670if (decomposedCondition.Length == 1)
System.Private.DataContractSerialization (459)
System\Runtime\Serialization\Json\XmlJsonReader.cs (18)
721if (offset > buffer.Length)
723throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
726if (count > buffer.Length - offset)
728throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
743if (offset > chars.Length)
745throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
748if (count > chars.Length - offset)
750throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
780if (offset > buffer.Length)
782throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.JsonOffsetExceedsBufferSize, buffer.Length));
785if (count > buffer.Length - offset)
787throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.JsonSizeExceedsRemainingBufferSpace, buffer.Length - offset));
821if (offset > array.Length)
823throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
826if (count > array.Length - offset)
828throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
1011else if (_scopes.Length == _scopeDepth)
1493if ((_scopes != null) && (_scopes.Length > JsonGlobals.maxScopeSize))
System\Runtime\Serialization\XmlWriterDelegator.cs (15)
532writer.WriteBase64(bytes, 0, bytes.Length);
680for (int i = 0; i < value.Length; i++)
687dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
695for (int i = 0; i < value.Length; i++)
702dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
710for (int i = 0; i < value.Length; i++)
717dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
725for (int i = 0; i < value.Length; i++)
732dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
740for (int i = 0; i < value.Length; i++)
747dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
755for (int i = 0; i < value.Length; i++)
762dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
770for (int i = 0; i < value.Length; i++)
777dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
System\Text\Base64Encoding.cs (32)
54if (index > chars.Length)
55throw new ArgumentOutOfRangeException(nameof(index), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
57if (count > chars.Length - index)
58throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - index));
105if (charIndex > chars.Length)
106throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
109if (charCount > chars.Length - charIndex)
110throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
114if (byteIndex > bytes.Length)
115throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
130byte* pbMax = _bytes + bytes.Length - byteIndex;
178if (charIndex > chars.Length)
179throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
182if (charCount > chars.Length - charIndex)
183throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
187if (byteIndex > bytes.Length)
188throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
203byte* pbMax = _bytes + bytes.Length - byteIndex;
261if (byteIndex > bytes.Length)
262throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
264if (byteCount > bytes.Length - byteIndex)
265throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
270if (charIndex > chars.Length)
271throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
272if (charCount < 0 || charCount > chars.Length - charIndex)
345if (byteIndex > bytes.Length)
346throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
348if (byteCount > bytes.Length - byteIndex)
349throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
354if (charIndex > chars.Length)
355throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
357if (charCount < 0 || charCount > chars.Length - charIndex)
System\Text\BinHexEncoding.cs (14)
28if (charIndex > chars.Length)
29throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
31if (charCount > chars.Length - charIndex)
32throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
35if (byteIndex > bytes.Length)
36throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
38if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
67if (byteIndex > bytes.Length)
68throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
70if (byteCount > bytes.Length - byteIndex)
71throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
75if (charIndex > chars.Length)
76throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
77if (charCount < 0 || charCount > chars.Length - charIndex)
System\Xml\ArrayHelper.cs (7)
34while (read < array.Length)
36int actual = ReadArray(reader, localName, namespaceUri, array, read, array.Length - read);
44if (read < array.Length || reader.NodeType == XmlNodeType.EndElement)
50if (totalRead != array.Length || arrayCount > 0)
56Array.Copy(arrays![i], 0, newArray, offset, arrays[i].Length);
57offset += arrays[i].Length;
75int actual = ReadArray(reader, localName, namespaceUri, array, 0, array.Length);
System\Xml\EncodingStreamWrapper.cs (9)
388if (encCount == s_encodingUTF8.Length && CompareCaseInsensitive(s_encodingUTF8, buffer, encStart))
392else if (encCount == s_encodingUnicodeLE.Length && CompareCaseInsensitive(s_encodingUnicodeLE, buffer, encStart))
396else if (encCount == s_encodingUnicodeBE.Length && CompareCaseInsensitive(s_encodingUnicodeBE, buffer, encStart))
400else if (encCount == s_encodingUnicode.Length && CompareCaseInsensitive(s_encodingUnicode, buffer, encStart))
403ThrowEncodingMismatch(DataContractSerializer.UTF8NoBom.GetString(buffer, encStart, encCount), DataContractSerializer.UTF8NoBom.GetString(s_encodingUTF8, 0, s_encodingUTF8.Length));
416for (int i = 0; i < key.Length; i++)
601_byteCount = _stream.Read(_bytes, _byteCount, (_chars.Length - 1) * 2);
700int size = _chars.Length < count ? _chars.Length : count;
System\Xml\UniqueId.cs (13)
70if (offset > guid.Length)
71throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, guid.Length));
72if (guidLength > guid.Length - offset)
99if (offset > chars.Length)
100throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
102if (count > chars.Length - offset)
103throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
205if (offset > chars.Length)
206throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
208if (count > chars.Length - offset)
285if (offset > buffer.Length)
286throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
288if (guidLength > buffer.Length - offset)
System\Xml\XmlBaseReader.cs (37)
272else if (_elementNodes.Length == _depth)
306else if (_attributeNodes.Length == attributeIndex)
466if (_attributeNodes != null && _attributeNodes.Length > 16)
468if (_elementNodes != null && _elementNodes.Length > 16)
1055for (int i = 0; i < localNames.Length; i++)
1070for (int i = 0; i < localNames.Length; i++)
1096for (int i = 0; i < localNames.Length; i++)
1111for (int i = 0; i < localNames.Length; i++)
1131if (offset > chars.Length)
1132throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
1134if (count > chars.Length - offset)
1135throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
1159if (offset > buffer.Length)
1160throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1162if (count > buffer.Length - offset)
1163throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1304if (value.Length > _quotas.MaxArrayLength)
1312return ReadContentAsBase64(_quotas.MaxArrayLength, _bufferReader.Buffer.Length);
1347if (offset > buffer.Length)
1348throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1350if (count > buffer.Length - offset)
1351throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1383if (offset > buffer.Length)
1384throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1386if (count > buffer.Length - offset)
1387throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1900if (_chars == null || _chars.Length < count)
2625if (_indices != null && _indices.Length > 32)
2635if (_indices != null && _indices.Length == _attributeCount && IsSorted())
2639for (int i = 0; i < newIndices.Length; i++)
2648for (int i = 0; i < _indices!.Length - 1; i++)
2725if (_namespaces != null && _namespaces.Length > 32)
2727if (_attributes != null && _attributes.Length > 4)
2741nameSpace.Uri.SetValue(3, xmlBuffer.Length - 3);
2776for (int i = 0; i < _shortPrefixUri.Length; i++)
2863else if (_attributes.Length == _attributeCount)
2901else if (_namespaces.Length == _nsCount)
System\Xml\XmlBinaryReader.cs (9)
49if (offset > buffer.Length)
50throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
52if (count > buffer.Length - offset)
53throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1026BufferReader.InsertBytes(buffer, 0, buffer.Length);
1230if (offset > array.Length)
1231throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1233if (count > array.Length - offset)
1234throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System\Xml\XmlBinaryWriter.cs (8)
109Debug.Assert(offset >= 0 && offset + 1 + Unsafe.SizeOf<T>() <= buffer.Length, "WriteTextNodeRaw");
124Debug.Assert(offset >= 0 && offset + Unsafe.SizeOf<T>() <= buffer.Length, "WriteRaw");
1185while ((count = reader.ReadValueChunk(_chars, 0, _chars.Length)) > 0)
1207while ((count = reader.ReadValueAsBase64(_bytes, 0, _bytes.Length)) > 0)
1280if (offset > array.Length)
1281throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1283if (count > array.Length - offset)
1284throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System\Xml\XmlCanonicalWriter.cs (50)
93_inclusivePrefixes = new string[inclusivePrefixes.Length];
94for (int i = 0; i < inclusivePrefixes.Length; ++i)
118if (_scopes != null && _scopes.Length > 16)
120if (_attributes != null && _attributes.Length > 16)
122if (_xmlnsBuffer != null && _xmlnsBuffer.Length > 1024)
153else if (_depth == _scopes.Length)
209if (prefixOffset > prefixBuffer.Length)
210throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
212if (prefixLength > prefixBuffer.Length - prefixOffset)
213throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
217if (localNameOffset > localNameBuffer.Length)
218throw new ArgumentOutOfRangeException(nameof(localNameOffset), SR.Format(SR.OffsetExceedsBufferSize, localNameBuffer.Length));
220if (localNameLength > localNameBuffer.Length - localNameOffset)
221throw new ArgumentOutOfRangeException(nameof(localNameLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, localNameBuffer.Length - localNameOffset));
250for (int i = 0; i < _inclusivePrefixes!.Length; ++i)
348else if (_xmlnsOffset + byteCount > _xmlnsBuffer.Length)
350byte[] newBuffer = new byte[Math.Max(_xmlnsOffset + byteCount, _xmlnsBuffer.Length * 2)];
385if (prefixOffset > prefixBuffer.Length)
386throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
388if (prefixLength > prefixBuffer.Length - prefixOffset)
389throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
393if (nsOffset > nsBuffer.Length)
394throw new ArgumentOutOfRangeException(nameof(nsOffset), SR.Format(SR.OffsetExceedsBufferSize, nsBuffer.Length));
396if (nsLength > nsBuffer.Length - nsOffset)
397throw new ArgumentOutOfRangeException(nameof(nsLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, nsBuffer.Length - nsOffset));
436if (prefixOffset > prefixBuffer.Length)
437throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
439if (prefixLength > prefixBuffer.Length - prefixOffset)
440throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
444if (localNameOffset > localNameBuffer.Length)
445throw new ArgumentOutOfRangeException(nameof(localNameOffset), SR.Format(SR.OffsetExceedsBufferSize, localNameBuffer.Length));
447if (localNameLength > localNameBuffer.Length - localNameOffset)
448throw new ArgumentOutOfRangeException(nameof(localNameLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, localNameBuffer.Length - localNameOffset));
507if (offset > chars.Length)
508throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
510if (count > chars.Length - offset)
511throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
562if (offset > chars.Length)
563throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
565if (count > chars.Length - offset)
566throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
599if (offset > chars.Length)
600throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
602if (count > chars.Length - offset)
603throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
663else if (_attributeCount == _attributes.Length)
681else if (_xmlnsAttributes.Length == _xmlnsAttributeCount)
877for (int i = 0; i < indices.Length; i++)
884Attribute[] attributes = new Attribute[_writer._attributes!.Length];
885for (int i = 0; i < indices.Length; i++)
System\Xml\XmlDictionaryReader.cs (20)
33return CreateBinaryReader(buffer, 0, buffer.Length, quotas);
92return CreateTextReader(buffer, 0, buffer.Length, quotas);
297for (int i = 0; i < localNames.Length; i++)
320for (int i = 0; i < localNames.Length; i++)
517while (read < buffer.Length)
521actual = ReadContentAsBase64(buffer, read, buffer.Length - read);
523actual = ReadContentAsBinHex(buffer, read, buffer.Length - read);
531if (read < buffer.Length)
539Buffer.BlockCopy(buffers[i], 0, buffer, offset, buffers[i].Length);
540offset += buffers[i].Length;
593Guid[] guids = new Guid[values.Length];
594for (int i = 0; i < values.Length; i++)
601UniqueId[] uniqueIds = new UniqueId[values.Length];
602for (int i = 0; i < values.Length; i++)
615for (int i = 0; i < strings.Length; i++)
635for (int i = 0; i < strings.Length; i++)
1010if (offset > array.Length)
1011throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1013if (count > array.Length - offset)
1014throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System.Private.Uri (4)
System.Private.Xml (852)
System\Xml\Core\XmlEncodedRawTextWriter.cs (10)
148_bufBytes = new byte[_bufChars.Length];
654Debug.Assert(count >= 0 && index + count <= buffer.Length);
678Debug.Assert(count >= 0 && index + count <= buffer.Length);
857_encoder!.Convert(_bufChars, startOffset, endOffset - startOffset, _bufBytes!, _bufBytesUsed, _bufBytes!.Length - _bufBytesUsed, false, out chEnc, out bEnc, out _);
860if (_bufBytesUsed >= (_bufBytes.Length - 16))
880_encoder!.Convert(_bufChars, 1, 0, _bufBytes!, 0, _bufBytes!.Length, true, out _, out bEnc, out _);
1689if (_lastMarkPos + 1 == _textContentMarks!.Length)
1698Debug.Assert(_lastMarkPos + 1 == _textContentMarks!.Length);
1699int[] newTextContentMarks = new int[_textContentMarks.Length * 2];
1700Array.Copy(_textContentMarks, newTextContentMarks, _textContentMarks.Length);
System\Xml\Core\XmlEncodedRawTextWriterAsync.cs (5)
550Debug.Assert(count >= 0 && index + count <= buffer.Length);
572Debug.Assert(count >= 0 && index + count <= buffer.Length);
689_encoder!.Convert(_bufChars, startOffset, endOffset - startOffset, _bufBytes!, _bufBytesUsed, _bufBytes!.Length - _bufBytesUsed, false, out chEnc, out bEnc, out _);
692if (_bufBytesUsed >= (_bufBytes.Length - 16))
712_encoder!.Convert(_bufChars, 1, 0, _bufBytes!, 0, _bufBytes!.Length, true, out _, out bEnc, out _);
System\Xml\Core\XmlTextReaderImpl.cs (38)
1597ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1644ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1690ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1737ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1797ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
2856bufferSize = _ps.bytes.Length;
2869if (_ps.bytes == null || _ps.bytes.Length < bufferSize)
2876if (_ps.chars == null || _ps.chars.Length < bufferSize + 1)
2883if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
2885int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
3346if (_ps.charsUsed == _ps.chars.Length - 1)
3354char[] newChars = new char[_ps.chars.Length * 2];
3355BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3365if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen)
3367byte[] newBytes = new byte[_ps.bytes.Length * 2];
3374charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3382int charsLen = _ps.chars.Length;
3405char[] newChars = new char[_ps.chars.Length * 2];
3406BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3431charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3441if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0)
3443int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed);
3465charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1);
3477Debug.Assert(_ps.charsUsed < _ps.chars.Length);
3490Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1);
5003if (_attrDuplSortingArray == null || _attrDuplSortingArray.Length < _attrCount)
7623Debug.Assert(nodeIndex < _nodes.Length);
7624Debug.Assert(_nodes[_nodes.Length - 1] == null);
7637Debug.Assert(nodeIndex < _nodes.Length);
7638if (nodeIndex >= _nodes.Length - 1)
7640NodeData[] newNodes = new NodeData[_nodes.Length * 2];
7641Array.Copy(_nodes, newNodes, _nodes.Length);
7644Debug.Assert(nodeIndex < _nodes.Length);
8101else if (_parsingStatesStackTop + 1 == _parsingStatesStack.Length)
8103ParsingState[] newParsingStateStack = new ParsingState[_parsingStatesStack.Length * 2];
8104Array.Copy(_parsingStatesStack, newParsingStateStack, _parsingStatesStack.Length);
8153if (array.Length - index < count)
9563Debug.Assert(endPos < chars.Length);
System\Xml\Core\XmlTextReaderImplAsync.cs (23)
393ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
449ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
514ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
570ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
622ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
882bufferSize = _ps.bytes.Length;
897if (_ps.bytes == null || _ps.bytes.Length < bufferSize)
904if (_ps.chars == null || _ps.chars.Length < bufferSize + 1)
911if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
913int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
1035if (_ps.charsUsed == _ps.chars.Length - 1)
1043char[] newChars = new char[_ps.chars.Length * 2];
1044BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
1053if (_ps.bytes!.Length - _ps.bytesUsed < MaxByteSequenceLen)
1055byte[] newBytes = new byte[_ps.bytes.Length * 2];
1062charsRead = _ps.chars.Length - _ps.charsUsed - 1;
1070int charsLen = _ps.chars.Length;
1093char[] newChars = new char[_ps.chars.Length * 2];
1094BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
1117charsRead = _ps.chars.Length - _ps.charsUsed - 1;
1125if (_ps.bytePos == _ps.bytesUsed && _ps.bytes!.Length - _ps.bytesUsed > 0)
1149charsRead = await _ps.textReader.ReadAsync(_ps.chars.AsMemory(_ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1)).ConfigureAwait(false);
1161Debug.Assert(_ps.charsUsed < _ps.chars.Length);
System\Xml\Serialization\XmlSerializationWriter.cs (41)
377for (int i = 0; i < xmlNodes.Length; i++)
406XmlCustomFormatter.WriteArrayBase64(_w, (byte[])o, 0, ((byte[])o).Length);
1005XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1021XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1040XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1126XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1263int arrayLength = a.Length;
1509for (int i = 0; i < parameterTypes.Length; i++)
1698for (int i = 0; i < structMapping.Members!.Length; i++)
1722for (int i = 0; i < enumFields.Length; i++)
1774for (int i = 0; i < memberInfos.Length; i++)
1821for (int i = 0; i < paramTypes.Length; i++)
1824if (i < (paramTypes.Length - 1))
1886for (int i = 0; i < args.Length; i++)
2467for (int i = 0; i < values.Length; i++)
2644for (int i = 0; i < mapping.Members!.Length; i++)
2658for (int j = 0; j < mapping.Members.Length; j++)
2698for (int i = 0; i < mapping.Members!.Length; i++)
2712for (int j = 0; j < mapping.Members.Length; j++)
2743for (int j = 0; j < mapping.Members.Length; j++)
2761if (isRpc && member.IsReturnValue && member.Elements!.Length > 0)
2793Writer.Write(mapping.Members.Length.ToString(CultureInfo.InvariantCulture));
2797WriteExtraMembers(mapping.Members.Length.ToString(CultureInfo.InvariantCulture), "pLength");
2883if (constants.Length > 0)
2891for (int i = 0; i < constants.Length; i++)
2911for (int i = 0; i < constants.Length; i++)
2922for (int i = 0; i < constants.Length; i++)
3182for (int i = 0; i < members.Length; i++)
3221for (int i = 0; i < members.Length; i++)
3227bool checkShouldPersist = m.CheckShouldPersist && (m.Elements!.Length > 0 || m.Text != null);
3485!(elements.Length == 1 && elements[0].Mapping is ArrayMapping))
3494if (elements.Length == 0 && text == null) return;
3612int count = elements.Length + (text == null ? 0 : 1);
3642if (elements.Length == 0 && text == null) return;
3643if (elements.Length == 1 && text == null)
3666for (int i = 0; i < elements.Length; i++)
3734if (elements.Length - anyCount > 0) Writer.Write("else ");
3830if (elements.Length > 0)
3852if (elements.Length > 0)
4390for (int i = 0; i < members.Length; i++)
4447for (int i = 0; i < choiceMapping.Constants!.Length; i++)
System.Private.Xml.Linq (20)
System.Reflection.Context (43)
System\Reflection\Context\Projection\ProjectingType.cs (19)
240methods.Length +
241constructors.Length +
242properties.Length +
243events.Length +
244fields.Length +
245nestedTypes.Length];
248Array.Copy(methods, 0, members, i, methods.Length); i += methods.Length;
249Array.Copy(constructors, 0, members, i, constructors.Length); i += constructors.Length;
250Array.Copy(properties, 0, members, i, properties.Length); i += properties.Length;
251Array.Copy(events, 0, members, i, events.Length); i += events.Length;
252Array.Copy(fields, 0, members, i, fields.Length); i += fields.Length;
253Array.Copy(nestedTypes, 0, members, i, nestedTypes.Length); i += nestedTypes.Length;
255Debug.Assert(i == members.Length);
System.Reflection.DispatchProxy (14)
System.Reflection.Emit (79)
System.Reflection.Metadata (54)
System.Reflection.MetadataLoadContext (124)
System.Resources.Extensions (13)
System.Resources.Writer (5)
System.Runtime.Caching (22)
System.Runtime.InteropServices (7)
System.Runtime.Numerics (99)
System.Runtime.Serialization.Formatters (80)
System.Security.Claims (9)
System.Security.Cryptography (394)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EcDsa.ImportExport.cs (8)
76p, p.Length,
77curve.A!, curve.A!.Length,
78curve.B!, curve.B!.Length,
79curve.G.X!, curve.G.X!.Length,
80curve.G.Y!, curve.G.Y!.Length,
81curve.Order!, curve.Order!.Length,
82curve.Cofactor, curve.Cofactor!.Length,
83curve.Seed, curve.Seed == null ? 0 : curve.Seed.Length);
src\libraries\Common\src\System\Security\Cryptography\ECOpenSsl.ImportExport.cs (25)
117parameters.Q.X, parameters.Q.X?.Length ?? 0,
118parameters.Q.Y, parameters.Q.Y?.Length ?? 0,
119parameters.D, parameters.D == null ? 0 : parameters.D.Length);
129parameters.Q.X, parameters.Q.X?.Length ?? 0,
130parameters.Q.Y, parameters.Q.Y?.Length ?? 0,
131parameters.D, parameters.D == null ? 0 : parameters.D.Length,
132parameters.Curve.Prime!, parameters.Curve.Prime!.Length,
133parameters.Curve.A!, parameters.Curve.A!.Length,
134parameters.Curve.B!, parameters.Curve.B!.Length,
135parameters.Curve.G.X!, parameters.Curve.G.X!.Length,
136parameters.Curve.G.Y!, parameters.Curve.G.Y!.Length,
137parameters.Curve.Order!, parameters.Curve.Order!.Length,
138parameters.Curve.Cofactor, parameters.Curve.Cofactor!.Length,
139parameters.Curve.Seed, parameters.Curve.Seed == null ? 0 : parameters.Curve.Seed.Length);
149parameters.Q.X, parameters.Q.X?.Length ?? 0,
150parameters.Q.Y, parameters.Q.Y?.Length ?? 0,
151parameters.D, parameters.D == null ? 0 : parameters.D.Length,
152parameters.Curve.Polynomial!, parameters.Curve.Polynomial!.Length,
153parameters.Curve.A!, parameters.Curve.A!.Length,
154parameters.Curve.B!, parameters.Curve.B!.Length,
155parameters.Curve.G.X!, parameters.Curve.G.X!.Length,
156parameters.Curve.G.Y!, parameters.Curve.G.Y!.Length,
157parameters.Curve.Order!, parameters.Curve.Order!.Length,
158parameters.Curve.Cofactor, parameters.Curve.Cofactor!.Length,
159parameters.Curve.Seed, parameters.Curve.Seed == null ? 0 : parameters.Curve.Seed.Length);
System\Security\Cryptography\DSA.cs (11)
101return SignData(data, 0, data.Length, hashAlgorithm);
141ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
144ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
198ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
201ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
303return VerifyData(data, 0, data.Length, signature, hashAlgorithm);
311ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
314ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
371ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
374ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
1107int qLength = dsaParameters.Q!.Length;
System\Security\Cryptography\ECDsa.cs (12)
47return SignData(data, 0, data.Length, hashAlgorithm);
55ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
58ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
112ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
115ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
723return VerifyData(data, 0, data.Length, signature, hashAlgorithm);
731ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
734ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
791ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
794ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
1018if (hash.Length <= destination.Length)
1021bytesWritten = hash.Length;
System\Security\Cryptography\PasswordDeriveBytes.cs (6)
126ib = _extra.Length - _extraCount;
153if (rgb.Length + ib > cb)
203_hash.TransformBlock(_password, 0, _password.Length, _password, 0);
207_hash.TransformBlock(_salt, 0, _salt.Length, _salt, 0);
236cs.Write(_baseValue!, 0, _baseValue!.Length);
249cs.Write(_baseValue, 0, _baseValue.Length);
System\Security\Cryptography\RSA.cs (17)
106if (destination.Length >= result.Length)
109bytesWritten = result.Length;
121if (destination.Length >= result.Length)
124bytesWritten = result.Length;
330if (destination.Length >= result.Length)
333bytesWritten = result.Length;
345if (destination.Length >= result.Length)
348bytesWritten = result.Length;
376return SignData(data, 0, data.Length, hashAlgorithm, padding);
389ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
392ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
638return VerifyData(data, 0, data.Length, signature, hashAlgorithm, padding);
652ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
655ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
735rentSize = rented.Length;
778rentSize = rented.Length;
1454if (written > rented.Length)
System.Security.Cryptography.Cose (17)
System.Text.Encoding.CodePages (62)
System.Text.Encodings.Web (5)
System.Text.Json (111)
System\Text\Json\BitStack.cs (15)
67Debug.Assert(index >= 0, $"Set - Negative - index: {index}, arrayLength: {_array.Length}");
70Debug.Assert(_array.Length <= int.MaxValue / 32 + 1, $"index: {index}, arrayLength: {_array.Length}");
76if (elementIndex >= _array.Length)
79Debug.Assert(index >= 0 && index > (int)((uint)_array.Length * 32 - 1), $"Only grow when necessary - index: {index}, arrayLength: {_array.Length}");
83Debug.Assert(elementIndex < _array.Length, $"Set - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
123Debug.Assert(index >= 0, $"Get - Negative - index: {index}, arrayLength: {_array.Length}");
127Debug.Assert(elementIndex < _array.Length, $"Get - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
135Debug.Assert(_array.Length < int.MaxValue / 2, $"Array too large - arrayLength: {_array.Length}");
136Debug.Assert(minSize >= 0 && minSize >= _array.Length);
138int nextDouble = Math.Max(minSize + 1, _array.Length * 2);
System\Text\Json\Document\JsonDocument.Parse.cs (11)
690MetadataDb database = MetadataDb.CreateLocked(utf8Json.Length);
691database.Append(tokenType, startLocation: 0, utf8Json.Length);
788Debug.Assert(rented.Length >= utf8Bom.Length);
807if (rented.Length == written)
810rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2));
811Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
816lastRead = stream.Read(rented, written, rented.Length - written);
871Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length);
895if (rented.Length == written)
898rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2);
899Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
System.Text.Json.SourceGeneration (11)
System.Text.RegularExpressions (184)
System\Text\RegularExpressions\RegexRunner.cs (19)
260runtrackpos = runtrack!.Length;
261runstackpos = runstack!.Length;
262runcrawlpos = runcrawl!.Length;
306runtrackpos = runtrack!.Length;
307runstackpos = runstack!.Length;
308runcrawlpos = runcrawl.Length;
455int[] newtrack = new int[runtrack!.Length * 2];
457Array.Copy(runtrack, 0, newtrack, runtrack.Length, runtrack.Length);
458runtrackpos += runtrack.Length;
468int[] newstack = new int[runstack!.Length * 2];
470Array.Copy(runstack, 0, newstack, runstack.Length, runstack.Length);
471runstackpos += runstack.Length;
480int[] newcrawl = new int[runcrawl!.Length * 2];
482Array.Copy(runcrawl, 0, newcrawl, runcrawl.Length, runcrawl.Length);
483runcrawlpos += runcrawl.Length;
511return runcrawl!.Length - runcrawlpos;
System\Text\RegularExpressions\Symbolic\BDDRangeConverter.cs (22)
55var result = new (uint, uint)[(1 << newBits) * ranges.Length];
70if (ranges[0].Item1 == 0 && ranges[ranges.Length - 1].Item2 == maximal)
76for (int i = 1; i < result.Length; i++)
115ranges = new (uint, uint)[ranges1.Length];
116for (int i = 0; i < ranges1.Length; i++)
136ranges = new (uint, uint)[rangesR.Length];
138for (int i = 1; i < rangesR.Length; i++)
145ranges = new (uint, uint)[rangesR.Length + 1];
147for (int i = 0; i < rangesR.Length; i++)
159(uint, uint) last = rangesL[rangesL.Length - 1];
169for (int i = 0; i < rangesL.Length - 1; i++)
195ranges = new (uint, uint)[rangesL.Length + rangesR.Length - 1];
196for (int i = 0; i < rangesL.Length - 1; i++)
201ranges[rangesL.Length - 1] = (last.Item1, first.Item2 | mask);
202for (int i = 1; i < rangesR.Length; i++)
204ranges[rangesL.Length - 1 + i] = (rangesR[i].Item1 | mask, rangesR[i].Item2 | mask);
209ranges = new (uint, uint)[rangesL.Length + rangesR.Length];
210for (int i = 0; i < rangesL.Length; i++)
215for (int i = 0; i < rangesR.Length; i++)
217ranges[rangesL.Length + i] = (rangesR[i].Item1 | mask, rangesR[i].Item2 | mask);
System.Text.RegularExpressions.Generator (64)
RegexGenerator.Emitter.cs (45)
1358literalChars.Length switch
4663Debug.Assert(args.Length is >= 1);
4666string key = $"{MethodName}{args.Length}";
4672var lines = new string[24 + args.Length];
4673lines[0] = $"/// <summary>Pushes {args.Length} value{(args.Length == 1 ? "" : "s")} onto the backtracking stack.</summary>";
4675lines[2] = $"internal static void {MethodName}(ref int[] stack, ref int pos{FormatN(", int arg{0}", args.Length)})";
4677lines[4] = $" // If there's space available for {(args.Length > 1 ? $"all {args.Length} values, store them" : "the value, store it")}.";
4680lines[7] = $" if ((uint){(args.Length > 1 ? $"(p + {args.Length - 1})" : "p")} < (uint)s.Length)";
4682for (int i = 0; i < args.Length; i++)
4686lines[9 + args.Length] = args.Length > 1 ? $" pos += {args.Length};" : " pos++;";
4687lines[10 + args.Length] = $" return;";
4688lines[11 + args.Length] = $" }}";
4689lines[12 + args.Length] = $"";
4690lines[13 + args.Length] = $" // Otherwise, resize the stack to make room and try again.";
4691lines[14 + args.Length] = $" WithResize(ref stack, ref pos{FormatN(", arg{0}", args.Length)});";
4692lines[15 + args.Length] = $"";
4693lines[16 + args.Length] = $" // <summary>Resize the backtracking stack array and push {args.Length} value{(args.Length == 1 ? "" : "s")} onto the stack.</summary>";
4694lines[17 + args.Length] = $" [MethodImpl(MethodImplOptions.NoInlining)]";
4695lines[18 + args.Length] = $" static void WithResize(ref int[] stack, ref int pos{FormatN(", int arg{0}", args.Length)})";
4696lines[19 + args.Length] = $" {{";
4697lines[20 + args.Length] = $" Array.Resize(ref stack, (pos + {args.Length - 1}) * 2);";
4698lines[21 + args.Length] = $" {MethodName}(ref stack, ref pos{FormatN(", arg{0}", args.Length)});";
4699lines[22 + args.Length] = $" }}";
4700lines[23 + args.Length] = $"}}";
4715Debug.Assert(args.Length is >= 1);
4717if (args.Length == 1)
4724string key = $"{MethodName}{args.Length}";
4728var lines = new string[5 + args.Length];
4729lines[0] = $"/// <summary>Pops {args.Length} value{(args.Length == 1 ? "" : "s")} from the backtracking stack.</summary>";
4731lines[2] = $"internal static void {MethodName}(int[] stack, ref int pos{FormatN(", out int arg{0}", args.Length)})";
4733for (int i = 0; i < args.Length; i++)
4737lines[4 + args.Length] = $"}}";
5405for (int i = 0; i < parts.Length; i++)
System.Threading.Channels (20)
System.Threading.RateLimiting (19)
System.Threading.Tasks.Dataflow (25)
System.Threading.Tasks.Parallel (13)
System.Transactions.Local (12)
System\Transactions\TransactionInteropNonWindows.cs (9)
57var whereaboutsCopy = new byte[whereabouts.Length];
58Buffer.BlockCopy(whereabouts, 0, whereaboutsCopy, 0, whereabouts.Length);
75if (cookie.Length < 32)
86var cookieCopy = new byte[cookie.Length];
87Buffer.BlockCopy(cookie, 0, cookieCopy, 0, cookie.Length);
145if (propagationToken.Length < 24)
246if (propagationToken.Length < 24)
251byte[] propagationTokenCopy = new byte[propagationToken.Length];
252Array.Copy(propagationToken, propagationTokenCopy, propagationToken.Length);
System.Web.HttpUtility (9)
System\Web\HttpUtility.cs (4)
180public static byte[]? UrlEncodeToBytes(byte[]? bytes) => bytes == null ? null : UrlEncodeToBytes(bytes, 0, bytes.Length);
190public static string? UrlDecode(byte[]? bytes, Encoding e) => bytes == null ? null : UrlDecode(bytes, 0, bytes.Length, e);
199public static byte[]? UrlDecodeToBytes(byte[]? bytes) => bytes == null ? null : UrlDecodeToBytes(bytes, 0, bytes.Length);
210return HttpEncoder.UrlEncode(bytes, 0, bytes.Length, alwaysCreateNewReturnValue: false);
System.Windows.Controls.Ribbon (9)
System.Xaml (97)
TaskUsageLogger (3)
Templates.Blazor.Tests (16)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Templates.Blazor.WebAssembly.Auth.Tests (16)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Templates.Blazor.WebAssembly.Tests (16)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Templates.Mvc.Tests (16)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Templates.Tests (16)
src\Shared\CertificateGeneration\CertificateManager.cs (8)
145if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
511Array.Clear(keyBytes, 0, keyBytes.Length);
512Array.Clear(pem, 0, pem.Length);
518Array.Clear(keyBytes, 0, keyBytes.Length);
519Array.Clear(pem, 0, pem.Length);
569Array.Clear(bytes, 0, bytes.Length);
597Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
TestExclusionListTasks (4)
TestTasks (1)
UIAutomationClient (67)
UIAutomationClientSideProviders (69)
UIAutomationProvider (1)
UIAutomationTypes (20)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (17)
5905get { return buffer.Length; }
5910IntPtr result = Marshal.AllocCoTaskMem(buffer.Length);
5911Marshal.Copy(buffer, 0, result, buffer.Length);
5919while (i < buffer.Length && buffer[i] != 0)
5924if (i < buffer.Length)
5934Marshal.Copy(ptr, buffer, 0, buffer.Length);
5941int count = Math.Min(bytes.Length, buffer.Length - offset);
5946if (offset < buffer.Length)
5963get { return buffer.Length; }
5968IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2);
5969Marshal.Copy(buffer, 0, result, buffer.Length);
5977while (i < buffer.Length && buffer[i] != 0)
5982if (i < buffer.Length)
5991Marshal.Copy(ptr, buffer, 0, buffer.Length);
5997int count = Math.Min(s.Length, buffer.Length - offset);
6002if (offset < buffer.Length)
VersioningWebSite (1)
Wasm.Performance.ConsoleHost (4)
Wasm.Performance.Driver (1)
WasmAppBuilder (36)
WebSocketSample (1)
WinShimmer (2)
WorkloadBuildTasks (7)
XmlFileLogger (3)
xunit.assert (10)
xunit.console (8)