251 references to AsMemory
Aspire.Dashboard (1)
dotnet (4)
dotnet.Tests (6)
CommandTests\Test\NamedPipeClient.cs (6)
60await _messageBuffer.WriteAsync(bytes.AsMemory(0, sizeof(int)), cancellationToken).ConfigureAwait(false);
72await _messageBuffer.WriteAsync(bytes.AsMemory(0, sizeof(int)), cancellationToken).ConfigureAwait(false);
82await _messageBuffer.WriteAsync(_serializationBuffer.GetBuffer().AsMemory(0, (int)_serializationBuffer.Position), cancellationToken).ConfigureAwait(false);
93await _namedPipeClientStream.WriteAsync(_messageBuffer.GetBuffer().AsMemory(0, (int)_messageBuffer.Position), cancellationToken).ConfigureAwait(false);
113int currentReadBytes = await _namedPipeClientStream.ReadAsync(_readBuffer.AsMemory(currentReadIndex, _readBuffer.Length), cancellationToken).ConfigureAwait(false);
141await _messageBuffer.WriteAsync(_readBuffer.AsMemory(currentReadIndex, missingBytesToReadOfCurrentChunk), cancellationToken).ConfigureAwait(false);
http2cat (1)
HttpStress (1)
IIS.Common.TestLib (1)
IIS.FunctionalTests (1)
IIS.LongTests (1)
IIS.NewHandler.FunctionalTests (1)
IIS.NewShim.FunctionalTests (1)
IIS.ShadowCopy.Tests (1)
IISExpress.FunctionalTests (1)
InMemory.FunctionalTests (6)
Interop.FunctionalTests (3)
Microsoft.AspNetCore.Components (2)
Microsoft.AspNetCore.Components.Endpoints (1)
Microsoft.AspNetCore.Components.Server (5)
Microsoft.AspNetCore.Components.WebAssembly (1)
Microsoft.AspNetCore.Components.WebView (1)
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Connections (4)
Microsoft.AspNetCore.Http.Connections.Client (1)
Microsoft.AspNetCore.Http.Extensions (3)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.HttpLogging (1)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Microsoft.AspNetCore.OpenApi (3)
Microsoft.AspNetCore.OutputCaching (1)
Microsoft.AspNetCore.RequestDecompression (1)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.ResponseCompression (1)
Microsoft.AspNetCore.Routing.FunctionalTests (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
Microsoft.AspNetCore.Server.IIS (1)
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (3)
Microsoft.AspNetCore.Shared.Tests (3)
Microsoft.AspNetCore.SignalR.Client.Core (1)
Microsoft.AspNetCore.SignalR.Client.Tests (3)
Microsoft.AspNetCore.SignalR.Common (3)
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (3)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (3)
Microsoft.AspNetCore.SignalR.Specification.Tests (3)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Microsoft.AspNetCore.SignalR.Tests (1)
Microsoft.AspNetCore.TestHost (1)
Microsoft.AspNetCore.TestHost.Tests (1)
Microsoft.AspNetCore.Watch.BrowserRefresh (3)
Microsoft.AspNetCore.WebSockets.Tests (2)
Microsoft.AspNetCore.WebUtilities (17)
Microsoft.AspNetCore.WebUtilities.Tests (10)
FileBufferingReadStreamTests.cs (9)
522Assert.Equal(data.AsMemory(0, 100).ToArray(), buffer);
540Assert.Equal(data.AsMemory(0, read).ToArray(), buffer);
559Assert.Equal(data.AsMemory(0, read).ToArray(), buffer);
579Assert.Equal(data.AsMemory(0, read1).ToArray(), buffer);
580Assert.Equal(data.AsMemory(0, read2).ToArray(), buffer2.AsMemory(0, read2).ToArray());
599Assert.Equal(data.AsMemory(0, read1).ToArray(), buffer);
600Assert.Equal(data.AsMemory(0, read2).ToArray(), buffer2.AsMemory(0, read2).ToArray());
Microsoft.Build.Tasks.Core (3)
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.DotNet.HotReload.Client.Tests (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Microsoft.Extensions.Http.Diagnostics (2)
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (12)
Resolver\LoopbackDnsServer.cs (9)
60int bytesWritten = await ProcessRequestCore((IPEndPoint)result.RemoteEndPoint, new ArraySegment<byte>(buffer, 0, result.ReceivedBytes), action, buffer.AsMemory(0, 512));
62await _dnsSocket.SendToAsync(buffer.AsMemory(0, bytesWritten), SocketFlags.None, result.RemoteEndPoint);
94int read = await tcpClient.ReceiveAsync(buffer.AsMemory(bytesRead, toRead), SocketFlags.None);
105await tcpClient.SendAsync(buffer.AsMemory(0, bytesWritten + 2), SocketFlags.None);
169!DnsPrimitives.TryReadQName(buffer.AsMemory(0, length), 0, out EncodedDomainName encodedName, out _))
212int bytesWritten = Write(buffer.AsMemory(0, 512));
249records.Add(new DnsResourceRecord(EncodeDomainName(name), QueryType.CNAME, QueryClass.Internet, ttl, buff.AsMemory(0, length)));
268records.Add(new DnsResourceRecord(EncodeDomainName(name), QueryType.SRV, QueryClass.Internet, ttl, buff.AsMemory(0, length)));
290records.Add(new DnsResourceRecord(EncodeDomainName(name), QueryType.SOA, QueryClass.Internet, ttl, buff.AsMemory(0, length)));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (2)
Microsoft.ML.Tokenizers (4)
Model\TiktokenTokenizer.cs (4)
331(int Id, int TokenIndex, int TokenLength)[] encodedTokens = BytePairEncoder.BytePairEncode(arrayPoolArray.AsMemory(0, encodedLength), _encoder, indexMappingSpan.Slice(0, encodedLength + 1));
448(int Id, int TokenIndex, int TokenLength)[] encodedTokens = BytePairEncoder.BytePairEncode(arrayPoolArray.AsMemory(0, encodedLength), _encoder, indexMappingSpan.Slice(0, encodedLength + 1));
613(int Id, int TokenIndex, int TokenLength)[] encodedTokens = BytePairEncoder.BytePairEncode(arrayPoolArray.AsMemory(0, encodedLength), _encoder, indexMappingSpan.Slice(0, encodedLength + 1));
739(int Id, int TokenIndex, int TokenLength)[] encodedTokens = BytePairEncoder.BytePairEncode(arrayPoolArray.AsMemory(0, encodedLength), _encoder, indexMappingSpan.Slice(0, encodedLength + 1));
Shared (1)
Sockets.FunctionalTests (3)
System.Formats.Tar (7)
System.IO.Compression (12)
System\IO\Compression\ZipArchiveEntry.Async.cs (5)
363await _archive.ArchiveStream.WriteAsync(writeBuffer.AsMemory(0, MetadataBufferLength), cancellationToken).ConfigureAwait(false);
369await _archive.ArchiveStream.WriteAsync(writeBuffer.AsMemory(0, CrcAndSizesBufferLength), cancellationToken).ConfigureAwait(false);
380await _archive.ArchiveStream.WriteAsync(writeBuffer.AsMemory(0, Zip64SizesBufferLength), cancellationToken).ConfigureAwait(false);
392await _archive.ArchiveStream.WriteAsync(writeBuffer.AsMemory(0, Zip64DataDescriptorCrcAndSizesBufferLength), cancellationToken).ConfigureAwait(false);
401return _archive.ArchiveStream.WriteAsync(dataDescriptor.AsMemory(0, bytesToWrite), cancellationToken);
System.Memory (1)
System.Memory.Data (1)
System.Net.Http (11)
System\Net\Http\SocketsHttpHandler\SocksHelper.cs (9)
89await WriteAsync(stream, buffer.AsMemory(0, buffer[1] + 2), async).ConfigureAwait(false);
96await ReadToFillAsync(stream, buffer.AsMemory(0, 2), async).ConfigureAwait(false);
126await WriteAsync(stream, buffer.AsMemory(0, 3 + usernameLength + passwordLength), async).ConfigureAwait(false);
133await ReadToFillAsync(stream, buffer.AsMemory(0, 2), async).ConfigureAwait(false);
184await WriteAsync(stream, buffer.AsMemory(0, addressLength + 6), async).ConfigureAwait(false);
191await ReadToFillAsync(stream, buffer.AsMemory(0, 5), async).ConfigureAwait(false);
204await ReadToFillAsync(stream, buffer.AsMemory(0, bytesToSkip), async).ConfigureAwait(false);
294await WriteAsync(stream, buffer.AsMemory(0, totalLength), async).ConfigureAwait(false);
300await ReadToFillAsync(stream, buffer.AsMemory(0, 8), async).ConfigureAwait(false);
System.Net.HttpListener (1)
System.Net.Mail (10)
System.Net.Quic (2)
System.Net.Requests (1)
System.Net.Security (2)
System.Net.Sockets (4)
System.Net.WebSockets (2)
System.Private.CoreLib (2)
System.Private.Xml (5)
System.Security.Cryptography (13)
System\Security\Cryptography\CryptoStream.cs (6)
220return ReadAsyncInternal(buffer.AsMemory(offset, count), cancellationToken).AsTask();
295ValueTask<int> completedValueTask = ReadAsyncCore(buffer.AsMemory(offset, count), default(CancellationToken), useAsync: false);
459return WriteAsyncInternal(buffer.AsMemory(offset, count), cancellationToken).AsTask();
499WriteAsyncCore(buffer.AsMemory(offset, count), default, useAsync: false).AsTask().GetAwaiter().GetResult();
730bytesRead = await ReadAsync(rentedBuffer.AsMemory(0, bufferSize), cancellationToken).ConfigureAwait(false);
731await destination.WriteAsync(rentedBuffer.AsMemory(0, bytesRead), cancellationToken).ConfigureAwait(false);
System.Security.Cryptography.Cose (3)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
408await WriteSignatureAsync(writer, signer, buffer, buffer.AsMemory(0, protectedMapBytesWritten), associatedData, content, cancellationToken).ConfigureAwait(false);
487await AppendToBeSignedAsync(buffer, toBeSignedBuilder, SigStructureContext.Signature, bodyProtected, buffer.AsMemory(start, signProtectedBytesWritten), associatedData, contentStream, cancellationToken).ConfigureAwait(false);
System.Security.Cryptography.Pkcs (1)
System.Text.Json (6)
System\Text\Json\Document\JsonDocument.Parse.cs (4)
93utf8Bytes.AsMemory(0, length),
294utf8Bytes.AsMemory(0, actualByteCount),
661document = Parse(rented.AsMemory(0, length), state.Options, rented, allowDuplicateProperties: allowDuplicateProperties);
911lastRead = await stream.ReadAsync(rented.AsMemory(written, utf8BomLength - written), cancellationToken).ConfigureAwait(false);