8 types derived from Task
Microsoft.AspNetCore.Mvc.Core.Test (1)
System.Private.CoreLib (7)
31 instantiations of Task
Microsoft.AspNetCore.Owin.Tests (1)
System.Linq.Parallel (6)
System.Private.CoreLib (12)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (1)
552return new Task(
System.Threading.Tasks.Dataflow (9)
System.Threading.Tasks.Parallel (3)
25172 references to Task
ApiExplorerWebSite (10)
AuthSamples.FunctionalTests (31)
AutobahnTestApp (2)
AzureAppServicesHostingStartupSample (1)
AzureAppServicesSample (1)
BasicLinkedApp (1)
BasicTestApp (59)
InteropTest\JavaScriptInterop.cs (34)
17public static Task AsyncThrowSyncException()
21public static async Task AsyncThrowAsyncException()
23await Task.Yield();
204public static Task VoidParameterlessAsync()
207return Task.CompletedTask;
211public static Task VoidWithOneParameterAsync(ComplexParameter parameter1)
214return Task.CompletedTask;
218public static Task VoidWithTwoParametersAsync(
223return Task.CompletedTask;
227public static Task VoidWithThreeParametersAsync(
233return Task.CompletedTask;
237public static Task VoidWithFourParametersAsync(
244return Task.CompletedTask;
248public static Task VoidWithFiveParametersAsync(
256return Task.CompletedTask;
260public static Task VoidWithSixParametersAsync(
269return Task.CompletedTask;
273public static Task VoidWithSevenParametersAsync(
283return Task.CompletedTask;
287public static Task VoidWithEightParametersAsync(
298return Task.CompletedTask;
304return Task.FromResult(new decimal[] { 0.1M, 0.2M });
310return Task.FromResult(new object[] { parameter1 });
318return Task.FromResult(new object[] { parameter1, parameter2 });
327return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue() });
337return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4 });
348return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5 });
359return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6 });
372return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6, parameter7 });
386return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6, parameter7, parameter8 });
401await Task.Yield();
423await Task.Yield();
476await Task.Yield();
519await Task.Yield();
BasicWebSite (44)
Benchmarks (1)
BlazorServerApp (1)
BlazorUnitedApp (1)
Certificate.Optional.Sample (1)
Certificate.Sample (1)
ClaimsTransformation (1)
ClientSample (19)
ConcurrencyLimiterSample (2)
CookiePolicySample (2)
CookieSample (1)
CookieSessionSample (6)
CorsMiddlewareWebSite (3)
CustomAuthorizationFailureResponse (8)
CustomPolicyProvider (3)
DatabaseErrorPageSample (2)
DefaultBuilder.SampleApp (1)
DeveloperExceptionPageSample (1)
Diagnostics.EFCore.FunctionalTests (31)
Diagnostics.FunctionalTests (12)
dotnet-openapi (8)
ErrorPageMiddlewareWebSite (7)
ExceptionHandlerSample (2)
FormatterWebSite (8)
GenericWebHost (1)
GetDocument.Insider (3)
HealthChecksSample (7)
HelixTestRunner (12)
HostedBlazorWebassemblyApp.Client (1)
HostedBlazorWebassemblyApp.Server (1)
HostFilteringSample (1)
HotAddSample (1)
HtmlGenerationWebSite (1)
http2cat (58)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
Http2SampleApp (1)
HttpOverridesSample (1)
HttpsPolicySample (1)
HttpStress (13)
Program.cs (13)
115Func<ClientContext, Task> TestAbort(string path)
168var clientOperations = new (string, Func<ClientContext, Task>)[]
219await Task.Delay(1);
307await Task.Delay(1);
465var writeTask = context.Response.WriteAsync(contentSource.Substring(0, contentSource.Length));
466await Task.Yield();
496return Task.CompletedTask;
579Task.WaitAll(Enumerable.Range(0, concurrentRequests).Select(taskNum => Task.Run(async () =>
586(string operation, Func<ClientContext, Task> func) = clientOperations[opIndex];
669protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context)
696protected override Task SerializeToStreamAsync(Stream stream, TransportContext context) =>
713protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context)
Identity.DefaultUI.WebSite (76)
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (71)
36return Task.FromResult<IList<Claim>>(claims);
39public Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
45return Task.FromResult(0);
48public Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
56return Task.FromResult(0);
59public Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
71return Task.FromResult(0);
74public Task SetEmailAsync(TUser user, string email, CancellationToken cancellationToken = default(CancellationToken))
77return Task.FromResult(0);
82return Task.FromResult(user.Email);
87return Task.FromResult(user.NormalizedEmail);
90public Task SetNormalizedEmailAsync(TUser user, string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
93return Task.FromResult(0);
98return Task.FromResult(user.EmailConfirmed);
101public Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
104return Task.FromResult(0);
110Task.FromResult(
116return Task.FromResult(user.LockoutEnd);
119public Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
122return Task.FromResult(0);
128return Task.FromResult(user.AccessFailedCount);
131public Task ResetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
134return Task.FromResult(0);
139return Task.FromResult(user.AccessFailedCount);
144return Task.FromResult(user.LockoutEnabled);
147public Task SetLockoutEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
150return Task.FromResult(0);
158public virtual Task AddLoginAsync(TUser user, UserLoginInfo login,
169return Task.FromResult(0);
172public Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
185return Task.FromResult(0);
192return Task.FromResult(result);
200return Task.FromResult(_logins[key]);
202return Task.FromResult<TUser>(null);
207return Task.FromResult(user.Id);
212return Task.FromResult(user.UserName);
215public Task SetUserNameAsync(TUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
218return Task.FromResult(0);
224return Task.FromResult(IdentityResult.Success);
230return Task.FromResult(IdentityResult.Success);
237return Task.FromResult(_users[userId]);
239return Task.FromResult<TUser>(null);
249Task.FromResult(
260return Task.FromResult(IdentityResult.Success);
263public Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken = default(CancellationToken))
266return Task.FromResult(0);
271return Task.FromResult(user.PasswordHash);
276return Task.FromResult(user.PasswordHash != null);
279public Task SetPhoneNumberAsync(TUser user, string phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
282return Task.FromResult(0);
287return Task.FromResult(user.PhoneNumber);
292return Task.FromResult(user.PhoneNumberConfirmed);
295public Task SetPhoneNumberConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
298return Task.FromResult(0);
301public Task SetSecurityStampAsync(TUser user, string stamp, CancellationToken cancellationToken = default(CancellationToken))
304return Task.FromResult(0);
309return Task.FromResult(user.SecurityStamp);
312public Task SetTwoFactorEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
315return Task.FromResult(0);
320return Task.FromResult(user.TwoFactorEnabled);
325return Task.FromResult(user.NormalizedUserName);
328public Task SetNormalizedUserNameAsync(TUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
331return Task.FromResult(0);
342return Task.FromResult<IList<TUser>>(query.ToList());
345public Task SetTokenAsync(TUser user, string loginProvider, string name, string value, CancellationToken cancellationToken)
366return Task.FromResult(0);
369public Task RemoveTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
380return Task.FromResult(0);
390return Task.FromResult(tokenEntity?.TokenValue);
397public Task SetAuthenticatorKeyAsync(TUser user, string key, CancellationToken cancellationToken)
407public Task ReplaceCodesAsync(TUser user, IEnumerable<string> recoveryCodes, CancellationToken cancellationToken)
Identity.ExternalClaims (8)
IdentitySample.DefaultUI (2)
IdentitySample.Mvc (10)
IIS.Common.TestLib (5)
IIS.FunctionalTests (238)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
IIS.LongTests (185)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
IIS.Microbenchmarks (4)
IIS.NewHandler.FunctionalTests (186)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
IIS.NewShim.FunctionalTests (186)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
IIS.ShadowCopy.Tests (36)
IIS.Tests (40)
IISExpress.FunctionalTests (339)
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
IISSample (1)
ILCompiler.DependencyAnalysisFramework (3)
ILLink.CodeFixProvider (6)
InMemory.FunctionalTests (1279)
BadHttpRequestTests.cs (26)
25public Task TestInvalidRequestLines(string request, string expectedExceptionMessage)
35public Task TestInvalidRequestLinesWithUnrecognizedVersion(string httpVersion)
45public Task TestInvalidHeaders(string rawHeaders, string expectedExceptionMessage)
71public Task BadRequestWhenHeaderNameContainsNonASCIIOrNullCharacters(string dataName)
86public Task BadRequestIfMethodRequiresLengthButNoContentLengthInHttp10Request(string method)
97public Task BadRequestIfContentLengthInvalid(string contentLength)
108public Task RejectsIncorrectMethods(string request, string allowedMethod)
118public Task BadRequestIfHostHeaderMissing()
127public Task BadRequestIfMultipleHostHeaders()
136public Task BadRequestIfHostHeaderDoesNotMatchRequestTarget(string requestTarget, string host)
147public async Task CanOptOutOfBadRequestIfHostHeaderDoesNotMatchRequestTarget(string hostHeader)
153return Task.CompletedTask;
171public Task BadRequestFor10BadHostHeaderFormat()
180public Task BadRequestFor11BadHostHeaderFormat()
189public async Task BadRequestLogsAreNotHigherThanDebug()
211public async Task TestRequestSplitting()
213await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
227public async Task BadRequestForHttp2()
229await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
244public Task BadRequestForAbsoluteFormTargetWithNonAsciiChars()
279private async Task TestBadRequest(string request, string expectedResponseStatusCode, string expectedExceptionMessage, string expectedAllowHeader = null)
306await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory) { DiagnosticSource = diagListener }))
332public async Task ExtraLinesBetweenRequestsIgnored(string extraLines)
393public async Task ExtraLinesIgnoredBetweenAdjacentRequests()
463public async Task ExtraLinesAtEndOfConnectionIgnored(string extraLines)
509private async Task ReceiveBadRequestResponse(InMemoryConnection connection, string expectedResponseStatusCode, string expectedDateHeaderValue, string expectedAllowHeader = null)
Http2\Http2ConnectionTests.cs (198)
31public async Task MaxConcurrentStreamsLogging_ReachLimit_MessageLogged()
53public async Task FlowControl_NoAvailability_ResponseHeadersStillFlushed()
85public async Task FlowControl_OneStream_CorrectlyAwaited()
163public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderReused()
212public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfNotReused()
307public async Task ResponseTrailers_MultipleStreams_Reset()
336return Task.CompletedTask;
396public async Task StreamPool_SingleStream_ReturnedToPool()
430public async Task StreamPool_MultipleStreamsConcurrent_StreamsReturnedToPool()
479public async Task StreamPool_MultipleStreamsInSequence_PooledStreamReused()
554public async Task StreamPool_StreamIsInvalidState_DontReturnedToPool()
598public async Task StreamPool_EndedStreamErrorsOnStart_NotReturnedToPool()
620public async Task StreamPool_UnendedStreamErrorsOnStart_NotReturnedToPool()
649public async Task StreamPool_UnusedExpiredStream_RemovedFromPool()
690public async Task Frame_Received_OverMaxSize_FrameError()
707public async Task ServerSettings_ChangesRequestMaxFrameSize()
739public async Task DATA_Received_ReadByStream()
765public async Task DATA_Received_MaxSize_ReadByStream()
792public async Task DATA_Received_GreaterThanInitialWindowSize_ReadByStream()
893public async Task DATA_Received_RightAtWindowLimit_DoesNotPausePipe()
923public async Task DATA_Received_Multiple_ReadByStream()
955public async Task DATA_Received_Multiplexed_ReadByStreams()
1021public async Task DATA_Received_Multiplexed_GreaterThanInitialWindowSize_ReadByStream()
1137public async Task DATA_Received_Multiplexed_AppMustNotBlockOtherFrames()
1209public async Task DATA_Received_WithPadding_ReadByStream(byte padLength)
1238public async Task DATA_Received_WithPadding_CountsTowardsInputFlowControl(byte padLength)
1307public async Task DATA_Received_ButNotConsumedByApp_CountsTowardsInputFlowControl()
1345public async Task DATA_BufferRequestBodyLargerThanStreamSizeSmallerThanConnectionPipe_Works()
1443public async Task DATA_Received_StreamIdZero_ConnectionError()
1457public async Task DATA_Received_StreamIdEven_ConnectionError()
1471public async Task DATA_Received_PaddingEqualToFramePayloadLength_ConnectionError()
1486public async Task DATA_Received_PaddingGreaterThanFramePayloadLength_ConnectionError()
1501public async Task DATA_Received_FrameLengthZeroPaddingZero_ConnectionError()
1516public async Task DATA_Received_InterleavedWithHeaders_ConnectionError()
1531public async Task DATA_Received_StreamIdle_ConnectionError()
1545public async Task DATA_Received_StreamHalfClosedRemote_ConnectionError()
1562public async Task DATA_Received_StreamClosed_ConnectionError()
1587public async Task Frame_MultipleStreams_CanBeCreatedIfClientCountIsLessThanActualMaxStreamCount()
1621public async Task MaxTrackedStreams_SmallMaxConcurrentStreams_LowerLimitOf100Async()
1633public async Task MaxTrackedStreams_DefaultMaxConcurrentStreams_DoubleLimit()
1645public async Task MaxTrackedStreams_LargeMaxConcurrentStreams_DoubleLimit()
1667public Task Frame_MultipleStreams_RequestsNotFinished_LowMaxStreamsPerConnection_EnhanceYourCalmAfter100()
1675public Task Frame_MultipleStreams_RequestsNotFinished_DefaultMaxStreamsPerConnection_EnhanceYourCalmAfterDoubleMaxStreams()
1682public async Task AbortConnectionAfterTooManyEnhanceYourCalms()
1685await InitializeConnectionAsync(_ => Task.FromException(new InvalidOperationException("No requests should be processed")));
1734private async Task RequestUntilEnhanceYourCalm(int maxStreamsPerConnection, int sentStreams)
1764public async Task DATA_Received_StreamClosedImplicitly_ConnectionError()
1792public async Task DATA_Received_NoStreamWindowSpace_ConnectionError()
1814public async Task DATA_Received_NoConnectionWindowSpace_ConnectionError()
1843public async Task DATA_Sent_DespiteConnectionOutputFlowControl_IfEmptyAndEndsStream()
1925public async Task OutputFlowControl_ConnectionAndRequestAborted_NoException()
1987public async Task DATA_Sent_DespiteStreamOutputFlowControl_IfEmptyAndEndsStream()
2008public async Task StreamWindow_BiggerThan_ConnectionWindow()
2060public async Task HEADERS_Received_Decoded()
2080public async Task HEADERS_Received_WithPadding_Decoded(byte padLength)
2097public async Task HEADERS_Received_WithPriority_Decoded()
2117public async Task HEADERS_Received_WithPriorityAndPadding_Decoded(byte padLength)
2136public async Task HEADERS_Received_WithTrailers_Available(bool sendData)
2180public async Task HEADERS_Received_ContainsExpect100Continue_100ContinueSent()
2212public async Task HEADERS_Received_AppCannotBlockOtherFrames()
2261public async Task HEADERS_HeaderTableSizeLimitZero_Received_DynamicTableUpdate()
2295public async Task HEADERS_ResponseSetsIgnoreIndexAndNeverIndexValues_HeadersParsed()
2303return Task.CompletedTask;
2389public async Task HEADERS_DisableDynamicHeaderCompression_HeadersNotCompressed()
2413public async Task HEADERS_OverMaxStreamLimit_Refused()
2439public async Task HEADERS_Received_StreamIdZero_ConnectionError()
2453public async Task HEADERS_Received_StreamIdEven_ConnectionError()
2467public async Task HEADERS_Received_StreamClosed_ConnectionError()
2493public async Task HEADERS_Received_StreamHalfClosedRemote_ConnectionError()
2510public async Task HEADERS_Received_StreamClosedImplicitly_ConnectionError()
2534public async Task HEADERS_Received_PaddingEqualToFramePayloadLength_ConnectionError(byte padLength)
2549public async Task HEADERS_Received_PaddingFieldMissing_ConnectionError()
2565public async Task HEADERS_Received_PaddingGreaterThanFramePayloadLength_ConnectionError(int frameLength, byte padLength)
2579public async Task HEADERS_Received_InterleavedWithHeaders_ConnectionError()
2594public async Task HEADERS_Received_WithPriority_StreamDependencyOnSelf_ConnectionError()
2608public async Task HEADERS_Received_IncompleteHeaderBlock_ConnectionError()
2622public async Task HEADERS_Received_IntegerOverLimit_ConnectionError()
2651public async Task HEADERS_Received_WithTrailers_ContainsIllegalTrailer_ConnectionError(byte[] trailers, string expectedErrorMessage)
2668public async Task HEADERS_Received_WithTrailers_EndStreamNotSet_ConnectionError(int intFlags)
2685public async Task HEADERS_Received_HeaderNameContainsUpperCaseCharacter_ConnectionError(byte[] headerBlock)
2698public Task HEADERS_Received_HeaderBlockContainsUnknownPseudoHeaderField_ConnectionError()
2712public Task HEADERS_Received_HeaderBlockContainsResponsePseudoHeaderField_ConnectionError()
2727public Task HEADERS_Received_HeaderBlockContainsDuplicatePseudoHeaderField_ConnectionError(IEnumerable<KeyValuePair<string, string>> headers)
2734public async Task HEADERS_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_MethodIsCONNECT_NoError(IEnumerable<KeyValuePair<string, string>> headers)
2750public Task HEADERS_Received_HeaderBlockContainsPseudoHeaderFieldAfterRegularHeaders_ConnectionError(IEnumerable<KeyValuePair<string, string>> headers)
2755private async Task HEADERS_Received_InvalidHeaderFields_ConnectionError(IEnumerable<KeyValuePair<string, string>> headers, string expectedErrorMessage)
2768public async Task HEADERS_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_StreamError(IEnumerable<KeyValuePair<string, string>> headers)
2788public Task HEADERS_Received_HeaderBlockOverLimit_ConnectionError()
2818public Task HEADERS_Received_TooManyHeaders_ConnectionError()
2837public Task HEADERS_Received_InvalidCharacters_ConnectionError()
2851public Task HEADERS_Received_HeaderBlockContainsConnectionHeader_ConnectionError()
2865public Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsNotTrailers_ConnectionError()
2879public async Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsTrailers_NoError()
2902public async Task HEADERS_Received_RequestLineLength_StreamError()
2920public async Task HEADERS_CookiesMergedIntoOne()
2947public async Task PRIORITY_Received_StreamIdZero_ConnectionError()
2961public async Task PRIORITY_Received_StreamIdEven_ConnectionError()
2977public async Task PRIORITY_Received_LengthNotFive_ConnectionError(int length)
2991public async Task PRIORITY_Received_InterleavedWithHeaders_ConnectionError()
3006public async Task PRIORITY_Received_StreamDependencyOnSelf_ConnectionError()
3020public async Task RST_STREAM_Received_ContinuesAppsAwaitingConnectionOutputFlowControl()
3022var writeTasks = new Task[4];
3140public async Task RST_STREAM_Received_ContinuesAppsAwaitingStreamOutputFlowControl()
3142var writeTasks = new Task[6];
3181async Task VerifyStreamBackpressure(int streamId, int headersLength)
3224public async Task RST_STREAM_Received_ReturnsSpaceToConnectionInputFlowControlWindow()
3258public async Task RST_STREAM_Received_StreamIdZero_ConnectionError()
3272public async Task RST_STREAM_Received_StreamIdEven_ConnectionError()
3286public async Task RST_STREAM_Received_StreamIdle_ConnectionError()
3302public async Task RST_STREAM_Received_LengthNotFour_ConnectionError(int length)
3319public async Task RST_STREAM_Received_InterleavedWithHeaders_ConnectionError()
3335public async Task RST_STREAM_IncompleteRequest_AdditionalDataFrames_ConnectionAborted()
3359public async Task RST_STREAM_IncompleteRequest_AdditionalTrailerFrames_ConnectionAborted()
3383public async Task RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset()
3406public async Task RST_STREAM_IncompleteRequest_AdditionalWindowUpdateFrame_ConnectionAborted()
3429public async Task SETTINGS_KestrelDefaults_Sent()
3479public async Task SETTINGS_Custom_Sent()
3538public async Task SETTINGS_Received_Sends_ACK()
3546public async Task SETTINGS_ACK_Received_DoesNotSend_ACK()
3559public async Task SETTINGS_Received_StreamIdNotZero_ConnectionError()
3582public async Task SETTINGS_Received_InvalidParameterValue_ConnectionError(int intParameter, uint value, int intExpectedErrorCode)
3599public async Task SETTINGS_Received_InterleavedWithHeaders_ConnectionError()
3616public async Task SETTINGS_Received_WithACK_LengthNotZero_ConnectionError(int length)
3635public async Task SETTINGS_Received_LengthNotMultipleOfSix_ConnectionError(int length)
3649public async Task SETTINGS_Received_WithInitialWindowSizePushingStreamWindowOverMax_ConnectionError()
3673public async Task SETTINGS_Received_ChangesAllowedResponseMaxFrameSize()
3730public async Task SETTINGS_Received_ClientMaxFrameSizeCannotExceedServerMaxFrameSize()
3769public async Task SETTINGS_Received_ChangesHeaderTableSize()
3798public async Task SETTINGS_Received_WithLargeHeaderTableSizeLimit_ChangesHeaderTableSize()
3836public async Task PUSH_PROMISE_Received_ConnectionError()
3850public async Task PING_Received_SendsACK()
3864public async Task PING_Received_WithACK_DoesNotSendACK()
3874public async Task PING_Received_InterleavedWithHeaders_ConnectionError()
3889public async Task PING_Received_StreamIdNotZero_ConnectionError()
3907public async Task PING_Received_LengthNotEight_ConnectionError(int length)
3921public async Task GOAWAY_Received_ConnectionStops()
3931public async Task GOAWAY_Received_ConnectionLifetimeNotification_Cancelled()
3944public async Task GOAWAY_Received_SetsConnectionStateToClosingAndWaitForAllStreamsToComplete()
3989public async Task GOAWAY_Received_ContinuesAppsAwaitingConnectionOutputFlowControl()
3991var writeTasks = new Task[6];
4092public async Task GOAWAY_Received_ContinuesAppsAwaitingStreamOutputFlowControl()
4094var writeTasks = new Task[6];
4133async Task VerifyStreamBackpressure(int streamId, int headersLength)
4169public async Task GOAWAY_Received_StreamIdNotZero_ConnectionError()
4183public async Task GOAWAY_Received_InterleavedWithHeaders_ConnectionError()
4198public async Task WINDOW_UPDATE_Received_StreamIdEven_ConnectionError()
4212public async Task WINDOW_UPDATE_Received_InterleavedWithHeaders_ConnectionError()
4231public async Task WINDOW_UPDATE_Received_LengthNotFour_ConnectionError(int streamId, int length)
4245public async Task WINDOW_UPDATE_Received_OnConnection_SizeIncrementZero_ConnectionError()
4259public async Task WINDOW_UPDATE_Received_OnStream_SizeIncrementZero_ConnectionError()
4274public async Task WINDOW_UPDATE_Received_StreamIdle_ConnectionError()
4288public async Task WINDOW_UPDATE_Received_OnConnection_IncreasesWindowAboveMaxValue_ConnectionError()
4305public async Task WINDOW_UPDATE_Received_OnStream_IncreasesWindowAboveMaxValue_StreamError()
4324public async Task WINDOW_UPDATE_Received_OnConnection_Respected()
4352var lastWriteTask = context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4415public async Task WINDOW_UPDATE_Received_OnStream_Respected()
4456public async Task WINDOW_UPDATE_Received_OnStream_Respected_WhenInitialWindowSizeReducedMidStream()
4512public async Task CONTINUATION_Received_Decoded()
4531public async Task CONTINUATION_Received_WithTrailers_Available(bool sendData)
4586public async Task CONTINUATION_Received_StreamIdMismatch_ConnectionError()
4602public async Task CONTINUATION_Received_IncompleteHeaderBlock_ConnectionError()
4618public async Task CONTINUATION_Received_WithTrailers_ContainsIllegalTrailer_ConnectionError(byte[] trailers, string expectedErrorMessage)
4635public async Task CONTINUATION_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_StreamError(IEnumerable<KeyValuePair<string, string>> headers)
4658public async Task CONTINUATION_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_MethodIsCONNECT_NoError(IEnumerable<KeyValuePair<string, string>> headers)
4674public async Task CONTINUATION_Sent_WhenHeadersLargerThanFrameLength()
4714public async Task UnknownFrameType_Received_Ignored()
4731public async Task UnknownFrameType_Received_InterleavedWithHeaders_ConnectionError()
4746public async Task ConnectionErrorAbortsAllStreams()
4771public async Task ConnectionResetLoggedWithActiveStreams()
4784public async Task ConnectionResetNotLoggedWithNoActiveStreams()
4795public async Task OnInputOrOutputCompletedCompletesOutput()
4808public async Task AbortSendsFinalGOAWAY()
4819public async Task CompletionSendsFinalGOAWAY()
4831public async Task StopProcessingNextRequestSendsGracefulGOAWAYAndWaitsForStreamsToComplete()
4833var task = Task.CompletedTask;
4875public async Task StopProcessingNextRequestSendsGracefulGOAWAYThenFinalGOAWAYWhenAllStreamsComplete()
4907public async Task AcceptNewStreamsDuringClosingConnection()
4953public async Task IgnoreNewStreamsDuringClosedConnection()
4973public async Task IOExceptionDuringFrameProcessingIsNotLoggedHigherThanDebug()
4991public async Task UnexpectedExceptionDuringFrameProcessingLoggedAWarning()
5012public async Task AppDoesNotReadRequestBody_ResetsAndDrainsRequest(int intFinalFrameType)
5063public async Task AbortedStream_ResetsAndDrainsRequest(int intFinalFrameType)
5107public async Task ResetStream_ResetsAndDrainsRequest(int intFinalFrameType)
5151public async Task RefusedStream_Post_ResetsAndDrainsRequest(int intFinalFrameType)
5159var connectionTask = _connection.ProcessRequestsAsync(new DummyApplication(_noopApplication));
5161async Task CompletePipeOnTaskCompletion()
5231public async Task RefusedStream_Post_2xLimitRefused()
5239var connectionTask = _connection.ProcessRequestsAsync(new DummyApplication(_ => requestBlock.Task));
5241async Task CompletePipeOnTaskCompletion()
5301public async Task FramesInBatchAreStillProcessedAfterStreamError_WithoutHeartbeat()
5348public async Task AbortedStream_ResetsAndDrainsRequest_RefusesFramesAfterEndOfStream(int intFinalFrameType)
5422public async Task AbortedStream_ResetsAndDrainsRequest_RefusesFramesAfterClientReset(int intFinalFrameType)
5467public async Task StartConnection_SendPreface_ReturnSettings()
5482public async Task StartConnection_SendHttp1xRequest_ReturnHttp11Status400()
5495public async Task StartConnection_SendHttp1xRequest_ExceedsRequestLineLimit_ProtocolError()
5509public async Task StartTlsConnection_SendHttp1xRequest_NoError()
5525public async Task StartConnection_SendNothing_NoError()
Http2\Http2TestBase.cs (59)
158protected Task _connectionTask;
173Task.Run(() =>
180_noopApplication = context => Task.CompletedTask;
195return Task.CompletedTask;
281return Task.CompletedTask;
352return Task.CompletedTask;
360return Task.CompletedTask;
369return Task.CompletedTask;
375return Task.CompletedTask;
383return Task.CompletedTask;
527var connectionTask = _connection.ProcessRequestsAsync(new DummyApplication(application));
529async Task CompletePipeOnTaskCompletion()
545protected async Task InitializeConnectionAsync(RequestDelegate application, int expectedSettingsCount = 4, bool expectedWindowUpdate = true, bool addKestrelFeatures = false)
550await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
586protected Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream, bool flushFrame = true)
598return Task.CompletedTask;
601protected Task StartStreamAsync(int streamId, Span<byte> headerData, bool endStream)
620protected Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
662protected Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
707protected Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
743protected Task WaitForStreamAsync(int streamId)
748protected Task WaitForAllStreamsAsync()
750return Task.WhenAll(_runningStreams.Values.Select(tcs => tcs.Task)).DefaultTimeout();
753protected Task SendAsync(ReadOnlySpan<byte> span)
760protected static async Task FlushAsync(PipeWriter writableBuffer)
765protected Task SendPreambleAsync() => SendAsync(Http2Connection.ClientPreface);
767protected async Task SendSettingsAsync()
773protected async Task SendSettingsAckWithInvalidLengthAsync(int length)
783protected async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
797protected async Task SendSettingsWithInvalidLengthAsync(int length)
809internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
827protected Task SendPushPromiseFrameAsync()
860internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
872protected async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
891protected async Task SendIncompleteHeadersFrameAsync(int streamId)
925internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
964internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
976protected async Task SendIncompleteContinuationFrameAsync(int streamId)
994protected Task SendDataAsync(int streamId, Memory<byte> data, bool endStream, bool flushFrame = true)
1002return Task.CompletedTask;
1005protected async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
1025protected Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
1045internal Task SendPingAsync(Http2PingFrameFlags flags)
1054protected Task SendPingWithInvalidLengthAsync(int length)
1064protected Task SendPingWithInvalidStreamIdAsync(int streamId)
1083protected Task SendPriorityAsync(int streamId, int streamDependency = 0)
1097protected Task SendInvalidPriorityFrameAsync(int streamId, int length)
1113protected Task SendRstStreamAsync(int streamId)
1125protected Task SendInvalidRstStreamFrameAsync(int streamId, int length)
1135protected Task SendGoAwayAsync()
1144protected Task SendInvalidGoAwayFrameAsync()
1154protected Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
1161protected Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
1171protected Task SendUnknownFrameTypeAsync(int streamId, int frameType)
1250protected Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
1257protected Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
1272internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode, params string[] expectedErrorMessage)
1279internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode, params string[] expectedErrorMessage)
1306internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode, string expectedErrorMessage)
Http3\Http3StreamTests.cs (120)
28public async Task HelloWorldTest()
49public async Task UnauthorizedHttpStatusResponse()
62return Task.CompletedTask;
72public async Task EmptyMethod_Reset()
90public async Task InvalidCustomMethod_Reset()
108public async Task CustomMethod_Accepted()
130public async Task RequestHeadersMaxRequestHeaderFieldSize_EndsStream()
150public async Task ConnectMethod_Accepted()
166public async Task OptionsStar_LeftOutOfPath()
185public async Task OptionsSlash_Accepted()
204public async Task PathAndQuery_Separated()
216return Task.CompletedTask;
239public async Task Path_DecodedAndNormalized(string input, string expected)
250return Task.CompletedTask;
264public async Task ConnectMethod_WithSchemeOrPath_Reset(string headerName, string value)
281public async Task SchemeMismatch_Reset(string scheme)
298public async Task SchemeMismatchAllowed_Processed(string scheme)
309return Task.CompletedTask;
323public async Task SchemeMismatchAllowed_InvalidScheme_Reset(string scheme)
340public async Task MissingAuthority_200Status()
360public async Task EmptyAuthority_200Status()
380public async Task MissingAuthorityFallsBackToHost_200Status()
402public async Task EmptyAuthorityIgnoredOverHost_200Status()
425public async Task AuthorityOverridesHost_200Status()
448public async Task AuthorityOverridesInvalidHost_200Status()
471public async Task InvalidAuthority_Reset()
490public async Task InvalidAuthorityWithValidHost_Reset()
510public async Task TwoHosts_StreamReset()
530public async Task MaxRequestLineSize_Reset()
551public async Task ContentLength_Received_SingleDataFrame_Verified()
580public async Task ContentLength_Received_MultipleDataFrame_Verified()
616public async Task ContentLength_Received_MultipleDataFrame_ReadViaPipe_Verified()
651public async Task RemoveConnectionSpecificHeaders()
684public async Task ContentLength_Received_NoDataFrames_Reset()
700return Task.CompletedTask;
712public async Task EndRequestStream_ContinueReadingFromResponse()
733await Task.Delay(50);
754public async Task FlushPipeAsync_OnStoppedHttp3Stream_ReturnsFlushResultWithIsCompletedTrue()
789public async Task FlushPipeAsync_OnCanceledPendingFlush_ReturnsFlushResultWithIsCanceledTrue()
823public async Task ResponseTrailers_WithoutData_Sent()
840return Task.CompletedTask;
853public async Task ResponseHeaders_WithNonAscii_Throws()
884public async Task ResponseHeaders_WithNonAsciiAndCustomEncoder_Works()
920public async Task ResponseHeaders_WithInvalidValuesAndCustomEncoder_AbortsConnection()
947public async Task ResponseTrailers_WithData_Sent()
979public async Task ResponseTrailers_WithExeption500_Cleared()
1005public async Task ResponseTrailers_WithNonAscii_Throws()
1033public async Task ResponseTrailers_WithNonAsciiAndCustomEncoder_Works()
1071public async Task ResponseTrailers_WithInvalidValuesAndCustomEncoder_AbortsConnection()
1102public async Task ResetStream_ReturnStreamError()
1118return Task.CompletedTask;
1128public async Task CompleteAsync_BeforeBodyStarted_SendsHeadersWithEndStream()
1144context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1175public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_SendsHeadersAndTrailersWithEndStream()
1190context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1228public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_TruncatedContentLength_ThrowsAnd500()
1242context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1275public async Task CompleteAsync_AfterBodyStarted_SendsBodyWithEndStream()
1290context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1328public async Task CompleteAsync_WriteAfterComplete_Throws()
1343context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1377public async Task CompleteAsync_WriteAgainAfterComplete_Throws()
1392context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1431public async Task CompleteAsync_AdvanceAfterComplete_AdvanceThrows()
1470public async Task CompleteAsync_AfterPipeWrite_WithTrailers_SendsBodyAndTrailersWithEndStream()
1485context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1530public async Task CompleteAsync_AfterBodyStarted_WithTrailers_SendsBodyAndTrailersWithEndStream()
1545context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1585public async Task CompleteAsync_AfterBodyStarted_WithTrailers_TruncatedContentLength_ThrowsAndReset()
1600context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1642public async Task PipeWriterComplete_AfterBodyStarted_WithTrailers_TruncatedContentLength_ThrowsAndReset()
1658context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1700public async Task AbortAfterCompleteAsync_GETWithResponseBodyAndTrailers_ResetsAfterResponse()
1715context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1759public async Task AbortAfterCompleteAsync_POSTWithResponseBodyAndTrailers_RequestBodyThrows()
1776context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1823public async Task ResetAfterCompleteAsync_GETWithResponseBodyAndTrailers_ResetsAfterResponse()
1838context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1886public async Task ResetAfterCompleteAsync_POSTWithResponseBodyAndTrailers_RequestBodyThrows()
1903context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1956public async Task DataBeforeHeaders_UnexpectedFrameError(bool pendingStreamsEnabled)
1972public async Task RequestTrailers_CanReadTrailersFromRequest()
2003public async Task FrameAfterTrailers_UnexpectedFrameError()
2038public async Task TrailersWithoutEndingStream_ErrorAccessingTrailers()
2089public async Task UnexpectedRequestFrame(string frameType, bool pendingStreamsEnabled)
2114public async Task UnexpectedServerFrame(string frameType)
2136public async Task RequestIncomplete()
2148public Task HEADERS_Received_HeaderBlockContainsUnknownPseudoHeaderField_ConnectionError()
2162public Task HEADERS_Received_HeaderBlockContainsResponsePseudoHeaderField_ConnectionError()
2259public Task HEADERS_Received_HeaderBlockContainsDuplicatePseudoHeaderField_ConnectionError(IEnumerable<KeyValuePair<string, string>> headers)
2266public async Task HEADERS_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_MethodIsCONNECT_NoError(IEnumerable<KeyValuePair<string, string>> headers)
2277public Task HEADERS_Received_HeaderBlockContainsPseudoHeaderFieldAfterRegularHeaders_ConnectionError(IEnumerable<KeyValuePair<string, string>> headers)
2282private async Task HEADERS_Received_InvalidHeaderFields_StreamError(IEnumerable<KeyValuePair<string, string>> headers, string expectedErrorMessage, Http3ErrorCode? errorCode = null)
2294public async Task HEADERS_Received_HeaderBlockDoesNotContainMandatoryPseudoHeaderField_StreamError(IEnumerable<KeyValuePair<string, string>> headers)
2303public async Task HEADERS_Received_HeaderBlockOverLimit_431()
2334public Task HEADERS_Received_HeaderBlockOverLimitx2_ConnectionError()
2364public async Task HEADERS_Received_TooManyHeaders_431()
2392public Task HEADERS_Received_TooManyHeadersx2_ConnectionError()
2411public Task HEADERS_Received_InvalidCharacters_ConnectionError()
2425public Task HEADERS_Received_HeaderBlockContainsConnectionHeader_ConnectionError()
2439public Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsNotTrailers_ConnectionError()
2453public async Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsTrailers_NoError()
2471public async Task MaxRequestBodySize_ContentLengthUnder_200()
2502public async Task MaxRequestBodySize_ContentLengthOver_413()
2545public async Task MaxRequestBodySize_NoContentLength_Under_200()
2575public async Task MaxRequestBodySize_NoContentLength_Over_413()
2619public async Task MaxRequestBodySize_AppCanLowerLimit(bool includeContentLength)
2674public async Task MaxRequestBodySize_AppCanRaiseLimit(bool includeContentLength)
2714public Task HEADERS_Received_RequestLineLength_Error()
2730public async Task UnsupportedControlStreamType(int typeId)
2761public async Task HEADERS_ExceedsClientMaxFieldSectionSize_ErrorOnServer()
2766return Task.CompletedTask;
2795public async Task PostRequest_ServerReadsPartialAndFinishes_SendsBodyWithEndStream()
2855public async Task HEADERS_WriteLargeResponseHeaderSection_Success()
2880return Task.CompletedTask;
2895public async Task HEADERS_WriteLargeResponseHeaderSectionTrailers_Success()
2920return Task.CompletedTask;
2936public async Task HEADERS_NoResponseBody_RequestEndsOnHeaders()
2948return Task.CompletedTask;
2959public async Task GetMemory_AfterAbort_GetsFakeMemory(int sizeHint)
HttpsConnectionMiddlewareTests.cs (58)
51public async Task CanReadAndWriteWithHttpsConnectionMiddleware()
71public async Task CanReadAndWriteWithHttpsConnectionMiddlewareWithPemCertificate()
105public async Task SslStreamIsAvailable()
127public async Task HandshakeDetailsAreAvailable()
166public async Task HandshakeDetailsAreAvailableAfterAsyncCallback()
172await Task.Yield();
202public async Task RequireCertificateFailsWhenNoCertificate()
219public async Task AllowCertificateContinuesWhenNoCertificate()
244public async Task AsyncCallbackSettingClientCertificateRequiredContinuesWhenNoCertificate()
278public async Task UsesProvidedServerCertificate()
285await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
297public async Task UsesProvidedServerCertificateSelector()
315await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
328public async Task UsesProvidedAsyncCallback()
335await Task.Yield();
348await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
361public async Task UsesProvidedServerCertificateSelectorEachTime()
383await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
403public async Task UsesProvidedServerCertificateSelectorValidatesEkus()
418await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
433public async Task UsesProvidedServerCertificateSelectorOverridesServerCertificate()
452await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
465public async Task UsesProvidedServerCertificateSelectorFailsIfYouReturnNull()
480await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
497public async Task CertificatePassedToHttpContext(HttpProtocols httpProtocols)
533public async Task RenegotiateForClientCertificateOnHttp1DisabledByDefault()
577public async Task CanRenegotiateForClientCertificate(HttpProtocols httpProtocols)
618public async Task CanRenegotiateForClientCertificate_MacOS_PlatformNotSupportedException()
659public async Task Renegotiate_ServerOptionsSelectionCallback_NotSupported()
703public async Task CanRenegotiateForTlsCallbackOptions()
751public async Task CanRenegotiateForClientCertificateOnHttp1CanReturnNoCert()
800public async Task ServerCertificateChainInExtraStore()
875public async Task RenegotiateForClientCertificateOnPostWithoutBufferingThrows()
917public async Task ServerOptionsSelectionCallback_SetsALPN()
928await using var server = new TestServer(context => Task.CompletedTask,
945public async Task TlsHandshakeCallbackOptionsOverload_SetsALPN()
961await using var server = new TestServer(context => Task.CompletedTask,
977public async Task TlsHandshakeCallbackOptionsOverload_EmptyAlpnList_DisablesAlpn()
994await using var server = new TestServer(context => Task.CompletedTask,
1012public async Task CanRenegotiateForClientCertificateOnPostIfDrained()
1059public async Task RenegotationFailureCausesConnectionClose()
1111public async Task HttpsSchemePassedToRequestFeature()
1126public async Task Tls10CanBeDisabled()
1160public async Task ClientCertificateValidationGetsCalledWithNotNullParameters(ClientCertificateMode mode)
1179await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
1194public async Task ValidationFailureRejectsConnection(ClientCertificateMode mode)
1206await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
1220public async Task RejectsConnectionOnSslPolicyErrorsWhenNoValidation(ClientCertificateMode mode)
1231await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
1243public async Task AllowAnyCertOverridesCertificateValidation()
1256await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions))
1268public async Task CertificatePassedToHttpContextIsNotDisposed()
1381public async Task ListenOptionsProtolsCanBeSetAfterUseHttps(HttpProtocols httpProtocols)
1389await using var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory), ConfigureListenOptions);
1476return new HttpsConnectionMiddleware(context => Task.CompletedTask, options, httpProtocols, loggerFactory, new KestrelMetrics(new TestMeterFactory()));
1481return new HttpsConnectionMiddleware(context => Task.CompletedTask, options, httpProtocols, new KestrelMetrics(new TestMeterFactory()));
1484private static async Task App(HttpContext httpContext)
1516private static async Task AssertConnectionResult(SslStream stream, bool success, string body = null)
HttpsTests.cs (36)
76public async Task UseHttpsWithAsyncCallbackDoesNotFallBackToDefaultCert()
83await using (var server = new TestServer(context => Task.CompletedTask,
170public async Task EmptyRequestLoggedAsDebug()
175await using (var server = new TestServer(context => Task.CompletedTask,
198public async Task ClientHandshakeFailureLoggedAsDebug()
203await using (var server = new TestServer(context => Task.CompletedTask,
227public async Task DoesNotThrowObjectDisposedExceptionOnConnectionAbort()
240await Task.Delay(1000, ct);
272public async Task DoesNotThrowObjectDisposedExceptionFromWriteAsyncAfterConnectionIsAborted()
317public async Task DoesNotThrowObjectDisposedExceptionOnEmptyConnection()
322await using (var server = new TestServer(context => Task.CompletedTask,
343public async Task ConnectionFilterDoesNotLeakBlock()
348await using (var server = new TestServer(context => Task.CompletedTask,
363public async Task HandshakeTimesOutAndIsLoggedAsDebug()
370await using (var server = new TestServer(context => Task.CompletedTask,
393public async Task HandshakeTimesOutAndIsLoggedAsDebugWithAsyncCallback()
400await using (var server = new TestServer(context => Task.CompletedTask,
406await Task.Yield();
427public async Task Http3_UseHttpsNoArgsWithDefaultCertificate_UseDefaultCertificate()
441await using (var server = new TestServer(context => Task.CompletedTask,
468public async Task Http3_ConfigureHttpsDefaults_Works()
481await using (var server = new TestServer(context => Task.CompletedTask,
512public async Task Http1And2And3_NoUseHttps_MultiplexBindNotCalled()
526await using (var server = new TestServer(context => Task.CompletedTask,
546public async Task Http3_NoUseHttps_Throws()
562await using var server = new TestServer(context => Task.CompletedTask,
582public async Task Http3_ServerOptionsSelectionCallback_Works()
597await using (var server = new TestServer(context => Task.CompletedTask,
628public async Task Http3_TlsHandshakeCallbackOptions_Works()
643await using (var server = new TestServer(context => Task.CompletedTask,
677public async Task ClientAttemptingToUseUnsupportedProtocolIsLoggedAsDebug()
683await using (var server = new TestServer(context => Task.CompletedTask,
711public async Task OnAuthenticate_SeesOtherSettings()
719await using (var server = new TestServer(context => Task.CompletedTask,
747public async Task OnAuthenticate_CanSetSettings()
755await using (var server = new TestServer(context => Task.CompletedTask,
RequestTests.cs (83)
24public async Task StreamsAreNotPersistedAcrossRequests()
56public async Task PipesAreNotPersistedAcrossRequests()
79public async Task RequestBodyPipeReaderDoesZeroByteReads()
109public async Task RequestBodyReadAsyncCanBeCancelled()
177public async Task CanUpgradeRequestWithConnectionKeepAliveUpgradeHeader()
228public async Task CanHandleRequestsWithUrlInAbsoluteForm(string requestUrl, string expectedPath, string queryValue)
265await Task.WhenAll(pathTcs.Task, rawTargetTcs.Task, queryTcs.Task).DefaultTimeout();
281public async Task CanHandleTwoAbsoluteFormRequestsInARow()
313public async Task ExecutionContextMutationsOfValueTypeDoNotLeakAcrossRequestsOnSameConnection()
318Task ExecuteApplication(HttpContext context)
326return Task.CompletedTask;
332return Task.CompletedTask;
347public async Task ExecutionContextMutationsOfReferenceTypeDoNotLeakAcrossRequestsOnSameConnection()
352Task ExecuteApplication(HttpContext context)
363return Task.CompletedTask;
369return Task.CompletedTask;
385public async Task ExecutionContextMutationsDoNotLeakAcrossAwaits()
390Task ExecuteApplication(HttpContext context)
418public async Task ExecutionContextMutationsOfValueTypeFlowIntoButNotOutOfAsyncEvents()
422async Task ExecuteApplication(HttpContext context)
456public async Task ExecutionContextMutationsOfReferenceTypeFlowThroughAsyncEvents()
460async Task ExecuteApplication(HttpContext context)
498public async Task ExecutionContextMutationsOfValueTypeFlowIntoButNotOutOfNonAsyncEvents()
502async Task ExecuteApplication(HttpContext context)
512return Task.CompletedTask;
520return Task.CompletedTask;
539private static async Task TestAsyncLocalValues(TestServiceContext testContext, TestServer server)
571public async Task AppCanSetTraceIdentifier()
586public async Task TraceIdentifierIsUnique()
601var tasks = new List<Task>(iterations);
604tasks.Add(Task.Run(async () =>
611await Task.WhenAll(tasks);
647public async Task Http11KeptAliveByDefault()
681public async Task Http10NotKeptAliveByDefault()
720public async Task Http10KeepAlive()
754public async Task Http10KeepAliveNotHonoredIfResponseContentLengthNotSet()
793public async Task Http10KeepAliveHonoredIfResponseContentLengthSet()
849public async Task Expect100ContinueHonored()
881public async Task Expect100ContinueHonoredWhenMinRequestBodyDataRateIsDisabled()
917public async Task ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeader()
963public async Task ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeaderPipeReader()
1010public async Task ContentLengthReadAsyncPipeReader()
1042public async Task ContentLengthReadAsyncPipeReaderBufferRequestBody()
1077public async Task ContentLengthReadAsyncPipeReaderBufferRequestBodyMultipleTimes()
1116public async Task ContentLengthReadAsyncPipeReaderReadsCompletedBody()
1153public async Task ContentLengthReadAsyncSingleBytesAtATime()
1227public async Task ContentLengthDoesNotConsumeEntireBufferDoesNotThrow()
1261public async Task ConnectionClosesWhenFinReceivedBeforeRequestCompletes()
1293public async Task RequestHeadersAreResetOnEachRequest()
1315return Task.CompletedTask;
1343public async Task UpgradeRequestIsNotKeptAliveOrChunked()
1379public async Task HeadersAndStreamsAreReusedAcrossRequests()
1456public async Task MatchesValidRequestTargetAndHostHeader(string request, string hostHeader)
1458await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
1473public async Task ServerConsumesKeepAliveContentLengthRequest()
1476await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
1514public async Task ServerConsumesKeepAliveChunkedRequest()
1517await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
1562public async Task NonKeepAliveRequestNotConsumedByAppCompletes()
1565await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
1588public async Task UpgradedRequestNotConsumedByAppCompletes()
1620public async Task DoesNotEnforceRequestBodyMinimumDataRateOnUpgradedRequest()
1678public async Task SynchronousReadsDisallowedByDefault()
1729public async Task SynchronousReadsAllowedByOptIn()
1772public async Task SynchronousReadsCanBeDisallowedGlobally()
1817public async Task SynchronousReadsCanBeAllowedGlobally()
1859public async Task ContentLengthSwallowedUnexpectedEndOfRequestContentDoesNotResultInWarnings()
1892public async Task ContentLengthRequestCallCancelPendingReadWorks()
1943public async Task ContentLengthRequestCallCompleteThrowsExceptionOnRead()
1987public async Task ContentLengthRequestCallCompleteDoesNotCauseException()
2028public async Task ContentLengthCallCompleteWithExceptionCauses500()
2070public async Task ReuseRequestHeaderStrings()
2080return Task.CompletedTask;
2125public async Task PersistentStateBetweenRequests()
2140return Task.CompletedTask;
2187public async Task Latin1HeaderValueAcceptedWhenLatin1OptionIsConfigured()
2196return Task.CompletedTask;
2221public async Task Latin1HeaderValueRejectedWhenLatin1OptionIsNotConfigured()
2225await using (var server = new TestServer(_ => Task.CompletedTask, testContext))
2250public async Task CustomRequestHeaderEncodingSelectorCanBeConfigured()
2259return Task.CompletedTask;
2286public async Task SingleLineFeedIsSupportedAnywhere()
2299await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory, disableHttp1LineFeedTerminators: false)))
ResponseTests.cs (192)
35public async Task OnCompleteCalledEvenWhenOnStartingNotCalled()
42context.Response.OnStarting(() => Task.Run(() => onStartingCalled = true));
43context.Response.OnCompleted(() => Task.Run(() =>
74public async Task OnStartingThrowsWhenSetAfterResponseHasAlreadyStarted()
82ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null));
109public async Task OnStartingThrowsWhenSetAfterStartAsyncIsCalled()
116ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null));
141public async Task ResponseBodyWriteAsyncCanBeCancelled()
156var timerTask = Task.Delay(TimeSpan.FromSeconds(1));
158var completedTask = await Task.WhenAny(writeTask, timerTask);
163timerTask = Task.Delay(TimeSpan.FromSeconds(1));
165completedTask = await Task.WhenAny(writeTask, timerTask);
208public async Task BodyWriterWriteAsync_OnAbortedRequest_ReturnsResultWithIsCompletedTrue()
238public async Task BodyWriterWriteAsync_OnCanceledPendingFlush_ReturnsResultWithIsCanceled()
272public Task ResponseStatusCodeSetBeforeHttpContextDisposeAppException()
286public Task ResponseStatusCodeSetBeforeHttpContextDisposeRequestAborted()
294return Task.CompletedTask;
301public Task ResponseStatusCodeSetBeforeHttpContextDisposeRequestAbortedAppException()
316public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformed()
323return Task.CompletedTask;
331public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformedRead()
346public Task ResponseStatusCodeSetBeforeHttpContextDisposedRequestMalformedReadIgnored()
367public async Task OnCompletedExceptionShouldNotPreventAResponse()
397public async Task OnCompletedShouldNotBlockAResponse()
434public async Task InvalidChunkedEncodingInRequestShouldNotBlockOnCompleted()
440httpContext.Response.OnCompleted(() => Task.Run(() =>
444return Task.CompletedTask;
470public async Task NoErrorResponseSentWhenAppSwallowsBadRequestException()
510public async Task TransferEncodingChunkedSetOnUnknownLengthHttp11Response()
544public async Task TransferEncodingChunkedNotSetOnNonBodyResponse(int statusCode)
549return Task.CompletedTask;
569public async Task ContentLengthZeroSetOn205Response()
574return Task.CompletedTask;
628public async Task AttemptingToWriteNonzeroContentLengthFailsFor1xxAnd204Responses(int statusCode, HttpMethod method)
633public async Task AttemptingToWriteZeroContentLengthFor1xxAnd204Responses_ContentLengthRemoved(int statusCode, HttpMethod method)
647public async Task AttemptingToWriteNonzeroContentLengthFailsFor2xxResponsesOnConnect(int statusCode)
661public async Task AttemptingToWriteZeroContentLengthFor2xxResponsesOnConnect_ContentLengthRemoved(int statusCode)
664private async Task AttemptingToWriteNonzeroContentLengthFails(int statusCode, HttpMethod method)
700private async Task AttemptingToWriteZeroContentLength_ContentLengthRemoved(int statusCode, HttpMethod method)
740public async Task AttemptingToWriteNonzeroContentLengthFailsFor205Response()
779public async Task AttemptingToWriteFailsForNonBodyResponse(int statusCode)
821public async Task AttemptingToWriteFailsFor205Response()
864public async Task TransferEncodingNotSetOnHeadResponse()
868return Task.CompletedTask;
888public async Task ResponseBodyNotWrittenOnHeadResponseAndLoggedOnlyOnce()
936public async Task ThrowsAndClosesConnectionWhenAppWritesMoreThanContentLengthWrite()
976public async Task ThrowsAndClosesConnectionWhenAppWritesMoreThanContentLengthWriteAsync()
1010public async Task InternalServerErrorAndConnectionClosedOnWriteWithMoreThanContentLengthAndResponseNotStarted()
1048public async Task InternalServerErrorAndConnectionClosedOnWriteAsyncWithMoreThanContentLengthAndResponseNotStarted()
1083public async Task WhenAppWritesLessThanContentLengthErrorLogged()
1135public async Task WhenAppWritesLessThanContentLengthCompleteThrowsAndErrorLogged()
1194public async Task WhenAppWritesLessThanContentLengthButRequestIsAbortedErrorNotLogged()
1241public async Task WhenAppSetsContentLengthButDoesNotWriteBody500ResponseSentAndConnectionDoesNotClose()
1248return Task.CompletedTask;
1282public async Task WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown(bool flushResponse)
1320public async Task WhenAppSetsTransferEncodingAndContentLengthWritingLessIsNotAnError()
1356public async Task WhenAppSetsTransferEncodingAndContentLengthWritingMoreIsNotAnError()
1388public async Task HeadResponseCanContainContentLengthHeader()
1393return Task.CompletedTask;
1414public async Task HeadResponseBodyNotWrittenWithAsyncWrite()
1445public async Task HeadResponseBodyNotWrittenWithSyncWrite()
1478public async Task ZeroLengthWritesFlushHeaders()
1512public async Task AppCanWriteOwnBadRequestResponse()
1555public async Task ConnectionClosedWhenChunkedIsNotFinalTransferCoding(string responseTransferEncoding)
1600public async Task ConnectionClosedWhenChunkedIsNotFinalTransferCodingEvenIfConnectionKeepAliveSetInResponse(string responseTransferEncoding)
1646public async Task ConnectionKeptAliveWhenChunkedIsFinalTransferCoding(string responseTransferEncoding)
1687public async Task FirstWriteVerifiedAfterOnStarting()
1697return Task.CompletedTask;
1729public async Task FirstWriteVerifiedAfterOnStartingWithResponseBody()
1739return Task.CompletedTask;
1771public async Task SubsequentWriteVerifiedAfterOnStarting()
1781return Task.CompletedTask;
1816public async Task SubsequentWriteVerifiedAfterOnStartingWithResponseBody()
1826return Task.CompletedTask;
1861public async Task FirstWriteAsyncVerifiedAfterOnStarting()
1869return Task.CompletedTask;
1901public async Task SubsequentWriteAsyncVerifiedAfterOnStarting()
1909return Task.CompletedTask;
1944public async Task WhenResponseAlreadyStartedResponseEndedBeforeConsumingRequestBody()
1981public async Task WhenResponseNotStartedResponseEndedBeforeConsumingRequestBody()
1983await using (var server = new TestServer(httpContext => Task.CompletedTask,
2014public async Task RequestDrainingFor100ContinueDoesNotBlockResponse()
2073await Task.Delay(TimeSpan.FromSeconds(1));
2085public async Task Sending100ContinueDoesNotPreventAutomatic400Responses()
2131public async Task Sending100ContinueAndResponseSendsChunkTerminatorBeforeConsumingRequestBody()
2178public async Task Http11ResponseSentToHttp10Request()
2202public async Task ZeroContentLengthSetAutomaticallyAfterNoWrites()
2234public async Task ZeroContentLengthSetAutomaticallyForNonKeepAliveRequests()
2278public async Task ZeroContentLengthNotSetAutomaticallyForHeadRequests()
2301public async Task ZeroContentLengthNotSetAutomaticallyForCertainStatusCodes()
2350public async Task ConnectionClosedAfter101Response()
2396public async Task ThrowingResultsIn500Response()
2408return Task.CompletedTask;
2446public async Task ThrowingInOnStartingResultsInFailedWritesAnd500Response()
2504public async Task OnStartingThrowsInsideOnStartingCallbacksRuns()
2517return Task.CompletedTask;
2521return Task.CompletedTask;
2549public async Task OnCompletedThrowsInsideOnCompletedCallbackRuns()
2563return Task.CompletedTask;
2567return Task.CompletedTask;
2595public async Task ThrowingInOnCompletedIsLogged()
2644public async Task ThrowingAfterWritingKillsConnection()
2656return Task.FromResult<object>(null);
2685public async Task ThrowingAfterPartialWriteKillsConnection()
2697return Task.FromResult<object>(null);
2726public async Task NoErrorsLoggedWhenServerEndsConnectionBeforeClient()
2757public async Task NoResponseSentWhenConnectionIsClosedByServerBeforeClientFinishesSendingRequest()
2764return Task.CompletedTask;
2780public async Task AppAbortIsLogged()
2787return Task.CompletedTask;
2805public async Task AppAbortViaIConnectionLifetimeFeatureIsLogged()
2809var closeTaskTcs = new TaskCompletionSource<Task>(TaskCreationOptions.RunContinuationsAsynchronously);
2813var closeTask = await closeTaskTcs.Task.DefaultTimeout();
2838public async Task ResponseHeadersAreResetOnEachRequest()
2860return Task.CompletedTask;
2888public async Task StartAsyncDefaultToChunkedResponse()
2917public async Task StartAsyncWithContentLengthAndEmptyWriteStillCallsFinalFlush()
2945public async Task StartAsyncAndEmptyWriteStillCallsFinalFlush()
2975public async Task StartAsyncWithSingleChunkedWriteStillWritesSuffix()
3007public async Task StartAsyncWithoutFlushStartsResponse()
3037public async Task StartAsyncThrowExceptionThrowsConnectionAbortedException()
3065public async Task StartAsyncWithContentLengthThrowExceptionThrowsConnectionAbortedException()
3094public async Task StartAsyncWithoutFlushingDoesNotFlush()
3106var res = await Task.WhenAny(tcs.Task, Task.Delay(1000)) == tcs.Task;
3132public async Task StartAsyncWithContentLengthWritingWorks()
3162public async Task LargeWriteWithContentLengthWritingWorks()
3192public async Task UnflushedContentLengthResponseIsFlushedAutomatically()
3220return Task.CompletedTask;
3241public async Task StartAsyncAndFlushWorks()
3272public async Task OnStartingCallbacksAreCalledInLastInFirstOutOrder()
3287return Task.CompletedTask;
3292return Task.CompletedTask;
3323public async Task OnCompletedCallbacksAreCalledInLastInFirstOutOrder()
3338return Task.CompletedTask;
3343return Task.CompletedTask;
3374public async Task SynchronousWritesDisallowedByDefault()
3404public async Task SynchronousWritesAllowedByOptIn()
3413return Task.CompletedTask;
3430public async Task SynchronousWritesCanBeAllowedGlobally()
3444return Task.CompletedTask;
3465public async Task SynchronousWritesCanBeDisallowedGlobally()
3504public async Task NonZeroContentLengthFor304StatusCodeIsAllowed()
3512return Task.CompletedTask;
3533public async Task AdvanceNegativeValueThrowsArgumentOutOfRangeException()
3566public async Task AdvanceNegativeValueThrowsArgumentOutOfRangeExceptionWithStart()
3575return Task.CompletedTask;
3596public async Task AdvanceWithTooLargeOfAValueThrowInvalidOperationException()
3605return Task.CompletedTask;
3628public async Task ContentLengthWithoutStartAsyncWithGetSpanWorks()
3645return Task.CompletedTask;
3666public async Task ContentLengthWithGetMemoryWorks()
3705public async Task ResponseBodyCanWrite()
3731public async Task ResponseBodyAndResponsePipeWorks()
3773public async Task ResponseBodyWriterCompleteWithoutExceptionDoesNotThrow()
3778await Task.CompletedTask;
3799public async Task ResponseBodyWriterCompleteWithoutExceptionNextWriteDoesThrow()
3830public async Task ResponseBodyWriterCompleteFlushesChunkTerminator()
3864public async Task ResponseAdvanceStateIsResetWithMultipleReqeusts()
3916public async Task ResponseStartCalledAndAutoChunkStateIsResetWithMultipleReqeusts()
3965public async Task ResponseStartCalledStateIsResetWithMultipleReqeusts()
4026public async Task ResponseIsLeasedMemoryInvalidStateIsResetWithMultipleReqeusts()
4034return Task.CompletedTask;
4038return Task.CompletedTask;
4071public async Task ResponsePipeWriterCompleteWithException()
4077await Task.CompletedTask;
4100public async Task ResponseCompleteGetMemoryReturnsRentedMemory()
4109await Task.CompletedTask;
4132public async Task ResponseCompleteGetMemoryReturnsRentedMemoryWithoutStartAsync()
4140await Task.CompletedTask;
4161public async Task ResponseGetMemoryAndStartAsyncMemoryReturnsNewMemory()
4196public async Task ResponseGetMemoryAndStartAsyncAdvanceThrows()
4228public async Task ResponseCompleteGetMemoryDoesThrow()
4238return Task.CompletedTask;
4261public async Task ResponseSetBodyToSameValueTwiceGetPipeMultipleTimesDifferentObject()
4272await Task.CompletedTask;
4293public async Task ResponseStreamWrappingWorks()
4326public async Task AltSvc_HeaderSetInAppCode_AltSvcNotOverwritten()
4332return Task.CompletedTask;
4363public async Task AltSvc_Http1And2And3EndpointConfigured_AltSvcInResponseHeaders()
4366httpContext => Task.CompletedTask,
4400public async Task AltSvc_Http1And2And3EndpointConfigured_NoMultiplexedFactory_NoAltSvcInResponseHeaders()
4403httpContext => Task.CompletedTask,
4433public async Task AltSvc_Http1_NoAltSvcInResponseHeaders()
4436httpContext => Task.CompletedTask,
4458public async Task AltSvc_Http3ConfiguredDifferentEndpoint_NoAltSvcInResponseHeaders()
4461httpContext => Task.CompletedTask,
4498public async Task AltSvc_DisableAltSvcHeaderIsTrue_Http1And2And3EndpointConfigured_NoAltSvcInResponseHeaders()
4501httpContext => Task.CompletedTask,
4530private static async Task ResponseStatusCodeSetBeforeHttpContextDispose(
src\Servers\Kestrel\shared\ConnectionCompletion.cs (10)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
16return Task.CompletedTask;
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
28var task = entry.Key.Invoke(entry.Value);
40return Task.CompletedTask;
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (28)
79protected Task _connectionTask;
137internal Task WaitForConnectionStopAsync(long expectedLastStreamId, bool ignoreNonGoAwayFrames, Http3ErrorCode? expectedErrorCode = null)
142internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, long? expectedLastStreamId, Http3ErrorCode expectedErrorCode, Action<Type, string[]> matchExpectedErrorMessage = null, params string[] expectedErrorMessage)
157internal async Task WaitForGoAwayAsync(bool ignoreNonGoAwayFrames, long? expectedLastStreamId)
224public async Task InitializeConnectionAsync(RequestDelegate application)
488public Task OnUnidentifiedStreamCreatedTask => OnUnidentifiedStreamCreatedTcs.Task;
489public Task OnStreamCreatedTask => OnStreamCreatedTcs.Task;
490public Task OnStreamCompletedTask => OnStreamCompletedTcs.Task;
491public Task OnHeaderReceivedTask => OnHeaderReceivedTcs.Task;
502protected Task SendAsync(ReadOnlySpan<byte> span)
509protected static Task FlushAsync(PipeWriter writableBuffer)
519internal async Task ReceiveEndAsync()
597internal async Task SendFrameAsync(Http3FrameType frameType, Memory<byte> data, bool endStream = false)
614internal Task EndStreamAsync(ReadOnlySpan<byte> span = default)
624internal async Task WaitForStreamErrorAsync(Http3ErrorCode protocolError, Action<string> matchExpectedErrorMessage = null, string expectedErrorMessage = null)
669public Task OnDisposedTask => _testStreamContext.OnDisposedTask;
670public Task OnDisposingTask => _testStreamContext.OnDisposingTask;
688public Task SendHeadersAsync(IEnumerable<KeyValuePair<string, string>> headers, bool endStream = false)
693public async Task SendHeadersAsync(Http3HeadersEnumerator headers, bool endStream = false)
717internal async Task SendHeadersPartialAsync()
725internal async Task SendDataAsync(Memory<byte> data, bool endStream = false)
758internal async Task ExpectReceiveEndOfStream()
863public async Task WriteStreamIdAsync(int id)
879internal async Task SendGoAwayAsync(long streamId, bool endStream = false)
887internal async Task SendSettingsAsync(List<Http3PeerSetting> settings, bool endStream = false)
951internal async Task WaitForGoAwayAsync(bool ignoreNonGoAwayFrames, long? expectedLastStreamId)
1170public Task OnDisposingTask => _disposingTcs.Task;
1171public Task OnDisposedTask => _disposedTcs.Task;
InProcessWebSite (112)
installer.tasks (2)
IntegrationTestsWebsite (1)
Interop.FunctionalTests (155)
InteropClient (26)
InteropTests (24)
InteropWebsite (11)
JwtBearerSample (1)
JwtClientSample (5)
JwtSample (3)
Kestrel.SampleApp (1)
LargeResponseApp (1)
LocalizationSample (2)
LocalizationWebsite (1)
Microsoft.Arcade.Common (13)
Microsoft.Arcade.Test.Common (1)
Microsoft.AspNetCore (6)
Microsoft.AspNetCore.Analyzer.Testing (1)
Microsoft.AspNetCore.Analyzers.Test (44)
Microsoft.AspNetCore.Antiforgery (5)
Microsoft.AspNetCore.Antiforgery.Test (40)
Microsoft.AspNetCore.App.Analyzers (8)
Microsoft.AspNetCore.App.Analyzers.Test (397)
Microsoft.AspNetCore.App.CodeFixes (14)
Microsoft.AspNetCore.Authentication (32)
Microsoft.AspNetCore.Authentication.Abstractions (25)
AuthenticationHttpContextExtensions.cs (16)
41public static Task ChallengeAsync(this HttpContext context, string? scheme) =>
51public static Task ChallengeAsync(this HttpContext context) =>
62public static Task ChallengeAsync(this HttpContext context, AuthenticationProperties? properties) =>
73public static Task ChallengeAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
83public static Task ForbidAsync(this HttpContext context, string? scheme) =>
93public static Task ForbidAsync(this HttpContext context) =>
104public static Task ForbidAsync(this HttpContext context, AuthenticationProperties? properties) =>
115public static Task ForbidAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
125public static Task SignInAsync(this HttpContext context, string? scheme, ClaimsPrincipal principal) =>
135public static Task SignInAsync(this HttpContext context, ClaimsPrincipal principal) =>
146public static Task SignInAsync(this HttpContext context, ClaimsPrincipal principal, AuthenticationProperties? properties) =>
157public static Task SignInAsync(this HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties) =>
166public static Task SignOutAsync(this HttpContext context) => context.SignOutAsync(scheme: null, properties: null);
175public static Task SignOutAsync(this HttpContext context, AuthenticationProperties? properties) => context.SignOutAsync(scheme: null, properties: properties);
183public static Task SignOutAsync(this HttpContext context, string? scheme) => context.SignOutAsync(scheme, properties: null);
192public static Task SignOutAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
Microsoft.AspNetCore.Authentication.BearerToken (7)
Microsoft.AspNetCore.Authentication.Certificate (12)
Microsoft.AspNetCore.Authentication.Cookies (43)
ITicketStore.cs (6)
45Task RenewAsync(string key, AuthenticationTicket ticket);
54Task RenewAsync(string key, AuthenticationTicket ticket, CancellationToken cancellationToken) => RenewAsync(key, ticket);
64Task RenewAsync(string key, AuthenticationTicket ticket, HttpContext httpContext, CancellationToken cancellationToken) => RenewAsync(key, ticket, cancellationToken);
95Task RemoveAsync(string key);
103Task RemoveAsync(string key, CancellationToken cancellationToken) => RemoveAsync(key);
112Task RemoveAsync(string key, HttpContext httpContext, CancellationToken cancellationToken) => RemoveAsync(key, cancellationToken);
Microsoft.AspNetCore.Authentication.Core (10)
Microsoft.AspNetCore.Authentication.Core.Test (86)
Microsoft.AspNetCore.Authentication.JwtBearer (18)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (7)
Microsoft.AspNetCore.Authentication.Negotiate (18)
Microsoft.AspNetCore.Authentication.Negotiate.Test (70)
NegotiateHandlerTests.cs (32)
24public async Task Anonymous_MissingConnectionFeatures_ThrowsNotSupported()
34public async Task Anonymous_NoChallenge_NoOps()
44public async Task Anonymous_Http2_NoOps()
54public async Task Anonymous_Challenge_401Negotiate()
65public async Task Anonymous_ChallengeHttp2_401Negotiate()
77public async Task NtlmStage1Auth_401NegotiateServerBlob1()
87public async Task AnonymousAfterNtlmStage1_Throws()
99public async Task NtlmStage2Auth_WithoutStage1_Throws()
111public async Task NtlmStage1And2Auth_Success(bool persistNtlm)
122public async Task KerberosAuth_Success(bool persistKerberos)
133public async Task KerberosTwoStageAuth_Success(bool persistKerberos)
145public async Task AnonymousAfterCompletedPersist_Cached(string protocol)
172public async Task AnonymousAfterCompletedNoPersist_Denied(string protocol)
198public async Task AuthHeaderAfterNtlmCompleted_ReAuthenticates(bool persist)
208public async Task RBACClaimsRetrievedFromCacheAfterKerberosCompleted()
232public async Task AuthHeaderAfterKerberosCompleted_ReAuthenticates(bool persist)
244public async Task AuthHeaderAfterKerberos2StageCompleted_ReAuthenticates(bool persist)
254public async Task ApplicationExceptionReExecute_AfterComplete_DoesntReRun()
294public async Task CredentialError_401()
305public async Task ClientError_400()
316public async Task OtherError_Throws()
325private static async Task AuthenticateAndRetrieveRBACClaims(TestServer server, TestConnection testConnection)
333private static async Task KerberosAuth(TestServer server, TestConnection testConnection)
340private static async Task KerberosStage1And2Auth(TestServer server, TestConnection testConnection)
346private static async Task KerberosStage1Auth(TestServer server, TestConnection testConnection)
353private static async Task KerberosStage2Auth(TestServer server, TestConnection testConnection)
360private static async Task NtlmStage1And2Auth(TestServer server, TestConnection testConnection)
366private static async Task NtlmStage1Auth(TestServer server, TestConnection testConnection)
373private static async Task NtlmStage2Auth(TestServer server, TestConnection testConnection)
411return Task.CompletedTask;
418return Task.CompletedTask;
502public void OnCompleted(Func<object, Task> callback, object state)
Microsoft.AspNetCore.Authentication.OAuth (9)
Microsoft.AspNetCore.Authentication.OpenIdConnect (34)
Events\OpenIdConnectEvents.cs (30)
14public Func<AuthenticationFailedContext, Task> OnAuthenticationFailed { get; set; } = context => Task.CompletedTask;
19public Func<AuthorizationCodeReceivedContext, Task> OnAuthorizationCodeReceived { get; set; } = context => Task.CompletedTask;
24public Func<MessageReceivedContext, Task> OnMessageReceived { get; set; } = context => Task.CompletedTask;
31public Func<RedirectContext, Task> OnRedirectToIdentityProvider { get; set; } = context => Task.CompletedTask;
36public Func<RedirectContext, Task> OnRedirectToIdentityProviderForSignOut { get; set; } = context => Task.CompletedTask;
41public Func<RemoteSignOutContext, Task> OnSignedOutCallbackRedirect { get; set; } = context => Task.CompletedTask;
46public Func<RemoteSignOutContext, Task> OnRemoteSignOut { get; set; } = context => Task.CompletedTask;
51public Func<TokenResponseReceivedContext, Task> OnTokenResponseReceived { get; set; } = context => Task.CompletedTask;
57public Func<TokenValidatedContext, Task> OnTokenValidated { get; set; } = context => Task.CompletedTask;
62public Func<UserInformationReceivedContext, Task> OnUserInformationReceived { get; set; } = context => Task.CompletedTask;
67public virtual Task AuthenticationFailed(AuthenticationFailedContext context) => OnAuthenticationFailed(context);
72public virtual Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext context) => OnAuthorizationCodeReceived(context);
77public virtual Task MessageReceived(MessageReceivedContext context) => OnMessageReceived(context);
84public virtual Task RedirectToIdentityProvider(RedirectContext context) => OnRedirectToIdentityProvider(context);
89public virtual Task RedirectToIdentityProviderForSignOut(RedirectContext context) => OnRedirectToIdentityProviderForSignOut(context);
94public virtual Task SignedOutCallbackRedirect(RemoteSignOutContext context) => OnSignedOutCallbackRedirect(context);
99public virtual Task RemoteSignOut(RemoteSignOutContext context) => OnRemoteSignOut(context);
104public virtual Task TokenResponseReceived(TokenResponseReceivedContext context) => OnTokenResponseReceived(context);
110public virtual Task TokenValidated(TokenValidatedContext context) => OnTokenValidated(context);
115public virtual Task UserInformationReceived(UserInformationReceivedContext context) => OnUserInformationReceived(context);
Microsoft.AspNetCore.Authentication.Test (753)
AuthenticationMiddlewareTests.cs (39)
22public async Task OnlyInvokesCanHandleRequestHandlers()
61public async Task IAuthenticateResultFeature_SetOnSuccessfulAuthenticate()
65.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom"))));
68.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler))));
69var middleware = new AuthenticationMiddleware(c => Task.CompletedTask, schemeProvider.Object);
84public async Task IAuthenticateResultFeature_NotSetOnUnsuccessfulAuthenticate()
88.Returns(Task.FromResult(AuthenticateResult.Fail("not authenticated")));
91.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler))));
92var middleware = new AuthenticationMiddleware(c => Task.CompletedTask, schemeProvider.Object);
104public async Task IAuthenticateResultFeature_NullResultWhenUserSetAfter()
108.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom"))));
111.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler))));
112var middleware = new AuthenticationMiddleware(c => Task.CompletedTask, schemeProvider.Object);
130public async Task IAuthenticateResultFeature_SettingResultSetsUser()
134.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom"))));
137.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler))));
138var middleware = new AuthenticationMiddleware(c => Task.CompletedTask, schemeProvider.Object);
157public async Task WebApplicationBuilder_RegistersAuthenticationAndAuthorizationMiddlewares()
185public async Task WebApplicationBuilder_OnlyRegistersMiddlewareWithSupportedServices()
255public Task ChallengeAsync(AuthenticationProperties properties)
260public Task ForbidAsync(AuthenticationProperties properties)
268return Task.FromResult(true);
271public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
274return Task.FromResult(0);
277public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties)
282public Task SignOutAsync(AuthenticationProperties properties)
297public Task ChallengeAsync(AuthenticationProperties properties)
302public Task ForbidAsync(AuthenticationProperties properties)
312public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
315return Task.FromResult(0);
318public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties)
323public Task SignOutAsync(AuthenticationProperties properties)
338public Task ChallengeAsync(AuthenticationProperties properties)
343public Task ForbidAsync(AuthenticationProperties properties)
350return Task.FromResult(false);
353public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
356return Task.FromResult(0);
359public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties)
364public Task SignOutAsync(AuthenticationProperties properties)
CookieTests.cs (83)
36public async Task NormalRequestPassesThrough()
45public async Task AjaxLoginRedirectToReturnUrlTurnsInto200WithLocationHeader()
57public async Task AjaxForbidTurnsInto403WithLocationHeader()
69public async Task AjaxLogoutRedirectToReturnUrlTurnsInto200WithLocationHeader()
81public async Task AjaxChallengeRedirectTurnsInto200WithLocationHeader()
93public async Task ProtectedCustomRequestShouldRedirectToCustomRedirectUri()
105private static Task SignInAsAlice(HttpContext context)
114private static Task SignInAsWrong(HttpContext context)
121private Task SignOutAsWrong(HttpContext context)
127public async Task SignInCausesDefaultCookieToBeCreated()
164public Task RenewAsync(string key, AuthenticationTicket ticket)
168return Task.FromResult(0);
175return Task.FromResult(ticket);
178public Task RemoveAsync(string key)
181return Task.FromResult(0);
186public async Task SignInWithTicketStoreWorks()
221public async Task SessionStoreRemovesExpired()
253public async Task CustomAuthSchemeEncodesCookieName()
297public async Task SignInWrongAuthTypeThrows()
310public async Task SignOutWrongAuthTypeThrows()
329public async Task SecureSignInCausesSecureOnlyCookieByDefault(
356public async Task CookieOptionsAlterSetCookieHeader()
407public async Task CookieContainsIdentity()
420public async Task CookieAppliesClaimsTransform()
438public async Task CookieStopsWorkingAfterExpiration()
468public async Task CookieExpirationCanBeOverridenInSignin()
502public async Task ExpiredCookieWithValidatorStillExpired()
512return Task.FromResult(0);
531public async Task CookieCanBeRejectedAndSignedOutByValidator()
543return Task.FromResult(0);
560public async Task CookieNotRenewedAfterSignOut()
571return Task.FromResult(0);
597public async Task CookieCanBeRenewedByValidator()
608return Task.FromResult(0);
643public async Task CookieCanBeReplacedByValidator()
653return Task.FromResult(0);
670public async Task CookieCanBeUpdatedByValidatorDuringRefresh()
686return Task.FromResult(0);
719public async Task CookieCanBeRenewedByValidatorWithSlidingExpiry()
729return Task.FromResult(0);
764public async Task CookieCanBeRenewedByValidatorWithModifiedProperties()
785return Task.FromResult(0);
820public async Task CookieCanBeRenewedByValidatorWithModifiedLifetime()
844return Task.FromResult(0);
879public async Task CookieValidatorOnlyCalledOnce()
890return Task.FromResult(0);
927public async Task ShouldRenewUpdatesIssuedExpiredUtc(bool sliding)
942return Task.FromResult(0);
980public async Task CookieExpirationCanBeOverridenInEvent()
991return Task.FromResult(0);
1018public async Task CookieIsRenewedWithSlidingExpiration()
1055public async Task CookieIsRenewedWithSlidingExpirationWithoutTransformations()
1067return Task.CompletedTask;
1101public async Task CookieIsRenewedWithSlidingExpirationEvent()
1115return Task.CompletedTask;
1153public async Task CookieUsesPathBaseByDefault()
1170public async Task CookieChallengeRedirectsToLoginWithoutCookie()
1184public async Task CookieForbidRedirectsWithoutCookie()
1198public async Task CookieChallengeRedirectsWithLoginPath()
1214public async Task CookieChallengeWithUnauthorizedRedirectsToLoginIfNotAuthenticated()
1232public async Task MapWillAffectChallengeOnlyWithUseAuth(bool useAuth)
1267public async Task ChallengeDoesNotSet401OnUnauthorized()
1291public async Task CanConfigureDefaultCookieInstance()
1319public async Task CanConfigureNamedCookieInstance()
1347public async Task MapWithSignInOnlyRedirectToReturnUrlOnLoginPath()
1370public async Task MapWillNotAffectSignInRedirectToReturnUrl()
1396public async Task MapWithSignOutOnlyRedirectToReturnUrlOnLogoutPath()
1418public async Task MapWillNotAffectSignOutRedirectToReturnUrl()
1444public async Task MapWillNotAffectAccessDenied()
1468public async Task NestedMapWillNotAffectLogin()
1498public async Task RedirectUriIsHonoredAfterSignin(string redirectUrl, string loginPath)
1520public async Task RedirectUriInQueryIsIgnoredAfterSigninForUnrecognizedEndpoints()
1542public async Task RedirectUriInQueryIsHonoredAfterSignin()
1565public async Task AbsoluteRedirectUriInQueryStringIsRejected()
1587public async Task EnsurePrecedenceOfRedirectUriAfterSignin()
1611public async Task NestedMapWillNotAffectAccessDenied()
1635public async Task CanSpecifyAndShareDataProtector()
1687public async Task NullExpiresUtcPropertyIsGuarded()
1700return Task.FromResult(0);
1789return Task.FromResult(p);
1793private Task<IHost> CreateHost(Action<CookieAuthenticationOptions> configureOptions, Func<HttpContext, Task> testpath = null, Uri baseAddress = null, bool claimsTransform = false)
1807private static async Task<IHost> CreateHostWithServices(Action<IServiceCollection> configureServices, Func<HttpContext, Task> testpath = null, Uri baseAddress = null)
1886private static Task DescribeAsync(HttpResponse res, AuthenticateResult result)
Microsoft.AspNetCore.Authentication.Twitter (10)
Microsoft.AspNetCore.Authentication.WsFederation (21)
Microsoft.AspNetCore.Authorization (22)
Microsoft.AspNetCore.Authorization.Policy (4)
Microsoft.AspNetCore.Authorization.Test (172)
AuthorizationEndpointConventionBuilderExtensionsTests.cs (10)
25var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
43var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
62var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
81var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
100var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
133var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
156var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
182var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
208var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
232var endpointModel = new RouteEndpointBuilder((context) => Task.CompletedTask, RoutePatternFactory.Parse("/"), 0);
DefaultAuthorizationServiceTests.cs (71)
25public async Task AuthorizeCombineThrowsOnUnknownPolicy()
36public async Task Authorize_ShouldAllowIfClaimIsPresent()
51public async Task Authorize_ShouldAllowIfClaimIsPresentWithSpecifiedAuthType()
72public async Task Authorize_ShouldAllowIfClaimIsAmongValues()
94public async Task Authorize_ShouldInvokeAllHandlersByDefault()
119public async Task Authorize_ShouldInvokeAllHandlersDependingOnSetting(bool invokeAllHandlers)
146public Task HandleAsync(AuthorizationHandlerContext context)
150return Task.FromResult(0);
162public Task HandleAsync(AuthorizationHandlerContext context)
166return Task.FromResult(0);
171public async Task CanFailWithReasons()
200public async Task Authorize_ShouldFailWhenAllRequirementsNotHandled()
222public async Task Authorize_ShouldNotAllowIfClaimTypeIsNotPresent()
243public async Task Authorize_ShouldNotAllowIfClaimValueIsNotPresent()
264public async Task Authorize_ShouldNotAllowIfNoClaims()
283public async Task Authorize_ShouldNotAllowIfUserIsNull()
297public async Task Authorize_ShouldNotAllowIfNotCorrectAuthType()
312public async Task Authorize_ShouldAllowWithNoAuthType()
333public async Task Authorize_ThrowsWithUnknownPolicy()
345public async Task Authorize_CustomRolePolicy()
368public async Task Authorize_HasAnyClaimOfTypePolicy()
389public async Task Authorize_PolicyCanAuthenticationSchemeWithNameClaim()
406public async Task RolePolicyCanRequireSingleRole()
423public async Task RolePolicyCanRequireOneOfManyRoles()
439public async Task RolePolicyCanBlockWrongRole()
460public async Task RolePolicyCanBlockNoRole()
487public async Task RequireUserNameFailsForWrongUserName()
508public async Task CanRequireUserName()
534public async Task CanRequireUserNameWithDiffClaimType()
556public async Task CanRequireRoleWithDiffClaimType()
578public async Task CanApproveAnyAuthenticatedUser()
603public async Task CanBlockNonAuthenticatedUser()
627protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CustomRequirement requirement)
631return Task.FromResult(0);
636public async Task CustomReqWithNoHandlerFails()
656public async Task CustomReqWithHandlerSucceeds()
685protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PassThroughRequirement requirement)
691return Task.FromResult(0);
698public async Task PassThroughRequirementWillSucceedWithoutCustomHandler(bool shouldSucceed)
718public async Task CanCombinePolicies()
746public async Task CombinePoliciesWillFailIfBasePolicyFails()
773public async Task CombinedPoliciesWillFailIfExtraRequirementFails()
817protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, OperationAuthorizationRequirement requirement, ExpenseReport resource)
823return Task.FromResult(0);
829protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, OperationAuthorizationRequirement requirement)
835return Task.FromResult(0);
840public async Task CanAuthorizeAllSuperuserOperations()
865protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, OperationAuthorizationRequirement requirement, string resource)
873protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, OperationAuthorizationRequirement requirement, int id)
879return Task.FromResult(0);
884public async Task CanUseValueTypeResource()
905public async Task DoesNotCallHandlerWithWrongResourceType()
926public async Task CanAuthorizeOnlyAllowedOperations()
943public async Task AuthorizeHandlerNotCalledWithNullResource()
958public async Task CanAuthorizeWithAssertionRequirement()
977public async Task CanAuthorizeWithAsyncAssertionRequirement()
983options.AddPolicy("Basic", policy => policy.RequireAssertion(context => Task.FromResult(true)));
999return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build());
1004return Task.FromResult<AuthorizationPolicy>(null);
1009return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build());
1014public async Task CanReplaceDefaultPolicyProvider()
1038return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build());
1043return Task.FromResult<AuthorizationPolicy>(null);
1048return Task.FromResult(new AuthorizationPolicyBuilder().RequireClaim(policyName).Build());
1053public async Task CanUseDynamicPolicyProvider()
1080public async Task CanUseCustomEvaluatorThatOverridesRequirement()
1121public async Task CanUseCustomContextThatAlwaysFails()
1135return Task.FromResult<IEnumerable<IAuthorizationHandler>>(new IAuthorizationHandler[1] { new FailHandler() });
1140public async Task CanUseCustomHandlerProvider()
1184public async Task Authorize_ShouldLogRequirementDetailWhenUnHandled()
1217public async Task Authorize_ShouldLogExplicitFailedWhenFailedCall()
PolicyEvaluatorTests.cs (22)
14public async Task AuthenticateFailsIfNoPrincipalReturned()
31public async Task AuthenticateMergeSchemes()
49public async Task AuthenticateMergeSchemesPreservesSingleScheme()
69public async Task AuthorizeSucceedsEvenIfAuthenticationFails()
86public async Task AuthorizeSucceedsOnlyIfResourceSpecified()
104public async Task AuthorizeChallengesIfAuthenticationFails()
121public async Task AuthorizeForbidsIfAuthenticationSuceeds()
138public async Task AuthorizeForbidsAndFailureIsIncludedIfAuthenticationSuceeds()
172=> Task.FromResult(AuthorizationResult.Success());
175=> Task.FromResult(AuthorizationResult.Success());
181=> Task.FromResult(AuthorizationResult.Failed());
184=> Task.FromResult(AuthorizationResult.Failed());
190=> Task.FromResult(AuthenticateResult.Fail("Sad."));
192public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
195public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
198public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
201public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
212return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(Principal, scheme)));
215public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
218public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
221public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
224public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
TestObjects\TestAuthenticationService.cs (8)
27return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(identity), scheme)));
30return Task.FromResult(AuthenticateResult.Fail("Denied"));
33public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
36return Task.CompletedTask;
39public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
42return Task.CompletedTask;
45public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
50public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
Microsoft.AspNetCore.BrowserTesting (9)
Microsoft.AspNetCore.Components (252)
EventCallbackFactoryBinderExtensions.cs (36)
58Func<string?, Task> setter,
98Func<bool, Task> setter,
138Func<bool?, Task> setter,
178Func<int, Task> setter,
218Func<int?, Task> setter,
258Func<long, Task> setter,
298Func<short, Task> setter,
338Func<long?, Task> setter,
378Func<short?, Task> setter,
418Func<float, Task> setter,
458Func<float?, Task> setter,
498Func<double, Task> setter,
538Func<double?, Task> setter,
578Func<decimal, Task> setter,
618Func<decimal?, Task> setter,
658Func<DateTime, Task> setter,
701Func<DateTime, Task> setter,
742Func<DateTime?, Task> setter,
785Func<DateTime?, Task> setter,
826Func<DateTimeOffset, Task> setter,
869Func<DateTimeOffset, Task> setter,
910Func<DateTimeOffset?, Task> setter,
953Func<DateTimeOffset?, Task> setter,
994Func<DateOnly, Task> setter,
1037Func<DateOnly, Task> setter,
1078Func<DateOnly?, Task> setter,
1121Func<DateOnly?, Task> setter,
1162Func<TimeOnly, Task> setter,
1205Func<TimeOnly, Task> setter,
1246Func<TimeOnly?, Task> setter,
1289Func<TimeOnly?, Task> setter,
1332Func<T, Task> setter,
1385Func<T, Task> setter,
1389Func<ChangeEventArgs, Task> callback = async e =>
1472Func<T, Task> setter,
1477Func<ChangeEventArgs, Task> callback = async e =>
RenderTree\Renderer.cs (56)
37private Task? _ongoingQuiescenceTask;
42private List<Task>? _pendingTasks;
43private Task? _disposeTask;
239protected Task RenderRootComponentAsync(int componentId)
250/// The returned <see cref="Task"/> waits for this component and all descendant components to
259protected internal async Task RenderRootComponentAsync(int componentId, ParameterView initialParameters)
323private async Task WaitForQuiescence()
344async Task ProcessAsynchronousWork()
351var pendingWork = Task.WhenAll(_pendingTasks);
391/// <returns>A <see cref="Task"/> to represent the UI update process.</returns>
392protected abstract Task UpdateDisplayAsync(in RenderBatch renderBatch);
401/// A <see cref="Task"/> which will complete once all asynchronous processing related to the event
404public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fieldInfo, EventArgs eventArgs)
417/// A <see cref="Task"/> which will complete once all asynchronous processing related to the event
420public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fieldInfo, EventArgs eventArgs, bool waitForQuiescence)
442return Task.CompletedTask;
463Task? task = null;
475return Task.CompletedTask;
488var errorHandledTask = GetErrorHandledTask(task, receiverComponentState);
568internal void AddToPendingTasksWithErrorHandling(Task task, ComponentState? owningComponentState)
590var handledErrorTask = GetErrorHandledTask(task, owningComponentState);
601/// <param name="task">The <see cref="Task"/>.</param>
602protected virtual void AddPendingTask(ComponentState? componentState, Task task)
742var updateDisplayTask = Task.CompletedTask;
798private Task InvokeRenderCompletedCalls(ArrayRange<RenderTreeDiff> updatedComponents, Task updateDisplayTask)
808return Task.CompletedTask;
815return Task.CompletedTask;
830List<Task> batch = null;
842Task.WhenAll(batch) :
843Task.CompletedTask;
846private async Task InvokeRenderCompletedCallsAfterUpdateDisplayTask(
847Task updateDisplayTask,
865List<Task> batch = null;
876var result = batch != null ?
877Task.WhenAll(batch) :
878Task.CompletedTask;
883private void NotifyRenderCompleted(ComponentState state, ref List<Task> batch)
892var task = state.NotifyRenderCompletedAsync();
912batch = batch ?? new List<Task>();
952var result = disposalTask.AsTask();
955async Task GetHandledAsynchronousDisposalErrorsTask(Task result)
989private void RemoveEventHandlerIds(ArrayRange<ulong> eventHandlerIds, Task afterTaskIgnoreErrors)
1014async Task ContinueAfterTask(ArrayRange<ulong> eventHandlerIds, Task afterTaskIgnoreErrors)
1033RemoveEventHandlerIds(eventHandlerIdsClone, Task.CompletedTask);
1037private async Task GetErrorHandledTask(Task taskToHandle, ComponentState? owningComponentState)
1145var done = Dispatcher.InvokeAsync(() => Dispose(disposing));
1169List<Task> asyncDisposables = null;
1207async Task HandleAsyncExceptions(List<Task> tasks)
1210foreach (var task in tasks)
Microsoft.AspNetCore.Components.Analyzers (2)
Microsoft.AspNetCore.Components.Analyzers.Tests (4)
Microsoft.AspNetCore.Components.Authorization (3)
Microsoft.AspNetCore.Components.Authorization.Tests (30)
Microsoft.AspNetCore.Components.Endpoints (61)
Microsoft.AspNetCore.Components.Endpoints.Tests (115)
EndpointHtmlRendererTest.cs (61)
50public async Task CanRender_ParameterlessComponent_ClientMode()
73public async Task CanPrerender_ParameterlessComponent_ClientMode()
111public async Task CanRender_ComponentWithParameters_ClientMode()
148public async Task CanRender_ComponentWithNullParameters_ClientMode()
183public async Task CanPrerender_ComponentWithParameters_ClientMode()
232public async Task CanPrerender_ComponentWithNullParameters_ClientMode()
280public async Task CanRender_ParameterlessComponent()
296public async Task CanRender_ParameterlessComponent_ServerMode()
328public async Task CanPrerender_ParameterlessComponent_ServerMode()
373public async Task Prerender_ServerAndClientComponentUpdatesInvokedPrerenderModes()
389public async Task CanRenderMultipleServerComponents()
431public async Task CanRender_ComponentWithParametersObject()
446public async Task CanRender_ComponentWithParameters_ServerMode()
485public async Task CanRender_ComponentWithNullParameters_ServerMode()
524public async Task CanPrerender_ComponentWithParameters_ServerPrerenderedMode()
575public async Task CanPrerender_ComponentWithNullParameters_ServerPrerenderedMode()
626public async Task ComponentWithInvalidRenderMode_Throws()
642public async Task RenderComponent_DoesNotInvokeOnAfterRenderInComponent()
659public async Task DisposableComponents_GetDisposedAfterScopeCompletes()
691public async Task CanCatch_ComponentWithSynchronousException()
711public async Task CanCatch_ComponentWithAsynchronousException()
731public async Task Rendering_ComponentWithJsInteropThrows()
754public async Task UriHelperRedirect_ThrowsInvalidOperationException_WhenResponseHasAlreadyStarted()
785public async Task HtmlHelper_Redirects_WhenComponentNavigates()
812public async Task CanRender_AsyncComponent()
851public async Task CanDispatchNamedEvent_ToComponent()
879public async Task Dispatching_WhenNoHandlerIsSpecified_Throws()
908public async Task Dispatching_WhenNamedEventDoesNotExist_Throws()
937public async Task Dispatching_WhenComponentHasRerendered_UsesCurrentDelegate()
949await Task.Delay(500);
962public async Task Dispatching_WhenComponentReRendersNamedEventAtSameLocation()
998public async Task Dispatching_WhenNamedEventChangesName()
1049public async Task RenderMode_CanRenderInteractiveComponents()
1153public async Task DoesNotEmitNestedRenderModeBoundaries()
1182public async Task PrerenderedState_EmptyWhenNoDeclaredRenderModes()
1185var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1203public async Task PrerenderedState_SelectsSingleStoreCorrectly(IComponentRenderMode renderMode)
1206var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1233public async Task PrerenderedState_MultipleStoresCorrectly()
1236var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1253public async Task PrerenderedState_PersistToStores_OnlyWhenContentIsAvailable(string renderMode)
1264var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1274return Task.CompletedTask;
1307public async Task PrerenderedState_PersistToStores_DoesNotNeedToInferRenderMode_ForSingleRenderMode(string declaredRenderMode)
1318var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1328return Task.CompletedTask;
1353public async Task PrerenderedState_Throws_WhenItCanInfer_CallbackRenderMode_ForMultipleRenderModes()
1356var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1366return Task.CompletedTask;
1376public async Task PrerenderedState_InfersCallbackRenderMode_ForMultipleRenderModes(string renderMode)
1386var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1432public async Task PrerenderedState_ExplicitRenderModes_AreRespected(string renderMode, string declared, bool persisted)
1451var endpoint = new Endpoint((context) => Task.CompletedTask, new EndpointMetadataCollection(declaredRenderModesMetadata),
1547[Parameter] public Task Continue { get; set; }
1559protected override async Task OnInitializedAsync()
1596private Task PersistState()
1599return Task.CompletedTask;
1606public Task SetParametersAsync(ParameterView parameters)
1624return Task.CompletedTask;
1709protected override async Task OnParametersSetAsync()
1722await Task.Yield();
Microsoft.AspNetCore.Components.Forms.Tests (13)
Microsoft.AspNetCore.Components.Performance (2)
Microsoft.AspNetCore.Components.QuickGrid (23)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (4)
Microsoft.AspNetCore.Components.Server (103)
Circuits\CircuitHost.cs (26)
25private Func<Func<Task>, Task> _dispatchInboundActivity;
102public Task InitializeAsync(ProtectedPrerenderComponentApplicationStore store, CancellationToken cancellationToken)
130var pendingRenders = new Task[count];
138await Task.WhenAll(pendingRenders);
229private async Task OnCircuitOpenedAsync(CancellationToken cancellationToken)
258public async Task OnConnectionUpAsync(CancellationToken cancellationToken)
287public async Task OnConnectionDownAsync(CancellationToken cancellationToken)
316private async Task OnCircuitDownAsync(CancellationToken cancellationToken)
346public async Task OnRenderCompletedAsync(long renderId, string errorMessageOrNull)
367public async Task BeginInvokeDotNetFromJS(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson)
393public async Task EndInvokeJSFromDotNet(long asyncCall, bool succeeded, string arguments)
427internal async Task ReceiveByteArray(int id, byte[] data)
527public async Task OnLocationChangedAsync(string uri, string state, bool intercepted)
569public async Task OnLocationChangingAsync(int callId, string uri, string? state, bool intercepted)
603authenticationStateProvider.SetAuthenticationState(Task.FromResult(authenticationState));
619internal Task HandleInboundActivityAsync(Func<Task> handler)
630private static Func<Func<Task>, Task> BuildInboundActivityDispatcher(IReadOnlyList<CircuitHandler> circuitHandlers, Circuit circuit)
682private async Task ReportUnhandledException(Exception exception)
705private async Task TryNotifyClientErrorAsync(IClientProxy client, string error, Exception exception = null)
728internal Task UpdateRootComponents(
811? new Task[operations.Length]
848return Task.CompletedTask;
853await Task.WhenAll(pendingTasks);
Microsoft.AspNetCore.Components.Server.Tests (180)
Circuits\CircuitHostTest.cs (58)
25public async Task DisposeAsync_DisposesResources()
44public async Task DisposeAsync_DisposesScopeAsynchronouslyIfPossible()
51.Returns(new ValueTask(Task.CompletedTask))
70public async Task DisposeAsync_DisposesResourcesAndSilencesException()
97public async Task DisposeAsync_DisposesRendererWithinSynchronizationContext()
127public async Task DisposeAsync_MarksJSRuntimeAsDisconnectedBeforeDisposingRenderer()
159public async Task InitializeAsync_InvokesHandlers()
172.Returns(Task.CompletedTask)
178.Returns(Task.CompletedTask)
184.Returns(Task.CompletedTask)
190.Returns(Task.CompletedTask)
204public async Task InitializeAsync_RendersRootComponentsInParallel()
239var initializeTask = circuitHost.InitializeAsync(new ProtectedPrerenderComponentApplicationStore(Mock.Of<IDataProtectionProvider>()), cancellationToken);
247public async Task InitializeAsync_ReportsOwnAsyncExceptions()
269var initializeAsyncTask = circuitHost.InitializeAsync(new ProtectedPrerenderComponentApplicationStore(Mock.Of<IDataProtectionProvider>()), new CancellationToken());
290public async Task DisposeAsync_InvokesCircuitHandler()
303.Returns(Task.CompletedTask)
309.Returns(Task.CompletedTask)
315.Returns(Task.CompletedTask)
321.Returns(Task.CompletedTask)
335public async Task HandleInboundActivityAsync_InvokesCircuitActivityHandlers()
348.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
349.Returns((Func<CircuitInboundActivityContext, Task> next) => async (CircuitInboundActivityContext context) =>
358.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
359.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
364.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
365.Returns((Func<CircuitInboundActivityContext, Task> next) => async (CircuitInboundActivityContext context) =>
381return Task.CompletedTask;
397public async Task HandleInboundActivityAsync_InvokesHandlerFunc_WhenNoCircuitActivityHandlersAreRegistered()
407return Task.CompletedTask;
415public async Task UpdateRootComponents_CanAddNewRootComponent()
437public async Task UpdateRootComponents_CanUpdateExistingRootComponent()
463public async Task UpdateRootComponents_CanReplaceExistingRootComponent_WhenNoComponentKeyWasSpecified()
490public async Task UpdateRootComponents_DoesNotUpdateExistingRootComponent_WhenDescriptorComponentTypeDoesNotMatchRootComponentType()
528public async Task UpdateRootComponents_DoesNotUpdateExistingRootComponent_WhenDescriptorKeyDoesNotMatchOriginalKey()
565public async Task UpdateRootComponents_CanRemoveExistingRootComponent()
587private async Task AddComponentAsync<TComponent>(CircuitHost circuitHost, int ssrComponentId, Dictionary<string, object> parameters = null, string componentKey = "")
604private async Task UpdateComponentAsync<TComponent>(CircuitHost circuitHost, int ssrComponentId, Dictionary<string, object> parameters = null, string componentKey = "")
620private async Task RemoveComponentAsync(CircuitHost circuitHost, int ssrComponentId)
657.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
658.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
666.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
667.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
754public Task SetParametersAsync(ParameterView parameters)
755=> Task.CompletedTask;
802public async Task SetParametersAsync(ParameterView parameters)
805await Task.WhenAll(_renderTcsArray.Select(tcs => tcs.Task));
829public Task SetParametersAsync(ParameterView parameters)
830=> Task.CompletedTask;
879public Task SetParametersAsync(ParameterView parameters)
887return Task.CompletedTask;
892var task = _renderHandle.Dispatcher.InvokeAsync(() => _renderHandle.Render(Render));
896public Task WaitForDisposeAsync()
921public Task OnAfterRenderAsync()
924return Task.CompletedTask;
927public Task SetParametersAsync(ParameterView parameters)
930return Task.CompletedTask;
935var task = _renderHandle.Dispatcher.InvokeAsync(() => _renderHandle.Render(_renderFragment));
Microsoft.AspNetCore.Components.Tests (517)
EventCallbackFactoryTest.cs (28)
166var @delegate = (Func<Task>)component.SomeFuncTask;
182var @delegate = (Func<Task>)component.SomeFuncTask;
200var @delegate = (Func<Task>)(() => Task.CompletedTask);
218var @delegate = (Func<string, Task>)component.SomeFuncTTask;
236var callback = EventCallback.Factory.Create(component, (Func<Task>)null);
249var @delegate = (Func<string, Task>)component.SomeFuncTTask;
267var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
287var callback = EventCallback.Factory.Create(component, (Func<string, Task>)null);
453var @delegate = (Func<Task>)component.SomeFuncTask;
469var @delegate = (Func<Task>)component.SomeFuncTask;
487var @delegate = (Func<Task>)(() => Task.CompletedTask);
507var callback = EventCallback.Factory.Create<string>(component, (Func<Task>)null);
520var @delegate = (Func<string, Task>)component.SomeFuncTTask;
536var @delegate = (Func<string, Task>)component.SomeFuncTTask;
554var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
574var callback = EventCallback.Factory.Create<string>(component, (Func<string, Task>)null);
603var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
624public Task SomeFuncTask()
626return Task.CompletedTask;
629public Task SomeFuncTTask(string s)
631return Task.CompletedTask;
639public Task HandleEventAsync(EventCallbackWorkItem item, object arg)
644public Task SetParametersAsync(ParameterView parameters)
EventCallbackTest.cs (46)
11public async Task EventCallback_Default()
21public async Task EventCallbackOfT_Default()
31public async Task EventCallback_NullReceiver()
45public async Task EventCallbackOfT_NullReceiver()
59public async Task EventCallback_Action_Null()
76public async Task EventCallback_Action_IgnoresArg()
93public async Task EventCallback_ActionT_Null()
112public async Task EventCallback_ActionT_Arg()
131public async Task EventCallback_ActionT_Arg_ValueType()
150public async Task EventCallback_ActionT_ArgMismatch()
167public async Task EventCallback_FuncTask_Null()
173var callback = new EventCallback(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
184public async Task EventCallback_FuncTask_IgnoresArg()
190var callback = new EventCallback(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
201public async Task EventCallback_FuncTTask_Null()
208var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
220public async Task EventCallback_FuncTTask_Arg()
227var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
239public async Task EventCallback_FuncTTask_Arg_ValueType()
246var callback = new EventCallback(component, (Func<int, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
258public async Task EventCallback_FuncTTask_ArgMismatch()
265var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
275public async Task EventCallbackOfT_Action_Null()
292public async Task EventCallbackOfT_Action_IgnoresArg()
309public async Task EventCallbackOfT_ActionT_Null()
328public async Task EventCallbackOfT_ActionT_Arg()
347public async Task EventCallbackOfT_FuncTask_Null()
353var callback = new EventCallback<EventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
364public async Task EventCallbackOfT_FuncTask_IgnoresArg()
370var callback = new EventCallback<EventArgs>(component, (Func<Task>)(() => { runCount++; return Task.CompletedTask; }));
381public async Task EventCallbackOfT_FuncTTask_Null()
388var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
400public async Task EventCallbackOfT_FuncTTask_Arg()
407var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
422public Task HandleEventAsync(EventCallbackWorkItem item, object arg)
430public Task SetParametersAsync(ParameterView parameters) => throw new NotImplementedException();
RendererTest.cs (218)
176public async Task CanRenderAsyncTopLevelComponents()
185var renderTask = renderer.Dispatcher.InvokeAsync(() => renderer.RenderRootComponentAsync(componentId));
229public async Task CanRenderAsyncNestedComponents()
315public async Task CanAddAndRenderNewRootComponentsWhileNotQuiescent()
324var renderTask1 = renderer.Dispatcher.InvokeAsync(() => renderer.RenderRootComponentAsync(component1Id));
331var renderTask2 = renderer.Dispatcher.InvokeAsync(() => renderer.RenderRootComponentAsync(component2Id));
348await Task.WhenAll(renderTask1, renderTask2);
352public async Task AsyncComponentTriggeringRootReRenderDoesNotDeadlock()
379var renderTask = renderer.Dispatcher.InvokeAsync(() => renderer.RenderRootComponentAsync(componentId.Value));
388public async Task CanRenderAsyncComponentsWithSyncChildComponents()
432public async Task CanRenderAsyncComponentsWithAsyncChildInit()
476public async Task CanRenderAsyncComponentsWithMultipleAsyncChildren()
563var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
593var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
606OnArbitraryDelegateEvent = (Func<DerivedEventArgs, Task>)(args => Task.CompletedTask),
629OnArbitraryDelegateEvent = (Func<Task>)(() => Task.CompletedTask),
716var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
747var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
776var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
816var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
822public async Task CanAsyncDispatchEventsToTopLevelComponents()
854var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
865public async Task CanAsyncDispatchTypedEventsToTopLevelComponents()
897var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
908public async Task CanAsyncDispatchActionEventsToTopLevelComponents()
940var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
951public async Task CanAsyncDispatchEventsToNestedComponents()
994var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs);
1011public async Task EventDispatching_DelegateParameter_MethodToDelegateConversion()
1052public async Task EventDispatching_DelegateParameter_NoTargetLambda()
1094public async Task EventDispatching_EventCallback_MethodToDelegateConversion()
1132public async Task EventDispatching_EventCallback_NoTargetLambda()
1173public async Task EventDispatching_EventCallback_AsyncNoTargetLambda()
1183builder.AddComponentParameter(1, nameof(EventComponent.OnClickEventCallback), EventCallback.Factory.Create(parentComponent, (Func<Task>)(() =>
1186return Task.CompletedTask;
1213public async Task EventDispatching_EventCallbackOfT_MethodToDelegateConversion()
1251public async Task EventDispatching_EventCallbackOfT_NoTargetLambda()
1292public async Task EventDispatching_EventCallbackOfT_AsyncNoTargetLambda()
1302builder.AddComponentParameter(1, nameof(EventComponent.OnClickEventCallbackOfT), EventCallback.Factory.Create<DerivedEventArgs>(parentComponent, (Func<Task>)(() =>
1305return Task.CompletedTask;
1332public async Task DispatchEventAsync_Delegate_SynchronousCompletion()
1358var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1366public async Task DispatchEventAsync_EventCallback_SynchronousCompletion()
1390var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1398public async Task DispatchEventAsync_EventCallbackOfT_SynchronousCompletion()
1424var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1433public async Task DispatchEventAsync_Delegate_SynchronousCancellation()
1459var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1467public async Task DispatchEventAsync_EventCallback_SynchronousCancellation()
1491var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1499public async Task DispatchEventAsync_EventCallbackOfT_SynchronousCancellation()
1526var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1535public async Task DispatchEventAsync_Delegate_SynchronousException()
1561var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1569public async Task DispatchEventAsync_EventCallback_SynchronousException()
1593var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1601public async Task DispatchEventAsync_EventCallbackOfT_SynchronousException()
1628var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1637public async Task DispatchEventAsync_Delegate_AsynchronousCompletion()
1648builder.AddComponentParameter(1, nameof(EventComponent.OnClickAsyncAction), (Func<Task>)(async () =>
1665var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1674public async Task DispatchEventAsync_EventCallback_AsynchronousCompletion()
1700var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1709public async Task DispatchEventAsync_EventCallbackOfT_AsynchronousCompletion()
1738var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1748public async Task DispatchEventAsync_Delegate_AsynchronousCancellation()
1759builder.AddComponentParameter(1, nameof(EventComponent.OnClickAsyncAction), (Func<Task>)(async () =>
1777var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1788public async Task DispatchEventAsync_EventCallback_AsynchronousCancellation()
1815var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1826public async Task DispatchEventAsync_EventCallbackOfT_AsynchronousCancellation()
1856var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1868public async Task DispatchEventAsync_Delegate_AsynchronousException()
1879builder.AddComponentParameter(1, nameof(EventComponent.OnClickAsyncAction), (Func<Task>)(async () =>
1897var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1907public async Task DispatchEventAsync_EventCallback_AsynchronousException()
1934var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1944public async Task DispatchEventAsync_EventCallbackOfT_AsynchronousException()
1974var task = renderer.DispatchEventAsync(eventHandlerId, new DerivedEventArgs());
1985public async Task CannotDispatchEventsWithUnknownEventHandlers()
2623public async Task DoesNotDispatchEventsAfterOwnerComponentIsDisposed()
2656var renderTask = renderer.DispatchEventAsync(eventHandlerId, args: null);
2673public async Task DisposesEventHandlersWhenAttributeValueChanged()
2690var renderTask = renderer.DispatchEventAsync(origEventHandlerId, args: null);
2715public async Task DisposesEventHandlersWhenAttributeRemoved()
2732var renderTask = renderer.DispatchEventAsync(origEventHandlerId, args: null);
2750public async Task DisposesEventHandlersWhenOwnerComponentRemoved()
2783var renderTask = renderer.DispatchEventAsync(eventHandlerId, args: null);
2801public async Task DisposesEventHandlersWhenAncestorElementRemoved()
2818var renderTask = renderer.DispatchEventAsync(origEventHandlerId, args: null);
2836public async Task AllRendersTriggeredSynchronouslyDuringEventHandlerAreHandledAsSingleBatch()
2870var renderTask = renderer.DispatchEventAsync(origEventHandlerId, args: null);
3063var renderTask = renderer.DispatchEventAsync(origEventHandlerId, args: null);
3079public async Task CanCombineBindAndConditionalAttribute()
3095var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
3113public async Task BindWithSynchronousSetter_Lambda()
3137var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
3145public async Task BindWithAsynchronousSetter_MethodGroupToDelegate()
3153async Task SetValue(string __value)
3156await Task.CompletedTask;
3176var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
3184public async Task BindWithAfter()
3201return RuntimeHelpers.InvokeAsynchronousDelegate(() => Task.CompletedTask);
3216var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
3224public async Task BindWithAfter_Action()
3256var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs);
3374OnUpdateDisplayAsync = _ => Task.CompletedTask
3468public async Task CanTriggerEventHandlerDisposedInEarlierPendingBatchAsync()
3485NextUpdateDisplayReturnTask = Task.CompletedTask
3531var awaitableTask = render1TCS.Task.ContinueWith(_ => Task.Delay(1000)).Unwrap();
3552var task = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3585var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3618var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3627EventAction = () => Task.FromException<(int, NestedAsyncComponent.EventType)>(exception),
3642public async Task ExceptionsThrownAsynchronouslyDuringFirstRenderCanBeHandled()
3652var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3682public async Task ExceptionsDispatchedOffSyncContextCanBeHandledAsync()
3698public async Task ExceptionsThrownAsynchronouslyAfterFirstRenderCanBeHandled()
3710var taskToAwait = Task.CompletedTask;
3738public async Task ExceptionsThrownAsynchronouslyFromMultipleComponentsCanBeHandled()
3749var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3807var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3851public async Task ExceptionsThrownFromHandleAfterRender_Sync_AreHandled()
3862var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3885return Task.FromResult((1, NestedAsyncComponent.EventType.OnAfterRenderAsyncSync));
3905public async Task ExceptionsThrownFromHandleAfterRender_Async_AreHandled()
3916var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
3927await Task.Yield();
3939await Task.Yield();
3961public async Task ExceptionThrownFromConstructor()
3973var renderTask = renderer.RenderRootComponentAsync(componentId);
3994public Task SetParametersAsync(ParameterView parameters)
4001public async Task ExceptionThrownFromAttach()
4013var renderTask = renderer.RenderRootComponentAsync(componentId);
4029public Task SetParametersAsync(ParameterView parameters)
4046var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
4080var renderTask = renderer.RenderRootComponentAsync(componentId, ParameterView.FromDictionary(new Dictionary<string, object>
4106public async Task CanceledTasksInHandleAfterRender_AreIgnored()
4263public async Task DisposingRenderer_CapturesSyncExceptionsFromAllRegisteredAsyncDisposableComponents()
4290public async Task DisposingRenderer_CapturesAsyncExceptionsFromAllRegisteredAsyncDisposableComponents()
4344var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new ChangeEventArgs
4396var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new ChangeEventArgs
4469public async Task CanSetComponentParameter_WhenParameterTypeHasImplicitConversionToString()
4526public async Task ThrowsIfComponentProducesInvalidRenderTree()
4609public async Task SetParametersAsyncExceptionsCanBeHandledByClosestErrorBoundary_Async()
4673var task = renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
4687public async Task EventDispatchExceptionsCanBeHandledByClosestErrorBoundary_Async()
4712var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
4731public async Task EventDispatchExceptionsCanBeHandledByClosestErrorBoundary_AfterDisposal()
4761var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, new EventArgs());
4783public async Task CanRemoveRootComponents()
4835public async Task CannotRemoveSameRootComponentMultipleTimesSynchronously()
4864public async Task CannotRemoveNonRootComponentsDirectly()
4961public async Task DisposeAsyncCallsComponentDisposeAsyncOnSyncContext()
4984public async Task NoHotReloadListenersAreRegistered_WhenMetadataUpdatesAreNotSupported()
5006public async Task DisposingRenderer_UnsubsribesFromHotReloadManager()
5118public Task SetParametersAsync(ParameterView parameters) => throw new NotImplementedException();
5130public Task SetParametersAsync(ParameterView parameters) => throw new NotImplementedException();
5179protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
5180=> Task.CompletedTask;
5198public Task SetParametersAsync(ParameterView parameters)
5201return Task.CompletedTask;
5206var t = _renderHandle.Dispatcher.InvokeAsync(() => _renderHandle.Render(_renderFragment));
5267public Task SetParametersAsync(ParameterView parameters)
5270return Task.CompletedTask;
5280public Func<EventArgs, Task> OnTestAsync { get; set; }
5286public Func<DerivedEventArgs, Task> OnClickAsync { get; set; }
5292public Func<Task> OnClickAsyncAction { get; set; }
5361public Task HandleEventAsync(EventCallbackWorkItem callback, object arg)
5424public Task SetParametersAsync(ParameterView parameters)
5428return Task.CompletedTask;
5431public Task HandleEventAsync(EventCallbackWorkItem callback, object arg)
5433var task = callback.InvokeAsync(arg);
5455public Task SetParametersAsync(ParameterView parameters)
5457return Task.CompletedTask;
5477public Task HandleEventAsync(EventCallbackWorkItem callback, object arg)
5479var task = callback.InvokeAsync(arg);
5505public Task OnAfterRenderAsync()
5509return Task.CompletedTask;
5512Task IComponent.SetParametersAsync(ParameterView parameters)
5515return Task.CompletedTask;
5561public Task NextUpdateDisplayReturnTask { get; set; }
5563protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
5574public AsyncComponent(Task taskToAwait, int number)
5580private readonly Task _taskToAwait;
5589public async Task SetParametersAsync(ParameterView parameters)
5630public Task HandleEventAsync(EventCallbackWorkItem callback, object arg)
5632var task = callback.InvokeAsync(arg);
5637public Task SetParametersAsync(ParameterView parameters)
5642public Task TriggerRenderAsync() => _renderHandle.Dispatcher.InvokeAsync(() => _renderHandle.Render(RenderFragment));
5719protected override async Task OnInitializedAsync()
5745protected override async Task OnParametersSetAsync()
5766protected override async Task OnAfterRenderAsync(bool firstRender)
5809EventAction = () => Task.FromResult((id, @event))
5819await Task.Yield();
5839public Task ExternalExceptionDispatch(Exception exception)
5842Task.Run(async () =>
5856[Parameter] public Task TaskToAwait { get; set; }
5858protected override async Task OnParametersSetAsync()
5866public Func<RenderBatch, Task> OnUpdateDisplayAsync { get; set; }
5868protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
5876private readonly Task _task;
5878public AsyncAfterRenderComponent(Task task)
5887public async Task OnAfterRenderAsync()
5956public Task SetParametersAsync(ParameterView parameters)
5971public Task ReceivedErrorTask => receivedErrorTaskCompletionSource.Task;
6003[Parameter] public Task ThrowDuringEventAsync { get; set; }
6005[Parameter] public Task ThrowDuringParameterSettingAsync { get; set; }
6007public override async Task SetParametersAsync(ParameterView parameters)
6035public async Task HandleEventAsync(EventCallbackWorkItem item, object arg)
6052public Func<Task> Callback { get; set; }
6054public override async Task SetParametersAsync(ParameterView parameters)
6075public Task SetParametersAsync(ParameterView parameters)
6087return Task.CompletedTask;
Microsoft.AspNetCore.Components.Web (41)
Web\WebEventCallbackFactoryEventArgsExtensions.cs (10)
36public static EventCallback<ClipboardEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ClipboardEventArgs, Task> callback)
68public static EventCallback<DragEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<DragEventArgs, Task> callback)
100public static EventCallback<ErrorEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ErrorEventArgs, Task> callback)
132public static EventCallback<FocusEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<FocusEventArgs, Task> callback)
164public static EventCallback<KeyboardEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<KeyboardEventArgs, Task> callback)
196public static EventCallback<MouseEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<MouseEventArgs, Task> callback)
227public static EventCallback<PointerEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<PointerEventArgs, Task> callback)
259public static EventCallback<ProgressEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ProgressEventArgs, Task> callback)
291public static EventCallback<TouchEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<TouchEventArgs, Task> callback)
323public static EventCallback<WheelEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<WheelEventArgs, Task> callback)
Microsoft.AspNetCore.Components.Web.Tests (136)
Microsoft.AspNetCore.Components.WebAssembly (42)
Microsoft.AspNetCore.Components.WebAssembly.Server (7)
Microsoft.AspNetCore.Components.WebAssembly.Server.Tests (18)
Microsoft.AspNetCore.Components.WebAssembly.Tests (12)
Microsoft.AspNetCore.Components.WebView (27)
Microsoft.AspNetCore.Components.WebView.Photino (18)
Microsoft.AspNetCore.Components.WebView.Test (9)
Microsoft.AspNetCore.Components.WebViewE2E.Test (4)
Microsoft.AspNetCore.ConcurrencyLimiter (3)
Microsoft.AspNetCore.ConcurrencyLimiter.Microbenchmarks (13)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (33)
Microsoft.AspNetCore.Connections.Abstractions (18)
ConnectionBuilderExtensions.cs (8)
32/// If you aren't calling the next function, use <see cref="Run(IConnectionBuilder, Func{ConnectionContext, Task})"/> instead.
34/// Prefer using <see cref="Use(IConnectionBuilder, Func{ConnectionContext, ConnectionDelegate, Task})"/> for better performance as shown below:
46public static IConnectionBuilder Use(this IConnectionBuilder connectionBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
52Func<Task> simpleNext = () => next(context);
60/// If you aren't calling the next function, use <see cref="Run(IConnectionBuilder, Func{ConnectionContext, Task})"/> instead.
65public static IConnectionBuilder Use(this IConnectionBuilder connectionBuilder, Func<ConnectionContext, ConnectionDelegate, Task> middleware)
76public static IConnectionBuilder Run(this IConnectionBuilder connectionBuilder, Func<ConnectionContext, Task> middleware)
Microsoft.AspNetCore.CookiePolicy (1)
Microsoft.AspNetCore.CookiePolicy.Test (61)
Microsoft.AspNetCore.Cors (11)
Microsoft.AspNetCore.Cors.Test (48)
CorsMiddlewareTests.cs (46)
24public async Task CorsRequest_MatchesPolicy_OnCaseInsensitiveAccessControlRequestMethod(string accessControlRequestMethod)
64public async Task CorsRequest_MatchPolicy_SetsResponseHeaders()
109public async Task PreFlight_MatchesPolicy_OnCaseInsensitiveOptionsMethod(string preflightMethod)
156public async Task PreFlight_MatchesPolicy_SetsResponseHeaders()
221public async Task PreFlight_WithCredentialsAllowed_ReflectsRequestHeaders()
292public async Task PreFlightRequest_DoesNotMatchPolicy_SetsResponseHeadersAndReturnsNoContent()
335public async Task CorsRequest_DoesNotMatchPolicy_DoesNotSetHeaders()
375public async Task Uses_PolicyProvider_AsFallback()
382.Returns(Task.FromResult<CorsPolicy>(null))
404public async Task DoesNotSetHeaders_ForNoPolicy()
411.Returns(Task.FromResult<CorsPolicy>(null))
435public async Task PreFlight_MatchesDefaultPolicy_SetsResponseHeaders()
508public async Task CorsRequest_SetsResponseHeaders()
567public async Task CorsRequest_SetsResponseHeader_IfExceptionHandlerClearsResponse()
638public async Task Invoke_WithCustomPolicyProviderThatReturnsAsynchronously_Works()
682public async Task Invoke_HasEndpointWithNoMetadata_RunsCors()
689.Returns(Task.FromResult<CorsPolicy>(null))
699httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint"));
712public async Task Invoke_HasEndpointWithEnableMetadata_MiddlewareHasPolicyName_RunsCorsWithPolicyName()
719.Returns(Task.FromResult<CorsPolicy>(null))
729httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute("MetadataPolicyName")), "Test endpoint"));
742public async Task Invoke_HasEndpointWithEnableMetadata_HasSignificantDisableCors_ReturnsNoContentForPreflightRequest()
756httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute(), new DisableCorsAttribute()), "Test endpoint"));
769public async Task Invoke_HasEndpointWithEnableMetadata_HasSignificantDisableCors_ExecutesNextMiddleware()
781return Task.CompletedTask;
788httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute(), new DisableCorsAttribute()), "Test endpoint"));
803public async Task Invoke_HasEndpointWithEnableMetadata_MiddlewareHasPolicy_RunsCorsWithPolicyName()
811.Returns(Task.FromResult<CorsPolicy>(null))
821httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute("MetadataPolicyName")), "Test endpoint"));
834public async Task Invoke_HasEndpointRequireCorsMetadata_MiddlewareHasPolicy_RunsCorsWithPolicyName()
843.Returns(Task.FromResult<CorsPolicy>(null))
856httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new CorsPolicyMetadata(metadataPolicy)), "Test endpoint"));
872public async Task Invoke_HasEndpointWithEnableMetadataWithNoName_RunsCorsWithStaticPolicy()
880.Returns(Task.FromResult<CorsPolicy>(null))
893httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute()), "Test endpoint"));
909public async Task Invoke_HasEndpointWithDisableMetadata_SkipCors()
916.Returns(Task.FromResult<CorsPolicy>(null))
926httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new DisableCorsAttribute()), "Test endpoint"));
939public async Task Invoke_HasEndpointWithMutlipleMetadata_SkipCorsBecauseOfMetadataOrder()
946.Returns(Task.FromResult<CorsPolicy>(null))
956httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute("MetadataPolicyName"), new DisableCorsAttribute()), "Test endpoint"));
969public async Task Invoke_InvokeFlagSet()
983httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute("MetadataPolicyName"), new DisableCorsAttribute()), "Test endpoint"));
994public async Task Invoke_WithoutOrigin_InvokeFlagSet()
1008httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableCorsAttribute("MetadataPolicyName"), new DisableCorsAttribute()), "Test endpoint"));
1018public async Task Invoke_WithoutEndpoint_InvokeFlagSet()
Microsoft.AspNetCore.DataProtection (5)
Microsoft.AspNetCore.DataProtection.Tests (12)
Microsoft.AspNetCore.Diagnostics (33)
Microsoft.AspNetCore.Diagnostics.Abstractions (2)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (12)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests (17)
Microsoft.AspNetCore.Diagnostics.HealthChecks (3)
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (45)
HealthCheckMiddlewareTests.cs (39)
43public async Task IgnoresRequestThatDoesNotMatchPath()
70public async Task MatchIsCaseInsensitive()
97public async Task ReturnsPlainTextStatus()
127public async Task StatusCodeIs200IfNoChecks()
157public async Task StatusCodeIs200IfAllChecksHealthy()
190public async Task StatusCodeIs200IfCheckIsDegraded()
223public async Task StatusCodeIs503IfCheckIsUnhealthy()
237.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")))
238.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad.")))
239.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
256public async Task StatusCodeIs503IfCheckHasUnhandledException()
270.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")))
272.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
289public async Task CanUseCustomWriter()
316.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")))
317.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad.")))
318.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
336public async Task NoResponseWriterReturnsEmptyBody()
353.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")))
354.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad.")))
355.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
371public async Task CanSetCustomStatusCodes()
406public async Task SetsCacheHeaders()
438public async Task CanSuppressCacheHeaders()
473public async Task CanFilterChecks()
490.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")))
492.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("A-ok!")))
493.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
510public async Task CanListenWithoutPath_AcceptsRequest()
540public async Task CanListenWithPath_AcceptsRequestWithExtraSlash()
568public async Task CanListenWithPath_AcceptsRequestWithCaseInsensitiveMatch()
598public async Task CanListenWithPath_RejectsRequestWithExtraSegments()
627public async Task CanListenWithPath_MultipleMiddleware_LeastSpecificFirst()
664public async Task CanListenWithPath_MultipleMiddleware_MostSpecificFirst()
700public async Task CanListenOnPort_AcceptsRequest_OnSpecifiedPort()
738public async Task CanListenOnPortWithoutPath_AcceptsRequest_OnSpecifiedPort()
776public async Task CanListenOnPort_RejectsRequest_OnOtherPort()
812public async Task CanListenOnPort_MultipleMiddleware()
856public async Task CanListenOnPort_MultipleMiddleware_DifferentPorts()
Microsoft.AspNetCore.Diagnostics.Tests (90)
DeveloperExceptionPageMiddlewareTest.cs (23)
27public async Task ExceptionIsSetOnProblemDetailsContext()
75public async Task ExceptionHandlerFeatureIsAvailableInCustomizeProblemDetailsWhenUsingExceptionPage()
134public async Task ExceptionHandlerPathFeatureIsAvailableInCustomizeProblemDetailsWhenUsingExceptionPage()
193public async Task UnhandledErrorsWriteToDiagnosticWhenUsingExceptionPage()
230public async Task ErrorPageWithAcceptHeaderForHtmlReturnsHtml()
267public async Task ErrorPageWithoutAcceptHeaderForHtmlReturnsPlainText()
303public async Task ErrorPageShowsEndpointMetadata()
338public async Task StatusCodeFromBadHttpRequestExceptionIsPreserved()
373public async Task ExceptionPageFiltersAreApplied()
407public async Task ExceptionFilterCallingNextWorks()
445public async Task ExceptionPageFiltersAreAppliedInOrder()
536public async Task NullInfoInCompilationException_ShouldNotThrowExceptionGeneratingExceptionPage(
574public async Task UnhandledError_ExceptionNameTagAdded()
651public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
659public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
667public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
675public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
683public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
ExceptionHandlerMiddlewareTest.cs (27)
33public async Task ExceptionIsSetOnProblemDetailsContext()
81public async Task Invoke_ExceptionThrownResultsInClearedRouteValuesAndEndpoint()
85httpContext.SetEndpoint(new Endpoint((_) => Task.CompletedTask, new EndpointMetadataCollection(), "Test"));
93return Task.CompletedTask;
102public async Task Invoke_ExceptionHandlerCaptureRouteValuesAndEndpoint()
106var endpoint = new Endpoint((_) => Task.CompletedTask, new EndpointMetadataCollection(), "Test");
117return Task.CompletedTask;
126public async Task IExceptionHandlers_CallNextIfNotHandled()
151public async Task IExceptionHandlers_SkipIfOneHandle()
176public async Task IExceptionHandlers_CallOptionExceptionHandlerIfNobodyHandles()
185return Task.CompletedTask;
207public async Task Metrics_NoExceptionThrown()
214var middleware = CreateMiddleware(_ => Task.CompletedTask, optionsAccessor, exceptionHandlers, meterFactory);
230public async Task Metrics_ExceptionThrown_Handled_Reported()
251public async Task Metrics_ExceptionThrown_ResponseStarted_Skipped()
278public async Task Metrics_ExceptionThrown_DefaultSettings_Handled_Reported()
298public async Task Metrics_ExceptionThrown_Handled_UseOriginalRoute()
301var originalEndpointBuilder = new RouteEndpointBuilder(c => Task.CompletedTask, RoutePatternFactory.Parse("/path"), 0);
322ExceptionHandler = (c) => Task.CompletedTask
358public async Task Metrics_ExceptionThrown_Handled_UseNewRoute()
361var originalEndpointBuilder = new RouteEndpointBuilder(c => Task.CompletedTask, RoutePatternFactory.Parse("/path"), 0);
364var newEndpointBuilder = new RouteEndpointBuilder(c => Task.CompletedTask, RoutePatternFactory.Parse("/new"), 0);
388return Task.CompletedTask;
425public async Task Metrics_ExceptionThrown_Unhandled_Reported()
432return Task.CompletedTask;
495exceptionHandler ??= c => Task.CompletedTask;
511next ??= c => Task.CompletedTask;
Microsoft.AspNetCore.FunctionalTests (13)
Microsoft.AspNetCore.Grpc.JsonTranscoding (24)
Microsoft.AspNetCore.Grpc.JsonTranscoding.IntegrationTests (41)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (106)
UnaryServerCallHandlerTests.cs (91)
44public async Task HandleCallAsync_MatchingRouteValue_SetOnRequestMessage()
51return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
88public async Task HandleCallAsync_ResponseBodySet_ResponseReturned(string name)
95return Task.FromResult(new HelloReply { Message = r.Name });
124public async Task HandleCallAsync_NullProperty_ResponseReturned()
129return Task.FromResult(new HelloReply { NullableMessage = null });
157public async Task HandleCallAsync_ResponseBodySetToRepeatedField_ArrayReturned()
164return Task.FromResult(new HelloReply { Values = { "One", "Two", "" } });
187public async Task HandleCallAsync_RootBodySet_SetOnRequestMessage()
194return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
222public async Task HandleCallAsync_SubBodySet_SetOnRequestMessage()
229return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
262public async Task HandleCallAsync_SubRepeatedBodySet_SetOnRequestMessage()
269return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
312public async Task HandleCallAsync_SubRepeatedMessageBodySet_SetOnRequestMessage()
319return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
362public async Task HandleCallAsync_SubMapBodySet_SetOnRequestMessage()
369return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
412public async Task HandleCallAsync_SubMapMessageBodySet_SetOnRequestMessage()
419return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
462public async Task HandleCallAsync_SubMapIntBodySet_SetOnRequestMessage()
469return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
512public async Task HandleCallAsync_MatchingQueryStringValues_SetOnRequestMessage()
519return Task.FromResult(new HelloReply());
540public async Task HandleCallAsync_MatchingQueryStringValues_JsonName_SetOnRequestMessage()
547return Task.FromResult(new HelloReply());
566public async Task HandleCallAsync_MatchingQueryStringValues_JsonNamePriority_JsonName_SetOnRequestMessage()
574return Task.FromResult(new HelloReply());
602public async Task HandleCallAsync_MatchingQueryStringValues_JsonNamePriority_FieldNameFallback_SetOnRequestMessage()
610return Task.FromResult(new HelloReply());
638public async Task HandleCallAsync_MatchingQueryStringValues_JsonNameAndValueObject_SetOnRequestMessage()
645return Task.FromResult(new HelloReply());
664public async Task HandleCallAsync_MatchingQueryStringValues_JsonNameHidesFieldName_SetOnRequestMessage()
671return Task.FromResult(new HelloReply());
691public async Task HandleCallAsync_SuccessfulResponse_DefaultValuesInResponseJson()
698return Task.FromResult(new HelloReply());
727public async Task HandleCallAsync_MalformedRequestBody_BadRequestReturned(string json, string expectedError)
732return Task.FromResult(new HelloReply());
759public async Task HandleCallAsync_MalformedRequestBody_RepeatedBody_BadRequestReturned(string json, string expectedError)
764return Task.FromResult(new HelloReply());
794public async Task HandleCallAsync_BadContentType_BadRequestReturned(string contentType)
799return Task.FromResult(new HelloReply());
822public async Task HandleCallAsync_RpcExceptionReturned_StatusReturned()
827return Task.FromException<HelloReply>(new RpcException(new Status(StatusCode.Unauthenticated, "Detail!"), "Message!"));
846public async Task HandleCallAsync_RpcExceptionThrown_StatusReturned()
875public async Task HandleCallAsync_RpcExceptionThrown_StatusDetailsReturned()
956public async Task HandleCallAsync_OtherExceptionThrown_StatusDetailsReturned()
1034public async Task HandleCallAsync_OtherExceptionThrown_StatusReturned()
1062public async Task HandleCallAsync_EnableDetailedErrors_OtherExceptionThrown_StatusReturned()
1092public async Task HandleCallAsync_StatusSet_StatusReturned()
1098return Task.FromResult(new HelloReply());
1117public async Task HandleCallAsync_HttpBodyRequest_RawRequestAvailable()
1130return Task.FromResult(new HelloReply { Message = $"Hello {name}!" });
1165public async Task HandleCallAsync_HttpBodyRequestLarge_RawRequestAvailable(int requestSize, bool sendContentLength)
1175return Task.FromResult(new HelloReply { Message = $"Hello {requestData.Length}!" });
1213public async Task HandleCallAsync_NullBody_WrapperType_Error()
1218return Task.FromResult(new HelloReply());
1244public async Task HandleCallAsync_WrapperType_Success(string requestJson, float? expectedValue)
1251return Task.FromResult(new HelloReply());
1274public async Task HandleCallAsync_HttpBodyRequest_NoBody_RawRequestAvailable()
1284return Task.FromResult(new HelloReply());
1304public async Task HandleCallAsync_SubHttpBodyRequest_RawRequestAvailable()
1311return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" });
1341public async Task HandleCallAsync_HttpBodyResponse_BodyReturned()
1346return Task.FromResult(new HttpBody
1372public async Task HandleCallAsync_UserState_HttpContextInUserState()
1380return Task.FromResult(new HelloReply());
1394public async Task HandleCallAsync_HasInterceptor_InterceptorCalled()
1402return Task.FromResult(new HelloReply());
1428public async Task HandleCallAsync_GetHostAndMethodAndPeer_MatchHandler()
1440return Task.FromResult(new HelloReply());
1456public async Task HandleCallAsync_ExceptionThrown_StatusReturned()
1480public async Task HandleCallAsync_MatchingRepeatedQueryStringValues_SetOnRequestMessage()
1487return Task.FromResult(new HelloReply());
1508public async Task HandleCallAsync_DataTypes_SetOnRequestMessage()
1515return Task.FromResult(new HelloReply());
1566public async Task HandleCallAsync_GetHttpContext_ReturnValue()
1572return Task.FromResult(new HelloReply());
1580public async Task HandleCallAsync_ServerCallContextFeature_ReturnValue()
1586return Task.FromResult(new HelloReply());
1599public async Task HandleCallAsync_IntegerEnum_SetOnRequestMessage(string value, HelloRequest.Types.DataTypes.Types.NestedEnum expectedEnum)
1616public async Task HandleCallAsync_InvalidEnum_Error(string value)
1639return handler != null ? handler(r, c) : Task.FromResult(new HelloReply());
1652public async Task HandleCallAsync_Wrappers_SetOnRequestMessage()
1659return Task.FromResult(new HelloReply());
1694public async Task HandleCallAsync_Any_Success()
1701return Task.FromResult(new HelloReply
1743public async Task HandleCallAsync_MatchingQueryStringValues_CustomDeserialization_SetOnRequestMessage()
1750return Task.FromResult(new HelloReply());
1779public async Task HandleCallAsync_MatchingQueryStringValues_KnownType_FieldSetter_SetOnRequestMessage()
1786return Task.FromResult(new HelloReply());
Microsoft.AspNetCore.Grpc.Microbenchmarks (1)
Microsoft.AspNetCore.Grpc.Swagger.Tests (5)
Microsoft.AspNetCore.HeaderPropagation (1)
Microsoft.AspNetCore.HeaderPropagation.Tests (34)
Microsoft.AspNetCore.HostFiltering (3)
Microsoft.AspNetCore.HostFiltering.Tests (11)
Microsoft.AspNetCore.Hosting (19)
Microsoft.AspNetCore.Hosting.Abstractions (4)
Microsoft.AspNetCore.Hosting.FunctionalTests (5)
Microsoft.AspNetCore.Hosting.Server.Abstractions (3)
Microsoft.AspNetCore.Hosting.Tests (116)
WebHostTests.cs (61)
25public async Task WebHostThrowsWithNoServer()
38public async Task NoDefaultAddressesAndDoNotPreferHostingUrlsIfNotConfigured()
50public async Task UsesLegacyConfigurationForAddressesAndDoNotPreferHostingUrlsIfNotConfigured()
88public async Task UsesNewConfigurationOverLegacyConfigForAddressesAndDoNotPreferHostingUrlsIfNotConfigured()
120public async Task PreferHostingUrlsWhenAddressIsConfigured()
156public async Task WebHostShutsDownWhenTokenTriggers()
171var runInBackground = host.RunAsync(cts.Token);
194public async Task WebHostStopAsyncUsesDefaultTimeoutIfGivenTokenDoesNotFire()
207return Task.Run(() =>
226var task = host.StopAsync(cts.Token);
228Assert.Equal(task, await Task.WhenAny(task, Task.Delay(TimeSpan.FromSeconds(10))));
233public async Task WebHostStopAsyncUsesDefaultTimeoutIfNoTokenProvided()
246return Task.Run(() =>
262var task = host.StopAsync();
264Assert.Equal(task, await Task.WhenAny(task, Task.Delay(TimeSpan.FromSeconds(10))));
269public async Task WebHostStopAsyncCanBeCancelledEarly()
282return Task.Run(() =>
300var task = host.StopAsync(cts.Token);
303Assert.Equal(task, await Task.WhenAny(task, Task.Delay(TimeSpan.FromSeconds(8))));
346var runHostAndVerifyApplicationStopped = Task.Run(async () =>
357Task.Run(() => lifetime.StopApplication());
370public async Task WebHostDisposesServiceProvider()
403public async Task WebHostNotifiesApplicationStarted()
424public async Task WebHostNotifiesAllIApplicationLifetimeCallbacksEvenIfTheyThrow()
457public async Task WebHostDoesNotNotifyAllIApplicationLifetimeEventsCallbacksIfTheyThrow()
481public async Task WebHostStopApplicationDoesNotFireStopOnHostedService()
521public async Task HostedServiceCanInjectApplicationLifetime()
545public async Task HostedServiceStartNotCalledIfWebHostNotStarted()
569public async Task WebHostStopApplicationFiresStopOnHostedService()
622public async Task WebHostDisposeApplicationFiresStopOnHostedService()
666public async Task WebHostDoesNotNotifyAllIHostedServicesAndIApplicationLifetimeCallbacksIfTheyThrow()
705public async Task WebHostInjectsHostingEnvironment()
860public async Task IsEnvironment_Extension_Is_Case_Insensitive()
872public async Task WebHost_CreatesDefaultRequestIdentifierFeature_IfNotPresent()
883return Task.CompletedTask;
894public async Task WebHost_DoesNot_CreateDefaultRequestIdentifierFeature_IfPresent()
904return Task.CompletedTask;
922public async Task WebHost_InvokesConfigureMethodsOnlyOnce()
938public async Task WebHost_HttpContextUseAfterRequestEnd_Fails()
948return Task.CompletedTask;
1019public async Task DisposeAsync_DisposesAppConfiguration()
1043public async Task DoesNotCallServerStopIfServerStartHasNotBeenCalled()
1062public async Task DoesNotCallServerStopIfServerStartHasNotBeenCalledIHostedService()
1162public Task StartAsync(CancellationToken token)
1165return Task.CompletedTask;
1168public Task StopAsync(CancellationToken token)
1171return Task.CompletedTask;
1193public Task StartAsync(CancellationToken token)
1196return Task.CompletedTask;
1198public Task StopAsync(CancellationToken token)
1201return Task.CompletedTask;
1247public Task StartAsync<TContext>(IHttpApplication<TContext> application, CancellationToken cancellationToken)
1263return Task.CompletedTask;
1266public Task StopAsync(CancellationToken cancellationToken)
1276return Task.CompletedTask;
1430public void OnCompleted(Func<object, Task> callback, object state) { }
1432public void OnStarting(Func<object, Task> callback, object state) { }
Microsoft.AspNetCore.Hosting.TestSites (4)
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (8)
Microsoft.AspNetCore.Http (26)
Microsoft.AspNetCore.Http.Abstractions (39)
Extensions\UseMiddlewareExtensions.cs (6)
86if (!typeof(Task).IsAssignableFrom(invokeMethod.ReturnType))
88throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNonTaskReturnType(InvokeMethodName, InvokeAsyncMethodName, nameof(Task)));
199private static Func<T, HttpContext, IServiceProvider, Task> ReflectionFallback<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
221return (Task)methodInfo.Invoke(middleware, BindingFlags.DoNotWrapExceptions, binder: null, methodArguments, culture: null)!;
225private static Func<T, HttpContext, IServiceProvider, Task> CompileExpression<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
290var lambda = Expression.Lambda<Func<T, HttpContext, IServiceProvider, Task>>(body, instanceArg, httpContextArg, providerArg);
Microsoft.AspNetCore.Http.Abstractions.Tests (77)
EndpointHttpContextExtensionsTests.cs (6)
45var initial = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
78var endpoint = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
92var initialEndpoint = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
100var endpoint = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
114var initialEndpoint = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
135var initialEndpoint = new Endpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test endpoint");
MapPathMiddlewareTests.cs (10)
12private static Task Success(HttpContext context)
17return Task.FromResult<object?>(null);
25private static Task NotImplemented(HttpContext context)
54public async Task PathMatchFunc_BranchTaken(string matchPath, string basePath, string requestPath, string expectedPathBase, string expectedPath)
84public async Task PathMatchAction_BranchTaken(string matchPath, string basePath, string requestPath)
112public async Task PathMatchAction_BranchTaken_WithPreserveMatchedPathSegment(string matchPath, string basePath, string requestPath)
142public async Task PathMismatchFunc_PassedThrough(string matchPath, string basePath, string requestPath)
164public async Task PathMismatchAction_PassedThrough(string matchPath, string basePath, string requestPath)
179public async Task ChainedRoutes_Success()
272return context => Task.CompletedTask;
UsePathBaseExtensionsTests.cs (11)
75public Task RequestPathBaseContainingPathBase_IsSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
89public Task RequestPathBaseNotContainingPathBase_IsNotSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
105public Task PathBaseNeverEndsWithSlash(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
113public Task PathBaseAndPathPreserveRequestCasing(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
125public Task PathBaseCanHaveUnicodeCharacters(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
137public Task PathBaseCanHavePercentCharacters(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
143public async Task PathBaseWorksAfterUseRoutingIfGlobalRouteBuilderUsed()
168public async Task PathBaseWorksBeforeUseRoutingIfGlobalRouteBuilderUsed()
190public async Task PathBaseWorksWithoutUseRoutingWithWebApplication()
209private static async Task TestPathBase(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
218return Task.FromResult(0);
Microsoft.AspNetCore.Http.Connections (67)
Internal\HttpConnectionDispatcher.cs (15)
61public async Task ExecuteAsync(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionDelegate connectionDelegate)
102public async Task ExecuteNegotiateAsync(HttpContext context, HttpConnectionDispatcherOptions options)
121private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connectionDelegate, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
156if (connection.TryActivatePersistentConnection(connectionDelegate, sse, Task.CompletedTask, context, _logger))
211var reconnectTask = Task.CompletedTask;
228reconnectTask = connection.NotifyOnReconnect?.Invoke(connection.Transport.Output) ?? Task.CompletedTask;
256var resultTask = await Task.WhenAny(connection.ApplicationTask!, connection.TransportTask!);
269await ((Task)connection.TransportTask!).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
328private async Task DoPersistentConnection(HttpConnectionContext connection)
331await Task.WhenAny(connection.ApplicationTask!, connection.TransportTask!);
336private async Task ProcessNegotiate(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
449private async Task ProcessSend(HttpContext context)
542private async Task ProcessDeleteAsync(HttpContext context)
Microsoft.AspNetCore.Http.Connections.Client (54)
Internal\ServerSentEventsTransport.cs (10)
32internal Task Running { get; private set; } = Task.CompletedTask;
47public async Task StartAsync(Uri url, TransferFormat transferFormat, CancellationToken cancellationToken = default)
89private async Task ProcessAsync(Uri url, HttpResponseMessage response)
94var receiving = ProcessEventStream(response, _transportCts.Token);
95var sending = SendUtils.SendMessages(url, _application, _httpClient, _logger, _inputCts.Token);
98var trigger = await Task.WhenAny(receiving, sending).ConfigureAwait(false);
127private async Task ProcessEventStream(HttpResponseMessage response, CancellationToken cancellationToken)
222public async Task StopAsync()
Internal\WebSocketsTransport.cs (16)
47private Func<PipeWriter, Task>? _notifyOnReconnect;
49internal Task Running { get; private set; } = Task.CompletedTask;
56public void OnReconnected(Func<PipeWriter, Task> notifyOnReconnect)
287public async Task StartAsync(Uri url, TransferFormat transferFormat, CancellationToken cancellationToken = default)
337private async Task ProcessSocketAsync(WebSocket socket, Uri url, bool isReconnect)
344var receiving = StartReceiving(socket);
345var sending = StartSending(socket, ignoreFirstCanceled: isReconnect);
354var trigger = await Task.WhenAny(receiving, sending).ConfigureAwait(false);
367var resultTask = await Task.WhenAny(sending, Task.Delay(_closeTimeout, _stopCts.Token)).ConfigureAwait(false);
433private async Task StartReceiving(WebSocket socket)
530private async Task StartSending(WebSocket socket, bool ignoreFirstCanceled)
655public async Task StopAsync()
Microsoft.AspNetCore.Http.Connections.Tests (223)
HttpConnectionDispatcherTests.cs (159)
55public async Task NegotiateVersionZeroReservesConnectionIdAndReturnsIt()
79public async Task NegotiateReservesConnectionTokenAndConnectionIdAndReturnsIt()
105public async Task CheckThatThresholdValuesAreEnforced()
127await dispatcher.ExecuteAsync(context, options, c => Task.CompletedTask);
130var writeTask = connection.Application.Output.WriteAsync(new[] { (byte)'b', (byte)'y', (byte)'t', (byte)'e', (byte)'s' });
142public async Task InvalidNegotiateProtocolVersionThrows()
170public async Task NoNegotiateVersionInQueryStringThrowsWhenMinProtocolVersionIsSet()
200public async Task CheckThatThresholdValuesAreEnforcedWithSends(HttpTransportType transportType)
239var executeTask = dispatcher.ExecuteAsync(context, new HttpConnectionDispatcherOptions(), app);
255public async Task NegotiateReturnsAvailableTransportsAfterFilteringByOptions(HttpTransportType transports)
290public async Task EndpointsThatAcceptConnectionId404WhenUnknownConnectionIdProvided(HttpTransportType transportType)
333public async Task EndpointsThatAcceptConnectionId404WhenUnknownConnectionIdProvidedForPost()
369public async Task PostNotAllowedForWebSocketConnections()
407public async Task PostReturns404IfConnectionDisposed()
446public async Task TransportEndingGracefullyWaitsOnApplication(HttpTransportType transportType)
486var task = dispatcher.ExecuteAsync(context, new HttpConnectionDispatcherOptions(), app);
507public async Task TransportEndingGracefullyWaitsOnApplicationLongPolling()
550var task = dispatcher.ExecuteAsync(context, new HttpConnectionDispatcherOptions(), app);
573public async Task PostSendsToConnection(HttpTransportType transportType)
623public async Task PostSendsToConnectionInParallel(HttpTransportType transportType)
637var executeTask1 = DispatcherExecuteAsync(dispatcher, connection, callerTracker, waitTcs.Task);
638var executeTask2 = DispatcherExecuteAsync(dispatcher, connection, callerTracker, waitTcs.Task);
642await Task.WhenAll(executeTask1, executeTask2);
645async Task DispatcherExecuteAsync(HttpConnectionDispatcher dispatcher, HttpConnectionContext connection, SemaphoreSlim callerTracker, Task waitTask)
679private readonly Task _waitTask;
681public TrackingMemoryStream(SemaphoreSlim callerTracker, Task waitTask)
687public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
709public async Task ResponsesForLongPollingHaveCacheHeaders()
733var pollTask = dispatcher.ExecuteAsync(pollContext, options, app);
742public async Task HttpContextFeatureForLongpollingWorksBetweenPolls()
789var task = dispatcher.ExecuteAsync(context, new HttpConnectionDispatcherOptions(), app);
844public async Task EndpointsThatRequireConnectionId400WhenNoConnectionIdProvided(HttpTransportType transportType)
884public async Task IOExceptionWhenReadingRequestReturns400Response(HttpTransportType transportType)
913await dispatcher.ExecuteAsync(context, new HttpConnectionDispatcherOptions(), c => Task.CompletedTask);
921public async Task EndpointsThatRequireConnectionId400WhenNoConnectionIdProvidedForPost()
954public async Task EndPointThatOnlySupportsLongPollingRejectsOtherTransports(HttpTransportType transportType, int status)
966public async Task EndPointThatOnlySupportsSSERejectsOtherTransports(HttpTransportType transportType, int status)
978public async Task EndPointThatOnlySupportsWebSockesRejectsOtherTransports(HttpTransportType transportType, int status)
988public async Task EndPointThatOnlySupportsWebSocketsAndSSERejectsLongPolling(HttpTransportType transportType, int status)
997public async Task CompletedEndPointEndsConnection()
1025public async Task SynchronousExceptionEndsConnection()
1057public async Task CompletedEndPointEndsLongPollingConnection()
1089public async Task Metrics()
1128public async Task Metrics_ListenStartAfterConnection_Empty()
1180public async Task LongPollingTimeoutSets200StatusCode()
1220public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
1243public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1269public async Task LongPollingConnectionClosesWhenSendTimeoutReached()
1296var dispatcherTask = dispatcher.ExecuteAsync(context, options, app);
1317public async Task SSEConnectionClosesWhenSendTimeoutReached()
1335var dispatcherTask = dispatcher.ExecuteAsync(context, options, app);
1356public async Task WebSocketConnectionClosesWhenSendTimeoutReached()
1379var dispatcherTask = dispatcher.ExecuteAsync(context, options, app);
1400public async Task WebSocketTransportTimesOutWhenCloseFrameNotReceived()
1421var task = dispatcher.ExecuteAsync(context, options, app);
1430public async Task RequestToActiveConnectionId409ForStreamingTransports(HttpTransportType transportType)
1451var request1 = dispatcher.ExecuteAsync(context1, options, app);
1460var webSocketTask = Task.CompletedTask;
1475public async Task RequestToActiveConnectionIdKillsPreviousConnectionLongPolling()
1494var request1 = dispatcher.ExecuteAsync(context1, options, app);
1503await Task.Delay(15);
1510var request2 = dispatcher.ExecuteAsync(context2, options, app);
1523await Task.Delay(15);
1540public async Task MultipleRequestsToActiveConnectionId409ForLongPolling()
1561var request1 = dispatcher.ExecuteAsync(context1, options, app);
1570var request2 = dispatcher.ExecuteAsync(context2, options, app);
1577var completedTask = await Task.WhenAny(request1, request2).DefaultTimeout();
1604public async Task RequestToDisposedConnectionIdReturns404(HttpTransportType transportType)
1635public async Task ConnectionStateSetToInactiveAfterPoll()
1653var task = dispatcher.ExecuteAsync(context, options, app);
1670public async Task BlockingConnectionWorksWithStreamingConnections()
1688var task = dispatcher.ExecuteAsync(context, options, app);
1704public async Task BlockingConnectionWorksWithLongPollingConnection()
1724var task = dispatcher.ExecuteAsync(context, options, app);
1746public async Task AttemptingToPollWhileAlreadyPollingReplacesTheCurrentPoll()
1765var task1 = dispatcher.ExecuteAsync(context1, options, app);
1769var task2 = dispatcher.ExecuteAsync(context2, options, app);
1793public async Task TransferModeSet(HttpTransportType transportType, TransferFormat? expectedTransferFormats)
1825public async Task LongPollingKeepsWindowsPrincipalAndIdentityBetweenRequests()
1862var connectionHandlerTask = dispatcher.ExecuteAsync(context, options, app);
1877public async Task LongPollingKeepsWindowsIdentityWithoutWindowsPrincipalBetweenRequests()
1914var connectionHandlerTask = dispatcher.ExecuteAsync(context, options, app);
1932public async Task WindowsIdentityNotClosed(HttpTransportType transportType)
1977public async Task SetsInherentKeepAliveFeatureOnFirstLongPollingRequest()
2009public async Task DeleteEndpointRejectsRequestToTerminateNonLongPollingTransport(HttpTransportType transportType)
2050public async Task DeleteEndpointGracefullyTerminatesLongPolling()
2069var pollTask = dispatcher.ExecuteAsync(context, options, app);
2103public async Task DeleteEndpointGracefullyTerminatesLongPollingEvenWhenBetweenPolls()
2151public async Task DeleteEndpointTerminatesLongPollingWithHangingApplication()
2174var pollTask = dispatcher.ExecuteAsync(context, options, app);
2206public async Task PollCanReceiveFinalMessageAfterAppCompletes()
2258public async Task NegotiateDoesNotReturnWebSocketsWhenNotAvailable()
2284public async Task NegotiateDoesNotReturnUseStatefulReconnectWhenNotEnabledOnServer()
2313public async Task NegotiateDoesNotReturnUseStatefulReconnectWhenEnabledOnServerButNotRequestedByClient()
2342public async Task NegotiateReturnsUseStatefulReconnectWhenEnabledOnServerAndRequestedByClient()
2371public async Task ReconnectStopsPreviousConnection()
2392var initialWebSocketTask = dispatcher.ExecuteAsync(context, options, app);
2414return Task.CompletedTask;
2422var newWebSocketTask = dispatcher.ExecuteAsync(context, options, app);
2446public async Task DisableReconnectDisallowsReplacementConnection()
2466var initialWebSocketTask = dispatcher.ExecuteAsync(context, options, app);
2488return Task.CompletedTask;
2529public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
2538public async Task WriteThatIsDisposedBeforeCompleteReturns404()
2580var sendTask = dispatcher.ExecuteAsync(context, options, app);
2586var disposeTask = connection.DisposeAsync().DefaultTimeout();
2601public async Task CanDisposeWhileWriteLockIsBlockedOnBackpressureAndResponseReturns404()
2643var sendTask = dispatcher.ExecuteAsync(context, options, app);
2658public async Task LongPollingCanPollIfWritePipeHasBackpressure()
2700var sendTask = dispatcher.ExecuteAsync(context, options, app).DefaultTimeout();
2714public async Task ErrorDuringPollWillCloseConnection()
2745var pollTask = dispatcher.ExecuteAsync(pollContext, options, app);
2757public async Task LongPollingConnectionClosingTriggersConnectionClosedToken()
2780var pollTask = dispatcher.ExecuteAsync(context, options, app);
2814public async Task SSEConnectionClosingTriggersConnectionClosedToken()
2840public async Task WebSocketConnectionClosingTriggersConnectionClosedToken()
2870public async Task ServerClosingClosesWebSocketConnection()
2889var executeTask = dispatcher.ExecuteAsync(context, options, app);
2918public async Task AbortingConnectionAbortsHttpContextAndTriggersConnectionClosedToken()
2951public async Task ServicesAvailableWithLongPolling()
2975var pollTask = dispatcher.ExecuteAsync(pollContext, options, app);
3002public async Task ServicesPreserveScopeWithLongPolling()
3032var pollTask = dispatcher.ExecuteAsync(pollContext, options, app);
3057public async Task DisposeLongPollingConnectionDisposesServiceScope()
3104public async Task LongRunningActivityTagSetOnExecuteAsync()
3140public async Task ConnectionClosedRequestedTriggeredOnAuthExpiration()
3161var pollTask = dispatcher.ExecuteAsync(context, options, app);
3192public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithJWT(HttpTransportType transportType)
3227return Task.CompletedTask;
3269AccessTokenProvider = () => Task.FromResult(token),
3292public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithCookies(HttpTransportType transportType)
3354public async Task AuthenticationExpirationUsesCorrectScheme(HttpTransportType transportType)
3389return Task.CompletedTask;
3431AccessTokenProvider = () => Task.FromResult(token),
3451public async Task AuthenticationExpirationSetToMaxValueByDefault()
3491public async Task RequestTimeoutDisabledWhenConnected(HttpTransportType transportType)
3564public async Task DisableRequestTimeoutInLongPolling()
3588var pollTask = dispatcher.ExecuteAsync(context, options, app);
3682private static async Task CheckTransportSupported(HttpTransportType supportedTransports, HttpTransportType transportType, int status, ILoggerFactory loggerFactory)
3806public override Task OnConnectedAsync(ConnectionContext connection)
3815public override Task OnConnectedAsync(ConnectionContext connection)
3819return Task.CompletedTask;
3825public override Task OnConnectedAsync(ConnectionContext connection)
3833public override Task OnConnectedAsync(ConnectionContext connection)
3835return Task.CompletedTask;
3841public override async Task OnConnectedAsync(ConnectionContext connection)
3876public Task Started => _startedTcs.Task;
3878public override async Task OnConnectedAsync(ConnectionContext connection)
3903public override async Task OnConnectedAsync(ConnectionContext connection)
3933public override async Task OnConnectedAsync(ConnectionContext connection)
3960public override async Task OnConnectedAsync(ConnectionContext connection)
3990public override async Task OnConnectedAsync(ConnectionContext connection)
4032private Task NotifyReconnect(PipeWriter writer)
4037return Task.CompletedTask;
4043public override void OnCompleted(Func<object, Task> callback, object state)
4047public override void OnStarting(Func<object, Task> callback, object state)
Microsoft.AspNetCore.Http.Extensions (76)
RequestDelegateFactory.cs (44)
106private static readonly MemberExpression CompletedTaskExpr = Expression.Property(null, (PropertyInfo)GetMemberInfo<Func<Task>>(() => Task.CompletedTask));
314private static Func<object?, HttpContext, Task>? CreateTargetableRequestDelegate(
522if (returnType == typeof(Task))
1074if (returnType == typeof(Task))
1225private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegate(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1232var continuation = Expression.Lambda<Func<object?, HttpContext, object?[], Task>>(
1252return Expression.Lambda<Func<object?, HttpContext, Task>>(
1266private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForJson(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1280var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1317var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
1399private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForForm(
1415var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1449var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
2359private static Task ExecuteValueTaskOfObject(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2361static async Task ExecuteAwaited(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2374private static Task ExecuteTaskOfObject(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2376static async Task ExecuteAwaited(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2389private static Task ExecuteAwaitedReturn(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2394private static Task ExecuteTaskOfTFast<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2398static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2411private static Task ExecuteTaskOfT<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2415static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2428private static Task ExecuteTaskOfString(Task<string?> task, HttpContext httpContext)
2433static async Task ExecuteAwaited(Task<string> task, HttpContext httpContext)
2446private static Task ExecuteWriteStringResponseAsync(HttpContext httpContext, string text)
2452private static Task ExecuteValueTask(ValueTask task)
2454static async Task ExecuteAwaited(ValueTask task)
2462return Task.CompletedTask;
2468private static ValueTask<object?> ExecuteTaskWithEmptyResult(Task task)
2470static async ValueTask<object?> ExecuteAwaited(Task task)
2501private static Task ExecuteValueTaskOfTFast<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2503static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2516private static Task ExecuteValueTaskOfT<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2518static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2531private static Task ExecuteValueTaskOfString(ValueTask<string?> task, HttpContext httpContext)
2535static async Task ExecuteAwaited(ValueTask<string> task, HttpContext httpContext)
2548private static Task ExecuteValueTaskResult<T>(ValueTask<T?> task, HttpContext httpContext) where T : IResult
2550static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext)
2563private static async Task ExecuteTaskResult<T>(Task<T?> task, HttpContext httpContext) where T : IResult
2570private static async Task ExecuteResultWriteResponse(IResult? result, HttpContext httpContext)
2577private static Task WriteJsonResponseFast<T>(HttpResponse response, T value, JsonTypeInfo<T> jsonTypeInfo)
2580private static Task WriteJsonResponse<T>(HttpResponse response, T? value, JsonTypeInfo<T> jsonTypeInfo)
2775private static void EnsureRequestTaskNotNull(Task? task)
SendFileResponseExtensions.cs (6)
25public static Task SendFileAsync(this HttpResponse response, IFileInfo file, CancellationToken cancellationToken = default)
43public static Task SendFileAsync(this HttpResponse response, IFileInfo file, long offset, long? count, CancellationToken cancellationToken = default)
59public static Task SendFileAsync(this HttpResponse response, string fileName, CancellationToken cancellationToken = default)
77public static Task SendFileAsync(this HttpResponse response, string fileName, long offset, long? count, CancellationToken cancellationToken = default)
85private static async Task SendFileAsyncCore(HttpResponse response, IFileInfo file, long offset, long? count, CancellationToken cancellationToken)
112private static async Task SendFileAsyncCore(HttpResponse response, string fileName, long offset, long? count, CancellationToken cancellationToken = default)
Microsoft.AspNetCore.Http.Extensions.Tests (477)
RequestDelegateFactoryTests.cs (100)
54Task TaskTestAction(HttpContext httpContext)
57return Task.CompletedTask;
71Task StaticTaskTestAction(HttpContext httpContext)
74return Task.CompletedTask;
91new object[] { (Func<HttpContext, Task>)TaskTestAction },
94new object[] { (Func<HttpContext, Task>)StaticTaskTestAction },
102public async Task RequestDelegateInvokesAction(Delegate @delegate)
131public async Task StaticMethodInfoOverloadWorksWithBasicReflection()
164public async Task NonStaticMethodInfoOverloadWorksWithBasicReflection()
238public async Task NullRouteParametersPrefersRouteOverQueryString()
267public async Task CreatingDelegateWithInstanceMethodInfoCreatesInstancePerCall()
478await Task.Yield();
496await Task.Yield();
579public async Task RequestDelegateHandlesDoesNotHandleArraysFromQueryStringWhenBodyIsInferred(Delegate action, string[]? queryValues, object? expectedParameterValue)
601public async Task RequestDelegateHandlesOptionalArraysFromNullQueryString()
625public async Task RequestDelegateHandlesNullableStringValuesFromExplicitQueryStringSource()
660public async Task RequestDelegateHandlesNullableStringValuesFromExplicitQueryStringSourceForUnpresentedValues()
688public async Task RequestDelegateCanAwaitValueTasksThatAreNotImmediatelyCompleted()
743public async Task RequestDelegateThrowsForTryParsableFailuresIfThrowOnBadRequestWithNonOptionalArrays()
841public async Task RequestDelegatePopulatesFromBodyParameter(Delegate action)
884public async Task RequestDelegateRejectsEmptyBodyGivenExplicitFromBodyParameter(Delegate action)
1135public async Task RequestDelegateRequiresServiceForAllImplicitFromServiceParameters(Delegate action)
1151public async Task RequestDelegateWithExplicitFromServiceParameters(Delegate action)
1168public async Task RequestDelegatePopulatesParametersFromServiceWithAndWithoutAttribute(Delegate action)
1193public async Task RequestDelegatePopulatesHttpContextParameterWithoutAttribute()
1213public async Task RequestDelegatePassHttpContextRequestAbortedAsCancellationToken()
1237public async Task RequestDelegatePassHttpContextUserAsClaimsPrincipal()
1258public async Task RequestDelegatePassHttpContextRequestAsHttpRequest()
1278public async Task RequestDelegatePassesHttpContextRresponseAsHttpResponse()
1309Task<JsonTodo> TaskTestAction() => Task.FromResult<JsonTodo>(originalTodo);
1312await Task.Yield();
1319await Task.Yield();
1339public async Task RequestDelegateWritesMembersFromChildTypesToJsonResponseBody_WithJsonPolymorphicOptions(Delegate @delegate)
1371public async Task RequestDelegateWritesJsonTypeDiscriminatorToJsonResponseBody_WithJsonPolymorphicOptions(Delegate @delegate)
1422Task<CustomResult> TaskTestAction() => Task.FromResult(new CustomResult(resultString));
1427static Task<CustomResult> StaticTaskTestAction() => Task.FromResult(new CustomResult("Still not enough tests!"));
1435static Task<object> StaticTaskOfIResultAsObject() => Task.FromResult<object>(new CustomResult("Still not enough tests!"));
1440Task<StructResult> TaskTestStructAction() => Task.FromResult(new StructResult(resultString));
1472public async Task RequestDelegateUsesCustomIResult(Delegate @delegate)
1495Task<IResult?> TaskTestAction() => Task.FromResult<IResult?>(null);
1511public async Task RequestDelegateThrowsInvalidOperationExceptionOnNullDelegate(Delegate @delegate, string message)
1556public async Task RequestDelegateHandlesRouteParamOptionality(Delegate @delegate, string paramName, string? routeParam, bool isInvalid, string? expectedResponse)
1661public async Task RequestDelegateHandlesBindAsyncOptionality(Delegate routeHandler, bool includeReferer, bool isInvalid, bool isStruct)
1732public async Task RequestDelegateHandlesServiceParamOptionality(Delegate @delegate, bool hasService, bool isInvalid)
1767public async Task CanSetStringParamAsOptionalWithNullabilityDisability(bool provideValue, string expectedResponse)
1797public async Task CanSetParseableStringParamAsOptionalWithNullabilityDisability(bool provideValue, string expectedResponse)
1827public async Task TreatsUnknownNullabilityAsOptionalForReferenceType(bool provideValue, string expectedResponse)
1857public async Task CanExecuteRequestDelegateWithResultsExtension()
1899public async Task RequestDelegateCanProcessUriValues(Delegate @delegate, string uri, string expectedResponse)
1922public async Task RequestDelegateThrowsBadHttpRequestExceptionWhenReadingOversizeFormResultsIn413BadRequest()
1955public async Task RequestDelegateThrowsBadHttpRequestExceptionWhenReadingOversizeJsonBodyResultsIn413BadRequest()
2150public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithNullTargetFactory()
2186public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithProvidedTargetFactory()
2246await Task.Yield();
2257await Task.Yield();
2273public async Task CanInvokeFilter_OnFSharpAsyncOfTReturningHandler(Delegate @delegate)
2315Task TaskMethod()
2317return Task.CompletedTask;
2322return Task.FromResult(default(FSharp.Core.Unit)!);
2332await Task.Yield();
2335async Task TaskWithYieldMethod()
2337await Task.Yield();
2346await Task.Yield();
2356new object[] { (Func<Task>)TaskMethod },
2360new object[] { (Func<Task>)TaskWithYieldMethod},
2368public async Task CanInvokeFilter_OnVoidReturningHandler(Delegate @delegate)
2395public async Task CanInvokeFilter_OnTaskModifyingHttpContext()
2399async Task HandlerWithTaskAwait(HttpContext c)
2402await Task.Yield();
2422var request = requestDelegate(httpContext);
2442await Task.Yield();
2448return Task.FromResult(new TodoStruct { Name = "Test todo" });
2453await Task.Yield();
2468await Task.Yield();
2487public async Task CanInvokeFilter_OnHandlerReturningTasksOfStruct(Delegate @delegate)
2632var @delegate = () => Task.FromResult(new AddsCustomEndpointMetadataResult());
2693var @delegate = () => Task.FromResult(new CountsDefaultEndpointMetadataResult());
2945var @delegate = (Todo todo) => Task.FromResult(new RemovesAcceptsMetadataResult());
3040RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
3068RequestDelegate requestDelegate = static context => Task.CompletedTask;
3082public async Task RDF_CanAssertOnEmptyResult()
3124public async Task RequestDelegateFactory_AsParameters_SupportsNullableRequiredMember()
3178public async Task RequestDelegateFactory_AsParameters_SupportsRequiredMember_NullabilityDisabled()
3295public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
3327public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3337public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3348public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
3413public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3604public Task ExecuteAsync(HttpContext httpContext)
3619public Task ExecuteAsync(HttpContext httpContext)
3745public Task StartAsync(CancellationToken cancellationToken = default)
3748return Task.CompletedTask;
3751public Task CompleteAsync()
3754return Task.CompletedTask;
3757public Task SendFileAsync(string path, long offset, long? count, CancellationToken cancellationToken = default)
3760return Task.CompletedTask;
3767public void OnStarting(Func<object, Task> callback, object state)
3771public void OnCompleted(Func<object, Task> callback, object state)
Microsoft.AspNetCore.Http.Features (9)
Microsoft.AspNetCore.Http.Microbenchmarks (27)
Microsoft.AspNetCore.Http.Results (80)
Microsoft.AspNetCore.Http.Results.Tests (236)
ResultsOfTTests.Generated.cs (61)
41public async Task ResultsOfTResult1TResult2_ExecuteResult_ExecutesAssignedResult(int input)
103public async Task ResultsOfTResult1TResult2_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
128public async Task ResultsOfTResult1TResult2_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
154public async Task ResultsOfTResult1TResult2_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
181public async Task ResultsOfTResult1TResult2_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
255public async Task ResultsOfTResult1TResult2TResult3_ExecuteResult_ExecutesAssignedResult(int input)
319public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
346public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
373public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
401public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
430public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
459public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
538public async Task ResultsOfTResult1TResult2TResult3TResult4_ExecuteResult_ExecutesAssignedResult(int input)
604public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
633public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
662public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
691public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
721public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
752public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
783public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
814public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
898public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_ExecuteResult_ExecutesAssignedResult(int input)
966public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
997public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
1028public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
1059public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
1090public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFifthTypeArg(int input, Type expectedResultType)
1122public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
1155public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
1188public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
1221public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
1254public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFifthTypeArg(int input, Type expectedResultType)
1343public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_ExecuteResult_ExecutesAssignedResult(int input)
1413public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
1446public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
1479public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
1512public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
1545public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFifthTypeArg(int input, Type expectedResultType)
1578public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsSixthTypeArg(int input, Type expectedResultType)
1612public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
1647public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
1682public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
1717public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
1752public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFifthTypeArg(int input, Type expectedResultType)
1787public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsSixthTypeArg(int input, Type expectedResultType)
1850public Task ExecuteAsync(HttpContext httpContext)
1853return Task.CompletedTask;
1863public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1877public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1891public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1905public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1919public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1933public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
1946public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
ResultsTests.cs (3)
303_ => Results.Stream((s) => Task.CompletedTask, contentType, fileDownloadName, lastModified, entityTag)
374Assert.Throws<ArgumentNullException>("streamWriterCallback", () => TypedResults.Stream(default(Func<Stream, Task>)));
1688(() => Results.Stream(s => Task.CompletedTask, null, null, null, null), typeof(PushStreamHttpResult)),
Microsoft.AspNetCore.Http.Tests (89)
Microsoft.AspNetCore.HttpLogging (23)
Microsoft.AspNetCore.HttpLogging.Tests (119)
Microsoft.AspNetCore.HttpOverrides (8)
Microsoft.AspNetCore.HttpOverrides.Tests (53)
ForwardedHeadersMiddlewareTest.cs (36)
18public async Task XForwardedForDefaultSettingsChangeRemoteIpAndPort()
53public async Task XForwardedForFirstValueIsInvalid(int limit, string header, string expectedIp, int expectedPort)
107public async Task XForwardedForForwardLimit(int limit, string header, string expectedIp, int expectedPort, string remainingHeader, bool requireSymmetry)
150public async Task XForwardedForLoopback(string originalIp, bool expectForwarded)
216public async Task XForwardedForForwardKnownIps(int limit, string header, string knownIPs, string expectedIp, int expectedPort, bool requireSymmetry)
255public async Task XForwardedForOverrideBadIpDoesntChangeRemoteIp()
284public async Task XForwardedHostOverrideChangesRequestHost()
348public async Task XForwardedHostAllowsValidCharacters(string hostHeader)
367return Task.FromResult(0);
433public async Task XForwardedHostFailsForInvalidCharacters(string hostHeader)
452return Task.FromResult(0);
484public async Task XForwardedHostAllowsSpecifiedHost(string hostHeader, string allowedHost)
503return Task.FromResult(0);
535public async Task XForwardedHostFailsMismatchedHosts(string hostHeader, string allowedHost)
554return Task.FromResult(0);
570public async Task XForwardedHostStopsAtFirstUnspecifiedHost()
590return Task.FromResult(0);
613public async Task XForwardedProtoOverrideChangesRequestProtocol(int limit, string header, string expected)
660public async Task XForwardedProtoAcceptsValidProtocols(string scheme)
679return Task.FromResult(0);
717public async Task XForwardedProtoRejectsInvalidProtocols(string scheme)
736return Task.FromResult(0);
761public async Task XForwardedProtoOverrideLimitedByXForwardedForCount(int limit, string protoHeader, string forHeader, string expected)
803public async Task XForwardedProtoOverrideCanBeIndependentOfXForwardedForCount(int limit, string protoHeader, string forHeader, string expected)
847public async Task XForwardedProtoOverrideLimitedByLoopback(string protoHeader, string forHeader, string remoteIp, bool loopback, string expected)
896public async Task AllForwardsEnabledChangeRequestRemoteIpHostProtocolAndPathBase()
931public async Task AllOptionsDisabledRequestDoesntChange()
966public async Task PartiallyEnabledForwardsPartiallyChangesRequest()
1004public async Task XForwardForIPv4ToIPv6Mapping(string forHeader, string knownProxies, string knownNetworks, string expectedRemoteIp)
1051public async Task ForwardersWithDIOptionsRunsOnce(int limit, string header, string expectedScheme, string remainingHeader)
1091public async Task ForwardersWithDirectOptionsRunsTwice(int limit, string header, string expectedScheme, string remainingHeader)
1133public async Task XForwardedPrefixReplaceEmptyPathBase(
1173public async Task XForwardedPrefixReplaceNonEmptyPathBase(
1213public async Task XForwardedPrefixInvalidPath(string forwardedPrefix)
1248public async Task XForwardedPrefixParameterCountMismatch(
1299public async Task XForwardedPrefixTruncateConsumedValues(
Microsoft.AspNetCore.HttpsPolicy (3)
Microsoft.AspNetCore.HttpsPolicy.Tests (19)
Microsoft.AspNetCore.Identity (40)
SignInManager.cs (13)
162public virtual async Task RefreshSignInAsync(TUser user)
194public virtual Task SignInAsync(TUser user, bool isPersistent, string? authenticationMethod = null)
205public virtual Task SignInAsync(TUser user, AuthenticationProperties authenticationProperties, string? authenticationMethod = null)
223public virtual Task SignInWithClaimsAsync(TUser user, bool isPersistent, IEnumerable<Claim> additionalClaims)
233public virtual async Task SignInWithClaimsAsync(TUser user, AuthenticationProperties? authenticationProperties, IEnumerable<Claim> additionalClaims)
251public virtual async Task SignOutAsync()
449public virtual async Task RememberTwoFactorClientAsync(TUser user)
461public virtual Task ForgetTwoFactorClientAsync()
724/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
909return Task.FromResult(SignInResult.LockedOut);
934/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
935protected virtual async Task ResetLockout(TUser user)
964var resetLockoutTask = ResetLockout(user);
Microsoft.AspNetCore.Identity.EntityFrameworkCore (75)
UserOnlyStore.cs (27)
137/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
138protected Task SaveChanges(CancellationToken cancellationToken)
140return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.CompletedTask;
148/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
164/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
190/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
215/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
231/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
305/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
306public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
315return Task.FromResult(false);
325/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
326public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
347/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
348public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
369/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
370public override Task AddLoginAsync(TUser user, UserLoginInfo login,
378return Task.FromResult(false);
388/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
389public override async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
408/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
427/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
464/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
497protected override Task AddUserTokenAsync(TUserToken token)
500return Task.CompletedTask;
508protected override Task RemoveUserTokenAsync(TUserToken token)
511return Task.CompletedTask;
UserStore.cs (32)
139/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
140protected Task SaveChanges(CancellationToken cancellationToken)
142return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.CompletedTask;
150/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
166/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
192/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
217/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
233/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
316/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
317public override async Task AddToRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken))
338/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
339public override async Task RemoveFromRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken))
420/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
421public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
430return Task.FromResult(false);
440/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
441public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
462/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
463public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
484/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
485public override Task AddLoginAsync(TUser user, UserLoginInfo login,
493return Task.FromResult(false);
503/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
504public override async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
523/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
542/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
579/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
602/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
640protected override Task AddUserTokenAsync(TUserToken token)
643return Task.CompletedTask;
651protected override Task RemoveUserTokenAsync(TUserToken token)
654return Task.CompletedTask;
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (50)
Microsoft.AspNetCore.Identity.FunctionalTests (97)
MapIdentityApiTests.cs (47)
41public async Task CanRegisterUser(string addIdentityMode)
50public async Task RegisterFailsGivenNoEmail()
60public async Task RegisterFailsGivenInvalidEmail(string addIdentityMode)
71public async Task RegisterFailsGivenDuplicateEmail(string addIdentityMode)
82public async Task LoginFailsGivenUnregisteredUser()
92public async Task LoginFailsGivenWrongPassword()
104public async Task CanLoginWithBearerToken(string addIdentityMode)
130public async Task CanChangeAccessTokenResponseJsonOptions(string addIdentityMode)
161public async Task CanCustomizeBearerTokenExpiration()
205public async Task CanLoginWithCookies()
228public async Task CannotLoginWithCookiesWithOnlyCoreServices()
240public async Task CanReadBearerTokenFromQueryString()
251return Task.CompletedTask;
273public async Task Returns401UnauthorizedStatusGivenNoBearerTokenOrCookie(string addIdentityMode)
289public async Task CanUseRefreshToken(string addIdentityMode)
308public async Task Returns401UnauthorizedStatusGivenNullOrEmptyRefreshToken()
321public async Task CanCustomizeRefreshTokenExpiration()
378public async Task RefreshReturns401UnauthorizedIfSecurityStampChanges()
397public async Task RefreshUpdatesUserFromStore()
423public async Task LoginCanBeLockedOut()
452public async Task LockoutCanBeDisabled()
478public async Task AccountConfirmationCanBeEnabled()
503public async Task EmailConfirmationCanBeEnabled()
528public async Task EmailConfirmationCanBeResent()
566public async Task AccountConfirmationEmailCanBeCustomized()
587public async Task CanAddEndpointsToMultipleRouteGroupsForSameUserType()
616public async Task CanAddEndpointsToMultipleRouteGroupsForMultipleUsersTypes()
664public async Task CanEnableAndLoginWithTwoFactor(string addIdentityMode)
722public async Task CanLoginWithRecoveryCodeAndDisableTwoFactor()
774public async Task CanResetSharedKey()
821public async Task CanResetRecoveryCodes()
890public async Task CanUsePersistentTwoFactorCookies()
948public async Task CanResetPassword()
1019public async Task CanChangeEmail(string addIdentityModes)
1110public async Task CannotUpdateClaimsDuringInfoPostWithCookies()
1195public async Task CanChangePasswordWithoutResetEmail()
1218public async Task MustSendValidRequestToSendEmailChangeConfirmation()
1380private async Task RegisterAsync(HttpClient client, string? groupPrefix = null, string? email = null)
1446private static async Task AssertProblemAsync(HttpResponseMessage response, string? detail, string? title = null, HttpStatusCode status = HttpStatusCode.Unauthorized)
1456private static async Task AssertValidationProblemAsync(HttpResponseMessage response, string error)
1501return Task.FromResult(true);
1514public Task SendEmailAsync(string email, string subject, string htmlMessage)
1517return Task.CompletedTask;
1526public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink)
1530return Task.CompletedTask;
1533public Task SendPasswordResetCodeAsync(ApplicationUser user, string email, string resetCode) =>
1536public Task SendPasswordResetLinkAsync(ApplicationUser user, string email, string resetLink) =>
Microsoft.AspNetCore.Identity.InMemory.Test (113)
InMemoryStore.cs (26)
18public Task AddToRoleAsync(TUser user, string role, CancellationToken cancellationToken = default(CancellationToken))
25return Task.FromResult(0);
29public Task RemoveFromRoleAsync(TUser user, string role, CancellationToken cancellationToken = default(CancellationToken))
37return Task.FromResult(0);
47return Task.FromResult(roles);
54return Task.FromResult(result);
65return Task.FromResult<IList<TUser>>(new List<TUser>());
67return Task.FromResult<IList<TUser>>(Users.Where(u => (u.Roles.Where(x => x.RoleId == role.Id).Any())).Select(x => x).ToList());
75return Task.FromResult(IdentityResult.Success);
85return Task.FromResult(IdentityResult.Success);
90return Task.FromResult(role.Id);
95return Task.FromResult(role.Name);
98public Task SetRoleNameAsync(TRole role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
101return Task.FromResult(0);
107return Task.FromResult(IdentityResult.Success);
114return Task.FromResult(_roles[roleId]);
116return Task.FromResult<TRole>(null);
122Task.FromResult(
129return Task.FromResult<IList<Claim>>(claims);
132public Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken))
135return Task.FromResult(0);
138public Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken))
147return Task.FromResult(0);
152return Task.FromResult(role.NormalizedName);
155public Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
158return Task.FromResult(0);
InMemoryUserStore.cs (71)
36return Task.FromResult<IList<Claim>>(claims);
39public Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
45return Task.FromResult(0);
48public Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
56return Task.FromResult(0);
59public Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
71return Task.FromResult(0);
74public Task SetEmailAsync(TUser user, string email, CancellationToken cancellationToken = default(CancellationToken))
77return Task.FromResult(0);
82return Task.FromResult(user.Email);
87return Task.FromResult(user.NormalizedEmail);
90public Task SetNormalizedEmailAsync(TUser user, string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
93return Task.FromResult(0);
98return Task.FromResult(user.EmailConfirmed);
101public Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
104return Task.FromResult(0);
110Task.FromResult(
116return Task.FromResult(user.LockoutEnd);
119public Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
122return Task.FromResult(0);
128return Task.FromResult(user.AccessFailedCount);
131public Task ResetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
134return Task.FromResult(0);
139return Task.FromResult(user.AccessFailedCount);
144return Task.FromResult(user.LockoutEnabled);
147public Task SetLockoutEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
150return Task.FromResult(0);
158public virtual Task AddLoginAsync(TUser user, UserLoginInfo login,
169return Task.FromResult(0);
172public Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
185return Task.FromResult(0);
192return Task.FromResult(result);
200return Task.FromResult(_logins[key]);
202return Task.FromResult<TUser>(null);
207return Task.FromResult(user.Id);
212return Task.FromResult(user.UserName);
215public Task SetUserNameAsync(TUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
218return Task.FromResult(0);
224return Task.FromResult(IdentityResult.Success);
230return Task.FromResult(IdentityResult.Success);
237return Task.FromResult(_users[userId]);
239return Task.FromResult<TUser>(null);
249Task.FromResult(
260return Task.FromResult(IdentityResult.Success);
263public Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken = default(CancellationToken))
266return Task.FromResult(0);
271return Task.FromResult(user.PasswordHash);
276return Task.FromResult(user.PasswordHash != null);
279public Task SetPhoneNumberAsync(TUser user, string phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
282return Task.FromResult(0);
287return Task.FromResult(user.PhoneNumber);
292return Task.FromResult(user.PhoneNumberConfirmed);
295public Task SetPhoneNumberConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
298return Task.FromResult(0);
301public Task SetSecurityStampAsync(TUser user, string stamp, CancellationToken cancellationToken = default(CancellationToken))
304return Task.FromResult(0);
309return Task.FromResult(user.SecurityStamp);
312public Task SetTwoFactorEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
315return Task.FromResult(0);
320return Task.FromResult(user.TwoFactorEnabled);
325return Task.FromResult(user.NormalizedUserName);
328public Task SetNormalizedUserNameAsync(TUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
331return Task.FromResult(0);
342return Task.FromResult<IList<TUser>>(query.ToList());
345public Task SetTokenAsync(TUser user, string loginProvider, string name, string value, CancellationToken cancellationToken)
366return Task.FromResult(0);
369public Task RemoveTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
380return Task.FromResult(0);
390return Task.FromResult(tokenEntity?.TokenValue);
397public Task SetAuthenticatorKeyAsync(TUser user, string key, CancellationToken cancellationToken)
407public Task ReplaceCodesAsync(TUser user, IEnumerable<string> recoveryCodes, CancellationToken cancellationToken)
Microsoft.AspNetCore.Identity.Specification.Tests (117)
Microsoft.AspNetCore.Identity.Test (361)
RoleManagerTest.cs (16)
11public async Task CreateCallsStore()
18store.Setup(s => s.GetRoleNameAsync(role, CancellationToken.None)).Returns(Task.FromResult(role.Name)).Verifiable();
19store.Setup(s => s.SetNormalizedRoleNameAsync(role, normalizer.NormalizeName(role.Name), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
31public async Task UpdateCallsStore()
38store.Setup(s => s.GetRoleNameAsync(role, CancellationToken.None)).Returns(Task.FromResult(role.Name)).Verifiable();
39store.Setup(s => s.SetNormalizedRoleNameAsync(role, normalizer.NormalizeName(role.Name), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
59public async Task FindByNameCallsStoreWithNormalizedName()
65store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName("Foo"), CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable();
77public async Task CanFindByNameCallsStoreWithoutNormalizedName()
82store.Setup(s => s.FindByNameAsync(role.Name, CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable();
95public async Task RoleExistsCallsStoreWithNormalizedName()
101store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName("Foo"), CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable();
121public async Task RoleManagerPublicNullChecks()
134public async Task RoleStoreMethodsThrowWhenDisposed()
178public Task SetRoleNameAsync(PocoRole role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
203public Task SetNormalizedRoleNameAsync(PocoRole role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
SecurityStampValidatorTest.cs (22)
26public Task ChallengeAsync(AuthenticationProperties properties)
31public Task ForbidAsync(AuthenticationProperties properties)
41public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
46public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties)
51public Task SignOutAsync(AuthenticationProperties properties)
58public async Task OnValidatePrincipalThrowsWithEmptyServiceCollection()
71public async Task OnValidatePrincipalTestSuccess(bool isPersistent)
95private async Task RunApplicationCookieTest(PocoUser user, Mock<HttpContext> httpContext, bool shouldStampValidate, Func<Task> testCode)
118authService.Setup(c => c.SignOutAsync(httpContext.Object, IdentityConstants.TwoFactorRememberMeScheme, /*properties*/null)).Returns(Task.CompletedTask).Verifiable();
131public async Task OnValidateIdentityRejectsWhenValidateSecurityStampFails()
154public async Task OnValidateIdentityAcceptsWhenStoreDoesNotSupportSecurityStamp()
197public async Task OnValidateIdentityRejectsWhenNoIssuedUtc()
213authService.Setup(c => c.SignOutAsync(httpContext.Object, IdentityConstants.TwoFactorRememberMeScheme, /*properties*/null)).Returns(Task.CompletedTask).Verifiable();
236public async Task OnValidateIdentityDoesNotRejectsWhenNotExpired()
272public async Task OnValidateIdentityDoesNotExtendExpirationWhenSlidingIsDisabled()
287signInManager.Setup(s => s.ValidateSecurityStampAsync(It.IsAny<ClaimsPrincipal>())).Returns(Task.FromResult(user));
288signInManager.Setup(s => s.CreateUserPrincipalAsync(It.IsAny<PocoUser>())).Returns(Task.FromResult(new ClaimsPrincipal(new ClaimsIdentity("auth"))));
320private async Task RunRememberClientCookieTest(bool shouldStampValidate, bool validationSuccess)
338authService.Setup(c => c.SignOutAsync(httpContext.Object, IdentityConstants.TwoFactorRememberMeScheme, /*properties*/null)).Returns(Task.CompletedTask).Verifiable();
362public Task TwoFactorRememberClientOnValidatePrincipalTestSuccess()
366public Task TwoFactorRememberClientOnValidatePrincipalRejectsWhenValidateSecurityStampFails()
SignInManagerTest.cs (69)
31public async Task PasswordSignInReturnsLockedOutWhenLockedOut()
61public async Task CheckPasswordSignInReturnsLockedOutWhenLockedOut()
118public async Task CanPasswordSignIn(bool isPersistent)
141public async Task CanPasswordSignInWithNoLogger()
165public async Task PasswordSignInWorksWithNonTwoFactorStore()
193public async Task CheckPasswordOnlyResetLockoutWhenTfaNotEnabledOrRemembered(bool tfaEnabled, bool tfaRemembered)
235public async Task CheckPasswordAlwaysResetLockoutWhenQuirked()
263public async Task PasswordSignInRequiresVerification(bool supportsLockout)
275manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable();
285It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
300public async Task ExternalSignInRequiresVerificationIfNotBypassed(bool bypass)
313manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable();
329It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
346return Task.FromResult(true);
355public async Task CanTwoFactorAuthenticatorSignIn(string providerName, bool isPersistent, bool rememberClient)
383It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
396public async Task TwoFactorAuthenticatorSignInFailWithoutLockout()
429public async Task TwoFactorAuthenticatorSignInAsyncReturnsLockedOut()
440return Task.FromResult(IdentityResult.Success);
444manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout));
476public async Task IsTwoFactorEnabled(bool userManagerSupportsTwoFactor, bool userTwoFactorEnabled, bool hasValidProviders)
513public async Task CanTwoFactorRecoveryCodeSignIn(bool supportsLockout, bool externalLogin)
537It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
538auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
539auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
562public async Task CanExternalSignIn(bool isPersistent, bool supportsLockout)
595public async Task CanResignIn(
617.Returns(Task.FromResult(authResult)).Verifiable();
626signInManager.Setup(s => s.SignInWithClaimsAsync(user, It.IsAny<AuthenticationProperties>(), It.IsAny<IEnumerable<Claim>>())).Returns(Task.FromResult(0)).Verifiable();
654public async Task CanTwoFactorSignIn(bool isPersistent, bool supportsLockout, bool externalLogin, bool rememberClient)
681It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
684auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
685auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
697It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
713public async Task TwoFactorSignInAsyncReturnsLockedOut()
724return Task.FromResult(IdentityResult.Success);
727manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout));
748public async Task RememberClientStoresUserId()
761It.Is<AuthenticationProperties>(v => v.IsPersistent == true))).Returns(Task.FromResult(0)).Verifiable();
774public async Task RememberBrowserSkipsTwoFactorVerificationSignIn(bool isPersistent)
782manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable();
813public async Task SignOutCallsContextResponseSignOut()
819auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ApplicationScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
820auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
821auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable();
832public async Task PasswordSignInFailsWithWrongPassword()
857public async Task PasswordSignInFailsWithUnknownUser()
875public async Task PasswordSignInFailsWithWrongPasswordCanAccessFailedAndLockout()
884return Task.FromResult(IdentityResult.Success);
887manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout));
902public async Task CheckPasswordSignInFailsWithWrongPasswordCanAccessFailedAndLockout()
911return Task.FromResult(IdentityResult.Success);
914manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout));
931public async Task CanRequireConfirmedEmailForPasswordSignIn(bool confirmed)
983It.Is<AuthenticationProperties>(v => isPersistent == null || v.IsPersistent == isPersistent))).Returns(Task.FromResult(0)).Verifiable();
989public async Task CanRequireConfirmedPhoneNumberForPasswordSignIn(bool confirmed)
1030public async Task GetExternalLoginInfoAsyncReturnsCorrectProviderDisplayName()
1061public async Task GetExternalLoginInfoAsyncWithOidcSubClaim()
1092public async Task ExternalLoginInfoAsyncReturnsAuthenticationPropertiesWithCustomValue()
1136public async Task CheckPasswordSignInFailsWhenResetLockoutFails(string signInManagerTypeName)
1159public async Task PasswordSignInWorksWhenResetLockoutReturnsNullIdentityResult(string signInManagerTypeName)
1184public async Task TwoFactorSignFailsWhenResetLockoutFails()
1222public async Task CheckPasswordSignInLockedOutResultIsDependentOnTheAccessFailedAsyncResult(IdentityResult accessFailedResult, SignInResult expectedSignInResult)
1248public async Task TwoFactorSignInLockedOutResultIsDependentOnTheAccessFailedAsyncResult(IdentityResult accessFailedResult, SignInResult expectedSignInResult)
1320protected override async Task ResetLockout(TUser user)
1337protected override Task ResetLockout(TUser user)
1344return Task.CompletedTask;
1360public Task<IEnumerable<AuthenticationScheme>> GetAllSchemesAsync() => Task.FromResult<IEnumerable<AuthenticationScheme>>(_defaultCookieSchemes.Values);
1361public Task<AuthenticationScheme> GetSchemeAsync(string name) => Task.FromResult(_defaultCookieSchemes.TryGetValue(name, out var scheme) ? scheme : null);
UserManagerTest.cs (205)
63public async Task CreateCallsStore()
70store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable();
71store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
83public async Task CreateUpdatesSecurityStampStore()
89store.Setup(s => s.GetSecurityStampAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.SecurityStamp)).Verifiable();
90store.Setup(s => s.SetSecurityStampAsync(user, It.IsAny<string>(), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
102public async Task CreateCallsUpdateEmailStore()
109store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable();
110store.Setup(s => s.GetEmailAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.Email)).Verifiable();
111store.Setup(s => s.SetNormalizedEmailAsync(user, normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
112store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
124public async Task DeleteCallsStore()
141public async Task UpdateCallsStore()
147store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable();
148store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
161public async Task UpdateWillUpdateNormalizedEmail()
167store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable();
168store.Setup(s => s.GetEmailAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.Email)).Verifiable();
169store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
170store.Setup(s => s.SetNormalizedEmailAsync(user, normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
183public async Task SetUserNameCallsStore()
189store.Setup(s => s.SetUserNameAsync(user, "foo", CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
190store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult("foo")).Verifiable();
191store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName("foo"), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
192store.Setup(s => s.UpdateAsync(user, CancellationToken.None)).Returns(Task.FromResult(IdentityResult.Success)).Verifiable();
204public async Task FindByIdCallsStore()
209store.Setup(s => s.FindByIdAsync(user.Id, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
221public async Task FindByNameCallsStoreWithNormalizedName()
227store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
239public async Task CanFindByNameCallsStoreWithoutNormalizedName()
244store.Setup(s => s.FindByNameAsync(user.UserName, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
257public async Task FindByEmailCallsStoreWithNormalizedEmail()
263store.Setup(s => s.FindByEmailAsync(normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
275public async Task CanFindByEmailCallsStoreWithoutNormalizedEmail()
280store.Setup(s => s.FindByEmailAsync(user.Email, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
299public async Task FindByEmailCallsStoreWithCustomNormalizedEmail()
304store.Setup(s => s.FindByEmailAsync("@Foo", CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
317public async Task FindByNameCallsStoreWithCustomNormalizedName()
322store.Setup(s => s.FindByNameAsync("#Foo", CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable();
335public async Task AddToRolesCallsStore()
343.Returns(Task.FromResult(0))
346.Returns(Task.FromResult(0))
349.Returns(Task.FromResult(0))
354.Returns(Task.FromResult(false))
357.Returns(Task.FromResult(false))
360.Returns(Task.FromResult(false))
374public async Task AddToRolesCallsStoreWithCustomNameNormalizer()
381.Returns(Task.FromResult(0))
384.Returns(Task.FromResult(0))
387.Returns(Task.FromResult(0))
392.Returns(Task.FromResult(false))
395.Returns(Task.FromResult(false))
398.Returns(Task.FromResult(false))
413public async Task AddToRolesFailsIfUserInRole()
421.Returns(Task.FromResult(0))
424.Returns(Task.FromResult(true))
437public async Task RemoveFromRolesCallsStore()
445.Returns(Task.FromResult(0))
448.Returns(Task.FromResult(0))
451.Returns(Task.FromResult(0))
455.Returns(Task.FromResult(true))
458.Returns(Task.FromResult(true))
461.Returns(Task.FromResult(true))
474public async Task RemoveFromRolesFailsIfNotInRole()
482.Returns(Task.FromResult(0))
485.Returns(Task.FromResult(true))
488.Returns(Task.FromResult(false))
501public async Task AddClaimsCallsStore()
508.Returns(Task.FromResult(0))
522public async Task AddClaimCallsStore()
529.Returns(Task.FromResult(0))
543public async Task UpdateClaimCallsStore()
551.Returns(Task.FromResult(0))
553store.Setup(s => s.UpdateAsync(user, CancellationToken.None)).Returns(Task.FromResult(IdentityResult.Success)).Verifiable();
565public async Task CheckPasswordWillRehashPasswordWhenNeeded()
578store.Setup(s => s.SetPasswordHashAsync(user, It.IsAny<string>(), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable();
579store.Setup(x => x.UpdateAsync(It.IsAny<PocoUser>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(IdentityResult.Success));
596public async Task CreateFailsWithNullSecurityStamp()
613public async Task UpdateFailsWithNullSecurityStamp()
630public async Task RemoveClaimsCallsStore()
637.Returns(Task.FromResult(0))
651public async Task RemoveClaimCallsStore()
658.Returns(Task.FromResult(0))
672public async Task CheckPasswordWithNullUserReturnsFalse()
687public async Task UsersEmailMethodsFailWhenStoreNotImplemented()
699public async Task UsersPhoneNumberMethodsFailWhenStoreNotImplemented()
709public async Task TokenMethodsThrowWithNoTokenProvider()
720public async Task PasswordMethodsFailWhenStoreNotImplemented()
733public async Task SecurityStampMethodsFailWhenStoreNotImplemented()
736store.Setup(x => x.GetUserIdAsync(It.IsAny<PocoUser>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(Guid.NewGuid().ToString()));
748public async Task LoginMethodsFailWhenStoreNotImplemented()
759public async Task ClaimMethodsFailWhenStoreNotImplemented()
868public Task SetNormalizedUserNameAsync(PocoUser user, string normalizedName, CancellationToken cancellationToken)
873public Task SetUserNameAsync(PocoUser user, string userName, CancellationToken cancellationToken)
902public async Task TwoFactorStoreMethodsFailWhenStoreNotImplemented()
912public async Task LockoutStoreMethodsFailWhenStoreNotImplemented()
925public async Task RoleMethodsFailWhenStoreNotImplemented()
938public async Task AuthTokenMethodsFailWhenStoreNotImplemented()
949public async Task AuthenticatorMethodsFailWhenStoreNotImplemented()
959public async Task RecoveryMethodsFailWhenStoreNotImplemented()
968private async Task VerifyException<TException>(Func<Task> code, string expectedMessage) where TException : Exception
983public async Task PasswordValidatorBlocksCreate()
993public async Task PasswordValidatorWithoutErrorsBlocksCreate()
1002public async Task ResetTokenCallNoopForTokenValueZero()
1016public async Task ManagerPublicNullChecks()
1046public async Task MethodsFailWithUnknownUserTest()
1147public async Task MethodsThrowWhenDisposedTest()
1204=> Task.FromResult(badResult);
1220return Task.FromResult<IList<Claim>>(new List<Claim>());
1223public Task AddClaimsAsync(PocoUser user, IEnumerable<Claim> claim, CancellationToken cancellationToken = default(CancellationToken))
1225return Task.FromResult(0);
1228public Task ReplaceClaimAsync(PocoUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
1230return Task.FromResult(0);
1233public Task RemoveClaimsAsync(PocoUser user, IEnumerable<Claim> claim, CancellationToken cancellationToken = default(CancellationToken))
1235return Task.FromResult(0);
1238public Task SetEmailAsync(PocoUser user, string email, CancellationToken cancellationToken = default(CancellationToken))
1240return Task.FromResult(0);
1245return Task.FromResult("");
1250return Task.FromResult(false);
1253public Task SetEmailConfirmedAsync(PocoUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
1255return Task.FromResult(0);
1260return Task.FromResult<PocoUser>(null);
1265return Task.FromResult<DateTimeOffset?>(DateTimeOffset.MinValue);
1268public Task SetLockoutEndDateAsync(PocoUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
1270return Task.FromResult(0);
1275return Task.FromResult(0);
1278public Task ResetAccessFailedCountAsync(PocoUser user, CancellationToken cancellationToken = default(CancellationToken))
1280return Task.FromResult(0);
1285return Task.FromResult(0);
1290return Task.FromResult(false);
1293public Task SetLockoutEnabledAsync(PocoUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
1295return Task.FromResult(0);
1298public Task AddLoginAsync(PocoUser user, UserLoginInfo login, CancellationToken cancellationToken = default(CancellationToken))
1300return Task.FromResult(0);
1303public Task RemoveLoginAsync(PocoUser user, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken))
1305return Task.FromResult(0);
1310return Task.FromResult<IList<UserLoginInfo>>(new List<UserLoginInfo>());
1315return Task.FromResult<PocoUser>(null);
1322public Task SetUserNameAsync(PocoUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
1324return Task.FromResult(0);
1329return Task.FromResult(IdentityResult.Success);
1334return Task.FromResult(IdentityResult.Success);
1339return Task.FromResult(IdentityResult.Success);
1344return Task.FromResult<PocoUser>(null);
1349return Task.FromResult<PocoUser>(null);
1352public Task SetPasswordHashAsync(PocoUser user, string passwordHash, CancellationToken cancellationToken = default(CancellationToken))
1354return Task.FromResult(0);
1359return Task.FromResult<string>(null);
1364return Task.FromResult(false);
1367public Task SetPhoneNumberAsync(PocoUser user, string phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
1369return Task.FromResult(0);
1374return Task.FromResult("");
1379return Task.FromResult(false);
1382public Task SetPhoneNumberConfirmedAsync(PocoUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
1384return Task.FromResult(0);
1387public Task AddToRoleAsync(PocoUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
1389return Task.FromResult(0);
1392public Task RemoveFromRoleAsync(PocoUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
1394return Task.FromResult(0);
1399return Task.FromResult<IList<string>>(new List<string>());
1404return Task.FromResult(false);
1407public Task SetSecurityStampAsync(PocoUser user, string stamp, CancellationToken cancellationToken = default(CancellationToken))
1409return Task.FromResult(0);
1414return Task.FromResult("");
1417public Task SetTwoFactorEnabledAsync(PocoUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
1419return Task.FromResult(0);
1424return Task.FromResult(false);
1429return Task.FromResult<string>(null);
1434return Task.FromResult<string>(null);
1439return Task.FromResult<string>(null);
1442public Task SetNormalizedUserNameAsync(PocoUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
1444return Task.FromResult(0);
1449return Task.FromResult<IList<PocoUser>>(new List<PocoUser>());
1454return Task.FromResult<IList<PocoUser>>(new List<PocoUser>());
1459return Task.FromResult("");
1462public Task SetNormalizedEmailAsync(PocoUser user, string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
1464return Task.FromResult(0);
1474return Task.FromResult("Test");
1479return Task.FromResult(true);
1484return Task.FromResult(true);
1503public Task AddClaimsAsync(PocoUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
1508public Task ReplaceClaimAsync(PocoUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
1513public Task RemoveClaimsAsync(PocoUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
1518public Task SetEmailAsync(PocoUser user, string email, CancellationToken cancellationToken = default(CancellationToken))
1533public Task SetEmailConfirmedAsync(PocoUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
1548public Task SetLockoutEndDateAsync(PocoUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
1558public Task ResetAccessFailedCountAsync(PocoUser user, CancellationToken cancellationToken = default(CancellationToken))
1573public Task SetLockoutEnabledAsync(PocoUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
1578public Task AddLoginAsync(PocoUser user, UserLoginInfo login, CancellationToken cancellationToken = default(CancellationToken))
1583public Task RemoveLoginAsync(PocoUser user, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken))
1613public Task SetUserNameAsync(PocoUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
1628public Task SetPasswordHashAsync(PocoUser user, string passwordHash, CancellationToken cancellationToken = default(CancellationToken))
1643public Task SetPhoneNumberAsync(PocoUser user, string phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
1658public Task SetPhoneNumberConfirmedAsync(PocoUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
1663public Task SetTwoFactorEnabledAsync(PocoUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
1673public Task AddToRoleAsync(PocoUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
1678public Task RemoveFromRoleAsync(PocoUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
1698public Task SetNormalizedUserNameAsync(PocoUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
1733public Task SetNormalizedEmailAsync(PocoUser user, string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
1740public async Task CanCustomizeUserValidatorErrors()
1760.Returns(Task.FromResult(user2))
1763.Returns(Task.FromResult(user2.Id))
1766.Returns(Task.FromResult(user.UserName))
1769.Returns(Task.FromResult(user.Email))
Microsoft.AspNetCore.Identity.UI (20)
Microsoft.AspNetCore.InternalTesting (34)
src\Shared\TaskExtensions.cs (12)
34public static Task DefaultTimeout(this Task task, int milliseconds = DefaultTimeoutDuration, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
44public static Task DefaultTimeout(this ValueTask task, int milliseconds = DefaultTimeoutDuration, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
96if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token)).ConfigureAwait(false))
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
131if (task == await Task.WhenAny(task, Task.Delay(timeout, cts.Token)).ConfigureAwait(false))
Microsoft.AspNetCore.InternalTesting.Tests (64)
Microsoft.AspNetCore.Localization (6)
Microsoft.AspNetCore.Localization.FunctionalTests (11)
Microsoft.AspNetCore.Localization.Routing (1)
Microsoft.AspNetCore.Localization.Routing.Tests (3)
Microsoft.AspNetCore.Localization.Tests (40)
Microsoft.AspNetCore.MiddlewareAnalysis (1)
Microsoft.AspNetCore.MiddlewareAnalysis.Tests (1)
Microsoft.AspNetCore.Mvc.Abstractions (31)
Microsoft.AspNetCore.Mvc.Api.Analyzers (5)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (7)
Microsoft.AspNetCore.Mvc.Core (294)
Infrastructure\ControllerActionInvoker.cs (27)
59private Task Next(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
75var task = BindArgumentsAsync();
128var task = filter.OnActionExecutionAsync(actionExecutingContext, InvokeNextActionFilterAwaitedAsync);
208var task = InvokeNextActionFilterAsync();
246var task = InvokeActionMethodAsync();
269return Task.CompletedTask;
281return Task.CompletedTask;
289private Task InvokeNextActionFilterAsync()
299var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
315return Task.CompletedTask;
317static async Task Awaited(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
349var task = InvokeNextActionFilterAsync();
356return Task.FromResult<ActionExecutedContext>(_actionExecutedContext);
358static async Task<ActionExecutedContext> Awaited(ControllerActionInvoker invoker, Task task)
379private Task InvokeActionMethodAsync()
400return Task.CompletedTask;
402static async Task Awaited(ControllerActionInvoker invoker, ValueTask<IActionResult> actionResultValueTask)
407static async Task Logged(ControllerActionInvoker invoker)
454protected override Task InvokeInnerFilterAsync()
465var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
472return Task.CompletedTask;
478return Task.FromException(ex);
481static async Task Awaited(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
512private Task BindArgumentsAsync()
520return Task.CompletedTask;
Infrastructure\ResourceInvoker.cs (71)
57public virtual Task InvokeAsync()
67Task task;
74return Awaited(this, Task.FromException(exception), scope);
84static async Task Awaited(ResourceInvoker invoker, Task task, IDisposable? scope)
96static async Task Logged(ResourceInvoker invoker)
213private Task InvokeFilterPipelineAsync()
232var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
239return Task.CompletedTask;
245return Task.FromException(ex);
248static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
259protected abstract Task InvokeInnerFilterAsync();
261protected virtual Task InvokeResultAsync(IActionResult result)
270static async Task Logged(ResourceInvoker invoker, IActionResult result)
289private Task Next(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
347var task = filter.OnAuthorizationAsync(authorizationContext);
483var task = filter.OnResourceExecutionAsync(resourceExecutingContext, InvokeNextResourceFilterAwaitedAsync);
561var task = InvokeNextResourceFilter();
605var task = InvokeAlwaysRunResultFilters();
654var task = InvokeNextExceptionFilterAsync();
681var task = filter.OnExceptionAsync(exceptionContext);
721var task = InvokeNextExceptionFilterAsync();
792var task = InvokeAlwaysRunResultFilters();
809return Task.CompletedTask;
825var task = InvokeResultFilters();
836var task = InvokeInnerFilterAsync();
853return Task.CompletedTask;
857var task = InvokeResultFilters();
886return Task.CompletedTask;
898return Task.CompletedTask;
916var task = InvokeNextResourceFilter();
923return Task.FromResult<ResourceExecutedContext>(_resourceExecutedContext);
925static async Task<ResourceExecutedContext> Awaited(ResourceInvoker invoker, Task task)
945private Task InvokeNextResourceFilter()
956var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
972return Task.CompletedTask;
974static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
997private Task InvokeNextExceptionFilterAsync()
1008var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
1015return Task.CompletedTask;
1021return Task.FromException(ex);
1024static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1045private Task InvokeAlwaysRunResultFilters()
1056var lastTask = ResultNext<IAlwaysRunResultFilter, IAsyncAlwaysRunResultFilter>(ref next, ref scope, ref state, ref isCompleted);
1063return Task.CompletedTask;
1069return Task.FromException(ex);
1072static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1083private Task InvokeResultFilters()
1094var lastTask = ResultNext<IResultFilter, IAsyncResultFilter>(ref next, ref scope, ref state, ref isCompleted);
1101return Task.CompletedTask;
1107return Task.FromException(ex);
1110static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1121private Task ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
1180var task = filter.OnResultExecutionAsync(resultExecutingContext, InvokeNextResultFilterAwaitedAsync<TFilter, TFilterAsync>);
1262var task = InvokeNextResultFilterAsync<TFilter, TFilterAsync>();
1312var task = InvokeResultAsync(_result);
1334return Task.CompletedTask;
1338return Task.CompletedTask;
1346private Task InvokeNextResultFilterAsync<TFilter, TFilterAsync>()
1358var lastTask = ResultNext<TFilter, TFilterAsync>(ref next, ref scope, ref state, ref isCompleted);
1375return Task.CompletedTask;
1377static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1412var task = InvokeNextResultFilterAsync<TFilter, TFilterAsync>();
1419return Task.FromResult<ResultExecutedContext>(_resultExecutedContext);
1421static async Task<ResultExecutedContext> Awaited(ResourceInvoker invoker, Task task)
Microsoft.AspNetCore.Mvc.Core.Test (813)
Routing\DynamicControllerEndpointMatcherPolicyTest.cs (13)
48new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(actions[0]), "Test1"),
49new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(actions[1]), "Test2"),
50new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(actions[2]), "Test3"),
54_ => Task.CompletedTask,
99public async Task ApplyAsync_NoMatch()
129public async Task ApplyAsync_HasMatchNoEndpointFound()
160public async Task ApplyAsync_HasMatchFindsEndpoint_WithoutRouteValues()
206public async Task ApplyAsync_ThrowsForTransformerWithInvalidLifetime()
237public async Task ApplyAsync_HasMatchFindsEndpoint_WithRouteValues()
294public async Task ApplyAsync_CanDiscardFoundEndpoints()
333public async Task ApplyAsync_CanReplaceFoundEndpoints()
356new Endpoint((ctx) => Task.CompletedTask, new EndpointMetadataCollection(Array.Empty<object>()), "ReplacedEndpoint")
395public async Task ApplyAsync_CanExpandTheListOfFoundEndpoints()
Microsoft.AspNetCore.Mvc.Core.TestCommon (108)
Microsoft.AspNetCore.Mvc.Cors (3)
Microsoft.AspNetCore.Mvc.Cors.Test (10)
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (73)
Microsoft.AspNetCore.Mvc.FunctionalTests (1020)
FileResultTests.cs (39)
23public async Task FileFromDisk_CanBeEnabled_WithMiddleware()
43public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequest(long start, long end, string expectedBody)
65public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequestIgnored(string rangeString)
85public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequestNotSatisfiable(string rangeString)
107public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequest_WithLastModifiedAndEtag(long start, long end, string expectedBody)
129public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequestIgnored_WithLastModifiedAndEtag(string rangeString)
149public async Task FileFromDisk_CanBeEnabled_WithMiddleware_RangeRequestNotSatisfiable_WithLastModifiedAndEtag(string rangeString)
170public async Task FileFromDisk_ReturnsFileWithFileName()
193public async Task FileFromDisk_ReturnsFileWithFileName_RangeProcessingNotEnabled_RangeRequestedIgnored(string httpMethod, string expectedBody)
211public async Task FileFromDisk_ReturnsFileWithFileName_IfRangeHeaderValid_RangeRequest_WithLastModifiedAndEtag()
231public async Task FileFromDisk_ReturnsFileWithFileName_IfRangeHeaderInvalid_RangeRequestIgnored_WithLastModifiedAndEtag()
260public async Task FileFromDisk_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest_WithLastModifiedAndEtag(
293public async Task FileFromDisk_ReturnsFileFromSymlink()
310public async Task FileFromStream_ReturnsFile()
330public async Task FileFromStream_ReturnsFile_RangeRequest(long start, long end, string expectedBody)
352public async Task FileFromStream_ReturnsFile_RangeRequestIgnored(string rangeString)
372public async Task FileFromStream_ReturnsFile_RangeRequestNotSatisfiable(string rangeString)
391public async Task FileFromStream_ReturnsFileWithFileName()
414public async Task FileFromStream_ReturnsFileWithFileName_RangeProcessingNotEnabled_RangeRequestedIgnored(string httpMethod, string expectedBody)
432public async Task FileFromStream_ReturnsFileWithFileName_IfRangeHeaderValid_RangeRequest()
452public async Task FileFromStream_ReturnsFileWithFileName_IfRangeHeaderInvalid_RangeRequestNotSatisfiable()
479public async Task FileFromStream_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest(
511public async Task FileFromBinaryData_ReturnsFile()
531public async Task FileFromBinaryData_ReturnsFile_RangeRequest(long start, long end, string expectedBody)
553public async Task FileFromBinaryData_ReturnsFile_RangeRequestIgnored(string rangeString)
573public async Task FileFromBinaryData_ReturnsFile_RangeRequestNotSatisfiable(string rangeString)
595public async Task FileFromBinaryData_ReturnsFileWithFileName()
618public async Task FileFromBinaryData_ReturnsFileWithFileName_RangeProcessingNotEnabled_RangeRequestedIgnored(string httpMethod, string expectedBody)
636public async Task FileFromBinaryData_ReturnsFileWithFileName_IfRangeHeaderValid()
656public async Task FileFromBinaryData_ReturnsFileWithFileName_IfRangeHeaderInvalid_RangeRequestIgnored()
685public async Task FileFromBinaryData_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest(
717public async Task FileFromEmbeddedResources_ReturnsFileWithFileName()
744public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_RangeRequest(long start, long end, string expectedBody)
768public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_RangeProcessingNotEnabled_RangeRequestedIgnored(string httpMethod, string expectedBody)
786public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_IfRangeHeaderValid_RangeRequest()
809public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_IfRangeHeaderInvalid_RangeRequestIgnored()
834public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_RangeRequestIgnored(string rangeString)
857public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_RangeRequestNotSatisfiable(string rangeString)
889public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest(
RoutingTestsBase.cs (79)
29public async Task ConventionalRoutedAction_RouteUrl_AmbientValues(string requestUrl, string controller, string action, string expectedUrl)
47public async Task ConventionalRoutedAction_RouteHasNonParameterConstraint_RouteConstraintRun_Allowed()
63public async Task ConventionalRoutedAction_RouteHasNonParameterConstraint_RouteConstraintRun_Denied()
73public async Task ConventionalRoutedAction_RouteContainsPage_RouteNotMatched()
92public async Task AttributeRoutedAction_InArea_StaysInArea_ActionDoesntExist()
113public async Task ConventionalRoutedAction_InArea_StaysInArea()
133public abstract Task HasEndpointMatch();
136public abstract Task RouteData_Routers_ConventionalRoute();
139public abstract Task RouteData_Routers_AttributeRoute();
146public async Task RouteData_DataTokens_FilterCanSetDataTokens()
178public async Task DataTokens_ReturnsDataTokensForRoute()
190public async Task DataTokens_ReturnsNoDataTokensForRoute()
202public async Task Page_PageRouteTransformer()
212public async Task Page_PageRouteTransformer_WithoutIndex()
222public async Task Page_PageRouteTransformer_RouteParameter()
234public async Task Page_PageRouteTransformer_PageWithConfiguredRoute()
246public virtual async Task ConventionalRoutedController_ActionIsReachable()
270public virtual async Task ConventionalRoutedController_ActionIsReachable_WithDefaults()
294public virtual async Task ConventionalRoutedController_NonActionIsNotReachable()
304public virtual async Task ConventionalRoutedController_InArea_ActionIsReachable()
329public virtual async Task ConventionalRoutedController_InArea_ActionBlockedByHttpMethod()
341public virtual async Task ConventionalRoutedController_WithOptionalSegment(string optionalSegment, string expected)
356public async Task AttributeRoutedAction_IsReachable()
384public async Task AttributeRoutedAction_AcceptRequestsWithValidMethods_InRoutesWithoutExtraTemplateSegmentsOnTheAction(
437public virtual async Task AttributeRoutedAction_RejectsRequestsWithWrongMethods_InRoutesWithoutExtraTemplateSegmentsOnTheAction(
454public virtual async Task AttributeRoutedAction_MultipleRouteAttributes_WorksWithNameAndOrder(string url)
478public virtual async Task AttributeRoutedAction_MultipleRouteAttributes_WorksWithOverrideRoutes()
504public virtual async Task AttributeRoutedAction_MultipleRouteAttributes_RouteAttributeTemplatesIgnoredForOverrideActions()
521public virtual async Task AttributeRoutedAction_MultipleRouteAttributes_CombinesWithMultipleHttpAttributes(
548public virtual async Task AttributeRoutedAction_MultipleHttpAttributesAndTokenReplacement(string url)
589public virtual async Task AttributeRoutedAction_MultipleRouteAttributes_WithMultipleHttpAttributes_RespectsConstraints(
605public async Task AttributeRoutedAction_IsNotReachableWithTraditionalRoute()
617public async Task AttributeRoutedAction_TriedBeforeConventionalRouting()
634public async Task AttributeRoutedAction_ControllerLevelRoute_WithActionParameter_IsReachable()
664public async Task AttributeRoutedAction_ControllerLevelRoute_IsReachable()
688public async Task AttributeRoutedAction_RouteAttributeOnAction_IsReachable(string method)
713public async Task AttributeRoutedAction_RouteAttributeOnActionAndController_IsReachable(string method)
733public async Task AttributeRoutedAction_RouteAttributeOnActionAndHttpGetOnDifferentAction_ReachesHttpGetAction()
756public async Task AttributeRoutedAction_ControllerLevelRoute_WithAcceptVerbs_IsReachable(string verb)
778public async Task AttributeRoutedAction_ControllerLevelRoute_WithAcceptVerbsAndRouteTemplate_IsReachable(string verb)
802public virtual async Task AttributeRoutedAction_AcceptVerbsAndRouteTemplate_IsReachable(string verb, string path)
823public async Task AttributeRoutedAction_WithCustomHttpAttributes_IsReachable()
846public async Task AttributeRoutedAction_ControllerLevelRoute_CombinedWithActionRoute_IsReachable(string verb, string action)
870public async Task AttributeRoutedAction_ActionLevelRouteWithTildeSlash_OverridesControllerLevelRoute()
891public async Task AttributeRoutedAction_OverrideActionOverridesOrderOnController()
912public async Task AttributeRoutedAction_OrderOnActionOverridesOrderOnController()
929public virtual async Task AttributeRoutedAction_LinkGeneration_OverrideActionOverridesOrderOnController()
940public virtual async Task AttributeRoutedAction_LinkGeneration_OrderOnActionOverridesOrderOnController()
953public virtual async Task AttributeRoutedAction_PreservesDefaultValue_IfRouteValueIsNull(string teamName, string expected)
965public virtual async Task AttributeRoutedAction_LinkToSelf()
985public virtual async Task AttributeRoutedAction_LinkWithAmbientController()
1005public virtual async Task AttributeRoutedAction_LinkToAttributeRoutedController()
1025public virtual async Task AttributeRoutedAction_LinkToConventionalController()
1047public virtual async Task AttributeRoutedAction_LinkWithName_WithNameInheritedFromControllerRoute(
1070public virtual async Task AttributeRoutedAction_LinkWithName_WithNameOverridenFromController()
1088public virtual async Task AttributeRoutedAction_Link_WithNonEmptyActionRouteTemplateAndNoActionRouteName()
1110public virtual async Task AttributeRoutedAction_LinkWithName_WithNonEmptyActionRouteTemplateAndActionRouteName()
1128public async Task ConventionalRoutedAction_DefaultValues_OptionalParameter_LinkToDefaultValuePath()
1149public async Task ConventionalRoutedAction_DefaultValues_OptionalParameter_LinkToFullPath()
1170public async Task ConventionalRoutedAction_DefaultValues_DefaultParameter_LinkToDefaultValuePath()
1192public async Task ConventionalRoutedAction_DefaultValues_DefaultParameterWithCatchAll_LinkToDefaultValuePath()
1214public async Task ConventionalRoutedAction_DefaultValues_DefaultParameter_LinkToFullPath()
1236public async Task ConventionalRoutedAction_DefaultValues_DefaultParameterMatches_LinkToShortenedPath()
1258public virtual async Task ConventionalRoutedAction_LinkToArea()
1279public virtual async Task ConventionalRoutedAction_InArea_ImplicitLinkToArea()
1299public virtual async Task ConventionalRoutedAction_InArea_ExplicitLeaveArea()
1320public virtual async Task AttributeRoutedAction_LinkToArea()
1341public virtual async Task AttributeRoutedAction_InArea_ImplicitLinkToArea()
1361public virtual async Task AttributeRoutedAction_InArea_ExplicitLeaveArea()
1382public virtual async Task AttributeRoutedAction_InArea_LinkToConventionalRoutedActionInArea()
1403public virtual async Task ConventionalRoutedAction_InArea_LinkToAttributeRoutedActionInArea()
1424public virtual async Task ConventionalRoutedAction_InArea_LinkToAnotherArea()
1445public virtual async Task AttributeRoutedAction_InArea_LinkToAnotherArea()
1471public async Task AttributeRouting_MixedAcceptVerbsAndRoute_Reachable(string path, string verb, string actionName)
1506public virtual async Task AttributeRouting_MixedAcceptVerbsAndRoute_Unreachable(string path, string verb)
1523public async Task AttributeRouting_RouteNameTokenReplace_Reachable(string path, string verb, string actionName)
1543public async Task RazorPage_WithLinks_GeneratesLinksCorrectly()
1561public async Task CanRunMiddlewareAfterRouting()
1573public async Task CanUseLinkGeneration_To_ConventionalActionWithPageParameter()
Microsoft.AspNetCore.Mvc.IntegrationTests (525)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (116)
Microsoft.AspNetCore.Mvc.Razor (14)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (3)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (36)
Microsoft.AspNetCore.Mvc.Razor.Test (128)
Microsoft.AspNetCore.Mvc.RazorPages (74)
Microsoft.AspNetCore.Mvc.RazorPages.Test (180)
Infrastructure\DynamicPageEndpointMatcherPolicyTest.cs (16)
40new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(actions[0]), "Test1"),
41new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(actions[1]), "Test2"),
45_ => Task.CompletedTask,
72new Endpoint(_ => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test1"),
73new Endpoint(_ => Task.CompletedTask, EndpointMetadataCollection.Empty, "Test2"),
74new Endpoint(_ => Task.CompletedTask, EndpointMetadataCollection.Empty, "ReplacedLoaded")
80.Returns((PageActionDescriptor descriptor, EndpointMetadataCollection endpoint) => Task.FromResult(new CompiledPageActionDescriptor
116public async Task ApplyAsync_NoMatch()
146public async Task ApplyAsync_HasMatchNoEndpointFound()
177public async Task ApplyAsync_HasMatchFindsEndpoint_WithoutRouteValues()
217public async Task ApplyAsync_HasMatchFindsEndpoint_WithRouteValues()
268public async Task ApplyAsync_Throws_ForTransformersWithInvalidLifetime()
298public async Task ApplyAsync_CanDiscardFoundEndpoints()
336public async Task ApplyAsync_CanReplaceFoundEndpoints()
358new Endpoint((ctx) => Task.CompletedTask, new EndpointMetadataCollection(new PageActionDescriptor()
396public async Task ApplyAsync_CanExpandTheListOfFoundEndpoints()
Microsoft.AspNetCore.Mvc.TagHelpers (14)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (355)
InputTagHelperTest.cs (52)
73public async Task CheckBoxHandlesMultipleAttributesSameNameArePreserved(
92getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
140getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
187getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
231getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
283getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
328getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
382getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
438getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
489getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
545getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
617public async Task ProcessAsync_GeneratesExpectedOutput(
656return Task.FromResult<TagHelperContent>(tagHelperContent);
891getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
906public async Task ProcessAsync_GenerateCheckBox_WithHiddenInputRenderModeNone()
945getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
963public async Task ProcessAsync_GenerateCheckBox_WithHiddenInputRenderModeInline()
1005getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
1023public async Task ProcessAsync_GenerateCheckBox_WithHiddenInputRenderModeEndOfForm()
1065getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
1083public async Task ProcessAsync_GenerateCheckBox_WithHiddenInputRenderModeEndOfForm_AndCanRenderAtEndOfFormNotSet()
1125getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
1143public async Task ProcessAsync_CallsGenerateCheckBox_WithExpectedParameters()
1169return Task.FromResult<TagHelperContent>(tagHelperContent);
1227public async Task ProcessAsync_CallsGenerateTextBox_WithExpectedParametersForHidden(
1269return Task.FromResult<TagHelperContent>(tagHelperContent);
1323public async Task ProcessAsync_GenerateCheckBox_WithHiddenInputExpectedFormAttribute()
1368getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null))
1394public async Task ProcessAsync_CallsGeneratePassword_WithExpectedParameters(
1435return Task.FromResult<TagHelperContent>(tagHelperContent);
1492public async Task ProcessAsync_CallsGenerateRadioButton_WithExpectedParameters(
1535return Task.FromResult<TagHelperContent>(tagHelperContent);
1605public async Task ProcessAsync_CallsGenerateTextBox_WithExpectedParameters(
1647return Task.FromResult<TagHelperContent>(tagHelperContent);
1743public async Task ProcessAsync_CallsGenerateTextBox_AddsExpectedAttributes(
1765getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1817public async Task ProcessAsync_CallsGenerateTextBox_InputTypeDateTime_RendersAsDateTime()
1838getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1886public async Task ProcessAsync_CallsGenerateTextBox_InputTypeDateOnly_RendersAsDate()
1907getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1978public async Task ProcessAsync_CallsGenerateTextBox_AddsExpectedAttributesForRfc3339(
2001getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
2057public async Task ProcessAsync_CallsGenerateTextBox_ProducesExpectedValue_ForDateTime(
2081getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
2119public async Task ProcessAsync_CallsGenerateTextBox_ProducesExpectedValue_ForDateOnly(
2143getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
2186public async Task ProcessAsync_CallsGenerateTextBox_ProducesExpectedValue_ForDateTimeNotRfc3339(
2211getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
2252public async Task ProcessAsync_CallsGenerateTextBox_ProducesExpectedValue_ForDateOnlyNotRfc3339(
2277getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
2312public async Task ProcessAsync_CallsGenerateTextBox_ProducesExpectedValue_OverridesDefaultFormat(
2335getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
TagHelperOutputExtensionsTest.cs (24)
337getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
439getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
467return Task.FromResult<TagHelperContent>(tagHelperContent);
502return Task.FromResult<TagHelperContent>(tagHelperContent);
534return Task.FromResult<TagHelperContent>(tagHelperContent);
563getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
591getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
617getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
776getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
802getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
825getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
853getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
878getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
900getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
927getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
949getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
979getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1000getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1022getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1049getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1068getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1091getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1112getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
1135getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
Microsoft.AspNetCore.Mvc.Test (11)
Microsoft.AspNetCore.Mvc.Testing (2)
Microsoft.AspNetCore.Mvc.ViewFeatures (103)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (159)
Rendering\HtmlHelperPartialExtensionsTest.cs (21)
53.Returns(Task.FromResult(htmlContent))
107public async Task PartialAsyncMethods_CallHtmlHelperWithExpectedArguments(
127.Returns(Task.FromResult(htmlContent))
182public async Task RenderPartialMethods_CallHtmlHelperWithExpectedArguments(
183Func<IHtmlHelper, Task> renderPartialAsyncMethod,
202.Returns(Task.FromResult(true))
213public static TheoryData<Func<IHtmlHelper, Task>, object, ViewDataDictionary> RenderPartialAsyncExtensionMethods
219return new TheoryData<Func<IHtmlHelper, Task>, object, ViewDataDictionary>
230public async Task RenderPartialAsyncMethods_CallHtmlHelperWithExpectedArguments(
231Func<IHtmlHelper, Task> renderPartialAsyncMethod,
250.Returns(Task.FromResult(true))
272.Returns(Task.FromResult((IHtmlContent)expected))
293.Returns(Task.FromResult((IHtmlContent)expected))
317.Returns(Task.FromResult((IHtmlContent)expected))
339.Returns(Task.FromResult((IHtmlContent)expected))
397public async Task PartialAsync_Throws_IfViewNotFound_MessageUsesGetViewLocations()
426public async Task PartialAsync_Throws_IfViewNotFound_MessageUsesFindViewLocations()
455public async Task PartialAsync_Throws_IfViewNotFound_MessageUsesAllLocations()
486public async Task RenderPartialAsync_Throws_IfViewNotFound_MessageUsesGetViewLocations()
515public async Task RenderPartialAsync_Throws_IfViewNotFound_MessageUsesFindViewLocations()
544public async Task RenderPartialAsync_Throws_IfViewNotFound_MessageUsesAllLocations()
Microsoft.AspNetCore.OpenApi (22)
Transformers\DelegateOpenApiDocumentTransformer.cs (5)
26private readonly Func<OpenApiDocument, OpenApiDocumentTransformerContext, CancellationToken, Task>? _documentTransformer;
27private readonly Func<OpenApiOperation, OpenApiOperationTransformerContext, CancellationToken, Task>? _operationTransformer;
29public DelegateOpenApiDocumentTransformer(Func<OpenApiDocument, OpenApiDocumentTransformerContext, CancellationToken, Task> transformer)
34public DelegateOpenApiDocumentTransformer(Func<OpenApiOperation, OpenApiOperationTransformerContext, CancellationToken, Task> transformer)
39public async Task TransformAsync(OpenApiDocument document, OpenApiDocumentTransformerContext context, CancellationToken cancellationToken)
Microsoft.AspNetCore.OpenApi.Microbenchmarks (8)
Microsoft.AspNetCore.OpenApi.Tests (127)
Services\OpenApiComponentService\OpenApiComponentService.ParameterSchemas.cs (11)
53public async Task GetOpenApiParameters_HandlesRouteParameterWithPrimitiveType(Delegate requestHandler, string schemaType, string schemaFormat, bool isNullable)
82public async Task GetOpenApiParameters_HandlesRouteParameterWithParsableType(Delegate requestHandler, string schemaType, string schemaFormat)
124public async Task GetOpenApiParameters_HandlesRouteParameterWithRouteConstraint(string routeTemplate, string type, string format, int? minimum, int? maximum, int? minLength, int? maxLength, string pattern)
161public async Task GetOpenApiParameters_HandlesRouteParametersWithDefaultValue(Delegate requestHandler, Action<IOpenApiAny> assert)
180public async Task GetOpenApiParameters_HandlesEnumParameterWithoutConverter()
200public async Task GetOpenApiParameters_HandlesEnumParameterWithConverter()
235public async Task GetOpenApiParameters_HandlesRouteParameterFromAsParameters()
263public async Task GetOpenApiParameters_HandlesRouteParametersWithMvcModelBinding()
288public async Task GetOpenApiParameters_HandlesRouteParametersWithValidationsInMvcModelBinding()
330public async Task GetOpenApiParameters_HandlesRouteParameterWithValidationAttributes(Delegate requestHandler, Action<OpenApiSchema> verifySchema)
362public async Task GetOpenApiParameters_HandlesArrayBasedTypes(Delegate requestHandler, string innerSchemaType, bool isNullable)
Transformers\OpenApiOptionsTests.cs (6)
14var transformer = new Func<OpenApiDocument, OpenApiDocumentTransformerContext, CancellationToken, Task>((document, context, cancellationToken) =>
17return Task.CompletedTask;
65var transformer = new Func<OpenApiOperation, OpenApiOperationTransformerContext, CancellationToken, Task>((operation, context, cancellationToken) =>
68return Task.CompletedTask;
82public Task TransformAsync(OpenApiDocument document, OpenApiDocumentTransformerContext context, CancellationToken cancellationToken)
84return Task.CompletedTask;
Microsoft.AspNetCore.OutputCaching (8)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (8)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
Microsoft.AspNetCore.OutputCaching.Tests (181)
CachedResponseBodyTests.cs (13)
25public async Task Copy_DoNothingWhenNoSegments()
34var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
37await Task.WhenAll(receiverTask, copyTask);
44public async Task Copy_SingleSegment()
57var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
58var copyTask = CopyDataAsync(body, pipe.Writer, cts.Token);
60await Task.WhenAll(receiverTask, copyTask);
67public async Task Copy_MultipleSegments()
81var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
82var copyTask = CopyDataAsync(body, pipe.Writer, cts.Token);
84await Task.WhenAll(receiverTask, copyTask);
90static async Task CopyDataAsync(ReadOnlySequence<byte> body, PipeWriter writer, CancellationToken cancellationToken)
96static async Task ReceiveDataAsync(PipeReader reader, List<byte[]> receivedSegments, CancellationToken cancellationToken)
Microsoft.AspNetCore.Owin (36)
OwinExtensions.cs (5)
11Func<IDictionary<string, object>, Task>,
12Func<IDictionary<string, object>, Task>
14using AppFunc = Func<IDictionary<string, object>, Task>;
16Func<IDictionary<string, object>, Task>,
17Func<IDictionary<string, object>, Task>
OwinFeatureCollection.cs (8)
18using SendFileFunc = Func<string, long, long?, CancellationToken, Task>;
182void IHttpResponseFeature.OnStarting(Func<object, Task> callback, object state)
194void IHttpResponseFeature.OnCompleted(Func<object, Task> callback, object state)
229Task IHttpResponseBodyFeature.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
264var loadAsync = Prop<Func<Task>>(OwinConstants.CommonKeys.LoadClientCertAsync);
424async Task IHttpResponseBodyFeature.StartAsync(CancellationToken cancellationToken)
435Task IHttpResponseBodyFeature.CompleteAsync()
442return Task.CompletedTask;
Microsoft.AspNetCore.Owin.Tests (12)
OwinExtensionTests.cs (12)
11Func<IDictionary<string, object>, Task>,
12Func<IDictionary<string, object>, Task>
14using AppFunc = Func<IDictionary<string, object>, Task>;
16Func<IDictionary<string, object>, Task>,
17Func<IDictionary<string, object>, Task>
25public async Task OwinConfigureServiceProviderAddsServices()
38return Task.FromResult(0);
54public async Task OwinDefaultNoServices()
72return Task.FromResult(0);
89public async Task OwinDefaultNullServiceProvider()
106return Task.FromResult(0);
122public async Task UseOwin()
Microsoft.AspNetCore.RateLimiting (3)
Microsoft.AspNetCore.RateLimiting.Tests (46)
RateLimitingMiddlewareTests.cs (26)
33return Task.CompletedTask;
42return Task.CompletedTask;
51return Task.CompletedTask;
60public async Task RequestsCallNextIfAccepted()
70return Task.CompletedTask;
85public async Task RequestRejected_CallsOnRejectedAndGives503()
110public async Task RequestRejected_WinsOverDefaultStatusCode()
135public async Task RequestAborted_DoesNotThrowTaskCanceledException()
166public async Task EndpointLimiterRequested_NoPolicy_Throws()
182public async Task EndpointLimiter_Rejects()
217public async Task EndpointLimiterConvenienceMethod_Rejects()
253public async Task EndpointLimiterRejects_EndpointOnRejectedFires()
284public async Task GlobalAndEndpoint_GlobalRejects_GlobalWins()
316public async Task GlobalAndEndpoint_EndpointRejects_EndpointWins()
348public async Task GlobalAndEndpoint_BothReject_GlobalWins()
380public async Task EndpointLimiterRejects_EndpointOnRejectedFires_WithIRateLimiterPolicy()
423public async Task EndpointLimiter_DuplicatePartitionKey_NoCollision()
464public async Task EndpointLimiter_DuplicatePartitionKey_Lambda_NoCollision()
497var endpoint1 = new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableRateLimitingAttribute(endpointName1)), "Test endpoint 1");
498var endpoint2 = new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableRateLimitingAttribute(endpointName2)), "Test endpoint 2");
515public async Task DisableRateLimitingAttribute_SkipsGlobalAndEndpoint()
537context.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new EnableRateLimitingAttribute(name), new DisableRateLimitingAttribute()), "Test endpoint"));
545context.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(new DisableRateLimitingAttribute(), new EnableRateLimitingAttribute(name)), "Test endpoint"));
553public async Task PolicyDirectlyOnEndpoint_GetsUsed()
583public async Task MultipleEndpointPolicies_LastOneWins()
649return Task.CompletedTask;
Microsoft.AspNetCore.Razor (12)
Microsoft.AspNetCore.Razor.Runtime (13)
Microsoft.AspNetCore.Razor.Runtime.Test (35)
Microsoft.AspNetCore.Razor.Test (13)
Microsoft.AspNetCore.RequestDecompression (2)
Microsoft.AspNetCore.RequestDecompression.Microbenchmarks (3)
Microsoft.AspNetCore.RequestDecompression.Tests (18)
Microsoft.AspNetCore.ResponseCaching (10)
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (5)
Microsoft.AspNetCore.ResponseCaching.Tests (74)
CachedResponseBodyTests.cs (13)
33public async Task Copy_DoNothingWhenNoSegments()
42var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
45await Task.WhenAll(receiverTask, copyTask);
51public async Task Copy_SingleSegment()
64var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
65var copyTask = CopyDataAsync(body, pipe.Writer, cts.Token);
67await Task.WhenAll(receiverTask, copyTask);
73public async Task Copy_MultipleSegments()
87var receiverTask = ReceiveDataAsync(pipe.Reader, receivedSegments, cts.Token);
88var copyTask = CopyDataAsync(body, pipe.Writer, cts.Token);
90await Task.WhenAll(receiverTask, copyTask);
95static async Task CopyDataAsync(CachedResponseBody body, PipeWriter writer, CancellationToken cancellationToken)
101static async Task ReceiveDataAsync(PipeReader reader, List<byte[]> receivedSegments, CancellationToken cancellationToken)
Microsoft.AspNetCore.ResponseCompression (11)
Microsoft.AspNetCore.ResponseCompression.Tests (44)
ResponseCompressionMiddlewareTest.cs (42)
49public async Task Request_NoAcceptEncoding_Uncompressed()
58public async Task Request_AcceptGzipDeflate_CompressedGzip()
67public async Task Request_AcceptBrotli_CompressedBrotli()
78public async Task Request_AcceptMixed_CompressedBrotli(string encoding1, string encoding2)
89public async Task Request_AcceptMixed_ConfiguredOrder_CompressedGzip(string encoding1, string encoding2)
104public async Task Request_AcceptUnknown_NotCompressed()
116public async Task RequestHead_NoAcceptEncoding_Uncompressed()
125public async Task RequestHead_AcceptGzipDeflate_CompressedGzip()
139public async Task ContentType_WithCharset_Compress(string contentType)
148public async Task GZipCompressionProvider_OptionsSetInDI_Compress()
188public async Task MimeTypes_OtherContentTypes_NoMatch(string contentType)
259public async Task MimeTypes_IncludedAndExcluded(
288public async Task NoIncludedMimeTypes_UseDefaults()
307public async Task NoBody_NotCompressed(string contentType)
325return Task.FromResult(0);
344public async Task Request_AcceptStar_Compressed()
353public async Task Request_AcceptIdentity_NotCompressed()
368public async Task Request_AcceptWithHigherCompressionQuality_Compressed(string[] acceptEncodings, int expectedBodyLength)
378public async Task Request_AcceptWithhigherIdentityQuality_NotCompressed(string[] acceptEncodings, int expectedBodyLength)
390public async Task Response_UnknownMimeType_NotCompressed()
401public async Task Response_WithContentRange_NotCompressed()
415public async Task Response_WithContentEncodingAlreadySet_NotReCompressed()
435public async Task Request_Https_CompressedIfEnabled(bool enableHttps, int expectedLength)
496public async Task Request_Https_CompressedIfOptIn(HttpsCompressionMode mode, int expectedLength)
559public async Task Request_Https_NotCompressedIfOptOut(HttpsCompressionMode mode, int expectedLength)
620public async Task FlushHeaders_SendsHeaders_Compresses(string encoding, int expectedBodyLength)
666public async Task FlushAsyncHeaders_SendsHeaders_Compresses(string encoding, int expectedBodyLength)
711public async Task FlushBody_CompressesAndFlushes(string encoding)
770public async Task FlushAsyncBody_CompressesAndFlushes(string encoding)
823public async Task TrickleWriteAndFlush_FlushesEachWrite(string encoding)
893public async Task TrickleWriteAndFlushAsync_FlushesEachWrite(string encoding)
957public async Task UncompressedTrickleWriteAndFlushAsync_FlushesEachWrite(string encoding)
1023public async Task SendFileAsync_DifferentContentType_NotBypassed()
1073public async Task SendFileAsync_FirstWrite_CompressesAndFlushes()
1123public async Task SendFileAsync_AfterFirstWrite_CompressesAndFlushes()
1174public async Task Dispose_SyncWriteOrFlushNotCalled(string encoding)
1264return Task.CompletedTask;
1359public Task CompleteAsync() => InnerFeature.CompleteAsync();
1363public Task SendFileAsync(string path, long offset, long? count, CancellationToken cancellation)
1370public Task StartAsync(CancellationToken token = default) => InnerFeature.StartAsync(token);
1434public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1474public override Task FlushAsync(CancellationToken cancellationToken)
Microsoft.AspNetCore.Rewrite (2)
Microsoft.AspNetCore.Rewrite.Tests (71)
MiddlewareTests.cs (34)
17public async Task CheckRewritePath()
47public async Task CheckRewritePathWithSkipRemaining()
77public async Task CheckRewritePath_MultipleRulesWithSkipRemaining()
109public async Task CheckRewritePath_MultipleRules()
150public async Task CheckRedirectPath(string pattern, string replacement, string baseAddress, string requestUrl, string expectedUrl)
178public async Task RewriteRulesCanComeFromConfigureOptions()
208public async Task CheckRedirectPathWithQueryString()
236public async Task CheckRedirectToHttpsStatus(int statusCode)
263public async Task CheckRedirectToHttpsSslPort(int? sslPort)
305public async Task CheckRedirectToHttpsUrl(string baseAddress, string hostPathAndQuery, string expectedHostPathAndQuery)
337public async Task CheckRedirectUsesConfiguredScheme(string hostSchemePathAndQuery, string redirectReplacement)
363public async Task CheckPermanentRedirectToHttps()
390public async Task CheckRedirectToHttpsWithSslPort(int sslPort, string expected)
419public async Task CheckRedirectToWwwWithStatusCode(int statusCode)
448public async Task CheckRedirectToWww(string requestUri, string redirectUri)
473public async Task CheckPermanentRedirectToWww()
508public async Task CheckNoRedirectToWww(string requestUri)
536public async Task CheckRedirectToNonWwwWithStatusCode(int statusCode)
565public async Task CheckRedirectToNonWww(string requestUri, string redirectUri)
590public async Task CheckPermanentRedirectToNonWww()
615public async Task CheckIfEmptyStringRedirectCorrectly()
638public async Task RewriteAfterUseRoutingHitsOriginalEndpoint()
675public async Task CheckIfEmptyStringRewriteCorrectly()
702public async Task SettingPathBase()
735public async Task CheckNoRedirectToWwwInNonWhitelistedDomains(string requestUri)
763public async Task CheckRedirectToWwwInWhitelistedDomains(string requestUri, string redirectUri)
788public async Task CheckPermanentRedirectToWwwInWhitelistedDomains()
817public async Task CheckRedirectToWwwWithStatusCodeInWhitelistedDomains(int statusCode)
844public async Task Rewrite_WorksAfterUseRoutingIfGlobalRouteBuilderUsed(string regex, string output)
880public async Task RewriteFromOptions_WorksAfterUseRoutingIfGlobalRouteBuilderUsed(string regex, string output)
916public async Task RewriteSkipRemaing_WorksAfterUseRoutingIfGlobalRouteBuilderUsed()
952public async Task RewriteWithMultipleRules_WorksAfterUseRoutingIfGlobalRouteBuilderUsed()
989public async Task RewriteWithMultipleRulesAndSkip_WorksAfterUseRoutingIfGlobalRouteBuilderUsed()
1026public async Task Rewrite_WorksWithoutUseRoutingWithWebApplication()
Microsoft.AspNetCore.Routing (65)
RequestDelegateRouteBuilderExtensions.cs (5)
91Func<HttpRequest, HttpResponse, RouteData, Task> handler)
133Func<HttpRequest, HttpResponse, RouteData, Task> handler)
175Func<HttpRequest, HttpResponse, RouteData, Task> handler)
217Func<HttpRequest, HttpResponse, RouteData, Task> handler)
235Func<HttpRequest, HttpResponse, RouteData, Task> handler)
Microsoft.AspNetCore.Routing.Abstractions (1)
Microsoft.AspNetCore.Routing.FunctionalTests (61)
Microsoft.AspNetCore.Routing.Microbenchmarks (31)
Microsoft.AspNetCore.Routing.Tests (399)
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (22)
65RequestDelegate requestDelegate = (d) => Task.CompletedTask;
80public async Task MapEndpoint_ReturnGenericTypeTask_GeneratedDelegate(Func<IEndpointRouteBuilder, string, RequestDelegate, IEndpointConventionBuilder> map)
91return await Task.FromResult("String Test");
112public async Task MapEndpoint_CanBeFiltered_EndpointFilterFactory(Func<IEndpointRouteBuilder, string, RequestDelegate, IEndpointConventionBuilder> map)
119RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
147public async Task MapEndpoint_CanBeFiltered_EndpointFilter()
154RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
177public async Task MapEndpoint_Filtered_DontExecuteEndpointWhenErrorResponseStatus()
226public async Task RequestFilters_CanAssertOnEmptyResult()
261public async Task RequestFilters_ReturnValue_SerializeJson()
268RequestDelegate requestDelegate = (HttpContext context) => Task.CompletedTask;
331RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
352RequestDelegate requestDelegate = (d) => Task.CompletedTask;
388Expression<RequestDelegate> handler = context => Task.CompletedTask;
437var endpointBuilder = map(builder, "/", context => Task.CompletedTask).WithMetadata(new EndpointNameMetadata("MapMe"));
460var endpointBuilder = map(builder, "/", context => Task.CompletedTask).WithMetadata(new EndpointNameMetadata("MapMe"));
515.Map(RoutePatternFactory.Parse("/"), context => Task.CompletedTask)
525private static Task Handle(HttpContext context) => Task.CompletedTask;
528private static Task HandleHttpMetdata(HttpContext context) => Task.CompletedTask;
557public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (12)
133public async Task MapGet_WithRouteParameter_BuildsEndpointWithRouteSpecificBinding()
171public async Task MapGet_WithoutRouteParameter_BuildsEndpointWithQuerySpecificBinding()
505public async Task MapVerbWithExplicitRouteParameterIsCaseInsensitive(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
547public async Task MapVerbWithRouteParameterDoesNotFallbackToQuery(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
601public async Task MapGetWithNamedFromRouteParameter_UsesFromRouteName()
624public async Task MapGetWithNamedFromRouteParameter_FailsForParameterName()
808public async Task MapMethod_FlowsThrowOnBadHttpRequest(bool throwOnBadRequest)
837public async Task MapMethod_DefaultsToNotThrowOnBadHttpRequestIfItCannotResolveRouteHandlerOptions()
890private static async Task AssertIdAsync(Endpoint endpoint, string expectedPattern, int expectedId)
915public async Task AddEndpointFilterMethods_CanRegisterFilterWithClassAndDelegateImplementations(Action<IEndpointConventionBuilder> addFilter)
931public async Task AddEndpointFilterMethods_WorkWithMapGroup(Action<IEndpointConventionBuilder> addFilter)
959public async Task RequestDelegateFactory_CanInvokeEndpointFilter_ThatAccessesServices()
EndpointRoutingMiddlewareFormOptionsTest.cs (13)
24public async Task SupportsSettingFormOptionsFromMetadata()
39c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(formOptionsMetadata), "myapp"));
56public async Task SupportsMergingSettingsFromMultipleFormOptionsMetadata()
73c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(formOptionsMetadata1, formOptionsMetadata2, formOptionsMetadata3), "myapp"));
91public async Task SupportsMergingSettingsFromMetadataAndServices()
111c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(formOptionsMetadata), "myapp"));
129public async Task SettingEndpointManuallyStillResolvesFormOptions()
139var endpoint = new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(endpointMetadata), "myapp");
146c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(formOptionsMetadata), "myapp"));
164public async Task OptionsNotSetForNonFormRequests()
171var endpoint = new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(endpointMetadata), "myapp");
178c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(formOptionsMetadata), "myapp"));
210next ??= c => Task.CompletedTask;
EndpointRoutingMiddlewareTest.cs (23)
25public async Task Invoke_OnCall_SetsEndpointFeature()
41public async Task Invoke_SkipsRouting_IfEndpointSet()
45httpContext.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(), "myapp"));
59public async Task Invoke_OnCall_WritesToConfiguredLogger()
93public async Task Invoke_BackCompatGetRouteValue_ValueUsedFromEndpointFeature()
115public async Task Invoke_BackCompatGetDataTokens_ValueUsedFromEndpointMetadata()
138public async Task Invoke_InitializationFailure_AllowsReinitialization()
161public async Task ShortCircuitWithoutStatusCode()
183public async Task ShortCircuitWithStatusCode()
211public async Task ThrowIfSecurityMetadataPresent(int? statusCode, bool hasAuthMetadata, bool hasCorsMetadata)
231public async Task Invoke_CheckForFallbackMetadata_LogIfPresent(bool hasFallbackMetadata)
250c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(metadata), "myapp"));
269public async Task Endpoint_BodySizeFeatureIsReadOnly()
286c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(metadata), "myapp"));
301public async Task Endpoint_DoesNotHaveBodySizeFeature()
315c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(metadata), "myapp"));
327public async Task Endpoint_DoesNotHaveSizeLimitMetadata()
343c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(), "myapp"));
357public async Task Endpoint_HasBodySizeFeature_SetUsingSizeLimitMetadata(bool isRequestSizeLimitDisabled)
374c.SetEndpoint(new Endpoint(c => Task.CompletedTask, new EndpointMetadataCollection(metadata), "myapp"));
398public async Task Create_WithoutHostBuilder_Success()
414endpoints.MapGet("/", (HttpContext c) => Task.CompletedTask);
470next ??= c => Task.CompletedTask;
Matching\ContentEncodingNegotiationMatcherPolicyTest.cs (33)
25new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"),
42new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"),
43new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"),
61new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(new DynamicMetadata()), "Endpoint -> Dynamic Endpoint Metadata"),
72public async Task ApplyAsync_SelectsEndpointWithContentEncodingMetadata_IfAcceptHeaderIncludesEncodingMetadata()
78new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"));
92public async Task ApplyAsync_SelectsEndpointWihtoutEncodingMetadata_IfAcceptHeaderDoesNotIncludeEncodingMetadata()
98new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"));
112public async Task ApplyAsync_SelectsEndpointWihtoutEncodingMetadata_IfAcceptHeaderDoesNotIncludeEncodingMetadata_ReverseCandidateOrder()
117new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"),
132public async Task ApplyAsync_SelectsEndpointWithHigherAcceptEncodingQuality_IfHeaderIncludesMultipleEncodingsWithQualityValues()
152public async Task ApplyAsync_SelectsEndpointWithHigherAcceptEncodingQuality_IfHeaderIncludesMultipleEncodingsWithQualityValues_ReverseCandidateOrder()
172public async Task ApplyAsync_SelectsEndpointWithHigherContentEncodingMetadataQuality_IfAcceptEncodingQualityIsEqual()
191public async Task ApplyAsync_SetsEndpointIfNoResourceCanSupportTheAcceptHeaderValues()
211public async Task ApplyAsync_DoesNotSetEndpointIfNoEndpointCanSupportTheAcceptHeaderValues_ButAnEndpointWithoutMetadataExists()
218new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"));
233public async Task ApplyAsync_SelectsFirstValidEndpointWhenContentEncodingMetadataQualityIsTheSame_IfAcceptEncodingQualityIsEqual()
252public async Task ApplyAsync_SelectsFirstValidEndpointWhenContentEncodingMetadataQualityIsTheSame_IfAcceptEncodingQualityIsEqual_Reverse()
271public async Task ApplyAsync_SetsAllCandidatesToInvalid_IfNoCandidateMatchesAcceptEncoding()
290public async Task ApplyAsync_SetsEndpointsWithEncodingMetadataToInvalid_IfRequestAsksForIdentity()
295new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
309public async Task ApplyAsync_SetsEndpointsWithEncodingMetadataToInvalid_IfRequestHasEmptyAcceptEncodingHeader()
314new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
328public async Task ApplyAsync_SetsEndpointsWithEncodingMetadataToInvalid_IfRequestHasNoAcceptEncodingHeader()
333new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
386new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
446new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"));
465new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"));
482new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Endpoint -> No Content Encoding"),
572new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
590new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
608new Endpoint(_ => Task.CompletedTask, new EndpointMetadataCollection(), "Identity"),
637_ => Task.CompletedTask,
Matching\FullFeaturedMatcherConformanceTest.cs (18)
22public virtual async Task Match_DefaultValues(string template, string path, string[] keys, string[] values)
36public virtual async Task Match_NonInlineDefaultValues()
51public virtual async Task Match_ExtraDefaultValues()
77public virtual async Task NotMatch_DefaultValues(string template, string path)
109public virtual async Task Match_OptionalParameter(string template, string path, string[] keys, string[] values)
132public virtual async Task NotMatch_OptionalParameter(string template, string path)
156public virtual async Task Match_CatchAllParameter(string template, string path, string[] keys, string[] values)
176public virtual async Task Quirks_CatchAllParameter(string template, string path, string[] keys, string[] values)
211public virtual async Task Match_ComplexSegment(string template, string path, string[] keys, string[] values)
231public virtual async Task NotMatch_ComplexSegment(string template, string path)
260public virtual async Task Match_OptionalSeparator(string template, string path, string[] keys, string[] values)
286public virtual async Task NotMatch_OptionalSeparator(string template, string path)
311public virtual async Task Match_WeirdCharacterCases(string template, string path, string[] keys, string[] values)
336public virtual async Task Match_SelectEndpoint_BasedOnPrecedence(string template1, string template2)
370public virtual async Task Match_SelectEndpoint_BasedOnOrder(string template1, string template2)
405public virtual async Task Match_IntegrationTest_MultipleEndpoints(string path, string expectedTemplate)
443public virtual async Task Match_Regression_16579_Order1()
473public virtual async Task Match_Regression_16579_Order2()
Microsoft.AspNetCore.Security.Microbenchmarks (5)
Microsoft.AspNetCore.Server.HttpSys (75)
RequestProcessing\RequestContext.FeatureCollection.cs (19)
70private List<Tuple<Func<object, Task>, object>>? _onStartingActions = new List<Tuple<Func<object, Task>, object>>();
71private List<Tuple<Func<object, Task>, object>>? _onCompletedActions = new List<Tuple<Func<object, Task>, object>>();
328_clientCertTask = Task.FromResult(value);
347return _clientCertTask = Task.FromResult(clientCert);
436void IHttpResponseFeature.OnStarting(Func<object, Task> callback, object state)
444_onStartingActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
447void IHttpResponseFeature.OnCompleted(Func<object, Task> callback, object state)
455_onCompletedActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
470async Task IHttpResponseBodyFeature.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
476Task IHttpResponseBodyFeature.StartAsync(CancellationToken cancellation)
481Task IHttpResponseBodyFeature.CompleteAsync() => CompleteAsync();
489internal async Task CompleteAsync()
602internal async Task OnResponseStart()
615private async Task NotifiyOnStartingAsync()
696internal Task OnCompleted()
700return Task.CompletedTask;
706private async Task NotifyOnCompletedAsync()
RequestProcessing\ResponseBody.cs (13)
310public override Task FlushAsync(CancellationToken cancellationToken)
314return Task.CompletedTask;
320private unsafe Task FlushInternalAsync(ArraySegment<byte> data, CancellationToken cancellationToken)
324return Task.CompletedTask;
331return Task.CompletedTask;
337return Task.FromCanceled<int>(cancellationToken);
576public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
586return Task.CompletedTask;
599internal async Task SendFileAsync(string fileName, long offset, long? count, CancellationToken cancellationToken)
613internal unsafe Task SendFileAsyncCore(string fileName, long offset, long? count, CancellationToken cancellationToken)
617return Task.CompletedTask;
624return Task.CompletedTask;
630return Task.FromCanceled<int>(cancellationToken);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (536)
Listener\RequestHeaderTests.cs (14)
19public async Task RequestHeaders_RemoveHeaders_Success()
25Task responseTask = SendRequestAsync(address, "Custom-Header", customValues, Encoding.UTF8);
60public async Task RequestHeaders_ClientSendsUtf8Headers_Success()
66Task responseTask = SendRequestAsync(address, "Custom-Header", customValues, Encoding.UTF8);
87public async Task RequestHeaders_Latin1Replaced()
93Task responseTask = SendRequestAsync(address, "Custom-Header", customValues, Encoding.Latin1);
114public async Task RequestHeaders_ClientSendsLatin1Headers_Success()
121Task responseTask = SendRequestAsync(address, "Custom-Header", customValues, Encoding.Latin1);
142public async Task RequestHeaders_ClientSendsBadLatin1Headers_Rejected()
156public async Task RequestHeaders_ClientSendsKnownHeaderWithNoValue_Success()
162Task responseTask = SendRequestAsync(address, "If-None-Match", customValues, Encoding.UTF8);
181public async Task RequestHeaders_ClientSendsUnknownHeaderWithNoValue_Success()
187Task responseTask = SendRequestAsync(address, "Custom-Header", customValues, Encoding.UTF8);
230await Task.Run(() => socket.Receive(response));
ResponseSendFileTests.cs (33)
36public async Task ResponseSendFile_MissingFile_Throws()
61public async Task ResponseSendFile_NoHeaders_DefaultsToChunked()
80public async Task ResponseSendFile_RelativeFile_Success()
99public async Task ResponseSendFile_Unspecified_Chunked()
118public async Task ResponseSendFile_MultipleWrites_Chunked()
138public async Task ResponseSendFile_HalfOfFile_Chunked()
157public async Task ResponseSendFile_OffsetOutOfRange_Throws()
176public async Task ResponseSendFile_CountOutOfRange_Throws()
195public async Task ResponseSendFile_Count0_Chunked()
214public async Task ResponseSendFile_ContentLength_PassedThrough()
235public async Task ResponseSendFile_ContentLengthSpecific_PassedThrough()
256public async Task ResponseSendFile_ContentLength0_PassedThrough()
277public async Task ResponseSendFile_TriggersOnStarting()
287return Task.FromResult(0);
305public async Task ResponseSendFile_EmptyFileCountUnspecified_SetsChunkedAndFlushesHeaders()
333public async Task ResponseSendFile_WithActiveCancellationToken_Success()
350public async Task ResponseSendFile_WithTimerCancellationToken_Success()
368public async Task ResponseSendFileWriteExceptions_FirstCallWithCanceledCancellationToken_CancelsAndAborts()
378var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
387return Task.CompletedTask;
396public async Task ResponseSendFile_FirstSendWithCanceledCancellationToken_CancelsAndAborts()
406var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
415return Task.CompletedTask;
424public async Task ResponseSendFileExceptions_SecondSendWithCanceledCancellationToken_CancelsAndAborts()
435var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
451public async Task ResponseSendFile_SecondSendWithCanceledCancellationToken_CancelsAndAborts()
462var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
478public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeFirstSend_SendThrows()
531public async Task ResponseSendFile_ClientDisconnectsBeforeFirstSend_SendCompletesSilently()
574public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeSecondSend_SendThrows()
616var bufferTask = response.Content.LoadIntoBufferAsync();
630public async Task ResponseSendFile_ClientDisconnectsBeforeSecondSend_SendCompletesSilently()
665var bufferTask = response.Content.LoadIntoBufferAsync();
ServerTests.cs (54)
27public async Task Server_200OK_Success()
31return Task.FromResult(0);
42public async Task Server_ConnectExistingQueueName_Success(RequestQueueMode queueMode)
59return Task.FromResult(0);
92public async Task Server_SetQueueName_Success()
97return Task.FromResult(0);
115public async Task Server_SendHelloWorld_Success()
129public async Task Server_EchoHelloWorld_Success()
145public async Task Server_ShutdownDuringRequest_Success()
165public async Task Server_DisposeWithoutStopDuringRequest_Aborts()
186public async Task Server_ShutdownDuringLongRunningRequest_TimesOut()
208public async Task Server_AppException_ClientReset()
227public async Task Server_BadHttpRequestException_SetStatusCode()
264List<Task> requestTasks = new List<Task>();
270Assert.True(Task.WaitAll(requestTasks.ToArray(), TimeSpan.FromSeconds(60)), "Timed out");
275public async Task Server_ClientDisconnects_CallCanceled()
309public async Task Server_Abort_CallCanceled()
336public async Task Server_SetQueueLimit_Success()
340using (Utilities.CreateHttpServer(out address, httpContext => Task.FromResult(0), LoggerFactory)) { }
355public async Task Server_SetHttp503VebosityHittingThrottle_Success()
362}, httpContext => Task.FromResult(0), LoggerFactory))
395public async Task Server_SetConnectionLimitInfinite_Success()
401}, httpContext => Task.FromResult(0), LoggerFactory))
415public async Task Server_MultipleStopAsyncCallsWaitForRequestsToDrain_Success()
432var stopTask1 = server.StopAsync(cts.Token);
433var stopTask2 = server.StopAsync(cts.Token);
434var stopTask3 = server.StopAsync(cts.Token);
442await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
449public async Task Server_MultipleStopAsyncCallsCompleteOnCancellation_SameToken_Success()
466var stopTask1 = server.StopAsync(cts.Token);
467var stopTask2 = server.StopAsync(cts.Token);
468var stopTask3 = server.StopAsync(cts.Token);
476await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
486public async Task Server_MultipleStopAsyncCallsCompleteOnSingleCancellation_FirstToken_Success()
503var stopTask1 = server.StopAsync(cts.Token);
504var stopTask2 = server.StopAsync(new CancellationTokenSource().Token);
505var stopTask3 = server.StopAsync(new CancellationTokenSource().Token);
513await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
523public async Task Server_MultipleStopAsyncCallsCompleteOnSingleCancellation_SubsequentToken_Success()
540var stopTask1 = server.StopAsync(new CancellationTokenSource().Token);
541var stopTask2 = server.StopAsync(cts.Token);
542var stopTask3 = server.StopAsync(new CancellationTokenSource().Token);
550await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
560public async Task Server_DisposeContinuesPendingStopAsyncCalls()
565Task stopTask1;
566Task stopTask2;
585await Task.WhenAll(stopTask1, stopTask2).TimeoutAfter(TimeSpan.FromSeconds(10));
590public async Task Server_StopAsyncCalledWithNoRequests_Success()
592using (var server = Utilities.CreateHttpServer(out _, httpContext => Task.CompletedTask, LoggerFactory))
601public async Task Server_AttachToExistingQueue_NoIServerAddresses_NoDefaultAdded(RequestQueueMode queueMode)
604using var server = Utilities.CreateHttpServer(out var address, httpContext => Task.CompletedTask, options =>
613await attachedServer.StartAsync(new DummyApplication(context => Task.CompletedTask), default);
620public async Task Server_UnsafePreferInlineScheduling()
src\Shared\Http2cat\Http2Utilities.cs (42)
153public async Task InitializeConnectionAsync(int expectedSettingsCount = 3)
174public Task StartStreamAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, bool endStream)
272public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, bool endStream)
312public Task SendHeadersWithPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte priority, int streamDependency, bool endStream)
355public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<KeyValuePair<string, string>> headers, byte padLength, byte priority, int streamDependency, bool endStream)
389public Task SendAsync(ReadOnlySpan<byte> span)
396public static async Task FlushAsync(PipeWriter writableBuffer)
401public Task SendPreambleAsync() => SendAsync(ClientPreface);
403public async Task SendSettingsAsync()
426public async Task SendSettingsAckWithInvalidLengthAsync(int length)
436public async Task SendSettingsWithInvalidStreamIdAsync(int streamId)
450public async Task SendSettingsWithInvalidLengthAsync(int length)
462internal async Task SendSettingsWithInvalidParameterValueAsync(Http2SettingsParameter parameter, uint value)
480public Task SendPushPromiseFrameAsync()
508internal async Task SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, byte[] headerBlock)
520public async Task SendInvalidHeadersFrameAsync(int streamId, int payloadLength, byte padLength)
539public async Task SendIncompleteHeadersFrameAsync(int streamId)
573internal async Task SendContinuationAsync(int streamId, Http2ContinuationFrameFlags flags, byte[] payload)
601internal Task SendEmptyContinuationFrameAsync(int streamId, Http2ContinuationFrameFlags flags)
613public async Task SendIncompleteContinuationFrameAsync(int streamId)
631public Task SendDataAsync(int streamId, Memory<byte> data, bool endStream)
644public async Task SendDataWithPaddingAsync(int streamId, Memory<byte> data, byte padLength, bool endStream)
664public Task SendInvalidDataFrameAsync(int streamId, int frameLength, byte padLength)
684internal Task SendPingAsync(Http2PingFrameFlags flags)
693public Task SendPingWithInvalidLengthAsync(int length)
703public Task SendPingWithInvalidStreamIdAsync(int streamId)
722public Task SendPriorityAsync(int streamId, int streamDependency = 0)
736public Task SendInvalidPriorityFrameAsync(int streamId, int length)
752public Task SendRstStreamAsync(int streamId)
764public Task SendInvalidRstStreamFrameAsync(int streamId, int length)
774public Task SendGoAwayAsync()
783public Task SendInvalidGoAwayFrameAsync()
793public Task SendWindowUpdateAsync(int streamId, int sizeIncrement)
805public Task SendInvalidWindowUpdateAsync(int streamId, int sizeIncrement, int length)
815public Task SendUnknownFrameTypeAsync(int streamId, int frameType)
877public async Task StopConnectionAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
885public Task WaitForConnectionStopAsync(int expectedLastStreamId, bool ignoreNonGoAwayFrames)
890internal Task ReceiveHeadersAsync(int expectedStreamId, Action<IDictionary<string, string>> verifyHeaders = null)
893internal async Task ReceiveHeadersAsync(int expectedStreamId, bool endStream = false, Action<IDictionary<string, string>> verifyHeaders = null)
934internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
941internal async Task WaitForConnectionErrorAsyncDoNotCloseTransport<TException>(bool ignoreNonGoAwayFrames, int expectedLastStreamId, Http2ErrorCode expectedErrorCode)
957internal async Task WaitForStreamErrorAsync(int expectedStreamId, Http2ErrorCode expectedErrorCode)
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (4)
Microsoft.AspNetCore.Server.IIS (96)
Core\IISHttpContext.cs (21)
47protected Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
48protected Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
59protected Task? _readBodyTask;
60protected Task? _writeBodyTask;
428private async Task InitializeResponse(bool flushHeaders)
440private async Task ProduceStart(bool flushHeaders)
512protected Task ProduceEnd()
519return Task.CompletedTask;
540return Task.CompletedTask;
550private async Task ProduceEndAwaited()
664public void OnStarting(Func<object, Task> callback, object state)
675_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
677_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
681public void OnCompleted(Func<object, Task> callback, object state)
687_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
689_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
693protected async Task FireOnStarting()
695Stack<KeyValuePair<Func<object, Task>, object>>? onStarting = null;
717protected async Task FireOnCompleted()
719Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted = null;
857private async Task HandleRequest()
Microsoft.AspNetCore.Server.IISIntegration (19)
Microsoft.AspNetCore.Server.IISIntegration.Tests (23)
Microsoft.AspNetCore.Server.IntegrationTesting (5)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (4)
Microsoft.AspNetCore.Server.Kestrel.Core (251)
Internal\AddressBinder.cs (8)
19public static Task BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func<ListenOptions, ListenOptions> useHttps, CancellationToken cancellationToken)
86internal static async Task BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
148Task BindAsync(AddressBindContext context, CancellationToken cancellationToken);
153public async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
173public override Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
195public override Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
215public virtual async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
235public virtual async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
Internal\Http\HttpProtocol.cs (43)
36private Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
37private Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
570public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> application) where TContext : notnull
624private async Task ProcessRequests<TContext>(IHttpApplication<TContext> application) where TContext : notnull
775public void OnStarting(Func<object, Task> callback, object state)
784_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
786_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
789public void OnCompleted(Func<object, Task> callback, object state)
793_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
795_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
798protected Task FireOnStarting()
806return Task.CompletedTask;
808static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
826protected Task FireOnCompleted()
834return Task.CompletedTask;
836static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
945public Task InitializeResponseAsync(int firstWriteByteCount)
947var startingTask = FireOnStarting();
957return Task.CompletedTask;
961public async Task InitializeResponseAwaited(Task startingTask, int firstWriteByteCount)
1008protected virtual Task TryProduceInvalidRequestResponse()
1018return Task.CompletedTask;
1021protected Task ProduceEnd()
1025return Task.CompletedTask;
1037return Task.CompletedTask;
1061private Task WriteSuffix()
1090return Task.CompletedTask;
1093private async Task WriteSuffixAwaited(ValueTask<FlushResult> writeTask)
1501var initializeTask = InitializeResponseAsync(0);
1516public Task CompleteAsync(Exception? exception = null)
1532var onStartingTask = FireOnStarting();
1554return Task.CompletedTask;
1557private async Task CompleteAsyncAwaited(Task onStartingTask)
1618var startingTask = FireOnStarting();
1627private async ValueTask<FlushResult> FirstWriteAsyncAwaited(Task initializeTask, ReadOnlyMemory<byte> data, CancellationToken cancellationToken)
1664public Task FlushAsync(CancellationToken cancellationToken = default)
1670private async ValueTask<FlushResult> FlushAsyncAwaited(Task initializeTask, CancellationToken cancellationToken)
1676public Task WriteAsync(ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
1681public async ValueTask<FlushResult> WriteAsyncAwaited(Task initializeTask, ReadOnlyMemory<byte> data, CancellationToken cancellationToken)
Internal\Infrastructure\KestrelConnection.cs (14)
15private Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
42public Task ExecutionTask => _completionTcs.Task;
75void IConnectionCompleteFeature.OnCompleted(Func<object, Task> callback, object state)
84_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
86_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
89public Task FireOnCompletedAsync()
101return Task.CompletedTask;
107private Task CompleteAsyncMayAwait(Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
113var task = entry.Key.Invoke(entry.Value);
125return Task.CompletedTask;
128private async Task CompleteAsyncAwaited(Task currentTask, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (235)
KestrelServerTests.cs (34)
339public async Task StartWithNoValidTransportFactoryThrows()
350async () => await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None));
356public async Task StartWithMultipleTransportFactories_UseSupported()
369await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
376public async Task StartWithNoValidTransportFactoryThrows_Http3()
391async () => await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None));
397public async Task StartWithMultipleTransportFactories_Http3_UseSupported()
414await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
421public async Task ListenWithCustomEndpoint_DoesNotThrow()
440await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
450public async Task ListenIPWithStaticPort_TransportsGetIPv6Any()
467await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
481public async Task ListenIPWithEphemeralPort_TransportsGetIPv6Any()
498await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
509public async Task ListenIPWithEphemeralPort_MultiplexedTransportsGetIPv6Any()
526await server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None);
537public async Task StopAsyncCallsCompleteWhenFirstCallCompletes()
577var stopTask1 = server.StopAsync(default);
578var stopTask2 = server.StopAsync(default);
579var stopTask3 = server.StopAsync(default);
588await Task.WhenAll(new[] { stopTask1, stopTask2, stopTask3 }).DefaultTimeout();
594public async Task StopAsyncCallsCompleteWithThrownException()
635var stopTask1 = server.StopAsync(default);
636var stopTask2 = server.StopAsync(default);
637var stopTask3 = server.StopAsync(default);
654public async Task StopAsyncDispatchesSubsequentStopAsyncContinuations()
690var stopTask1 = server.StopAsync(default);
691var stopTask2 = server.StopAsync(default);
696var continuationTask = Task.Run(async () =>
753public async Task ReloadsOnConfigurationChangeWhenOptedIn()
761Func<Task> changeCallback = null;
912public async Task DoesNotReloadOnConfigurationChangeByDefault()
984server.StartAsync(new DummyApplication(context => Task.CompletedTask), CancellationToken.None).GetAwaiter().GetResult();
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (95)
src\Servers\Kestrel\shared\ConnectionCompletion.cs (10)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
16return Task.CompletedTask;
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
28var task = entry.Key.Invoke(entry.Value);
40return Task.CompletedTask;
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (28)
79protected Task _connectionTask;
137internal Task WaitForConnectionStopAsync(long expectedLastStreamId, bool ignoreNonGoAwayFrames, Http3ErrorCode? expectedErrorCode = null)
142internal async Task WaitForConnectionErrorAsync<TException>(bool ignoreNonGoAwayFrames, long? expectedLastStreamId, Http3ErrorCode expectedErrorCode, Action<Type, string[]> matchExpectedErrorMessage = null, params string[] expectedErrorMessage)
157internal async Task WaitForGoAwayAsync(bool ignoreNonGoAwayFrames, long? expectedLastStreamId)
224public async Task InitializeConnectionAsync(RequestDelegate application)
488public Task OnUnidentifiedStreamCreatedTask => OnUnidentifiedStreamCreatedTcs.Task;
489public Task OnStreamCreatedTask => OnStreamCreatedTcs.Task;
490public Task OnStreamCompletedTask => OnStreamCompletedTcs.Task;
491public Task OnHeaderReceivedTask => OnHeaderReceivedTcs.Task;
502protected Task SendAsync(ReadOnlySpan<byte> span)
509protected static Task FlushAsync(PipeWriter writableBuffer)
519internal async Task ReceiveEndAsync()
597internal async Task SendFrameAsync(Http3FrameType frameType, Memory<byte> data, bool endStream = false)
614internal Task EndStreamAsync(ReadOnlySpan<byte> span = default)
624internal async Task WaitForStreamErrorAsync(Http3ErrorCode protocolError, Action<string> matchExpectedErrorMessage = null, string expectedErrorMessage = null)
669public Task OnDisposedTask => _testStreamContext.OnDisposedTask;
670public Task OnDisposingTask => _testStreamContext.OnDisposingTask;
688public Task SendHeadersAsync(IEnumerable<KeyValuePair<string, string>> headers, bool endStream = false)
693public async Task SendHeadersAsync(Http3HeadersEnumerator headers, bool endStream = false)
717internal async Task SendHeadersPartialAsync()
725internal async Task SendDataAsync(Memory<byte> data, bool endStream = false)
758internal async Task ExpectReceiveEndOfStream()
863public async Task WriteStreamIdAsync(int id)
879internal async Task SendGoAwayAsync(long streamId, bool endStream = false)
887internal async Task SendSettingsAsync(List<Http3PeerSetting> settings, bool endStream = false)
951internal async Task WaitForGoAwayAsync(bool ignoreNonGoAwayFrames, long? expectedLastStreamId)
1170public Task OnDisposingTask => _disposingTcs.Task;
1171public Task OnDisposedTask => _disposedTcs.Task;
Microsoft.AspNetCore.Server.Kestrel.Tests (9)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (16)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (23)
src\Servers\Kestrel\shared\ConnectionCompletion.cs (10)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
16return Task.CompletedTask;
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
28var task = entry.Key.Invoke(entry.Value);
40return Task.CompletedTask;
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (68)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (8)
Microsoft.AspNetCore.Session (6)
Microsoft.AspNetCore.Session.Tests (35)
Microsoft.AspNetCore.Shared.Tests (53)
Microsoft.AspNetCore.SignalR.Client.Core (117)
HubConnection.cs (60)
115public event Func<Exception?, Task>? Closed;
133public event Func<Exception?, Task>? Reconnecting;
151public event Func<string?, Task>? Reconnected;
249/// <returns>A <see cref="Task"/> that represents the asynchronous start.</returns>
250public virtual async Task StartAsync(CancellationToken cancellationToken = default)
259private async Task StartAsyncInner(CancellationToken cancellationToken = default)
302/// <returns>A <see cref="Task"/> that represents the asynchronous stop.</returns>
303public virtual async Task StopAsync(CancellationToken cancellationToken = default)
374public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task> handler, object state)
457/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
461public virtual async Task SendCoreAsync(string methodName, object?[] args, CancellationToken cancellationToken = default)
469private async Task StartAsyncCore(CancellationToken cancellationToken)
547private async Task StopAsyncCore(bool disposing)
559var reconnectTask = _state.ReconnectTask;
574var connectionStateStopTask = Task.CompletedTask;
593var writeTask = SendHubMessage(connectionState, CloseMessage.Empty);
689async Task OnStreamCanceled(InvocationRequest irq)
850private Task SendStreamItems<T>(ConnectionState connectionState, string streamId, ChannelReader<T> reader, CancellationTokenSource tokenSource)
852async Task ReadChannelStream()
868private Task SendIAsyncEnumerableStreamItems<T>(ConnectionState connectionState, string streamId, IAsyncEnumerable<T> stream, CancellationTokenSource tokenSource)
870async Task ReadAsyncEnumerableStream()
884private async Task CommonStreaming(ConnectionState connectionState, string streamId, Func<Task> createAndConsumeStream, CancellationTokenSource cts)
960private async Task InvokeCore(ConnectionState connectionState, string methodName, InvocationRequest irq, object?[] args, string[]? streams, CancellationToken cancellationToken)
985private async Task InvokeStreamCore(ConnectionState connectionState, string methodName, InvocationRequest irq, object?[] args, string[]? streams, CancellationToken cancellationToken)
1012private async Task SendHubMessage(ConnectionState connectionState, HubMessage hubMessage, CancellationToken cancellationToken = default)
1034private async Task SendCoreAsyncCore(string methodName, object?[] args, CancellationToken cancellationToken)
1058private async Task SendWithLock(ConnectionState expectedConnectionState, HubMessage message, CancellationToken cancellationToken, [CallerMemberName] string callerName = "")
1159private async Task DispatchInvocationAsync(InvocationMessage invocation, ConnectionState connectionState)
1193var task = handler.InvokeAsync(invocation.Arguments);
1243private async Task DispatchInvocationStreamItemAsync(StreamItemMessage streamItem, InvocationRequest irq)
1276private async Task HandshakeAsync(ConnectionState startingConnectionState, int protocolVersion, CancellationToken cancellationToken)
1381private async Task ReceiveLoop(ConnectionState connectionState)
1392var timerTask = connectionState.TimerLoop(timer);
1401async Task StartProcessingInvocationMessages(ChannelReader<InvocationMessage> invocationMessageChannelReader)
1407var invokeTask = DispatchInvocationAsync(invocationMessage, connectionState);
1505internal Task RunTimerActions()
1518private async Task HandleConnectionClose(ConnectionState connectionState)
1571async Task RunClosedEventAsync()
1595private async Task ReconnectAsync(Exception? closeException)
1634await Task.Delay(nextRetryDelay.Value, _state.StopCts.Token).ConfigureAwait(false);
1749async Task RunReconnectingEventAsync()
1776async Task RunReconnectedEventAsync()
1891private readonly Func<object?[], object, Task> _callback;
1894public InvocationHandler(Type[] parameterTypes, Func<object?[], object, Task> callback, object state)
1901public Task InvokeAsync(object?[] parameters)
1926public Task? ReceiveTask { get; set; }
1931public Task? InvocationMessageReceiveTask { get; set; }
2024public Task StopAsync()
2042private async Task StopAsyncCore()
2054await ((ReceiveTask ?? Task.CompletedTask).ConfigureAwait(false));
2067public async Task TimerLoop(TimerAwaitable timer)
2103public Task AckAsync(AckMessage ackMessage)
2110return Task.CompletedTask;
2127internal async Task RunTimerActions()
2229ReconnectTask = Task.CompletedTask;
2238public Task ReconnectTask { get; set; } = Task.CompletedTask;
2274public Task WaitConnectionLockAsync(CancellationToken token, [CallerMemberName] string? memberName = null, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = 0)
HubConnectionExtensions.cs (12)
21return Task.CompletedTask;
211public static IDisposable On(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], Task> handler)
215var currentHandler = (Func<object?[], Task>)state;
227public static IDisposable On(this HubConnection hubConnection, string methodName, Func<Task> handler)
242public static IDisposable On<T1>(this HubConnection hubConnection, string methodName, Func<T1, Task> handler)
260public static IDisposable On<T1, T2>(this HubConnection hubConnection, string methodName, Func<T1, T2, Task> handler)
279public static IDisposable On<T1, T2, T3>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, Task> handler)
299public static IDisposable On<T1, T2, T3, T4>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, T4, Task> handler)
320public static IDisposable On<T1, T2, T3, T4, T5>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, T4, T5, Task> handler)
342public static IDisposable On<T1, T2, T3, T4, T5, T6>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, T4, T5, T6, Task> handler)
365public static IDisposable On<T1, T2, T3, T4, T5, T6, T7>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, T4, T5, T6, T7, Task> handler)
389public static IDisposable On<T1, T2, T3, T4, T5, T6, T7, T8>(this HubConnection hubConnection, string methodName, Func<T1, T2, T3, T4, T5, T6, T7, T8, Task> handler)
HubConnectionExtensions.InvokeAsync.cs (23)
25public static Task InvokeAsync(this HubConnection hubConnection, string methodName, CancellationToken cancellationToken = default)
37/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
39public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, CancellationToken cancellationToken = default)
52/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
54public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, CancellationToken cancellationToken = default)
68/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
70public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, CancellationToken cancellationToken = default)
85/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
87public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, CancellationToken cancellationToken = default)
103/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
105public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, CancellationToken cancellationToken = default)
122/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
124public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, CancellationToken cancellationToken = default)
142/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
144public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, CancellationToken cancellationToken = default)
163/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
165public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, CancellationToken cancellationToken = default)
185/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
187public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, CancellationToken cancellationToken = default)
208/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
210public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, object? arg10, CancellationToken cancellationToken = default)
222/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
223public static Task InvokeCoreAsync(this HubConnection hubConnection, string methodName, object?[] args, CancellationToken cancellationToken = default)
HubConnectionExtensions.SendAsync.cs (11)
25public static Task SendAsync(this HubConnection hubConnection, string methodName, CancellationToken cancellationToken = default)
40public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, CancellationToken cancellationToken = default)
56public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, CancellationToken cancellationToken = default)
73public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, CancellationToken cancellationToken = default)
91public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, CancellationToken cancellationToken = default)
110public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, CancellationToken cancellationToken = default)
130public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, CancellationToken cancellationToken = default)
151public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, CancellationToken cancellationToken = default)
173public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, CancellationToken cancellationToken = default)
196public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, CancellationToken cancellationToken = default)
220public static Task SendAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, object? arg10, CancellationToken cancellationToken = default)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (111)
HubConnectionTests.cs (92)
84public async Task CheckFixedMessage(string protocolName, HttpTransportType transportType, string path)
117public async Task ServerRejectsClientWithOldProtocol()
153public async Task ClientCanConnectToServerWithLowerMinimumProtocol()
183public async Task CanSendAndReceiveMessage(string protocolName, HttpTransportType transportType, string path)
212public async Task CanSendNull(string protocolName)
241public async Task CanStopAndStartConnection(string protocolName, HttpTransportType transportType, string path)
273public async Task CanAccessConnectionIdFromHubConnection(string protocolName, HttpTransportType transportType, string path)
308public async Task CanStartConnectionFromClosedEvent(string protocolName, HttpTransportType transportType, string path)
370public async Task MethodsAreCaseInsensitive(string protocolName, HttpTransportType transportType, string path)
400public async Task CanInvokeFromOnHandler(string protocolName, HttpTransportType transportType, string path)
440public async Task StreamAsyncCoreTest(string protocolName, HttpTransportType transportType, string path)
475public async Task CanStreamToHubWithIAsyncEnumerableMethodArg(string protocolName)
488await Task.Delay(10);
521public async Task StreamAsyncTest(string protocolName, HttpTransportType transportType, string path)
556public async Task StreamAsyncDoesNotStartIfTokenAlreadyCanceled(string protocolName, HttpTransportType transportType, string path)
593public async Task StreamAsyncCanBeCanceled(string protocolName, HttpTransportType transportType, string path)
635public async Task StreamAsyncWithException(string protocolName, HttpTransportType transportType, string path)
677public async Task CanInvokeClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
711public async Task InvokeNonExistantClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
728return Task.CompletedTask;
753public async Task CanStreamClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
783public async Task CanStreamToAndFromClientInSameInvocation(string protocolName, HttpTransportType transportType, string path)
820public async Task CanStreamToServerWithIAsyncEnumerable(string protocolName, HttpTransportType transportType, string path)
833await Task.Delay(10);
867public async Task CanCancelIAsyncEnumerableClientToServerUpload(string protocolName, HttpTransportType transportType, string path)
880await Task.Delay(10);
920public async Task StreamAsyncCanBeCanceledThroughGetAsyncEnumerator(string protocolName, HttpTransportType transportType, string path)
961public async Task CanCloseStreamMethodEarly(string protocolName, HttpTransportType transportType, string path)
1002public async Task StreamDoesNotStartIfTokenAlreadyCanceled(string protocolName, HttpTransportType transportType, string path)
1031public async Task ExceptionFromStreamingSentToClient(string protocolName, HttpTransportType transportType, string path)
1065public async Task ServerThrowsHubExceptionIfHubMethodCannotBeResolved(string hubProtocolName, HttpTransportType transportType, string hubPath)
1092public async Task ServerThrowsHubExceptionIfHubMethodCannotBeResolvedAndArgumentsPassedIn(string hubProtocolName, HttpTransportType transportType, string hubPath)
1119public async Task ServerThrowsHubExceptionOnHubMethodArgumentCountMismatch(string hubProtocolName)
1146public async Task ServerThrowsHubExceptionOnHubMethodArgumentTypeMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
1173public async Task ServerThrowsHubExceptionIfStreamingHubMethodCannotBeResolved(string hubProtocolName, HttpTransportType transportType, string hubPath)
1201public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentCountMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
1229public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentTypeMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
1257public async Task ServerThrowsHubExceptionIfNonStreamMethodInvokedWithStreamAsync(string hubProtocolName, HttpTransportType transportType, string hubPath)
1284public async Task ServerThrowsHubExceptionIfStreamMethodInvokedWithInvoke(string hubProtocolName, HttpTransportType transportType, string hubPath)
1311public async Task ServerThrowsHubExceptionIfBuildingAsyncEnumeratorIsNotPossible(string hubProtocolName, HttpTransportType transportType, string hubPath)
1338public async Task ServerLogsErrorIfClientInvokeCannotBeSerialized(string protocolName)
1358connection.Closed += (ex) => { closedTcs.TrySetResult(ex); return Task.CompletedTask; };
1392public async Task ServerLogsErrorIfReturnValueCannotBeSerialized(string protocolName)
1412connection.Closed += (ex) => { closedTcs.TrySetResult(ex); return Task.CompletedTask; };
1445public async Task RandomGenericIsNotTreatedAsStream()
1466public async Task ClientCanUseJwtBearerTokenForAuthentication(HttpTransportType transportType)
1504public async Task ClientWillFailAuthEndPointIfNotAuthorized(HttpTransportType transportType, string hubPath)
1531public async Task ClientCanUseJwtBearerTokenForAuthenticationWhenRedirected(HttpTransportType transportType)
1559public async Task ClientCanSendHeaders(HttpTransportType transportType)
1590public async Task UserAgentIsSet()
1632public async Task UserAgentCanBeCleared()
1667public async Task UserAgentCanBeSet()
1703public async Task WebSocketOptionsAreApplied()
1738public async Task WebSocketsCanConnectOverHttp2()
1796public async Task TransportFallsbackFromHttp2WhenUsingCredentials(HttpTransportType httpTransportType)
1855public async Task WebSocketsFailsWhenHttp1NotAllowedAndUsingCredentials()
1898public async Task WebSocketsWithAccessTokenOverHttp2()
1931return Task.FromResult("test");
1963public async Task CookiesFromNegotiateAreAppliedToWebSockets()
1990public async Task CheckHttpConnectionFeatures()
2026public async Task UserIdProviderCanAccessHttpContext()
2057public async Task NegotiationSkipsServerSentEventsWhenUsingBinaryProtocol()
2087public async Task StopCausesPollToReturnImmediately()
2110var stopTask = hubConnection.StopAsync();
2129public async Task CanAutomaticallyReconnect(HttpTransportType transportType)
2155return Task.CompletedTask;
2161return Task.CompletedTask;
2190public async Task CanAutomaticallyReconnectAfterRedirect()
2215return Task.CompletedTask;
2221return Task.CompletedTask;
2250public async Task CanAutomaticallyReconnectAfterSkippingNegotiation()
2281return Task.CompletedTask;
2287return Task.CompletedTask;
2317public async Task CanBlockOnAsyncOperationsWithOneAtATimeSynchronizationContext(HttpTransportType transportType)
2331await Task.Yield();
2354public async Task LongPollingUsesHttp2ByDefault()
2407public async Task LongPollingWorksWithHttp2OnlyEndpoint()
2450public async Task ServerSentEventsUsesHttp2ByDefault()
2500public async Task ServerSentEventsWorksWithHttp2OnlyEndpoint()
2543public async Task CanReconnectAndSendMessageWhileDisconnected()
2602public async Task CanReconnectAndSendMessageOnceConnected()
2631return Task.CompletedTask;
2672public async Task ChangingUserNameDuringReconnectLogsWarning()
2706return Task.CompletedTask;
2744public async Task ServerAbortsConnectionWithAckingEnabledNoReconnectAttempted()
2770return Task.CompletedTask;
2796public async Task CanSetMessageBufferSizeOnClient()
2839public async Task ServerWithOldProtocolVersionClientWithNewProtocolVersionWorksDoesNotAllowStatefulReconnect()
2877return Task.CompletedTask;
2918private readonly Task _runTask;
2924_runTask = Task.Run(Run);
2947private async Task Run()
Microsoft.AspNetCore.SignalR.Client.Tests (524)
HttpConnectionTests.Transport.cs (33)
31public async Task HttpConnectionSetsAccessTokenOnAllRequests(HttpTransportType transportType)
56return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
62return Task.FromResult(callCount.ToString(CultureInfo.InvariantCulture));
81public async Task HttpConnectionSetsInherentKeepAliveFeature(HttpTransportType transportType, bool expectedValue)
89testHttpHandler.OnRequest((request, next, token) => Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent)));
107public async Task HttpConnectionSetsUserAgentOnAllRequests(HttpTransportType transportType)
138return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
155public async Task HttpConnectionSetsRequestedWithOnAllRequests(HttpTransportType transportType)
178return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
193public async Task CanReceiveData()
223public async Task CanSendData()
237return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Accepted));
255public Task SendThrowsIfConnectionIsNotStarted()
268public Task TransportPipeCannotBeAccessedAfterConnectionIsDisposed()
284public Task TransportIsShutDownAfterDispose()
301public Task StartAsyncTransferFormatOverridesOptions()
316public async Task HttpConnectionFailsOnNegotiateWhenAuthFails()
331return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
345public async Task HttpConnectionRetriesAccessTokenProviderWhenAuthFailsLongPolling()
386return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Unauthorized));
395return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK));
401return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
421public async Task HttpConnectionFailsAfterFirstRetryFailsLongPolling()
439return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
455public async Task HttpConnectionRetriesAccessTokenProviderWhenAuthFailsServerSentEvents()
486return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Unauthorized));
493return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK, new StreamContent(stream)));
499return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
517public async Task HttpConnectionFailsAfterFirstRetryFailsServerSentEvents()
536return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK, new StreamContent(stream)));
542return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
571public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
600public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
HubClientProxyGeneratorTests.cs (24)
31Task ReturnTask();
55public Task ReturnTask()
58return Task.CompletedTask;
78It.IsAny<Func<object[], object, Task>>(),
86It.IsAny<Func<object[], object, Task>>(),
94It.IsAny<Func<object[], object, Task>>(),
102It.IsAny<Func<object[], object, Task>>(),
129It.IsAny<Func<object[], object, Task>>(),
137It.IsAny<Func<object[], object, Task>>(),
145It.IsAny<Func<object[], object, Task>>(),
153It.IsAny<Func<object[], object, Task>>(),
171public async Task CallbacksGetTriggered()
176Func<object[], object, Task> noArgFunc = null;
182It.IsAny<Func<object[], object, Task>>(),
185(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
191Func<object[], object, Task> singleArgFunc = null;
198It.IsAny<Func<object[], object, Task>>(),
201(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
207Func<object[], object, Task> manyArgsFunc = null;
214It.IsAny<Func<object[], object, Task>>(),
217(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
224Func<object[], object, Task> returnTaskFunc = null;
230It.IsAny<Func<object[], object, Task>>(),
233(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
HubConnectionTests.cs (54)
26public async Task InvokeThrowsIfSerializingMessageFails()
46public async Task SendAsyncThrowsIfSerializingMessageFails()
61public async Task ClosedEventRaisedWhenTheClientIsStopped()
74return Task.CompletedTask;
83public async Task StopAsyncCanBeCalledFromOnHandler()
103public async Task StopAsyncDoesNotWaitForOnHandlers()
127public async Task PendingInvocationsAreCanceledWhenConnectionClosesCleanly()
142public async Task PendingInvocationsAreTerminatedWithExceptionWhenTransportCompletesWithError()
167public async Task PendingInvocationsAreCanceledWhenTokenTriggered()
183public async Task InvokeAsyncCanceledWhenPassedCanceledToken()
202public async Task SendAsyncCanceledWhenPassedCanceledToken()
221public async Task SendAsyncCanceledWhenTokenCanceledDuringSend()
233var sendTask = hubConnection.SendAsync("testMethod", new byte[100], cts.Token);
244public async Task StreamAsChannelAsyncCanceledWhenPassedCanceledToken()
263public async Task StreamAsyncCanceledWhenPassedCanceledToken()
282public async Task CanCancelTokenAfterStreamIsCompleted()
312public async Task CanCancelTokenDuringStream_SendsCancelInvocation()
346public async Task ConnectionTerminatedIfServerTimeoutIntervalElapsesWithNoMessages()
362return Task.CompletedTask;
375public async Task ServerTimeoutIsDisabledWhenUsingTransportWithInherentKeepAlive()
390return Task.CompletedTask;
403public async Task PendingInvocationsAreTerminatedIfServerTimeoutIntervalElapsesWithNoMessages()
419var invokeTask = hubConnection.InvokeAsync("Method").DefaultTimeout();
430public async Task StreamIntsToServer()
470public async Task StreamIntsToServerViaSend()
479var sendTask = hubConnection.SendAsync("SomeMethod", channel.Reader);
501public async Task StreamsObjectsToServer()
545public async Task UploadStreamCancellationSendsStreamComplete()
577public async Task UploadStreamErrorSendsStreamComplete()
603public async Task ActiveUploadStreamWhenConnectionClosesObservesException()
637public async Task InvocationCanCompleteBeforeStreamCompletes()
663public async Task WrongTypeOnServerResponse()
702public async Task CanAwaitInvokeFromOnHandlerWithServerClosingConnection()
732return Task.CompletedTask;
748public async Task CanAwaitUsingHubConnection()
759public async Task VerifyUserOptionsAreNotChanged()
764var accessTokenFactory = new Func<Task<string>>(() => Task.FromResult("fakeAccessToken"));
807public async Task ClientResultResponseAfterConnectionCloseObservesException()
842public async Task HubConnectionIsMockable()
847mockConnection.Setup(c => c.StartAsync(default)).Returns(() => Task.CompletedTask);
848mockConnection.Setup(c => c.StopAsync(default)).Returns(() => Task.CompletedTask);
850mockConnection.Setup(c => c.On(It.IsAny<string>(), It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), It.IsAny<object>()));
853.Returns(() => Task.FromResult(It.IsAny<ChannelReader<object>>()));
854mockConnection.Setup(c => c.InvokeCoreAsync(It.IsAny<string>(), It.IsAny<Type>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>())).Returns(() => Task.FromResult(It.IsAny<object>()));
855mockConnection.Setup(c => c.SendCoreAsync(It.IsAny<string>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>())).Returns(() => Task.CompletedTask);
862_ = hubConnection.On("someMethod2", new Type[] { typeof(int) }, (args, obj) => Task.CompletedTask, 2);
871mockConnection.Verify(c => c.On("someMethod", It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), It.IsAny<object>()), Times.Once);
872mockConnection.Verify(c => c.On("someMethod2", It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), 2), Times.Once);
883public async Task DisableReconnectCalledWhenCloseMessageReceived()
901return Task.CompletedTask;
915public async Task DisableReconnectCalledWhenSendingCloseMessage()
933return Task.CompletedTask;
1037public Task DisableReconnectCalled => _disableReconnect.Task;
1040public void OnReconnected(Func<PipeWriter, Task> notifyOnReconnected) { }
TestHttpMessageHandler.cs (8)
80await Task.Yield();
126return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Accepted));
175public void OnNegotiate(Func<HttpRequestMessage, CancellationToken, HttpResponseMessage> handler) => OnNegotiate((req, cancellationToken) => Task.FromResult(handler(req, cancellationToken)));
192public void OnLongPollDelete(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPollDelete((cancellationToken) => Task.FromResult(handler(cancellationToken)));
209public void OnLongPoll(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPoll(cancellationToken => Task.FromResult(handler(cancellationToken)));
218OnLongPoll((request, token) => Task.FromResult(handler(request, token)));
236public void OnSocketSend(Func<byte[], CancellationToken, HttpResponseMessage> handler) => OnSocketSend((data, cancellationToken) => Task.FromResult(handler(data, cancellationToken)));
256return Task.FromException<HttpResponseMessage>(new InvalidOperationException($"Http endpoint not implemented: {request.Method} {request.RequestUri}"));
WebSocketsTransportTests.cs (8)
17public async Task StopCancelsSendAndReceive()
30var webSocketsTransport = new WebSocketsTransport(options, loggerFactory: LoggerFactory, () => Task.FromResult<string>(null), null);
43public Task ConnectAsync(Uri uri, CancellationToken cancellationToken) => Task.CompletedTask;
55public override Task CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
56=> Task.CompletedTask;
58public override async Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
73public override async Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
Microsoft.AspNetCore.SignalR.Common (4)
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Microsoft.AspNetCore.SignalR.Core (194)
ClientProxyExtensions.cs (33)
20/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
22public static Task SendAsync(this IClientProxy clientProxy, string method, CancellationToken cancellationToken = default)
35/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
37public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, CancellationToken cancellationToken = default)
51/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
53public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, CancellationToken cancellationToken = default)
68/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
70public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, CancellationToken cancellationToken = default)
86/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
88public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, CancellationToken cancellationToken = default)
105/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
107public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, CancellationToken cancellationToken = default)
125/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
127public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, CancellationToken cancellationToken = default)
146/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
148public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, CancellationToken cancellationToken = default)
168/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
170public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, CancellationToken cancellationToken = default)
191/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
193public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, CancellationToken cancellationToken = default)
215/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
217public static Task SendAsync(this IClientProxy clientProxy, string method, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, object? arg10, CancellationToken cancellationToken = default)
228/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
242/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
257/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
273/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
290/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
308/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
327/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
347/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
368/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
390/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
413/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
DefaultHubLifetimeManager.cs (40)
34public override Task AddToGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
42return Task.CompletedTask;
51return Task.CompletedTask;
63return Task.CompletedTask;
67public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
75return Task.CompletedTask;
84return Task.CompletedTask;
90return Task.CompletedTask;
94public override Task SendAllAsync(string methodName, object?[] args, CancellationToken cancellationToken = default)
99private Task SendToAllConnections(string methodName, object?[] args, Func<HubConnectionContext, object?, bool>? include, object? state = null, CancellationToken cancellationToken = default)
101List<Task>? tasks = null;
123tasks = new List<Task>();
138return Task.CompletedTask;
142return Task.WhenAll(tasks);
147private static void SendToGroupConnections(string methodName, object?[] args, ConcurrentDictionary<string, HubConnectionContext> connections, Func<HubConnectionContext, object?, bool>? include, object? state, ref List<Task>? tasks, ref SerializedHubMessage? message, CancellationToken cancellationToken)
168tasks = new List<Task>();
183public override Task SendConnectionAsync(string connectionId, string methodName, object?[] args, CancellationToken cancellationToken = default)
191return Task.CompletedTask;
202public override Task SendGroupAsync(string groupName, string methodName, object?[] args, CancellationToken cancellationToken = default)
211List<Task>? tasks = null;
217return Task.WhenAll(tasks);
221return Task.CompletedTask;
225public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object?[] args, CancellationToken cancellationToken = default)
228List<Task>? tasks = null;
247return Task.WhenAll(tasks);
250return Task.CompletedTask;
254public override Task SendGroupExceptAsync(string groupName, string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
261List<Task>? tasks = null;
268return Task.WhenAll(tasks);
272return Task.CompletedTask;
286public override Task SendUserAsync(string userId, string methodName, object?[] args, CancellationToken cancellationToken = default)
292public override Task OnConnectedAsync(HubConnectionContext connection)
295return Task.CompletedTask;
299public override Task OnDisconnectedAsync(HubConnectionContext connection)
312return Task.CompletedTask;
316public override Task SendAllExceptAsync(string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
322public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object?[] args, CancellationToken cancellationToken = default)
328public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object?[] args, CancellationToken cancellationToken = default)
384public override Task SetConnectionResultAsync(string connectionId, CompletionMessage result)
387return Task.CompletedTask;
HubLifetimeManager.cs (28)
19/// <returns>A <see cref="Task"/> that represents the asynchronous connect.</returns>
20public abstract Task OnConnectedAsync(HubConnectionContext connection);
27/// <returns>A <see cref="Task"/> that represents the asynchronous disconnect.</returns>
28public abstract Task OnDisconnectedAsync(HubConnectionContext connection);
36/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
37public abstract Task SendAllAsync(string methodName, object?[] args, CancellationToken cancellationToken = default);
46/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
47public abstract Task SendAllExceptAsync(string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default);
56/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
57public abstract Task SendConnectionAsync(string connectionId, string methodName, object?[] args, CancellationToken cancellationToken = default);
66/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
67public abstract Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object?[] args, CancellationToken cancellationToken = default);
76/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
77public abstract Task SendGroupAsync(string groupName, string methodName, object?[] args, CancellationToken cancellationToken = default);
86/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
87public abstract Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object?[] args, CancellationToken cancellationToken = default);
97/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
98public abstract Task SendGroupExceptAsync(string groupName, string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default);
107/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
108public abstract Task SendUserAsync(string userId, string methodName, object?[] args, CancellationToken cancellationToken = default);
117/// <returns>A <see cref="Task"/> that represents the asynchronous send.</returns>
118public abstract Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object?[] args, CancellationToken cancellationToken = default);
126/// <returns>A <see cref="Task"/> that represents the asynchronous add.</returns>
127public abstract Task AddToGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default);
135/// <returns>A <see cref="Task"/> that represents the asynchronous remove.</returns>
136public abstract Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default);
157/// <returns>A <see cref="Task"/> that represents the result being set or being forwarded to another server.</returns>
158public virtual Task SetConnectionResultAsync(string connectionId, CompletionMessage result)
Internal\DefaultHubDispatcher.cs (21)
28private readonly Func<HubLifetimeContext, Task>? _onConnectedMiddleware;
29private readonly Func<HubLifetimeContext, Exception?, Task>? _onDisconnectedMiddleware;
73public override async Task OnConnectedAsync(HubConnectionContext connection)
100public override async Task OnDisconnectedAsync(HubConnectionContext connection, Exception? exception)
126public override Task DispatchMessageAsync(HubConnectionContext connection, HubMessage hubMessage)
136return Task.CompletedTask;
214return Task.CompletedTask;
217private Task ProcessInvocationBindingFailure(HubConnectionContext connection, InvocationBindingFailureMessage bindingFailureMessage)
226private Task ProcessStreamBindingFailure(HubConnectionContext connection, StreamBindingFailureMessage bindingFailureMessage)
239return Task.CompletedTask;
242private Task ProcessStreamItem(HubConnectionContext connection, StreamItemMessage message)
244if (!connection.StreamTracker.TryProcessItem(message, out var processTask))
247return Task.CompletedTask;
254private Task ProcessInvocation(HubConnectionContext connection,
269return Task.CompletedTask;
332Task? invocation = null;
357static async Task ExecuteInvocation(DefaultHubDispatcher<THub> dispatcher,
463private async Task StreamAsync(string invocationId, HubConnectionContext connection, object?[] arguments, AsyncServiceScope scope,
561if (methodExecutor.MethodReturnType == typeof(Task))
563await (Task)methodExecutor.Execute(hub, arguments)!;
577private static async Task SendInvocationError(string? invocationId, HubConnectionContext connection, string errorMessage)
Internal\Proxies.cs (9)
19public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
36public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
55public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
72public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
93public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
108public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
125public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
142public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
160public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default)
Microsoft.AspNetCore.SignalR.Microbenchmarks (70)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (4)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (4)
Microsoft.AspNetCore.SignalR.Specification.Tests (99)
src\Shared\TaskExtensions.cs (8)
34public static Task DefaultTimeout(this Task task, int milliseconds = DefaultTimeoutDuration, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
44public static Task DefaultTimeout(this ValueTask task, int milliseconds = DefaultTimeoutDuration, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
Microsoft.AspNetCore.SignalR.StackExchangeRedis (59)
RedisHubLifetimeManager.cs (49)
91public override async Task OnConnectedAsync(HubConnectionContext connection)
98var userTask = Task.CompletedTask;
102var connectionTask = SubscribeToConnection(connection);
109await Task.WhenAll(connectionTask, userTask);
113public override Task OnDisconnectedAsync(HubConnectionContext connection)
120return Task.CompletedTask;
124var tasks = new List<Task>();
149return Task.WhenAll(tasks);
153public override Task SendAllAsync(string methodName, object?[] args, CancellationToken cancellationToken = default)
160public override Task SendAllExceptAsync(string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
167public override Task SendConnectionAsync(string connectionId, string methodName, object?[] args, CancellationToken cancellationToken = default)
184public override Task SendGroupAsync(string groupName, string methodName, object?[] args, CancellationToken cancellationToken = default)
193public override Task SendGroupExceptAsync(string groupName, string methodName, object?[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
202public override Task SendUserAsync(string userId, string methodName, object?[] args, CancellationToken cancellationToken = default)
209public override Task AddToGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
225public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
241public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object?[] args, CancellationToken cancellationToken = default)
245var publishTasks = new List<Task>(connectionIds.Count);
253return Task.WhenAll(publishTasks);
257public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object?[] args, CancellationToken cancellationToken = default)
260var publishTasks = new List<Task>(groupNames.Count);
271return Task.WhenAll(publishTasks);
275public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object?[] args, CancellationToken cancellationToken = default)
280var publishTasks = new List<Task>(userIds.Count);
289return Task.WhenAll(publishTasks);
292return Task.CompletedTask;
302private Task AddGroupAsyncCore(HubConnectionContext connection, string groupName)
312return Task.CompletedTask;
324private async Task RemoveGroupAsyncCore(HubConnectionContext connection, string groupName)
346private async Task SendGroupActionAndWaitForAck(string connectionId, string groupName, GroupAction action)
349var ack = _ackHandler.CreateAck(id);
357private Task RemoveUserAsync(HubConnectionContext connection)
437public override Task SetConnectionResultAsync(string connectionId, CompletionMessage result)
440return Task.CompletedTask;
449private async Task SubscribeToAll()
461var tasks = new List<Task>(_connections.Count);
471await Task.WhenAll(tasks);
480private async Task SubscribeToGroupManagementChannel()
516private async Task SubscribeToAckChannel()
528private async Task SubscribeToConnection(HubConnectionContext connection)
583private Task SubscribeToUser(HubConnectionContext connection)
597var tasks = new List<Task>(subscriptions.Count);
603await Task.WhenAll(tasks);
613private async Task SubscribeToGroupAsync(string groupChannel, HubConnectionStore groupConnections)
623var tasks = new List<Task>(groupConnections.Count);
634await Task.WhenAll(tasks);
643private async Task SubscribeToReturnResultsAsync()
734private async Task EnsureRedisServerConnection()
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (28)
Microsoft.AspNetCore.SignalR.Tests (711)
AddSignalRTests.cs (13)
261public override Task AddToGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
266public override Task OnConnectedAsync(HubConnectionContext connection)
271public override Task OnDisconnectedAsync(HubConnectionContext connection)
276public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
281public override Task SendAllAsync(string methodName, object[] args, CancellationToken cancellationToken = default)
286public override Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
291public override Task SendConnectionAsync(string connectionId, string methodName, object[] args, CancellationToken cancellationToken = default)
296public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args, CancellationToken cancellationToken = default)
301public override Task SendGroupAsync(string groupName, string methodName, object[] args, CancellationToken cancellationToken = default)
306public override Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
311public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args, CancellationToken cancellationToken = default)
316public override Task SendUserAsync(string userId, string methodName, object[] args, CancellationToken cancellationToken = default)
321public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args, CancellationToken cancellationToken = default)
ClientProxyTests.cs (32)
22public async Task UserProxy_SendAsync_ArrayArgumentNotExpanded()
29.Returns(Task.CompletedTask);
43public async Task MultipleUserProxy_SendAsync_ArrayArgumentNotExpanded()
50.Returns(Task.CompletedTask);
64public async Task GroupProxy_SendAsync_ArrayArgumentNotExpanded()
71.Returns(Task.CompletedTask);
85public async Task MultipleGroupProxy_SendAsync_ArrayArgumentNotExpanded()
92.Returns(Task.CompletedTask);
106public async Task GroupExceptProxy_SendAsync_ArrayArgumentNotExpanded()
113.Returns(Task.CompletedTask);
127public async Task AllClientProxy_SendAsync_ArrayArgumentNotExpanded()
134.Returns(Task.CompletedTask);
148public async Task AllClientsExceptProxy_SendAsync_ArrayArgumentNotExpanded()
155.Returns(Task.CompletedTask);
169public async Task SingleClientProxy_SendAsync_ArrayArgumentNotExpanded()
176.Returns(Task.CompletedTask);
190public async Task MultipleClientProxy_SendAsync_ArrayArgumentNotExpanded()
197.Returns(Task.CompletedTask);
211public async Task SingleClientProxyWithInvoke_ThrowsNotSupported()
222public override Task AddToGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
227public override Task OnConnectedAsync(HubConnectionContext connection)
232public override Task OnDisconnectedAsync(HubConnectionContext connection)
237public override Task RemoveFromGroupAsync(string connectionId, string groupName, CancellationToken cancellationToken = default)
242public override Task SendAllAsync(string methodName, object[] args, CancellationToken cancellationToken = default)
247public override Task SendAllExceptAsync(string methodName, object[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
252public override Task SendConnectionAsync(string connectionId, string methodName, object[] args, CancellationToken cancellationToken = default)
257public override Task SendConnectionsAsync(IReadOnlyList<string> connectionIds, string methodName, object[] args, CancellationToken cancellationToken = default)
262public override Task SendGroupAsync(string groupName, string methodName, object[] args, CancellationToken cancellationToken = default)
267public override Task SendGroupExceptAsync(string groupName, string methodName, object[] args, IReadOnlyList<string> excludedConnectionIds, CancellationToken cancellationToken = default)
272public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string methodName, object[] args, CancellationToken cancellationToken = default)
277public override Task SendUserAsync(string userId, string methodName, object[] args, CancellationToken cancellationToken = default)
282public override Task SendUsersAsync(IReadOnlyList<string> userIds, string methodName, object[] args, CancellationToken cancellationToken = default)
DefaultHubLifetimeManagerTests.cs (18)
24public async Task SendAllAsyncWillCancelWithToken()
35var sendTask = manager.SendAllAsync("Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
54public async Task SendAllExceptAsyncWillCancelWithToken()
65var sendTask = manager.SendAllExceptAsync("Hello", new object[] { "World" }, new List<string> { connection1.ConnectionId }, cts.Token).DefaultTimeout();
81public async Task SendConnectionAsyncWillCancelWithToken()
89var sendTask = manager.SendConnectionAsync(connection1.ConnectionId, "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
103public async Task SendConnectionsAsyncWillCancelWithToken()
111var sendTask = manager.SendConnectionsAsync(new List<string> { connection1.ConnectionId }, "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
125public async Task SendGroupAsyncWillCancelWithToken()
134var sendTask = manager.SendGroupAsync("group", "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
148public async Task SendGroupExceptAsyncWillCancelWithToken()
161var sendTask = manager.SendGroupExceptAsync("group", "Hello", new object[] { "World" }, new List<string> { connection1.ConnectionId }, cts.Token).DefaultTimeout();
177public async Task SendGroupsAsyncWillCancelWithToken()
186var sendTask = manager.SendGroupsAsync(new List<string> { "group" }, "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
200public async Task SendUserAsyncWillCancelWithToken()
211var sendTask = manager.SendUserAsync("user", "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
230public async Task SendUsersAsyncWillCancelWithToken()
241var sendTask = manager.SendUsersAsync(new List<string> { "user1", "user2" }, "Hello", new object[] { "World" }, cts.Token).DefaultTimeout();
HubConnectionHandlerTests.cs (365)
39public async Task HubsAreDisposed()
49var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
62public async Task AsyncDisposablesInHubsAreSupported()
77var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
93public async Task ConnectionAbortedTokenTriggers()
103var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
118public async Task OnDisconnectedAsyncTriggersWhenAbortedTokenCallbackThrows()
127var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
144public async Task AbortFromHubMethodForcesClientDisconnect()
153var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
168public async Task MissingHandshakeAndMessageSentFromHubConnectionCanBeDisposedCleanly()
177var connectionHandlerTask = await client.ConnectAsync(connectionHandler, false, false);
190public async Task HandshakeTimesOut()
205var connectionHandlerTask = await client.ConnectAsync(connectionHandler, false);
216public async Task CanLoadHubContext()
227public async Task CanLoadTypedHubContext()
245Assert.Equal($"Cannot generate proxy implementation for '{typeof(IVoidReturningTypedHubClient).FullName}.{nameof(IVoidReturningTypedHubClient.Send)}'. All client proxy methods must return '{typeof(Task).FullName}' or 'System.Threading.Tasks.Task<T>'.", ex.Message);
250public async Task HandshakeFailureFromUnknownProtocolSendsResponseWithError()
261var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
274public async Task HandshakeFailureFromUnsupportedFormatSendsResponseWithError()
287var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
300public async Task ConnectionClosedWhenHandshakeLargerThanMaxMessageSize()
317var connectionHandlerTask = await client.ConnectAsync(connectionHandler,
334public async Task SendingHandshakeRequestInChunksWorks()
347var connectionHandlerTask = await client.ConnectAsync(connectionHandler,
377public async Task SendingInvocatonInChunksWorks()
390var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
418public async Task SendingHandshakeRequestAndInvocationInSamePayloadParsesHandshakeAndInvocation()
429var connectionHandlerTask = await client.ConnectAsync(connectionHandler,
456public async Task HandshakeSuccessSendsResponseWithoutError()
464var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
477public async Task HubMessageOverTheMaxMessageSizeThrows()
489var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
506public async Task ChunkedHubMessageOverTheMaxMessageSizeThrows()
518var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
536public async Task ManyHubMessagesOneOverTheMaxMessageSizeThrows()
552var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
587public async Task ManyHubMessagesUnderTheMessageSizeButConfiguredWithMax()
603var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
634public async Task HandshakeFailureFromIncompatibleProtocolVersionSendsResponseWithError()
646var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
659public async Task ConnectionClosesOnServerWithPartialHandshakeMessageAndCompletedPipe()
671var connectionHandlerTask = await client.ConnectAsync(connectionHandler, sendHandshakeRequestMessage: false, expectedHandshakeResponseMessage: false);
688public async Task LifetimeManagerOnDisconnectedAsyncCalledIfLifetimeManagerOnConnectedAsyncThrows()
712var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
729public async Task HubOnDisconnectedAsyncCalledIfHubOnConnectedAsyncThrows()
749var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
761public async Task LifetimeManagerOnDisconnectedAsyncCalledIfHubOnDisconnectedAsyncThrows()
781var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
794public async Task HubMethodCanReturnValueFromTask()
804var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
820public async Task HubMethodCanReturnValueFromValueTask()
830var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
846public async Task HubMethodCanReturnValueTask()
856var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
872public async Task HubMethodsAreCaseInsensitive(Type hubType)
880var connectionHandlerTask = (Task)await client.ConnectAsync(connectionHandler);
897public async Task HubMethodCanThrowOrYieldFailedTask(string methodName, bool detailedErrors)
926var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
950public async Task HubMethodListeningToConnectionAbortedClosesOnConnectionContextAbort()
958var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
977public async Task DetailedExceptionEvenWhenNotExplicitlySet()
995var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1010public async Task HubMethodDoesNotSendResultWhenInvocationIsNonBlocking()
1020var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1039public async Task HubMethodCanBeVoid()
1049var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1064public async Task HubMethodCanBeRenamedWithAttribute()
1074var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1090public async Task HubMethodNameAttributeIsInherited()
1100var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1119public async Task NonBlockingInvocationDoesNotSendCompletion(string methodName)
1135var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1153public async Task HubMethodWithMultiParam()
1163var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1178public async Task CanCallInheritedHubMethodFromInheritingHub()
1188var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1203public async Task CanCallOverridenVirtualHubMethod()
1213var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1228public async Task CannotCallOverriddenBaseHubMethod()
1238var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1272public async Task CannotCallStaticHubMethods()
1282var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1297public async Task CannotCallObjectMethodsOnHub()
1307var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1330public async Task CannotCallDisposeMethodOnHub()
1340var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1369public async Task BroadcastHubMethodSendsToAllClients(Type hubType)
1378var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1379var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1381await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1385foreach (var result in await Task.WhenAll(
1399await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1405public async Task SendArraySendsArrayToAllClients()
1416var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1417var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1419await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1423foreach (var result in await Task.WhenAll(
1438await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1445public async Task SendToOthers(Type hubType)
1454var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1455var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1457await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1479await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1486public async Task SendToCaller(Type hubType)
1495var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1496var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1498await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1517await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1523public async Task FailsToInitializeInvalidTypedHub()
1538var connectionTask = await firstClient.ConnectAsync(connectionHandler);
1549public async Task SendToAllExcept(Type hubType)
1559var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1560var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1561var thirdConnectionHandlerTask = await thirdClient.ConnectAsync(connectionHandler);
1563await Task.WhenAll(firstClient.Connected, secondClient.Connected, thirdClient.Connected).DefaultTimeout();
1588await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask, thirdConnectionHandlerTask).DefaultTimeout();
1595public async Task SendToMultipleClients(Type hubType)
1605var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1606var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1607var thirdConnectionHandlerTask = await thirdClient.ConnectAsync(connectionHandler);
1609await Task.WhenAll(firstClient.Connected, secondClient.Connected, thirdClient.Connected).DefaultTimeout();
1636await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask, thirdConnectionHandlerTask).DefaultTimeout();
1643public async Task SendToMultipleUsers(Type hubType)
1653var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1654var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1655var thirdConnectionHandlerTask = await thirdClient.ConnectAsync(connectionHandler);
1657await Task.WhenAll(firstClient.Connected, secondClient.Connected, thirdClient.Connected).DefaultTimeout();
1681await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask, thirdConnectionHandlerTask).DefaultTimeout();
1688public async Task HubsCanAddAndSendToGroup(Type hubType)
1697var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1698var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1700await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1725await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1732public async Task SendToGroupExcept(Type hubType)
1741var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1742var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1744await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1778await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1785public async Task SendToOthersInGroup(Type hubType)
1794var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1795var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1797await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1829await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1836public async Task InvokeMultipleGroups(Type hubType)
1845var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1846var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1848await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1872await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1878public async Task RemoveFromGroupWhenNotInGroupDoesNotFail()
1888var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
1902public async Task HubsCanSendToUser(Type hubType)
1911var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1912var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1914await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1929await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1936public async Task HubsCanSendToConnection(Type hubType)
1945var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1946var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1948await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1963await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
1969public async Task DelayedSendTest()
1978var firstConnectionHandlerTask = await firstClient.ConnectAsync(connectionHandler);
1979var secondConnectionHandlerTask = await secondClient.ConnectAsync(connectionHandler);
1981await Task.WhenAll(firstClient.Connected, secondClient.Connected).DefaultTimeout();
1996await Task.WhenAll(firstConnectionHandlerTask, secondConnectionHandlerTask).DefaultTimeout();
2003public async Task HubsCanStreamResponses(string method, string protocolName)
2018var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2040public async Task NonErrorCompletionSentWhenStreamCanceledFromClient()
2049var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2079public async Task ReceiveCorrectErrorFromStreamThrowing(string streamMethod, string detailedError)
2098var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2124public async Task CanSendToConnectionsWithDifferentProtocols()
2134var firstConnectionHandlerTask = await client1.ConnectAsync(connectionHandler);
2135var secondConnectionHandlerTask = await client2.ConnectAsync(connectionHandler);
2189public async Task UnauthorizedConnectionCannotInvokeHubMethodWithAuthorization()
2209var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2225public async Task AuthorizedConnectionCanInvokeHubMethodWithAuthorization()
2246var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2274public async Task ConnectionLifetimeNotificationClosesConnectionWithReconnectAllowed()
2286var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2305public Task HandleAsync(AuthorizationHandlerContext context)
2320return Task.CompletedTask;
2325public async Task HubMethodWithAuthorizationProvidesResourceToAuthHandlers()
2354var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2370public async Task HubOptionsCanUseCustomJsonSerializerSettings()
2391var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2412public async Task JsonHubProtocolUsesCamelCasingByDefault()
2421var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2442public async Task HubOptionsCanUseCustomMessagePackSettings()
2461var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2481public async Task HubOptionsCanNotHaveNullSupportedProtocols()
2505public async Task HubOptionsCanNotHaveEmptySupportedProtocols()
2529public async Task ConnectionUserIdIsAssignedByUserIdProvider()
2555var connectionHandlerTask1 = await client1.ConnectAsync(connectionHandler);
2556var connectionHandlerTask2 = await client2.ConnectAsync(connectionHandler);
2608public async Task CanGetHttpContextFromHubConnectionContext()
2624var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2639public async Task GetHttpContextFromHubConnectionContextHandlesNull()
2649var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2664public async Task AcceptsPingMessages()
2673var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2691public async Task DoesNotWritePingMessagesIfSufficientOtherMessagesAreSent()
2702var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2711await Task.Delay(10);
2735public async Task WritesPingMessageIfNothingWrittenWhenKeepAliveIntervalElapses()
2749var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2797public async Task ConnectionNotTimedOutIfClientNeverPings()
2811var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2833public async Task ConnectionTimesOutIfInitialPingAndThenNoMessages()
2847var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2860public async Task OnDisconnectedAsyncReceivesExceptionOnPingTimeout()
2880var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2896public async Task ReceivingMessagesPreventsConnectionTimeoutFromOccuring()
2910var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
2979public Task WaitForReadStart()
3005public async Task HubMethodInvokeDoesNotCountTowardsClientTimeout()
3026var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3064public async Task HubMethodInvokeCountsTowardsClientTimeoutIfParallelNotMaxed()
3082var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3100public async Task EndingConnectionSendsCloseMessageWithNoError()
3109var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3131public async Task ErrorInHubOnConnectSendsCloseMessageWithError(bool detailedErrors)
3152var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3172public async Task StreamingInvocationsDoNotBlockOtherInvocations()
3187var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3204public async Task StreamMethodThatThrowsWillCleanup()
3222var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3245public async Task StreamMethodThatReturnsNullWillCleanup()
3257var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3280public async Task StreamMethodWithDuplicateIdFails()
3292var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3316public async Task InvocationsRunInOrderWithNoParallelism()
3335var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3371public async Task InvocationsCanRunOutOfOrderWithParallelism()
3390var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3427public async Task PendingInvocationUnblockedWhenBlockingMethodCompletesWithParallelism()
3446var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3497public async Task StreamInvocationsDoNotBlockOtherInvocations()
3517var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3552public async Task ServerSendsCloseWithErrorWhenConnectionClosedWithPartialMessage()
3564var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3587public async Task StreamUploadBufferCapacityBlocksOtherInvocations()
3601var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3618public async Task UploadStringsToConcat()
3625var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3641public async Task UploadStreamedObjects()
3648var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3669public async Task UploadManyStreams()
3676var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3712protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, DelayRequirement requirement, HubInvocationContext resource)
3722public async Task UploadStreamStreamItemsSentAsSoonAsPossible()
3740var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3764public async Task UploadStreamDoesNotCountTowardsMaxInvocationLimit()
3776var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3794public async Task ConnectionAbortedIfSendFailsWithProtocolError()
3806var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3815public async Task SerializationExceptionsSendSelfArePassedToOnDisconnectedAsync()
3825var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3838public async Task SerializationExceptionsSendAllArePassedToOnDisconnectedAsync()
3848var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
3861public async Task UploadStreamItemInvalidTypeAutoCasts()
3872var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3889public async Task ServerReportsProtocolMinorVersion()
3903var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3914public async Task UploadStreamItemInvalidType()
3923var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3938public async Task UploadStreamItemInvalidId()
3950var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3963public async Task UploadStreamCompleteInvalidId()
3975var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
3990public async Task UploadStreamCompleteWithError()
4010public async Task UploadStreamWithTooManyStreamsFails()
4029public async Task UploadStreamWithTooFewStreamsFails()
4048public async Task UploadStreamReleasesHubActivatorOnceComplete()
4060var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4086public async Task UploadStreamFromSendReleasesHubActivatorOnceComplete()
4098var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4101var createTask = hubActivator.CreateTask.Task;
4126public async Task UploadStreamClosesStreamsOnServerWhenMethodCompletes()
4135var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4163public async Task UploadStreamAndStreamingMethodClosesStreamsOnServerWhenMethodCompletes()
4172var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4205public async Task StreamHubMethodCanBeTriggeredOnCancellation(string methodName, params object[] args)
4218var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4246public async Task CancellationAfterGivenMessagesEndsStreaming(string methodName, int count)
4261var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4291public async Task StreamHubMethodCanAcceptCancellationTokenAsArgumentAndBeTriggeredOnConnectionAborted()
4304var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4322public async Task StreamHubMethodCanAcceptNullableParameter()
4335var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4349public async Task StreamHubMethodCanAcceptNullableParameterWithCancellationToken()
4362var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4379public async Task InvokeHubMethodCannotAcceptCancellationTokenAsArgument()
4388var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4404public async Task CanPassStreamingParameterToStreamHubMethod()
4415Task connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4456public async Task CanPassDerivedParameterToStreamHubMethod(string method)
4485var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4504public async Task ClientsCallerPropertyCanBeUsedOutsideOfHub()
4517var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4533public async Task CanSendThroughIHubContext()
4542var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4560public async Task ConnectionCloseCleansUploadStreams()
4569var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4591public async Task SpecificHubOptionForMaximumReceiveMessageSizeIsUsedOverGlobalHubOption()
4611var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4623public async Task CanSendThroughIHubContextBaseHub()
4632var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
4650public async Task HubMethodFailsIfServiceNotFound()
4660var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4667public async Task HubMethodCanInjectService()
4677var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4684public async Task HubMethodCanInjectMultipleServices()
4696var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4703public async Task HubMethodCanInjectServicesWithOtherParameters()
4715var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4729public async Task StreamFromServiceDoesNotWork()
4740var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4747public async Task ServiceNotResolvedWithoutAttribute_WithSettingDisabledGlobally()
4762var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4769public async Task ServiceResolvedWithoutAttribute()
4783var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4790public async Task ServiceResolvedForIEnumerableParameter()
4804var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4811public async Task ServiceResolvedWithoutAttribute_WithHubSpecificSettingEnabled()
4829var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4836public async Task ServiceNotResolvedWithAndWithoutAttribute_WithOptionDisabled()
4852var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4859public async Task ServiceResolvedWithAndWithoutAttribute()
4874var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4881public async Task ServiceNotResolvedIfNotInDI()
4894var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4901public async Task ServiceNotResolvedForIEnumerableParameterIfNotInDI()
4914var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4921public async Task KeyedServiceResolvedIfInDI()
4937var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4944public async Task HubMethodCanInjectKeyedServiceWithOtherParameters()
4960var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4967public async Task HubMethodCanInjectKeyedServiceWithNonKeyedService()
4984var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
4991public async Task MultipleKeyedServicesResolved()
5007var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
5014public async Task MultipleKeyedServicesWithSameNameResolved()
5030var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
5078public async Task SendToAnotherClientFromOnConnectedAsync()
5100var connectionHandlerTask = await client1.ConnectAsync(connectionHandler).DefaultTimeout();
5111public async Task ConnectionClosesWhenClientSendsCloseMessage()
5121var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
5135public async Task ConnectionClosesWhenClientSendsCloseMessageWithError()
5145var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
5163public async Task UnsolicitedSequenceAndAckMessagesDoNothing()
5177var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
5190public async Task CanSetMessageBufferSizeOnServer()
5207var connectionHandlerTask = await client.ConnectAsync(connectionHandler).DefaultTimeout();
5229public void OnReconnected(Func<PipeWriter, Task> notifyOnReconnect) { }
5239public async Task IReconnectNotifyTriggersSequenceMessage()
5253var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
5302public async Task GracefulCloseDisablesReconnect()
5317var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
5337private Func<PipeWriter, Task> _notifyOnReconnect;
5339public Task ReconnectDisabled => _reconnectDisabled.Task;
5341public Task NotifyOnReconnect(PipeWriter writer)
5347public void OnReconnected(Func<PipeWriter, Task> notifyOnReconnect)
HubConnectionHandlerTestUtils\Hubs.cs (102)
17public Task GroupRemoveMethod(string groupName)
22public Task ClientSendMethod(string userId, string message)
27public Task SendToMultipleUsers(IReadOnlyList<string> userIds, string message)
32public Task ConnectionSendMethod(string connectionId, string message)
37public Task SendToMultipleClients(string message, IReadOnlyList<string> connectionIds)
42public Task GroupAddMethod(string groupName)
47public Task GroupSendMethod(string groupName, string message)
52public Task GroupExceptSendMethod(string groupName, string message, IReadOnlyList<string> excludedConnectionIds)
57public Task SendToMultipleGroups(string message, IReadOnlyList<string> groupNames)
62public Task SendToOthersInGroup(string groupName, string message)
67public Task BroadcastMethod(string message)
72public Task BroadcastItem()
77public Task SendArray()
84return Task.FromResult(42);
94return new ValueTask(Task.CompletedTask);
122public Task SendAnonymousObject()
127public override Task OnDisconnectedAsync(Exception e)
129return Task.CompletedTask;
142public Task MethodThatYieldsFailedTask()
144return Task.FromException(new InvalidOperationException("BOOM!"));
161public Task SendToAllExcept(string message, IReadOnlyList<string> excludedConnectionIds)
171public Task SendToOthers(string message)
176public Task SendToCaller(string message)
181public Task ProtocolError()
205public async Task StreamDontRead(ChannelReader<string> source)
284public Task UploadIgnoreItems(ChannelReader<string> source)
297async Task ChannelFunc(ChannelWriter<string> output, ChannelReader<string> input)
305public async Task UploadDoesWorkOnComplete(ChannelReader<string> source)
329public async Task BlockingMethod()
346_ = Task.Run(async () =>
386public override Task OnConnectedAsync()
396public override Task OnConnectedAsync()
408public Task ClientSendMethod(string userId, string message)
413public Task SendToMultipleUsers(List<string> userIds, string message)
418public Task ConnectionSendMethod(string connectionId, string message)
423public Task SendToMultipleClients(string message, IReadOnlyList<string> connectionIds)
428public Task GroupAddMethod(string groupName)
433public Task GroupSendMethod(string groupName, string message)
438public Task GroupExceptSendMethod(string groupName, string message, IReadOnlyList<string> excludedConnectionIds)
443public Task SendToOthersInGroup(string groupName, string message)
448public Task SendToMultipleGroups(string message, IReadOnlyList<string> groupNames)
453public Task BroadcastMethod(string message)
458public Task SendToAllExcept(string message, IReadOnlyList<string> excludedConnectionIds)
463public Task SendToOthers(string message)
468public Task SendToCaller(string message)
476public override Task OnConnectedAsync()
488public Task ClientSendMethod(string userId, string message)
493public Task SendToMultipleUsers(List<string> userIds, string message)
498public Task ConnectionSendMethod(string connectionId, string message)
503public Task SendToMultipleClients(string message, IReadOnlyList<string> connectionIds)
508public async Task DelayedSend(string connectionId, string message)
510await Task.Delay(100);
514public Task GroupAddMethod(string groupName)
519public Task GroupSendMethod(string groupName, string message)
524public Task GroupExceptSendMethod(string groupName, string message, IReadOnlyList<string> excludedConnectionIds)
529public Task SendToMultipleGroups(string message, IReadOnlyList<string> groupNames)
534public Task SendToOthersInGroup(string groupName, string message)
539public Task BroadcastMethod(string message)
544public Task SendToAllExcept(string message, IReadOnlyList<string> excludedConnectionIds)
549public Task SendToOthers(string message)
554public Task SendToCaller(string message)
567Task Send(string message);
568Task Broadcast(string message);
579public override Task OnConnectedAsync()
589public override Task OnDisconnectedAsync(Exception exception)
694_ = Task.Run(async () =>
708await Task.Yield();
714await Task.Yield();
722await Task.Yield();
729await Task.Yield();
738await Task.Yield();
797_ = Task.Run(async () =>
815await Task.Yield();
821await Task.Yield();
827await Task.Yield();
833await Task.Yield();
964public override async Task OnConnectedAsync()
973public override Task OnConnectedAsync()
977return Task.CompletedTask;
983public override async Task OnConnectedAsync()
1018Task.Run(async () =>
1033Task.Run(async () =>
1048Task.Run(async () =>
1063Task.Run(() =>
1068return Task.CompletedTask;
1078Task.Run(async () =>
1101await Task.Yield();
1114Task.Run(async () =>
1118await Task.Yield();
1140public async Task Upload(ChannelReader<string> stream)
1209Task Send(string message);
1219public override Task OnConnectedAsync()
1231public override Task OnDisconnectedAsync(Exception exception)
1248public override Task OnConnectedAsync()
1260public Task ProtocolErrorSelf()
1265public Task ProtocolErrorAll()
1270public override Task OnDisconnectedAsync(Exception exception)
1292public override async Task OnConnectedAsync()
1300public override async Task OnDisconnectedAsync(Exception ex)
1315public override Task OnConnectedAsync()
1381public async Task Stream(ChannelReader<int> channelReader)
1440public override async Task OnConnectedAsync()
Internal\TypedClientBuilderTests.cs (20)
12public async Task ProducesImplementationThatProxiesMethodsToIClientProxyAsync()
36public async Task ProducesImplementationThatProxiesMethodsToIRenamedClientProxyAsync()
60public async Task SupportsSubInterfaces()
97public async Task SupportsCancellationToken()
160Assert.Equal($"Cannot generate proxy implementation for '{typeof(IVoidMethodClient).FullName}.{nameof(IVoidMethodClient.Method)}'. All client proxy methods must return '{typeof(Task).FullName}' or '{typeof(Task).FullName}<T>'.", ex.Message);
168Assert.Equal($"Cannot generate proxy implementation for '{typeof(IStringMethodClient).FullName}.{nameof(IStringMethodClient.Method)}'. All client proxy methods must return '{typeof(Task).FullName}' or '{typeof(Task).FullName}<T>'.", ex.Message);
206public async Task ProducesImplementationThatProxiesMethodsToISingleClientProxyAsync()
232public async Task ThrowsIfReturnMethodUsedWithoutSingleClientProxy()
245public async Task ResultMethodSupportsCancellationToken()
283Task Method(string arg1, int arg2, object arg3);
290Task MethodAsync(string arg1, int arg2, object arg3);
305Task Method(out string arg1);
310Task Method(ref string arg1);
315Task SubMethod(string foo);
320Task Method(string foo, CancellationToken cancellationToken);
321Task NoArgumentMethod(CancellationToken cancellationToken);
346public Task SendCoreAsync(string method, object[] args, CancellationToken cancellationToken)
360public Task SendCoreAsync(string method, object[] args, CancellationToken cancellationToken)
TestFilters.cs (22)
19public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
35public async Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
52public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
66public async Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
91public Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
97public Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
112public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
121public async Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
155public Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
159return Task.CompletedTask;
165public Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
169return Task.CompletedTask;
Microsoft.AspNetCore.SignalR.Tests.Utils (13)
Microsoft.AspNetCore.SpaProxy (10)
Microsoft.AspNetCore.SpaServices.Extensions (21)
Microsoft.AspNetCore.SpaServices.Extensions.Tests (2)
Microsoft.AspNetCore.StaticAssets (10)
Microsoft.AspNetCore.StaticAssets.Tests (25)
Microsoft.AspNetCore.StaticFiles (18)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (12)
Microsoft.AspNetCore.StaticFiles.Tests (106)
DefaultFilesMiddlewareTests.cs (15)
17public async Task NullArguments()
41public async Task NoMatch_PassesThrough_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
53public async Task NoMatch_PassesThrough_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
58private async Task NoMatch_PassesThrough(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
81public async Task Endpoint_With_RequestDelegate_PassesThrough()
124public async Task Endpoint_With_Null_RequestDelegate_Does_Not_PassThrough()
181public async Task FoundDirectoryWithDefaultFile_PathModified_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
201public async Task FoundDirectoryWithDefaultFile_PathModified_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
206private async Task FoundDirectoryWithDefaultFile_PathModified(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
236public async Task NearMatch_RedirectAddSlash_All(string baseUrl, string baseDir, string requestUrl, string queryString)
248public async Task NearMatch_RedirectAddSlash_Windows(string baseUrl, string baseDir, string requestUrl, string queryString)
253private async Task NearMatch_RedirectAddSlash(string baseUrl, string baseDir, string requestUrl, string queryString)
286public async Task PostDirectory_PassesThrough_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
303public async Task PostDirectory_PassesThrough_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
308private async Task PostDirectory_PassesThrough(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
DirectoryBrowserMiddlewareTests.cs (19)
17public async Task WorksWithoutEncoderRegistered()
25public async Task NullArguments()
62public async Task NoMatch_PassesThrough_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
74public async Task NoMatch_PassesThrough_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
79private async Task NoMatch_PassesThrough(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
98public async Task Endpoint_With_RequestDelegate_PassesThrough()
139public async Task Endpoint_With_Null_RequestDelegate_Does_Not_PassThrough()
193public async Task FoundDirectory_Served_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
207public async Task FoundDirectory_Served_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
212private async Task FoundDirectory_Served(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
241public async Task NearMatch_RedirectAddSlash_All(string baseUrl, string baseDir, string requestUrl, string queryString)
251public async Task NearMatch_RedirectAddSlash_Windows(string baseUrl, string baseDir, string requestUrl, string queryString)
256private async Task NearMatch_RedirectAddSlash(string baseUrl, string baseDir, string requestUrl, string queryString)
290public async Task PostDirectory_PassesThrough_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
301public async Task PostDirectory_PassesThrough_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
306private async Task PostDirectory_PassesThrough(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
338public async Task HeadDirectory_HeadersButNotBodyServed_All(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
349public async Task HeadDirectory_HeadersButNotBodyServed_Windows(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
354private async Task HeadDirectory_HeadersButNotBodyServed(string baseUrl, string baseDir, string requestUrl, bool appendTrailingSlash = true)
StaticFileMiddlewareTests.cs (27)
23public async Task ReturnsNotFoundWithoutWwwroot()
49public async Task ReturnsNotFoundForBrokenSymlink()
84public async Task ReturnsNotFoundIfSendFileThrows()
119public async Task FoundFile_LastModifiedTrimsSeconds()
139public async Task NullArguments()
158public async Task FoundFile_Served_All(string baseUrl, string baseDir, string requestUrl)
170public async Task FoundFile_Served_Windows(string baseUrl, string baseDir, string requestUrl)
175private async Task FoundFile_Served(string baseUrl, string baseDir, string requestUrl)
205public async Task OnPrepareResponse_Executed_Test()
245public async Task OnPrepareResponseAsync_Executed_Test()
262return Task.CompletedTask;
287public async Task OnPrepareResponse_Execution_Order_Test()
312return Task.CompletedTask;
338public async Task File_Served_If_Endpoint_With_Null_RequestDelegate_Is_Active()
379public async Task File_NotServed_If_Endpoint_With_RequestDelegate_Is_Active()
418public async Task OverrideDefaultStatusCode()
440public async Task DontOverrideNonDefaultStatusCode()
468public async Task HeadFile_HeadersButNotBodyServed(string baseUrl, string baseDir, string requestUrl)
490public async Task Get_NoMatch_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
495public async Task Head_NoMatch_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
500public async Task Unknown_NoMatch_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
505public async Task Options_Match_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
510public async Task Trace_Match_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
515public async Task Post_Match_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
520public async Task Put_Match_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
525public async Task Unknown_Match_PassesThrough(string baseUrl, string baseDir, string requestUrl) =>
528private async Task PassesThrough(string method, string baseUrl, string baseDir, string requestUrl)
Microsoft.AspNetCore.TestHost (44)
Microsoft.AspNetCore.TestHost.Tests (163)
Microsoft.AspNetCore.Tests (82)
Microsoft.AspNetCore.WebSockets (6)
Microsoft.AspNetCore.WebSockets.ConformanceTests (2)
Microsoft.AspNetCore.WebSockets.Tests (45)
Microsoft.AspNetCore.WebUtilities (57)
HttpResponseStreamWriter.cs (36)
193public override Task WriteAsync(char value)
209return Task.CompletedTask;
213private async Task WriteAsyncAwaited(char value)
224public override Task WriteAsync(char[] values, int index, int count)
233return Task.CompletedTask;
241return Task.CompletedTask;
249private async Task WriteAsyncAwaited(char[] values, int index, int count)
266public override Task WriteAsync(string? value)
275return Task.CompletedTask;
283return Task.CompletedTask;
291private async Task WriteAsyncAwaited(string value)
312public override Task WriteAsync(ReadOnlyMemory<char> value, CancellationToken cancellationToken = default)
321return Task.FromCanceled(cancellationToken);
326return Task.CompletedTask;
334return Task.CompletedTask;
342private async Task WriteAsyncAwaited(ReadOnlyMemory<char> value)
364public override Task WriteLineAsync(ReadOnlyMemory<char> value, CancellationToken cancellationToken = default)
373return Task.FromCanceled(cancellationToken);
378return Task.CompletedTask;
387return Task.CompletedTask;
395private async Task WriteLineAsyncAwaited(ReadOnlyMemory<char> value)
402public override Task WriteLineAsync(char[] values, int index, int count)
411return Task.CompletedTask;
422return Task.CompletedTask;
430private async Task WriteLineAsyncAwaited(char[] values, int index, int count)
437public override Task WriteLineAsync(char value)
453return Task.CompletedTask;
461private async Task WriteLineAsyncAwaited(char value)
468public override Task WriteLineAsync(string? value)
477return Task.CompletedTask;
488return Task.CompletedTask;
496private async Task WriteLineAsyncAwaited(string value)
514public override Task FlushAsync()
591private async Task FlushInternalAsync(bool flushEncoder)
672private static Task GetObjectDisposedTask()
674return Task.FromException(new ObjectDisposedException(nameof(HttpResponseStreamWriter)));
Microsoft.AspNetCore.WebUtilities.Microbenchmarks (4)
Microsoft.AspNetCore.WebUtilities.Tests (126)
HttpRequestStreamReaderTest.cs (18)
42public static async Task ReadToEndAsync()
53public static async Task ReadToEndAsync_Reads_Asynchronously()
131public static async Task ReadAsync_ReadInTwoChunks()
150public static async Task ReadLine_ReadMultipleLines(Func<HttpRequestStreamReader, Task<string>> action)
172public static async Task ReadLine_ReadWithNoNewlines(Func<HttpRequestStreamReader, Task<string>> action)
189public static async Task ReadLine_MultipleContinuousLines(Func<HttpRequestStreamReader, Task<string>> action)
213public static async Task ReadLine_CarriageReturnAndLineFeedAcrossBufferBundaries(Func<HttpRequestStreamReader, Task<string>> action)
237public static async Task ReadLine_EOF(Func<HttpRequestStreamReader, Task<string>> action)
250public static async Task ReadLine_NewLineOnly(Func<HttpRequestStreamReader, Task<string>> action)
305public static async Task ReadAsync_Memory_ReadAllCharactersAtOnce()
324public static async Task ReadAsync_Memory_WithMoreDataThanInternalBufferSize()
389public static async Task StreamDisposed_ExpectObjectDisposedExceptionAsync(Func<HttpRequestStreamReader, Task> action)
471yield return new object[] { new Func<HttpRequestStreamReader, Task>(async (httpRequestStreamReader) =>
475yield return new object[] { new Func<HttpRequestStreamReader, Task>(async (httpRequestStreamReader) =>
484Task.FromResult(httpRequestStreamReader.ReadLine())
519public override Task FlushAsync(CancellationToken cancellationToken)
549public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
HttpResponseStreamWriterTest.cs (36)
15public async Task DoesNotWriteBOM()
34public async Task DoesNotFlush_UnderlyingStream_OnDisposingWriter()
50public async Task DoesNotDispose_UnderlyingStream_OnDisposingWriter()
69public async Task FlushesBuffer_OnClose(int byteLength)
90public async Task FlushesBuffer_OnDispose(int byteLength)
145public async Task NoDataWritten_FlushAsync_DoesNotFlushUnderlyingStream()
164public async Task FlushesBuffer_ButNotStream_OnFlushAsync(int byteLength)
185public async Task FlushWriteThrows_DontFlushInDispose(int byteLength)
313public async Task WriteCharAsync_WritesToStream(int byteLength)
337public async Task WriteCharArrayAsync_WritesToStream(int byteLength)
360public async Task WriteReadOnlyMemoryAsync_WritesToStream(int byteLength)
379public async Task WriteReadOnlyMemoryAsync_TokenCanceled_ReturnsCanceledTask()
415public async Task WriteLineReadOnlyMemoryAsync_WritesToStream(int byteLength, int newLineLength)
435public async Task WriteLineReadOnlyMemoryAsync_TokenCanceled_ReturnsCanceledTask()
474public async Task WriteLineAsyncCharArray_WritesToStream(int charCount, int newLineLength)
496public async Task WriteLineAsyncCharArray_OnlyWritesNewLineToStream_ForNullArgument(int newLineLength)
518public async Task WriteLineAsyncCharArray_OnlyWritesNewLineToStream_ForZeroCount(int newLineLength)
542public async Task WriteLineAsyncChar_WritesToStream(int newLineLength)
581public async Task WriteLineAsyncString_WritesToStream(int charCount, int newLineLength)
603public async Task WriteLineAsyncString_OnlyWritesNewLineToStream_ForNullArgument(int newLineLength)
625public async Task WritesData_InExpectedEncoding(string data, string encodingName)
656public async Task WritesData_OfDifferentLength_InExpectedEncoding(
710public async Task HttpResponseStreamWriter_WritesDataCorrectly_ForCharactersHavingSurrogatePairs(int characterSize)
777public static async Task StreamDisposed_ExpectedObjectDisposedExceptionAsync(Func<HttpResponseStreamWriter, Task> function)
810public override Task FlushAsync(CancellationToken cancellationToken)
826public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
881yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
885yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
889yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
893yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
897yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
901yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
905yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
909yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
914yield return new object[] { new Func<HttpResponseStreamWriter, Task>(async (httpResponseStreamWriter) =>
Microsoft.Bcl.TimeProvider (13)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (13)
7/// Provide extensions methods for <see cref="Task"/> operations with <see cref="TimeProvider"/>.
49public static Task Delay(this TimeProvider timeProvider, TimeSpan delay, CancellationToken cancellationToken = default)
52return Task.Delay(delay, timeProvider, cancellationToken);
124/// Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes, when the specified timeout expires, or when the specified <see cref="CancellationToken"/> has cancellation requested.
127/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
130/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
134public static Task WaitAsync(this Task task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
221/// Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes, when the specified timeout expires, or when the specified <see cref="CancellationToken"/> has cancellation requested.
224/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
227/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
Microsoft.Build (71)
Microsoft.Build.CommandLine.UnitTests (33)
Microsoft.Build.Engine.OM.UnitTests (4)
Microsoft.Build.Engine.UnitTests (24)
ProjectCache\ProjectCacheTests.cs (18)
25using Task = System.Threading.Tasks.Task;
202public override Task BeginBuildAsync(CacheContext context, PluginLoggerBase logger, CancellationToken cancellationToken)
204return Task.CompletedTask;
212public override Task EndBuildAsync(PluginLoggerBase logger, CancellationToken cancellationToken)
214return Task.CompletedTask;
235public Func<CacheContext, PluginLoggerBase, CancellationToken, Task>? BeginBuildImplementation { get; set; }
238public override Task BeginBuildAsync(CacheContext context, PluginLoggerBase logger, CancellationToken cancellationToken)
242: Task.CompletedTask;
252: Task.FromResult(CacheResult.IndicateNonCacheHit(CacheResultType.CacheNotApplicable));
255public override Task EndBuildAsync(PluginLoggerBase logger, CancellationToken cancellationToken)
257return Task.CompletedTask;
279public override Task BeginBuildAsync(CacheContext context, PluginLoggerBase logger, CancellationToken cancellationToken)
285return Task.CompletedTask;
304await Task.Delay(_projectQuerySleepTime.Value, cancellationToken);
313public override Task EndBuildAsync(PluginLoggerBase logger, CancellationToken cancellationToken)
319return Task.CompletedTask;
1597return Task.FromResult(CacheResult.IndicateNonCacheHit(CacheResultType.CacheNotApplicable));
1602return Task.FromResult(
Microsoft.Build.Tasks.Core (4)
Microsoft.Build.Tasks.UnitTests (9)
Microsoft.Build.Utilities.UnitTests (2)
Microsoft.DotNet.Arcade.Sdk (1)
Microsoft.DotNet.Arcade.Sdk.Tests (4)
Microsoft.DotNet.Build.Tasks.Feed (18)
Microsoft.DotNet.Build.Tasks.Feed.Tests (4)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Build.Tasks.Packaging (4)
Microsoft.DotNet.Deployment.Tasks.Links (6)
Microsoft.DotNet.Helix.Client (64)
generated-code\Aggregate.cs (11)
235internal async Task OnAnalysisSummaryFailed(Request req, Response res)
330internal async Task OnBuildHistoryFailed(Request req, Response res)
435internal async Task OnBuildFailed(Request req, Response res)
547internal async Task OnJobSummaryFailed(Request req, Response res)
654internal async Task OnWorkItemSummaryFailed(Request req, Response res)
796internal async Task OnAnalysisDetailFailed(Request req, Response res)
890internal async Task OnPropertiesFailed(Request req, Response res)
965internal async Task OnInvestigation_ContinueFailed(Request req, Response res)
1082internal async Task OnInvestigationFailed(Request req, Response res)
1202internal async Task OnHistoryFailed(Request req, Response res)
1283internal async Task OnMultiSourceFailed(Request req, Response res)
Microsoft.DotNet.Helix.JobSender (7)
Microsoft.DotNet.Helix.JobSender.Tests (2)
Microsoft.DotNet.Helix.Sdk (38)
Microsoft.DotNet.Helix.Sdk.Tests (6)
Microsoft.DotNet.Open.Api.Tools.Tests (32)
Microsoft.DotNet.RemoteExecutor (6)
RemoteExecutor.cs (5)
217public static RemoteInvokeHandle Invoke(Func<Task> method, RemoteInvokeOptions options = null)
230public static RemoteInvokeHandle Invoke(Func<string, Task> method, string arg,
245public static RemoteInvokeHandle Invoke(Func<string, string, Task> method, string arg1, string arg2,
261public static RemoteInvokeHandle Invoke(Func<string, string, string, Task> method, string arg1,
369|| method.ReturnType == typeof(Task)
Microsoft.DotNet.RemoteExecutor.Tests (5)
Microsoft.DotNet.SignCheck (3)
Microsoft.DotNet.SwaggerGenerator.MSBuild (1)
Microsoft.DotNet.VersionTools (26)
Microsoft.DotNet.VersionTools.Tests (6)
Microsoft.Extensions.ApiDescription.Client.Tests (17)
Microsoft.Extensions.Caching.Abstractions (10)
DistributedCacheExtensions.cs (3)
40public static Task SetAsync(this IDistributedCache cache, string key, byte[] value, CancellationToken token = default(CancellationToken))
85public static Task SetStringAsync(this IDistributedCache cache, string key, string value, CancellationToken token = default(CancellationToken))
100public static Task SetStringAsync(this IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken))
Microsoft.Extensions.Caching.Hybrid (5)
Microsoft.Extensions.Caching.Hybrid.Tests (33)
Microsoft.Extensions.Caching.Memory (10)
Microsoft.Extensions.Caching.MicroBenchmarks (6)
Microsoft.Extensions.Caching.SqlServer (10)
Microsoft.Extensions.Caching.SqlServer.Tests (23)
Microsoft.Extensions.Caching.StackExchangeRedis (7)
RedisCache.cs (7)
185var setFields = batch.HashSetAsync(prefixedKey, fields);
200public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)
206private async Task SetImplAsync(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options, CancellationToken token = default)
233await Task.WhenAll(
263public async Task RefreshAsync(string key, CancellationToken token = default)
478public async Task RemoveAsync(string key, CancellationToken token = default)
538private async Task RefreshAsync(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr, CancellationToken token)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (24)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (5)
Microsoft.Extensions.DependencyInjection (3)
Microsoft.Extensions.Diagnostics.HealthChecks (16)
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (2)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (86)
DefaultHealthCheckServiceTest.cs (38)
34.AddCheck("Foo", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy())))
35.AddCheck("Foo", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy())))
36.AddCheck("Bar", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy())))
37.AddCheck("Baz", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy())))
38.AddCheck("Baz", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy())));
54public async Task CheckAsync_RunsAllChecksAndAggregatesResultsAsync()
74b.AddAsyncCheck("HealthyCheck", _ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage, data)), healthyCheckTags);
75b.AddAsyncCheck("DegradedCheck", _ => Task.FromResult(HealthCheckResult.Degraded(DegradedMessage)), degradedCheckTags);
76b.AddAsyncCheck("UnhealthyCheck", _ => Task.FromResult(HealthCheckResult.Unhealthy(UnhealthyMessage, exception)), unhealthyCheckTags);
119public async Task CheckAsync_TagsArePresentInHealthReportEntryIfExceptionOccurs()
160public async Task CheckAsync_RunsFilteredChecksAndAggregatesResultsAsync()
177b.AddAsyncCheck("HealthyCheck", _ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage, data)));
178b.AddAsyncCheck("DegradedCheck", _ => Task.FromResult(HealthCheckResult.Degraded(DegradedMessage)));
179b.AddAsyncCheck("UnhealthyCheck", _ => Task.FromResult(HealthCheckResult.Unhealthy(UnhealthyMessage, exception)));
202public async Task CheckHealthAsync_SetsRegistrationForEachCheck()
245public async Task CheckHealthAsync_Cancellation_CanPropagate()
256await Task.Delay(10000, ct);
274public async Task CheckHealthAsync_ConvertsExceptionInHealthCheckToUnhealthyResultAsync()
283b.AddAsyncCheck("Faults", ct => Task.FromException<HealthCheckResult>(faultedException));
284b.AddAsyncCheck("Succeeds", ct => Task.FromResult(HealthCheckResult.Healthy()));
317public async Task CheckHealthAsync_SetsUpALoggerScopeForEachCheck()
334return Task.FromResult(HealthCheckResult.Healthy());
358public async Task CheckHealthAsync_CheckCanDependOnTransientService()
382public async Task CheckHealthAsync_CheckCanDependOnScopedService()
407public async Task CheckHealthAsync_CheckCanDependOnScopedService_per_check()
437public async Task CheckHealthAsync_CheckCanHaveScopedDisposableDependencies()
462public async Task CheckHealthAsync_CheckCanDependOnSingletonService()
486public async Task CheckHealthAsync_ChecksAreRunInParallel()
514await Task.WhenAll(output1.Task, output2.Task).TimeoutAfter(TimeSpan.FromSeconds(10));
534public async Task CheckHealthAsync_TimeoutReturnsUnhealthy()
541await Task.Delay(2000, ct);
567await Task.Delay(1).ConfigureAwait(false);
593public async Task CheckHealthAsync_WithFailureStatus()
668return Task.FromResult(HealthCheckResult.Healthy());
686return Task.FromResult(HealthCheckResult.Healthy());
690return Task.FromResult(HealthCheckResult.Unhealthy("failed", e));
704return Task.FromResult(HealthCheckResult.Healthy(data: data));
736return Task.FromResult(HealthCheckResult.Healthy(data: new Dictionary<string, object> { { "self", this } }));
HealthCheckPublisherHostedServiceTest.cs (41)
41public async Task StartAsync_WithoutPublishers_DoesNotStartTimer()
68public async Task StartAsync_WithPublishers_StartsTimer()
96public async Task StartAsync_WithPublishers_StartsTimer_RunsPublishers()
141public async Task StopAsync_CancelsExecution()
155var running = RunServiceAsync(service);
182public async Task RunAsync_WaitsForCompletion_Single()
198var running = RunServiceAsync(service);
236public async Task RunAsync_WaitsForCompletion_Single_RegistrationParameters()
251instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
258instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
270instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
282instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
297return Task.FromResult(HealthCheckResult.Healthy(HealthyMessage));
310instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
322instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
334instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
346instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
358var running = RunServiceAsync(service);
362await Task.Yield();
395public async Task RunAsync_WaitsForCompletion_Multiple()
416var running = RunServiceAsync(service);
447public async Task RunAsync_PublishersCanTimeout()
462var running = RunServiceAsync(service);
500public async Task RunAsync_CanFilterHealthChecks()
525instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
532instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
544instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
556instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
571return Task.FromResult(HealthCheckResult.Healthy(HealthyMessage));
584instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
596instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
608instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
620instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
664public async Task RunAsync_HandlesExceptions()
706public async Task RunAsync_HandlesExceptions_Multiple()
787private Task RunServiceAsync(HealthCheckPublisherHostedService service) => service.RunAsync((TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)));
789private static async Task AssertCanceledAsync(CancellationToken cancellationToken)
791await Assert.ThrowsAsync<TaskCanceledException>(() => Task.Delay(TimeSpan.FromSeconds(10), cancellationToken));
807public Task Started => _started.Task;
809public Task? Wait { get; set; }
811public async Task PublishAsync(HealthReport report, CancellationToken cancellationToken)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Hosting (24)
Microsoft.Extensions.Hosting.Abstractions (37)
Microsoft.Extensions.Hosting.Systemd (4)
Microsoft.Extensions.Hosting.WindowsServices (3)
Microsoft.Extensions.Http.Polly.Tests (31)
Microsoft.Extensions.Identity.Core (169)
IUserStore.cs (12)
21/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
29/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
38/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
39Task SetUserNameAsync(TUser user, string? userName, CancellationToken cancellationToken);
46/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the normalized user name for the specified <paramref name="user"/>.</returns>
55/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
56Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken);
63/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
71/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
79/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the delete operation.</returns>
88/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
98/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
RoleManager.cs (14)
153/// The <see cref="Task"/> that represents the asynchronous operation.
174/// The <see cref="Task"/> that represents the asynchronous operation.
176public virtual async Task UpdateNormalizedRoleNameAsync(TRole role)
187/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> for the update.
202/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> for the delete.
217/// The <see cref="Task"/> that represents the asynchronous operation, containing true if the role name exists, otherwise false.
243/// The <see cref="Task"/> that represents the asynchronous operation, containing the role
257/// The <see cref="Task"/> that represents the asynchronous operation, containing the name of the
272/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
289/// The <see cref="Task"/> that represents the asynchronous operation, containing the ID of the
303/// The <see cref="Task"/> that represents the asynchronous operation, containing the role
320/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
340/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
358/// The <see cref="Task"/> that represents the asynchronous operation, containing the list of <see cref="Claim"/>s
UserManager.cs (66)
436return id == null ? Task.FromResult<TUser?>(null) : FindByIdAsync(id);
444/// The <see cref="Task"/> that represents the asynchronous operation, containing the security
449return Task.FromResult(Guid.NewGuid().ToString());
458/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
485/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
501/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
517/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
530/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userName"/> if it exists.
568/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
619/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
620public virtual async Task UpdateNormalizedUserNameAsync(TUser user)
631/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
644/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
659/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
672/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing true if
704/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a password
723/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
754/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
781/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
801/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="PasswordVerificationResult"/>
818/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
838/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
859/// <returns>The <see cref="Task"/> that represents the asynchronous operation,
875/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
902/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
921/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
943/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
968/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
984/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1002/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1023/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1044/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1062/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1097/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1121/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1149/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1191/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1217/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing a list of role names.</returns>
1232/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified <paramref name="user"/> is
1262/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1321public virtual async Task UpdateNormalizedEmailAsync(TUser user)
1336/// The <see cref="Task"/> that represents the asynchronous operation, an email confirmation token.
1350/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1390/// The <see cref="Task"/> that represents the asynchronous operation, an email change token.
1405/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1429/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's telephone number, if any.</returns>
1444/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1467/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1492/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a confirmed
1509/// The <see cref="Task"/> that represents the asynchronous operation, containing the telephone change number token.
1525/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the <paramref name="token"/>
1546/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the <paramref name="token"/>
1576/// The <see cref="Task"/> that represents result of the asynchronous operation, a token for
1611/// The <see cref="Task"/> that represents result of the asynchronous operation, a list of two
1636/// The <see cref="Task"/> that represents result of the asynchronous operation, true if the token is valid,
1663/// The <see cref="Task"/> that represents result of the asynchronous operation, a two factor authentication token
1684/// The <see cref="Task"/> that represents the asynchronous operation, true if the specified <paramref name="user "/>
1702/// The <see cref="Task"/> that represents the asynchronous operation, the <see cref="IdentityResult"/> of the operation
1721/// The <see cref="Task"/> that represents the asynchronous operation, true if the specified <paramref name="user "/>
1744/// The <see cref="Task"/> that represents the asynchronous operation, the <see cref="IdentityResult"/> of the operation
1761/// The <see cref="Task"/> that represents the asynchronous operation, true if a user can be locked out, otherwise false.
1792/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
1814/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
1838/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
1857/// <returns>The <see cref="Task"/> that contains the result the asynchronous operation, the current failed access count
2199private async Task UpdateSecurityStampInternal(TUser user)
Microsoft.Extensions.Identity.Stores (109)
UserStoreBase.cs (96)
115/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
121return Task.FromResult(ConvertIdToString(user.Id)!);
129/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
135return Task.FromResult(user.UserName);
144/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
145public virtual Task SetUserNameAsync(TUser user, string? userName, CancellationToken cancellationToken = default(CancellationToken))
151return Task.CompletedTask;
159/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the normalized user name for the specified <paramref name="user"/>.</returns>
165return Task.FromResult(user.NormalizedUserName);
174/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
175public virtual Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken = default(CancellationToken))
181return Task.CompletedTask;
189/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
197/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
205/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
214/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
254/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
272/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
273public virtual Task SetPasswordHashAsync(TUser user, string? passwordHash, CancellationToken cancellationToken = default(CancellationToken))
279return Task.CompletedTask;
293return Task.FromResult(user.PasswordHash);
306return Task.FromResult(user.PasswordHash != null);
366/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
367public abstract Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken));
376/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
377public abstract Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken));
385/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
386public abstract Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken));
394/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
395public abstract Task AddLoginAsync(TUser user, UserLoginInfo login, CancellationToken cancellationToken = default(CancellationToken));
404/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
405public abstract Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken));
413/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
424/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
454return Task.FromResult(user.EmailConfirmed);
464public virtual Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
470return Task.CompletedTask;
480public virtual Task SetEmailAsync(TUser user, string? email, CancellationToken cancellationToken = default(CancellationToken))
486return Task.CompletedTask;
500return Task.FromResult(user.Email);
516return Task.FromResult(user.NormalizedEmail);
526public virtual Task SetNormalizedEmailAsync(TUser user, string? normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
532return Task.CompletedTask;
560return Task.FromResult(user.LockoutEnd);
569/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
570public virtual Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
576return Task.CompletedTask;
584/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the incremented failed access count.</returns>
591return Task.FromResult(user.AccessFailedCount);
599/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
601public virtual Task ResetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
607return Task.CompletedTask;
615/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the failed access count.</returns>
621return Task.FromResult(user.AccessFailedCount);
630/// The <see cref="Task"/> that represents the asynchronous operation, true if a user can be locked out, otherwise false.
637return Task.FromResult(user.LockoutEnabled);
646/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
647public virtual Task SetLockoutEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
653return Task.CompletedTask;
662/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
663public virtual Task SetPhoneNumberAsync(TUser user, string? phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
669return Task.CompletedTask;
677/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's telephone number, if any.</returns>
683return Task.FromResult(user.PhoneNumber);
692/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a confirmed
700return Task.FromResult(user.PhoneNumberConfirmed);
709/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
710public virtual Task SetPhoneNumberConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
716return Task.CompletedTask;
725/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
726public virtual Task SetSecurityStampAsync(TUser user, string stamp, CancellationToken cancellationToken = default(CancellationToken))
733return Task.CompletedTask;
741/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
747return Task.FromResult(user.SecurityStamp);
757/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
758public virtual Task SetTwoFactorEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
764return Task.CompletedTask;
774/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified
782return Task.FromResult(user.TwoFactorEnabled);
791/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
810protected abstract Task AddUserTokenAsync(TUserToken token);
817protected abstract Task RemoveUserTokenAsync(TUserToken token);
827/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
828public virtual async Task SetTokenAsync(TUser user, string loginProvider, string name, string? value, CancellationToken cancellationToken)
853/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
854public virtual async Task RemoveTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
874/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
895/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
896public virtual Task SetAuthenticatorKeyAsync(TUser user, string key, CancellationToken cancellationToken)
904/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
952public virtual Task ReplaceCodesAsync(TUser user, IEnumerable<string> recoveryCodes, CancellationToken cancellationToken)
1036/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
1046/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
1047public abstract Task AddToRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken));
1055/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
1056public abstract Task RemoveFromRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken));
Microsoft.Extensions.Logging.AzureAppServices (11)
Microsoft.Extensions.ObjectPool.Microbenchmark (8)
Microsoft.Extensions.SecretManager.Tools.Tests (1)
Microsoft.Interop.ComInterfaceGenerator (11)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
33protected abstract Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
99private static async Task<Solution> ApplyActionAndEnableUnsafe(Solution solution, DocumentId documentId, Func<DocumentEditor, CancellationToken, Task> documentBasedFix, CancellationToken ct)
110public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
157protected record struct ConvertToSourceGeneratedInteropFix(Func<DocumentEditor, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
Microsoft.Interop.LibraryImportGenerator (12)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
33protected abstract Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
99private static async Task<Solution> ApplyActionAndEnableUnsafe(Solution solution, DocumentId documentId, Func<DocumentEditor, CancellationToken, Task> documentBasedFix, CancellationToken ct)
110public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
157protected record struct ConvertToSourceGeneratedInteropFix(Func<DocumentEditor, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
Microsoft.JSInterop (15)
Microsoft.JSInterop.Tests (39)
MiddlewareAnalysisSample (1)
mscorlib (1)
Mvc.Analyzers.Test (43)
Mvc.Api.Analyzers.Test (183)
MvcFactsTest.cs (42)
18public Task IsController_ReturnsFalseForInterfaces() => IsControllerReturnsFalse(typeof(ITestController));
21public Task IsController_ReturnsFalseForAbstractTypes() => IsControllerReturnsFalse(typeof(AbstractController));
24public Task IsController_ReturnsFalseForValueType() => IsControllerReturnsFalse(typeof(ValueTypeController));
27public Task IsController_ReturnsFalseForGenericType() => IsControllerReturnsFalse(typeof(OpenGenericController<>));
30public Task IsController_ReturnsFalseForPocoType() => IsControllerReturnsFalse(typeof(PocoType));
33public Task IsController_ReturnsFalseForTypeDerivedFromPocoType() => IsControllerReturnsFalse(typeof(DerivedPocoType));
36public Task IsController_ReturnsTrueForTypeDerivingFromController() => IsControllerReturnsTrue(typeof(TypeDerivingFromController));
39public Task IsController_ReturnsTrueForTypeDerivingFromControllerBase() => IsControllerReturnsTrue(typeof(TypeDerivingFromControllerBase));
42public Task IsController_ReturnsTrueForTypeDerivingFromController_WithoutSuffix() => IsControllerReturnsTrue(typeof(NoSuffix));
45public Task IsController_ReturnsTrueForTypeWithSuffix_ThatIsNotDerivedFromController() => IsControllerReturnsTrue(typeof(PocoController));
48public Task IsController_ReturnsTrueForTypeWithoutSuffix_WithControllerAttribute() => IsControllerReturnsTrue(typeof(CustomBase));
51public Task IsController_ReturnsTrueForTypeDerivingFromCustomBaseThatHasControllerAttribute() => IsControllerReturnsTrue(typeof(ChildOfCustomBase));
54public Task IsController_ReturnsFalseForTypeWithNonControllerAttribute() => IsControllerReturnsFalse(typeof(BaseNonController));
57public Task IsController_ReturnsFalseForTypesDerivingFromTypeWithNonControllerAttribute() => IsControllerReturnsFalse(typeof(BasePocoNonControllerChildController));
60public Task IsController_ReturnsFalseForTypesDerivingFromTypeWithNonControllerAttributeWithControllerAttribute() =>
63private async Task IsControllerReturnsFalse(Type type)
77private async Task IsControllerReturnsTrue(Type type)
95public Task IsAction_ReturnsFalseForConstructor() => IsActionReturnsFalse(TestIsControllerActionType, ".ctor");
98public Task IsAction_ReturnsFalseForStaticConstructor() => IsActionReturnsFalse(TestIsControllerActionType, ".cctor");
101public Task IsAction_ReturnsFalseForPrivateMethod() => IsActionReturnsFalse(TestIsControllerActionType, "PrivateMethod");
104public Task IsAction_ReturnsFalseForProtectedMethod() => IsActionReturnsFalse(TestIsControllerActionType, "ProtectedMethod");
107public Task IsAction_ReturnsFalseForInternalMethod() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.InternalMethod));
110public Task IsAction_ReturnsFalseForGenericMethod() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.GenericMethod));
113public Task IsAction_ReturnsFalseForStaticMethod() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.StaticMethod));
116public Task IsAction_ReturnsFalseForNonActionMethod() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.NonAction));
119public Task IsAction_ReturnsFalseForOverriddenNonActionMethod() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.NonActionBase));
122public Task IsAction_ReturnsFalseForDisposableDispose() => IsActionReturnsFalse(TestIsControllerActionType, nameof(TestIsControllerAction.Dispose));
125public Task IsAction_ReturnsFalseForExplicitDisposableDispose() => IsActionReturnsFalse(typeof(ExplicitIDisposable), "System.IDisposable.Dispose");
128public Task IsAction_ReturnsFalseForAbstractMethods() => IsActionReturnsFalse(typeof(TestIsControllerActionBase), nameof(TestIsControllerActionBase.AbstractMethod));
131public Task IsAction_ReturnsFalseForObjectEquals() => IsActionReturnsFalse(typeof(object), nameof(object.Equals));
134public Task IsAction_ReturnsFalseForObjectHashCode() => IsActionReturnsFalse(typeof(object), nameof(object.GetHashCode));
137public Task IsAction_ReturnsFalseForObjectToString() => IsActionReturnsFalse(typeof(object), nameof(object.ToString));
140public Task IsAction_ReturnsFalseForOverriddenObjectEquals() =>
144public Task IsAction_ReturnsFalseForOverriddenObjectHashCode() =>
147private async Task IsActionReturnsFalse(Type type, string methodName)
163public Task IsAction_ReturnsTrueForNewMethodsOfObject() => IsActionReturnsTrue(typeof(OverridesObjectMethods), nameof(OverridesObjectMethods.ToString));
166public Task IsAction_ReturnsTrueForNotDisposableDispose() => IsActionReturnsTrue(typeof(NotDisposable), nameof(NotDisposable.Dispose));
169public Task IsAction_ReturnsTrueForNotDisposableDisposeOnTypeWithExplicitImplementation() =>
173public Task IsAction_ReturnsTrueForOrdinaryAction() => IsActionReturnsTrue(TestIsControllerActionType, nameof(TestIsControllerAction.Ordinary));
176public Task IsAction_ReturnsTrueForOverriddenMethod() => IsActionReturnsTrue(TestIsControllerActionType, nameof(TestIsControllerAction.AbstractMethod));
179public async Task IsAction_ReturnsTrueForNotDisposableDisposeOnTypeWithImplicitImplementation()
194private async Task IsActionReturnsTrue(Type type, string methodName)
TestFiles\ApiConventionAnalyzerIntegrationTest\DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs (1)
15await Task.Yield();
TestFiles\ApiConventionAnalyzerIntegrationTest\DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs (1)
15await Task.Yield();
TestFiles\ApiConventionAnalyzerIntegrationTest\DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs (1)
14await Task.Yield();
TestFiles\ApiConventionAnalyzerIntegrationTest\NoDiagnosticsAreReturned_ForOkResultReturningAction.cs (1)
14await Task.Yield();
NativeIISSample (1)
Negotiate.Server (1)
NegotiateAuthSample (2)
netstandard (1)
OpenIdConnectSample (4)
OutputCachingSample (2)
PathSchemeSelection (1)
PlaintextApp (3)
PortableTask (1)
PresentationBuildTasks (1)
PresentationFramework (1)
ProjectCachePlugin (5)
RazorBuildWebSite.Views (3)
RazorPagesWebSite (16)
RazorWebSite (5)
RequestDecompressionSample (1)
ResponseCachingSample (1)
ResponseCompressionSample (2)
RewriteSample (1)
RoutingSandbox (5)
RoutingWebSite (2)
Sample (5)
SampleStartups (6)
Sandbox (3)
ServerComparison.FunctionalTests (27)
ResponseTests.cs (14)
34public Task ResponseFormats_ContentLength(TestVariant variant)
41public Task ResponseFormats_Chunked(TestVariant variant)
48public Task ResponseFormats_ManuallyChunk(TestVariant variant)
60public Task ResponseFormats_Http10ConnectionClose(TestVariant variant)
67public Task ResponseFormats_Http11ConnectionClose(TestVariant variant)
74public Task ResponseFormats_ManuallyChunkAndClose(TestVariant variant)
79private async Task ResponseFormats(TestVariant variant, Func<HttpClient, ILogger, Task> scenario, [CallerMemberName] string testName = null)
126private static async Task CheckContentLengthAsync(HttpClient client, ILogger logger)
151private static async Task CheckHttp11ConnectionCloseAsync(HttpClient client, ILogger logger)
171private static async Task CheckHttp10ConnectionCloseAsync(HttpClient client, ILogger logger)
196private static async Task CheckChunkedAsync(HttpClient client, ILogger logger)
221private static async Task CheckManuallyChunkedAsync(HttpClient client, ILogger logger)
246private static async Task CheckManuallyChunkedAndCloseAsync(HttpClient client, ILogger logger)
ServerComparison.TestSites (1)
SessionSample (1)
SignalR.Client.FunctionalTestApp (8)
SignalRSamples (39)
Hubs\Chat.cs (10)
10public override Task OnConnectedAsync()
16public override Task OnDisconnectedAsync(Exception exception)
22public Task Send(string name, string message)
27public Task SendToOthers(string name, string message)
32public Task SendToConnection(string connectionId, string name, string message)
37public Task SendToGroup(string groupName, string name, string message)
42public Task SendToOthersInGroup(string groupName, string name, string message)
47public async Task JoinGroup(string groupName, string name)
54public async Task LeaveGroup(string groupName, string name)
61public Task Echo(string name, string message)
SocialSample (6)
SocialWeather (14)
Sockets.BindTests (72)
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (52)
39public async Task RegisterAddresses_HostName_Success()
47public async Task RegisterAddresses_IPv4_Success(string addressInput, string testUrl)
55public async Task RegisterAddresses_IPv4Port5000Default_Success(string addressInput, string testUrl)
68public async Task RegisterAddresses_IPv4Port80_Success(string addressInput, string testUrl)
79public async Task RegisterAddresses_IPv4StaticPort_Success()
85public async Task RegisterAddresses_IPv4LocalhostStaticPort_Success()
91public async Task RegisterIPEndPoint_IPv4StaticPort_Success()
98public async Task RegisterIPEndPoint_IPv6StaticPort_Success()
106public async Task RegisterIPEndPoint_DynamicPort_Success(IPEndPoint endPoint, string testUrl)
114public async Task RegisterIPEndPoint_Port443_Success(IPEndPoint endpoint, string testUrl)
127public async Task RegisterAddresses_IPv6_Success(string addressInput, string[] testUrls)
135public async Task RegisterAddresses_IPv6Port5000Default_Success(string addressInput, string[] testUrls)
148public async Task RegisterAddresses_IPv6Port80_Success(string addressInput, string[] testUrls)
162public async Task RegisterAddresses_IPv6ScopeId_Success(string addressInput, string testUrl)
169public async Task RegisterAddresses_IPv6StaticPort_Success()
176public async Task RegisterAddresses_IPv6LocalhostStaticPort_Success()
181private async Task RegisterAddresses_Success(string addressInput, string[] testUrls, int testPort = 0)
224private Task RegisterAddresses_Success(string addressInput, string testUrl, int testPort = 0)
227private Task RegisterAddresses_StaticPort_Success(string addressInput, string[] testUrls) =>
231public async Task RegisterHttpAddress_UpgradedToHttpsByConfigureEndpointDefaults()
270private async Task RunTestWithStaticPort(Func<int, Task> test)
301private Task RegisterAddresses_StaticPort_Success(string addressInput, string testUrl)
304private async Task RegisterIPEndPoint_Success(IPEndPoint endPoint, string testUrl, int testPort = 0)
343private Task RegisterIPEndPoint_StaticPort_Success(IPAddress address, string testUrl)
347public async Task ListenAnyIP_IPv4_Success()
354public async Task ListenAnyIP_IPv6_Success()
362public async Task ListenAnyIP_HostName_Success()
368private async Task ListenAnyIP_Success(string[] testUrls, int testPort = 0)
400public async Task ListenLocalhost_IPv4LocalhostStaticPort_Success()
407public async Task ListenLocalhost_IPv6LocalhostStaticPort_Success()
412private Task ListenLocalhost_StaticPort_Success(string[] testUrls) =>
415private async Task ListenLocalhost_Success(string[] testUrls, int testPort = 0)
448public Task DefaultsServerAddress_BindsToIPv4()
452return Task.CompletedTask;
461public Task DefaultsServerAddress_BindsToIPv6()
465return Task.CompletedTask;
473public Task DefaultsServerAddress_BindsToIPv4WithHttp()
477return Task.CompletedTask;
487public Task DefaultsServerAddress_BindsToIPv6WithHttp()
491return Task.CompletedTask;
499private async Task RegisterDefaultServerAddresses_Success(IEnumerable<string> addresses, bool mockHttps = false)
534public async Task ThrowsWhenBindingToIPv4AddressInUse()
569public async Task ThrowsWhenBindingToIPv6AddressInUse()
604public async Task OverrideDirectConfigurationWithIServerAddressesFeature_Succeeds()
648public async Task DoesNotOverrideDirectConfigurationWithIServerAddressesFeature_IfPreferHostingUrlsFalse()
692public async Task DoesNotOverrideDirectConfigurationWithIServerAddressesFeature_IfAddressesEmpty()
742public async Task ThrowsWhenBindingLocalhostToDynamicPort()
767public async Task ThrowsForUnsupportedAddressFromHosting(string address)
790public async Task CanRebindToEndPoint()
839public async Task CanRebindToMultipleEndPoints()
895public async Task EndpointDefaultsConfig_CanSetProtocolForUrlsConfig(string input, HttpProtocols expected)
Sockets.FunctionalTests (113)
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (32)
66public async Task LargeUpload(long contentLength, bool checkBytes)
146public Task RemoteIPv4Address()
153public Task RemoteIPv6Address()
159public async Task DoesNotHangOnConnectionCloseRequest()
193public async Task CanHandleMultipleConcurrentRequests()
239public async Task ConnectionClosedPriorToRequestIsLoggedAsDebug()
269await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
291public async Task ConnectionResetPriorToRequestIsLoggedAsDebug()
321await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
342public async Task ConnectionClosedBetweenRequestsIsLoggedAsDebug()
366await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
401public async Task ConnectionResetBetweenRequestsIsLoggedAsDebug()
425await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory)))
461public async Task ConnectionClosedOrResetMidRequestIsLoggedAsDebug(bool close)
530public async Task ThrowsOnReadAfterConnectionError()
584public async Task RequestAbortedTokenFiredOnClientFIN()
623public async Task RequestAbortedTokenUnchangedOnAbort()
670public async Task AbortingTheConnection(bool fin)
688return Task.CompletedTask;
718public async Task ConnectionClosedTokenFiresOnClientFIN(string listenOptionsName)
731return Task.CompletedTask;
753public async Task ConnectionClosedTokenFiresOnServerFIN(string listenOptionsName)
763return Task.CompletedTask;
789public async Task ConnectionClosedTokenFiresOnServerAbort(string listenOptionsName)
801return Task.CompletedTask;
830public async Task RequestsCanBeAbortedMidRead(string listenOptionsName)
859var readTask = request.Body.CopyToAsync(Stream.Null);
923public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOptionsName, bool fin)
1013var ignore = connection.Stream.WriteAsync(scratchBuffer, 0, scratchBuffer.Length);
1030public async Task AppCanHandleClientAbortingConnectionMidRequest(string listenOptionsName)
1079private async Task TestRemoteIPAddress(string registerAddress, string requestAddress, string expectAddress)
1125private static async Task AssertStreamContains(Stream stream, string expectedSubstring)
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (31)
50public async Task LargeDownload()
108public async Task IgnoreNullHeaderValues(string headerName, StringValues headerValue, string expectedValue)
155public async Task WriteAfterConnectionCloseNoops(ListenOptions listenOptions)
198public async Task ThrowsOnWriteWithRequestAbortedTokenAfterRequestIsAborted(ListenOptions listenOptions)
261public async Task WritingToConnectionAfterUnobservedCloseTriggersRequestAbortedToken(ListenOptions listenOptions)
310await Task.Delay(10);
335var ignore = connection.Stream.WriteAsync(scratchBuffer, 0, scratchBuffer.Length);
352public async Task AppCanHandleClientAbortingConnectionMidResponse(ListenOptions listenOptions)
373await Task.Delay(10);
423public async Task ClientAbortingConnectionImmediatelyIsNotLoggedHigherThanDebug(ListenOptions listenOptions)
431await using (var server = new TestServer(context => Task.CompletedTask, testServiceContext, listenOptions))
461public async Task ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate(bool fin)
510async Task App(HttpContext context)
524await Task.Yield();
593public async Task HttpsConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate(bool fin)
712public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressure(bool fin)
760async Task App(HttpContext context)
803var sendTask = Task.Run(async () =>
808await Task.Delay(10);
833public async Task ConnectionNotClosedWhenClientSatisfiesMinimumDataRateGivenLargeResponseChunks()
860async Task App(HttpContext context)
909public async Task ConnectionNotClosedWhenClientSatisfiesMinimumDataRateGivenLargeResponseHeaders()
937async Task App(HttpContext context)
994public async Task ClientCanReceiveFullConnectionCloseResponseWithoutErrorAtALowDataRate()
1021async Task App(HttpContext context)
1068private async Task AssertStreamAborted(Stream stream, int totalBytes)
1095private async Task AssertBytesReceivedAtTargetRate(Stream stream, int expectedBytes, int targetBytesPerSecond)
1113await Task.Delay(expectedTimeElapsed - timeElapsed);
1118private async Task AssertStreamCompletedAtTargetRate(Stream stream, long expectedBytes, int targetBytesPerSecond)
1134await Task.Delay(expectedTimeElapsed - timeElapsed);
StaticFileSample (1)
StatusCodePagesSample (2)
System.ComponentModel.EventBasedAsync (1)
System.Console (6)
System.Data.Common (76)
System.Diagnostics.Process (12)
System.Formats.Tar (51)
System.IO.Compression (28)
System.IO.Compression.Brotli (10)
System.IO.Hashing (2)
System.IO.IsolatedStorage (2)
System.IO.Pipelines (23)
System.IO.Pipes (20)
System.Linq.Expressions (1)
System.Linq.Parallel (15)
System.Memory.Data (6)
System.Net.Http (191)
System\Net\Http\HttpContent.cs (29)
285Task.FromResult<Stream>(new MemoryStream(buffer.Array!, buffer.Offset, buffer.Count, writable: false)) :
297Task<Stream> ts = Task.FromResult((Stream)_contentReadStream);
331protected abstract Task SerializeToStreamAsync(Stream stream, TransportContext? context);
341protected virtual Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) =>
373public Task CopyToAsync(Stream stream) =>
376public Task CopyToAsync(Stream stream, CancellationToken cancellationToken) =>
379public Task CopyToAsync(Stream stream, TransportContext? context) =>
382public Task CopyToAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken)
392return Task.FromException(GetStreamCopyException(e));
395static async Task WaitAsync(ValueTask copyTask)
415Task task = SerializeToStreamAsync(stream, context, cancellationToken);
470public Task LoadIntoBufferAsync() =>
476public Task LoadIntoBufferAsync(long maxBufferSize) =>
479internal Task LoadIntoBufferAsync(CancellationToken cancellationToken) =>
482internal Task LoadIntoBufferAsync(long maxBufferSize, CancellationToken cancellationToken)
489return Task.CompletedTask;
495return Task.FromException(error!);
500Task task = SerializeToStreamAsync(tempBuffer, null, cancellationToken);
506return Task.FromException(GetStreamCopyException(e));
511private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
692private void CheckTaskNotNull(Task task)
831private static async Task<TResult> WaitAndReturnAsync<TState, TResult>(Task waitTask, TState state, Func<TState, TResult> returnFunc)
873public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
896public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
1023public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1026return Task.CompletedTask;
1050public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (18)
349return Task.FromResult(false);
354return Task.FromResult(true);
377private async Task FlushOutgoingBytesAsync()
469private async Task ProcessIncomingFramesAsync()
1124internal Task FlushAsync(CancellationToken cancellationToken) =>
1172private Task PerformWriteAsync<T>(int writeBytes, T state, Func<T, Memory<byte>, bool> writeAction, CancellationToken cancellationToken = default)
1180return Task.FromException(GetRequestAbortedException(_abortException));
1187return Task.FromException(new ObjectDisposedException(nameof(Http2Connection)));
1193private async Task ProcessOutgoingFramesAsync()
1274private Task SendSettingsAckAsync() =>
1286private Task SendPingAsync(long pingContent, bool isAck = false) =>
1300private Task SendRstStreamAsync(int streamId, Http2ProtocolErrorCode errorCode) =>
1693private async Task SendStreamDataAsync(int streamId, ReadOnlyMemory<byte> buffer, bool finalFlush, CancellationToken cancellationToken)
1740private Task SendEndStreamAsync(int streamId) =>
1750private Task SendWindowUpdateAsync(int streamId, int amount)
2010Task requestBodyTask = http2Stream.SendRequestBodyAsync(requestBodyCancellationToken);
2013Task responseHeadersTask = http2Stream.ReadResponseHeadersAsync(cancellationToken);
2026await Task.WhenAny(requestBodyTask, responseHeadersTask).ConfigureAwait(false) == requestBodyTask ||
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (7)
505Task? sendRequestContentTask = null;
725Task sendTask = sendRequestContentTask;
956private async Task SendRequestContentWithExpect100ContinueAsync(
1839private Task CopyToUntilEofAsync(Stream destination, bool async, int bufferSize, CancellationToken cancellationToken)
1854return Task.CompletedTask;
1857private async Task CopyToUntilEofWithExistingBufferedDataAsync(Stream destination, bool async, int bufferSize, CancellationToken cancellationToken)
1875private async Task CopyToContentLengthAsync(Stream destination, bool async, ulong length, int bufferSize, CancellationToken cancellationToken)
System.Net.Http.Json (5)
System.Net.HttpListener (11)
System.Net.Mail (19)
System.Net.NameResolution (19)
System\Net\Dns.cs (18)
489private static Task GetHostEntryOrAddressesCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny, bool justAddresses, AddressFamily family, CancellationToken cancellationToken)
495return justAddresses ? (Task)
496Task.FromCanceled<IPAddress[]>(cancellationToken) :
497Task.FromCanceled<IPHostEntry>(cancellationToken);
513return justAddresses ? (Task)
514Task.FromResult(family == AddressFamily.Unspecified || ipAddress.AddressFamily == family ? new[] { ipAddress } : Array.Empty<IPAddress>()) :
515Task.FromResult(CreateHostEntryForAddress(ipAddress));
532Task? t;
583Task? task = NameResolutionPal.GetAddrInfoAsync(hostName, justAddresses, addressFamily, cancellationToken);
594static async Task<T> CompleteAsync(Task task, string hostName, long startingTimestamp)
641private static readonly Dictionary<object, Task> s_tasks = new Dictionary<object, Task>();
663s_tasks.TryGetValue(key, out Task? prevTask);
664prevTask ??= Task.CompletedTask;
683((ICollection<KeyValuePair<object, Task>>)s_tasks).Remove(new KeyValuePair<object, Task>(key!, task!));
696((ICollection<KeyValuePair<object, Task>>)s_tasks).Remove(new KeyValuePair<object, Task>(key!, task));
System.Net.NetworkInformation (3)
System.Net.Quic (15)
System.Net.Requests (21)
System.Net.Security (54)
System\Net\Security\NegotiateStream.cs (17)
180public virtual Task AuthenticateAsClientAsync() =>
183public virtual Task AuthenticateAsClientAsync(NetworkCredential credential, string targetName) =>
186public virtual Task AuthenticateAsClientAsync(
192public virtual Task AuthenticateAsClientAsync(NetworkCredential credential, ChannelBinding? binding, string targetName) =>
195public virtual Task AuthenticateAsClientAsync(
203public virtual Task AuthenticateAsServerAsync() =>
206public virtual Task AuthenticateAsServerAsync(ExtendedProtectionPolicy? policy) =>
209public virtual Task AuthenticateAsServerAsync(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) =>
212public virtual Task AuthenticateAsServerAsync(
296public override Task FlushAsync(CancellationToken cancellationToken) =>
477/// <returns>A <see cref="Task"/> that represents the asynchronous read operation.</returns>
478public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
503private async Task WriteAsync<TIOAdapter>(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken)
721private async Task AuthenticateAsync<TIOAdapter>(CancellationToken cancellationToken)
750private async Task SendBlobAsync<TIOAdapter>(byte[]? message, CancellationToken cancellationToken)
859private async Task ReceiveBlobAsync<TIOAdapter>(CancellationToken cancellationToken)
919private async Task SendAuthResetSignalAndThrowAsync<TIOAdapter>(byte[] message, Exception exception, CancellationToken cancellationToken)
System\Net\Security\SslStream.cs (14)
374public virtual Task AuthenticateAsClientAsync(string targetHost) => AuthenticateAsClientAsync(targetHost, null, false);
376public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, bool checkCertificateRevocation) => AuthenticateAsClientAsync(targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
378public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
392public Task AuthenticateAsClientAsync(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken = default)
401public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate) =>
404public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
417public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
431public Task AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken = default)
438public Task AuthenticateAsServerAsync(ServerOptionsSelectionCallback optionsCallback, object? state, CancellationToken cancellationToken = default)
445public virtual Task ShutdownAsync()
456return Task.CompletedTask;
680public override Task FlushAsync(CancellationToken cancellationToken) => InnerStream.FlushAsync(cancellationToken);
685public virtual Task NegotiateClientCertificateAsync(CancellationToken cancellationToken = default)
860public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
System.Net.Sockets (23)
System\Net\Sockets\Socket.Tasks.cs (6)
78public Task ConnectAsync(EndPoint remoteEP) => ConnectAsync(remoteEP, default).AsTask();
135public Task ConnectAsync(IPAddress address, int port) => ConnectAsync(new IPEndPoint(address, port));
152public Task ConnectAsync(IPAddress[] addresses, int port) => ConnectAsync(addresses, port, CancellationToken.None).AsTask();
229public Task ConnectAsync(string host, int port) => ConnectAsync(host, port, default).AsTask();
879t = Task.FromResult(fromNetworkStream & !isReceive ? 0 : saea.BytesTransferred);
883t = Task.FromException<int>(GetException(saea.SocketError, wrapExceptionsInIOExceptions: fromNetworkStream));
System.Net.WebClient (12)
System.Net.WebSockets (20)
System\Net\WebSockets\ManagedWebSocket.cs (12)
231Task lockTask = mutex.EnterAsync(CancellationToken.None);
257public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
291return new ValueTask(Task.FromException(exc));
330return Task.FromException<WebSocketReceiveResult>(exc);
348public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
358return Task.FromException(exc);
364public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
370private async Task CloseOutputAsyncCore(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
419Task lockTask = _sendMutex.EnterAsync(cancellationToken);
469return new ValueTask(Task.FromException(
509private async ValueTask SendFrameFallbackAsync(MessageOpcode opcode, bool endOfMessage, bool disableCompression, ReadOnlyMemory<byte> payloadBuffer, Task lockTask, CancellationToken cancellationToken)
1267private async Task CloseAsyncPrivate(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
System.Net.WebSockets.Client (7)
System\Net\WebSockets\ClientWebSocket.cs (6)
82public Task ConnectAsync(Uri uri, CancellationToken cancellationToken)
94public Task ConnectAsync(Uri uri, HttpMessageInvoker? invoker, CancellationToken cancellationToken)
124private async Task ConnectAsyncCore(Uri uri, HttpMessageInvoker? invoker, CancellationToken cancellationToken)
145public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) =>
160public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) =>
163public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) =>
System.Private.CoreLib (1535)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs (4)
30private Task? m_dispatchTask;
138Task? previousDispatchTask = m_dispatchTask;
139m_dispatchTask = Task.Factory.StartNew(() => DispatchEventsToEventListeners(sessionID, syncTimeUtc, syncTimeQPC, timeQPCFrequency, previousDispatchTask, m_dispatchTaskCancellationSource.Token), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
158private unsafe void DispatchEventsToEventListeners(ulong sessionID, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency, Task? previousDispatchTask, CancellationToken token)
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (14)
303public override Task FlushAsync(CancellationToken cancellationToken)
306return Task.FromCanceled<int>(cancellationToken);
313private async Task FlushAsyncInternal(CancellationToken cancellationToken)
579return Task.FromCanceled<int>(cancellationToken);
589Task semaphoreLockTask = sem.WaitAsync(cancellationToken);
612: Task.FromException<int>(error);
640Task semaphoreLockTask = sem.WaitAsync(cancellationToken);
672Memory<byte> buffer, CancellationToken cancellationToken, int bytesAlreadySatisfied, Task semaphoreLockTask)
997public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1017Task semaphoreLockTask = sem.WaitAsync(cancellationToken);
1056ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken, Task semaphoreLockTask)
1270public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
1277Task.FromCanceled<int>(cancellationToken) :
1281private async Task CopyToAsyncCore(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (25)
731public static Task AppendAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken = default(CancellationToken))
737? Task.FromCanceled(cancellationToken)
740static async Task Core(string path, byte[] bytes, CancellationToken cancellationToken)
922? Task.FromCanceled<string>(cancellationToken)
959public static Task WriteAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default(CancellationToken))
962public static Task WriteAllTextAsync(string path, string? contents, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
968return Task.FromCanceled(cancellationToken);
978return Task.FromCanceled<byte[]>(cancellationToken);
989return Task.FromException<byte[]>(ExceptionDispatchInfo.SetCurrentStackTrace(new IOException(SR.IO_FileTooLong2GB)));
1063public static Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken = default(CancellationToken))
1069? Task.FromCanceled(cancellationToken)
1072static async Task Core(string path, byte[] bytes, CancellationToken cancellationToken)
1087? Task.FromCanceled<string[]>(cancellationToken)
1111public static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken = default(CancellationToken))
1114public static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken)) =>
1117private static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, bool append, CancellationToken cancellationToken)
1123return Task.FromCanceled(cancellationToken);
1135return Task.FromException(e);
1141private static async Task InternalWriteAllLinesAsync(StreamWriter writer, IEnumerable<string> contents, CancellationToken cancellationToken)
1157public static Task AppendAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default(CancellationToken))
1160public static Task AppendAllTextAsync(string path, string? contents, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
1166return Task.FromCanceled(cancellationToken);
1172public static Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken = default(CancellationToken))
1175public static Task AppendAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken)) =>
1326private static async Task WriteToFileAsync(string path, FileMode mode, string? contents, Encoding encoding, CancellationToken cancellationToken)
src\libraries\System.Private.CoreLib\src\System\IO\FileStream.cs (9)
264public override Task FlushAsync(CancellationToken cancellationToken)
268return Task.FromCanceled(cancellationToken);
293return Task.FromCanceled<int>(cancellationToken);
336public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
342return Task.FromCanceled(cancellationToken);
539public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
612internal Task BaseFlushAsync(CancellationToken cancellationToken)
625internal Task BaseWriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
634internal Task BaseCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (11)
311Task semaphoreLockTask = semaphore.WaitAsync(cancellationToken);
391private async ValueTask<int> ReadAsyncSlowPath(Task semaphoreLockTask, Memory<byte> buffer, CancellationToken cancellationToken)
582public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
611Task semaphoreLockTask = semaphore.WaitAsync(cancellationToken);
674private async ValueTask WriteAsyncSlowPath(Task semaphoreLockTask, ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
783public override Task FlushAsync(CancellationToken cancellationToken)
787return Task.FromCanceled<int>(cancellationToken);
795private async Task FlushAsyncInternal(CancellationToken cancellationToken)
832public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
838Task.FromCanceled<int>(cancellationToken) :
842private async Task CopyToAsyncCore(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (34)
79public Task CopyToAsync(Stream destination) => CopyToAsync(destination, GetCopyBufferSize());
81public Task CopyToAsync(Stream destination, int bufferSize) => CopyToAsync(destination, bufferSize, CancellationToken.None);
83public Task CopyToAsync(Stream destination, CancellationToken cancellationToken) => CopyToAsync(destination, GetCopyBufferSize(), cancellationToken);
85public virtual Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
100static async Task Core(Stream source, Stream destination, int bufferSize, CancellationToken cancellationToken)
189public Task FlushAsync() => FlushAsync(CancellationToken.None);
191public virtual Task FlushAsync(CancellationToken cancellationToken) =>
192Task.Factory.StartNew(
218Task? semaphoreTask = null;
237var thisTask = Task.InternalCurrent as ReadWriteTask;
305Task.FromCanceled<int>(cancellationToken) :
484internal Task BeginWriteInternal(
500Task? semaphoreTask = null;
519var thisTask = Task.InternalCurrent as ReadWriteTask;
556private static void RunReadWriteTaskWhenReady(Task asyncWaiter, ReadWriteTask readWriteTask)
703void ITaskCompletionAction.Invoke(Task completingTask)
729public Task WriteAsync(byte[] buffer, int offset, int count) => WriteAsync(buffer, offset, count, CancellationToken.None);
731public virtual Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
735Task.FromCanceled(cancellationToken) :
750private static async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
762private Task BeginEndWriteAsync(byte[] buffer, int offset, int count)
1024public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) =>
1026Task.FromCanceled(cancellationToken) :
1027Task.CompletedTask;
1036public override Task FlushAsync(CancellationToken cancellationToken) =>
1038Task.FromCanceled(cancellationToken) :
1039Task.CompletedTask;
1048TaskToAsyncResult.Begin(Task.CompletedTask, callback, state);
1059Task.FromCanceled<int>(cancellationToken) :
1060Task.FromResult(0);
1073public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
1075Task.FromCanceled(cancellationToken) :
1076Task.CompletedTask;
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (59)
48private Task _asyncWriteTask = Task.CompletedTask;
656public override Task WriteAsync(char value)
670Task task = WriteAsyncInternal(value, appendNewLine: false);
676private async Task WriteAsyncInternal(char value, bool appendNewLine)
704public override Task WriteAsync(string? value)
720Task task = WriteAsyncInternal(value.AsMemory(), appendNewLine: false, default);
727return Task.CompletedTask;
731public override Task WriteAsync(char[] buffer, int index, int count)
754Task task = WriteAsyncInternal(new ReadOnlyMemory<char>(buffer, index, count), appendNewLine: false, cancellationToken: default);
760public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
773return Task.FromCanceled(cancellationToken);
776Task task = WriteAsyncInternal(buffer, appendNewLine: false, cancellationToken: cancellationToken);
781private async Task WriteAsyncInternal(ReadOnlyMemory<char> source, bool appendNewLine, CancellationToken cancellationToken)
818public override Task WriteLineAsync()
832Task task = WriteAsyncInternal(ReadOnlyMemory<char>.Empty, appendNewLine: true, cancellationToken: default);
838public override Task WriteLineAsync(char value)
852Task task = WriteAsyncInternal(value, appendNewLine: true);
858public override Task WriteLineAsync(string? value)
877Task task = WriteAsyncInternal(value.AsMemory(), appendNewLine: true, default);
883public override Task WriteLineAsync(char[] buffer, int index, int count)
906Task task = WriteAsyncInternal(new ReadOnlyMemory<char>(buffer, index, count), appendNewLine: true, cancellationToken: default);
912public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
924return Task.FromCanceled(cancellationToken);
927Task task = WriteAsyncInternal(buffer, appendNewLine: true, cancellationToken: cancellationToken);
933public override Task FlushAsync()
947/// <returns>A <see cref="Task"/> that represents the asynchronous flush operation.</returns>
948public override Task FlushAsync(CancellationToken cancellationToken)
954return Task.FromCanceled(cancellationToken);
965private Task FlushAsyncInternal(bool flushStream, bool flushEncoder, CancellationToken cancellationToken = default)
969return Task.FromCanceled(cancellationToken);
975return Task.CompletedTask;
980async Task Core(bool flushStream, bool flushEncoder, CancellationToken cancellationToken)
1034public override Task FlushAsync() => Task.CompletedTask;
1035public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
1055public override Task WriteAsync(char value) => Task.CompletedTask;
1056public override Task WriteAsync(string? value) => Task.CompletedTask;
1057public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
1058public override Task WriteAsync(char[] buffer, int index, int count) => Task.CompletedTask;
1059public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
1080public override Task WriteLineAsync(char value) => Task.CompletedTask;
1081public override Task WriteLineAsync(string? value) => Task.CompletedTask;
1082public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
1083public override Task WriteLineAsync(char[] buffer, int index, int count) => Task.CompletedTask;
1084public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
1085public override Task WriteLineAsync() => Task.CompletedTask;
src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (91)
538public virtual Task WriteAsync(char value) =>
539Task.Factory.StartNew(static state =>
545public virtual Task WriteAsync(string? value) =>
546Task.Factory.StartNew(static state =>
558public virtual Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default)
561cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
562value == null ? Task.CompletedTask :
565async Task WriteAsyncCore(StringBuilder sb, CancellationToken ct)
574public Task WriteAsync(char[]? buffer)
578return Task.CompletedTask;
584public virtual Task WriteAsync(char[] buffer, int index, int count) =>
585Task.Factory.StartNew(static state =>
591public virtual Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) =>
592cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
595Task.Factory.StartNew(static state =>
601public virtual Task WriteLineAsync(char value) =>
602Task.Factory.StartNew(static state =>
608public virtual Task WriteLineAsync(string? value) =>
609Task.Factory.StartNew(static state =>
621public virtual Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default)
624cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
628async Task WriteLineAsyncCore(StringBuilder sb, CancellationToken ct)
638public Task WriteLineAsync(char[]? buffer)
648public virtual Task WriteLineAsync(char[] buffer, int index, int count) =>
649Task.Factory.StartNew(static state =>
655public virtual Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) =>
656cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
659Task.Factory.StartNew(static state =>
665public virtual Task WriteLineAsync()
670public virtual Task FlushAsync()
672return Task.Factory.StartNew(static state => ((TextWriter)state!).Flush(), this,
681/// <returns>A <see cref="Task"/> that represents the asynchronous flush operation.</returns>
684public virtual Task FlushAsync(CancellationToken cancellationToken) =>
685cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
701public override Task FlushAsync() => Task.CompletedTask;
702public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
724public override Task WriteAsync(char value) => Task.CompletedTask;
725public override Task WriteAsync(string? value) => Task.CompletedTask;
726public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
727public override Task WriteAsync(char[] buffer, int index, int count) => Task.CompletedTask;
728public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
750public override Task WriteLineAsync(char value) => Task.CompletedTask;
751public override Task WriteLineAsync(string? value) => Task.CompletedTask;
752public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
753public override Task WriteLineAsync(char[] buffer, int index, int count) => Task.CompletedTask;
754public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
755public override Task WriteLineAsync() => Task.CompletedTask;
936public override Task WriteAsync(char value)
939return Task.CompletedTask;
943public override Task WriteAsync(string? value)
946return Task.CompletedTask;
950public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default)
954return Task.FromCanceled(cancellationToken);
958return Task.CompletedTask;
962public override Task WriteAsync(char[] buffer, int index, int count)
965return Task.CompletedTask;
969public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
973return Task.FromCanceled(cancellationToken);
977return Task.CompletedTask;
981public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
985return Task.FromCanceled(cancellationToken);
989return Task.CompletedTask;
993public override Task WriteLineAsync(char value)
996return Task.CompletedTask;
1000public override Task WriteLineAsync()
1003return Task.CompletedTask;
1007public override Task WriteLineAsync(string? value)
1010return Task.CompletedTask;
1014public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default)
1018return Task.FromCanceled(cancellationToken);
1022return Task.CompletedTask;
1026public override Task WriteLineAsync(char[] buffer, int index, int count)
1029return Task.CompletedTask;
1033public override Task FlushAsync()
1036return Task.CompletedTask;
1040public override Task FlushAsync(CancellationToken cancellationToken)
1044return Task.FromCanceled(cancellationToken);
1048return Task.CompletedTask;
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs (10)
57public static void SetStateMachine(IAsyncStateMachine stateMachine, Task? task)
106internal static void LogTraceOperationBegin(Task t, Type stateMachineType)
111internal static Action CreateContinuationWrapper(Action continuation, Action<Action, Task> invokeAction, Task innerTask) =>
125internal static Task? TryGetContinuationTask(Action continuation) =>
128continuation.Target as Task; // The continuation targets a task directly, such as with AsyncStateMachineBox
140private readonly Action<Action, Task> _invokeAction; // This wrapper is an action that wraps another action, this is that Action.
142internal readonly Task _innerTask; // If the continuation is logically going to invoke a task, this is that task (may be null)
144internal ContinuationWrapper(Action continuation, Action<Action, Task> invokeAction, Task innerTask)
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\TaskAwaiter.cs (39)
19/// <summary>Provides an awaiter for awaiting a <see cref="Task"/>.</summary>
26internal readonly Task m_task;
29/// <param name="task">The <see cref="Task"/> to be awaited.</param>
30internal TaskAwaiter(Task task)
41/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
51/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
61/// <summary>Ends the await on the completed <see cref="Task"/>.</summary>
79internal static void ValidateEnd(Task task, ConfigureAwaitOptions options = ConfigureAwaitOptions.None)
98private static void HandleNonSuccessAndDebuggerNotification(Task task, ConfigureAwaitOptions options)
127private static void ThrowForNonSuccess(Task task)
166/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
174internal static void OnCompletedInternal(Task task, Action continuation, bool continueOnCapturedContext, bool flowExecutionContext)
180if (TplEventSource.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
189/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
193internal static void UnsafeOnCompletedInternal(Task task, IAsyncStateMachineBox stateMachineBox, bool continueOnCapturedContext)
199if (TplEventSource.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
215private static Action OutputWaitEtwEvents(Task task, Action continuation)
220if (Task.s_asyncDebuggingEnabled)
222Task.AddToActiveTasks(task);
230Task? currentTaskAtBegin = Task.InternalCurrent;
233Task? continuationTask = AsyncMethodBuilderCore.TryGetContinuationTask(continuation);
248if (Task.s_asyncDebuggingEnabled)
250Task.RemoveFromActiveTasks(innerTask);
260Task? currentTaskAtEnd = Task.InternalCurrent;
307/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
317/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
354/// <summary>Provides an awaitable object that allows for configured awaits on <see cref="Task"/>.</summary>
362/// <param name="task">The awaitable <see cref="Task"/>.</param>
364internal ConfiguredTaskAwaitable(Task task, ConfigureAwaitOptions options)
385internal readonly Task m_task;
390/// <param name="task">The <see cref="Task"/> to await.</param>
392internal ConfiguredTaskAwaiter(Task task, ConfigureAwaitOptions options)
405/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
415/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
425/// <summary>Ends the await on the completed <see cref="Task"/>.</summary>
487/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
497/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs (45)
48/// <see cref="Task.Start()">Start</see>
53/// <see cref="Task.Dispose()">Dispose</see>, are thread-safe
286internal Task(Func<TResult> valueSelector, Task? parent, CancellationToken cancellationToken,
302internal Task(Delegate valueSelector, object? state, Task? parent, CancellationToken cancellationToken,
310internal static Task<TResult> StartNew(Task? parent, Func<TResult> function, CancellationToken cancellationToken,
330internal static Task<TResult> StartNew(Task? parent, Func<object?, TResult> function, object? state, CancellationToken cancellationToken,
521/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
551/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
559/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
569/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
578/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
620/// <returns>A new continuation <see cref="Task"/>.</returns>
622/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
629public Task ContinueWith(Action<Task<TResult>> continuationAction)
643/// <returns>A new continuation <see cref="Task"/>.</returns>
645/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
652public Task ContinueWith(Action<Task<TResult>> continuationAction, CancellationToken cancellationToken)
668/// <returns>A new continuation <see cref="Task"/>.</returns>
670/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
680public Task ContinueWith(Action<Task<TResult>> continuationAction, TaskScheduler scheduler)
699/// <returns>A new continuation <see cref="Task"/>.</returns>
701/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
713public Task ContinueWith(Action<Task<TResult>> continuationAction, TaskContinuationOptions continuationOptions)
737/// <returns>A new continuation <see cref="Task"/>.</returns>
739/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
753public Task ContinueWith(Action<Task<TResult>> continuationAction, CancellationToken cancellationToken,
760internal Task ContinueWith(Action<Task<TResult>> continuationAction, TaskScheduler scheduler, CancellationToken cancellationToken,
778Task continuationTask = new ContinuationTaskFromResultTask<TResult>(
801/// <returns>A new continuation <see cref="Task"/>.</returns>
803/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
810public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state)
825/// <returns>A new continuation <see cref="Task"/>.</returns>
827/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
834public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, CancellationToken cancellationToken)
851/// <returns>A new continuation <see cref="Task"/>.</returns>
853/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
863public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskScheduler scheduler)
883/// <returns>A new continuation <see cref="Task"/>.</returns>
885/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
897public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskContinuationOptions continuationOptions)
922/// <returns>A new continuation <see cref="Task"/>.</returns>
924/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
938public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, CancellationToken cancellationToken,
945internal Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskScheduler scheduler, CancellationToken cancellationToken,
963Task continuationTask = new ContinuationTaskFromResultTask<TResult>(
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\FutureFactory.cs (82)
41private TaskScheduler GetDefaultScheduler(Task? currTask)
252/// <see cref="Task.Start()">Start</see> to schedule it for execution.
258Task? currTask = Task.InternalCurrent;
279/// <see cref="Task.Start()">Start</see> to schedule it for execution.
285Task? currTask = Task.InternalCurrent;
308/// <see cref="Task.Start()">Start</see> to schedule it for execution.
314Task? currTask = Task.InternalCurrent;
348/// <see cref="Task.Start()">Start</see> to schedule it for execution.
355Task.InternalCurrentIfAttached(creationOptions), function, cancellationToken,
373/// <see cref="Task.Start()">Start</see> to schedule it for execution.
379Task? currTask = Task.InternalCurrent;
402/// <see cref="Task.Start()">Start</see> to schedule it for execution.
408Task? currTask = Task.InternalCurrent;
433/// <see cref="Task.Start()">Start</see> to schedule it for execution.
439Task? currTask = Task.InternalCurrent;
475/// <see cref="Task.Start()">Start</see> to schedule it for execution.
481return Task<TResult>.StartNew(Task.InternalCurrentIfAttached(creationOptions), function, state, cancellationToken,
531if (Task.s_asyncDebuggingEnabled)
532Task.RemoveFromActiveTasks(promise);
653if (Task.s_asyncDebuggingEnabled)
654Task.AddToActiveTasks(promise);
659Task t = new Task(new Action<object>(delegate
669if (Task.s_asyncDebuggingEnabled)
670Task.AddToActiveTasks(t);
770if (Task.s_asyncDebuggingEnabled)
771Task.AddToActiveTasks(promise);
792if (Task.s_asyncDebuggingEnabled)
793Task.RemoveFromActiveTasks(promise);
887if (Task.s_asyncDebuggingEnabled)
888Task.AddToActiveTasks(promise);
909if (Task.s_asyncDebuggingEnabled)
910Task.RemoveFromActiveTasks(promise);
1012if (Task.s_asyncDebuggingEnabled)
1013Task.AddToActiveTasks(promise);
1034if (Task.s_asyncDebuggingEnabled)
1035Task.RemoveFromActiveTasks(promise);
1145if (Task.s_asyncDebuggingEnabled)
1146Task.AddToActiveTasks(promise);
1167if (Task.s_asyncDebuggingEnabled)
1168Task.RemoveFromActiveTasks(promise);
1324Task.CreationOptionsFromContinuationOptions(continuationOptions, out TaskCreationOptions tco, out _);
1348public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction)
1376public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
1410public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1431/// cref="Task">Task</see>.</param>
1454public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction,
1648internal static Task<TResult> ContinueWhenAllImpl(Task[] tasks,
1649Func<Task[], TResult>? continuationFunction, Action<Task[]>? continuationAction,
1659Task[] tasksCopy = TaskFactory.CheckMultiContinuationTasksAndCopy(tasks);
1670Task<Task[]> starter = TaskFactory.CommonCWAllLogic(tasksCopy);
1679Debug.Assert(state is Func<Task[], TResult>);
1680return ((Func<Task[], TResult>)state)(completedTasks.Result);
1691Debug.Assert(state is Action<Task[]>);
1692((Action<Task[]>)state)(completedTasks.Result); return default!;
1718public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction)
1746public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
1780public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1801/// cref="Task">Task</see>.</param>
1824public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction,
1970internal static Task<TResult> ContinueWhenAnyImpl(Task[] tasks,
1971Func<Task, TResult>? continuationFunction, Action<Task>? continuationAction,
1983Task<Task> starter = TaskFactory.CommonCWAnyLogic(tasks);
1999Debug.Assert(state is Func<Task, TResult>);
2000return ((Func<Task, TResult>)state)(completedTask.Result);
2010Debug.Assert(state is Action<Task>);
2011((Action<Task>)state)(completedTask.Result);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (436)
25/// Represents the current stage in the lifecycle of a <see cref="Task"/>.
71/// <see cref="Task"/> instances may be created in a variety of ways. The most common approach is by
74/// purposes. For example, to create a <see cref="Task"/> that runs an action, the factory's StartNew
85/// The <see cref="Task"/> class also provides constructors that initialize the Task but that do not
92/// All members of <see cref="Task"/>, except for <see cref="Dispose()"/>, are thread-safe
117internal static Task? t_currentTask; // The currently executing task.
132private Task? ParentForDebugger => m_contingentProperties?.m_parent; // Private property used by a debugger to access this Task's parent
181private static Dictionary<int, Task>? s_currentActiveTasks;
185internal static bool AddToActiveTasks(Task task)
189Dictionary<int, Task> activeTasks =
191Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ??
203internal static void RemoveFromActiveTasks(Task task)
205Dictionary<int, Task>? activeTasks = s_currentActiveTasks;
246internal volatile List<Task>? m_exceptionalChildren;
248internal Task? m_parent;
340Task? parent = InternalCurrent;
351/// Initializes a new <see cref="Task"/> with the specified action.
361/// Initializes a new <see cref="Task"/> with the specified action and <see cref="Threading.CancellationToken">CancellationToken</see>.
376/// Initializes a new <see cref="Task"/> with the specified action and creation options.
396/// Initializes a new <see cref="Task"/> with the specified action and creation options.
420/// Initializes a new <see cref="Task"/> with the specified action and state.
433/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
450/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
471/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
505internal Task(Delegate action, object? state, Task? parent, CancellationToken cancellationToken,
584Task? parent = props.m_parent;
607private void AssignCancellationToken(CancellationToken cancellationToken, Task? antecedent, TaskContinuation? continuation)
635ctr = cancellationToken.UnsafeRegister(static t => ((Task)t!).InternalCancel(), this);
646var tuple = (TupleSlim<Task, Task, TaskContinuation>)t!;
648Task targetTask = tuple.Item1;
649Task antecedentTask = tuple.Item2;
653}, new TupleSlim<Task, Task, TaskContinuation>(this, antecedent, continuation));
664Task? parent = m_contingentProperties?.m_parent;
776internal static bool AnyTaskRequiresNotifyDebuggerOfWaitCompletion(Task?[] tasks)
779foreach (Task? task in tasks)
856Task? currentTask = InternalCurrent;
857Task? parentTask = m_contingentProperties?.m_parent;
903/// Starts the <see cref="Task"/>, scheduling it for execution to the current <see
911/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
921/// Starts the <see cref="Task"/>, scheduling it for execution to the specified <see
936/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
977/// Runs the <see cref="Task"/> synchronously on the current <see
996/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1006/// Runs the <see cref="Task"/> synchronously on the <see
1021/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1141internal static Task InternalStartNew(
1142Task? creatingTask, Delegate action, object? state, CancellationToken cancellationToken, TaskScheduler scheduler,
1153Task t = new Task(action, state, creatingTask, cancellationToken, options, internalOptions | InternalTaskOptions.QueuedByRuntime, scheduler);
1160/// Gets a unique ID for a <see cref="Task">Task</see> or task continuation instance.
1184/// Gets a unique ID for this <see cref="Task">Task</see> instance.
1205/// Returns the unique ID of the currently executing <see cref="Task">Task</see>.
1211Task? currentTask = InternalCurrent;
1220/// Gets the <see cref="Task">Task</see> instance currently executing, or
1223internal static Task? InternalCurrent => t_currentTask;
1231internal static Task? InternalCurrentIfAttached(TaskCreationOptions creationOptions)
1238/// cref="Task">Task</see> to end prematurely. If the <see
1239/// cref="Task">Task</see> completed successfully or has not yet thrown any
1294/// Gets whether this <see cref="Task">Task</see> instance has completed
1298/// A <see cref="Task">Task</see> will complete in Canceled state either if its <see cref="CancellationToken">CancellationToken</see>
1362/// Gets whether this <see cref="Task"/> threw an OperationCanceledException while its CancellationToken was signaled.
1367/// Gets whether this <see cref="Task">Task</see> has completed.
1421/// The <see cref="Task"/> has been disposed.
1439/// Gets the state object supplied when the <see cref="Task">Task</see> was created,
1456/// Provides access to factory methods for creating <see cref="Task"/> and <see cref="Task{TResult}"/> instances.
1470public static Task CompletedTask => s_cachedCompleted;
1515/// Gets whether the <see cref="Task"/> completed due to an unhandled exception.
1564/// Disposes the <see cref="Task"/>, releasing all of its unmanaged resources.
1567/// Unlike most of the members of <see cref="Task"/>, this method is not thread-safe.
1568/// Also, <see cref="Dispose()"/> may only be called on a <see cref="Task"/> that is in one of
1574/// The exception that is thrown if the <see cref="Task"/> is not in
1586/// Disposes the <see cref="Task"/>, releasing all of its unmanaged resources.
1593/// Unlike most of the members of <see cref="Task"/>, this method is not thread-safe.
1944Task? parent = m_contingentProperties?.m_parent;
2027List<Task>? exceptionalChildren = props.m_exceptionalChildren;
2139Task? parent = m_contingentProperties?.m_parent;
2151internal void ProcessChildCompletion(Task childTask)
2166Interlocked.CompareExchange(ref props.m_exceptionalChildren, new List<Task>(), null);
2173List<Task>? tmp = props.m_exceptionalChildren;
2204List<Task>? exceptionalChildren = props.m_exceptionalChildren;
2212foreach (Task task in exceptionalChildren)
2301private void ExecuteWithThreadLocal(ref Task? currentTaskSlot, Thread? threadPoolThread = null)
2304Task? previousTask = currentTaskSlot;
2382Debug.Assert(obj is Task);
2384Unsafe.As<Task>(obj).InnerInvoke();
2438/// <summary>Gets an awaiter used to await this <see cref="Task"/>.</summary>
2445/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
2455/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
2472/// Sets a continuation onto the <see cref="Task"/>.
2476/// <param name="continuationAction">The action to invoke when the <see cref="Task"/> has completed.</param>
2545/// Sets a continuation onto the <see cref="Task"/>.
2549/// <param name="stateMachineBox">The action to invoke when the <see cref="Task"/> has completed.</param>
2615/// Waits for the <see cref="Task"/> to complete execution.
2618/// The <see cref="Task"/> was canceled -or- an exception was thrown during
2619/// the execution of the <see cref="Task"/>.
2634/// Waits for the <see cref="Task"/> to complete execution.
2641/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2644/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2645/// cref="Task"/>.
2655/// Waits for the <see cref="Task"/> to complete execution.
2662/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2665/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2666/// cref="Task"/>.
2689/// Waits for the <see cref="Task"/> to complete execution.
2698/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2699/// cref="Task"/>.
2707/// Waits for the <see cref="Task"/> to complete execution.
2712/// <returns>true if the <see cref="Task"/> completed execution within the allotted time; otherwise,
2720/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2721/// cref="Task"/>.
2729/// Waits for the <see cref="Task"/> to complete execution.
2739/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2742/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2743/// cref="Task"/>.
2790/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes or when the specified <see cref="CancellationToken"/> has cancellation requested.</summary>
2792/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2793public Task WaitAsync(CancellationToken cancellationToken) => WaitAsync(Timeout.UnsignedInfinite, TimeProvider.System, cancellationToken);
2795/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes or when the specified timeout expires.</summary>
2796/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
2797/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2798public Task WaitAsync(TimeSpan timeout) => WaitAsync(ValidateTimeout(timeout, ExceptionArgument.timeout), TimeProvider.System, default);
2800/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes or when the specified timeout expires.</summary>
2801/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
2803/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2805public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider)
2811/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes, when the specified timeout expires, or when the specified <see cref="CancellationToken"/> has cancellation requested.</summary>
2812/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
2814/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2815public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) =>
2818/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes, when the specified timeout expires, or when the specified <see cref="CancellationToken"/> has cancellation requested.</summary>
2819/// <param name="timeout">The timeout after which the <see cref="Task"/> should be faulted with a <see cref="TimeoutException"/> if it hasn't otherwise completed.</param>
2822/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2824public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken)
2830private Task WaitAsync(uint millisecondsTimeout, TimeProvider timeProvider, CancellationToken cancellationToken)
2854private readonly Task _task;
2860internal CancellationPromise(Task source, uint millisecondsDelay, TimeProvider timeProvider, CancellationToken token)
2915void ITaskCompletionAction.Invoke(Task completingTask)
2981Task? currentTask = InternalCurrent;
3012Task? currentTask = InternalCurrent;
3041public void Invoke(Task completingTask) { Set(); }
3143/// Cancels the <see cref="Task"/>.
3605/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3608/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3611/// <returns>A new continuation <see cref="Task"/>.</returns>
3613/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3620public Task ContinueWith(Action<Task> continuationAction)
3626/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3629/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3633/// <returns>A new continuation <see cref="Task"/>.</returns>
3635/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3642public Task ContinueWith(Action<Task> continuationAction, CancellationToken cancellationToken)
3648/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3651/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3657/// <returns>A new continuation <see cref="Task"/>.</returns>
3659/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3669public Task ContinueWith(Action<Task> continuationAction, TaskScheduler scheduler)
3675/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3678/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3688/// <returns>A new continuation <see cref="Task"/>.</returns>
3690/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3702public Task ContinueWith(Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
3708/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3711/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3726/// <returns>A new continuation <see cref="Task"/>.</returns>
3728/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3742public Task ContinueWith(Action<Task> continuationAction, CancellationToken cancellationToken,
3749private Task ContinueWith(Action<Task> continuationAction, TaskScheduler scheduler,
3766Task continuationTask = new ContinuationTaskFromTask(
3782/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3785/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3789/// <returns>A new continuation <see cref="Task"/>.</returns>
3791/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3798public Task ContinueWith(Action<Task, object?> continuationAction, object? state)
3804/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3807/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3812/// <returns>A new continuation <see cref="Task"/>.</returns>
3814/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3821public Task ContinueWith(Action<Task, object?> continuationAction, object? state, CancellationToken cancellationToken)
3827/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3830/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3837/// <returns>A new continuation <see cref="Task"/>.</returns>
3839/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3849public Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskScheduler scheduler)
3855/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3858/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3869/// <returns>A new continuation <see cref="Task"/>.</returns>
3871/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3883public Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskContinuationOptions continuationOptions)
3889/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3892/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3908/// <returns>A new continuation <see cref="Task"/>.</returns>
3910/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3924public Task ContinueWith(Action<Task, object?> continuationAction, object? state, CancellationToken cancellationToken,
3931private Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskScheduler scheduler,
3948Task continuationTask = new ContinuationTaskFromTask(
3965/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3971/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
3983public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction)
3990/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3996/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4012public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
4018/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4024/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4042public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler)
4048/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4054/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4078public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
4084/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4090/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4124public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
4131private Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler,
4164/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4170/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4183public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state)
4190/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4196/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4213public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, CancellationToken cancellationToken)
4219/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4225/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4244public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskScheduler scheduler)
4250/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4256/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4281public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskContinuationOptions continuationOptions)
4287/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4293/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4328public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, CancellationToken cancellationToken,
4335private Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskScheduler scheduler,
4428internal void ContinueWithCore(Task continuationTask,
4665/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4668/// An array of <see cref="Task"/> instances on which to wait.
4677/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4678/// the execution of at least one of the <see cref="Task"/> instances.
4682public static void WaitAll(params Task[] tasks)
4694/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4697/// An array of <see cref="Task"/> instances on which to wait.
4703/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4704/// the execution of at least one of the <see cref="Task"/> instances.
4707public static void WaitAll(/*params*/ ReadOnlySpan<Task> tasks)
4714/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4717/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
4721/// An array of <see cref="Task"/> instances on which to wait.
4734/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4735/// the execution of at least one of the <see cref="Task"/> instances.
4744public static bool WaitAll(Task[] tasks, TimeSpan timeout)
4761/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4764/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
4770/// <param name="tasks">An array of <see cref="Task"/> instances on which to wait.
4779/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4780/// the execution of at least one of the <see cref="Task"/> instances.
4788public static bool WaitAll(Task[] tasks, int millisecondsTimeout)
4799/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4802/// An array of <see cref="Task"/> instances on which to wait.
4814/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4815/// the execution of at least one of the <see cref="Task"/> instances.
4822public static void WaitAll(Task[] tasks, CancellationToken cancellationToken)
4833/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4836/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
4840/// An array of <see cref="Task"/> instances on which to wait.
4856/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4857/// the execution of at least one of the <see cref="Task"/> instances.
4868public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
4878/// <summary>Waits for all of the provided <see cref="Task"/> objects to complete execution unless the wait is cancelled.</summary>
4883/// <exception cref="ObjectDisposedException">One or more of the <see cref="Task"/> objects in tasks has been disposed.</exception>
4886/// At least one of the <see cref="Task"/> instances was canceled. If a task was canceled, the <see cref="AggregateException"/>
4890public static void WaitAll(IEnumerable<Task> tasks, CancellationToken cancellationToken = default)
4897ReadOnlySpan<Task> span =
4898tasks is List<Task> list ? CollectionsMarshal.AsSpan(list) :
4899tasks is Task[] array ? array :
4900CollectionsMarshal.AsSpan(new List<Task>(tasks));
4908private static bool WaitAllCore(ReadOnlySpan<Task> tasks, int millisecondsTimeout, CancellationToken cancellationToken)
4924List<Task>? waitedOnTaskList = null;
4925List<Task>? notificationTasks = null;
4935Task task = tasks[i];
4979foreach (Task task in waitedOnTaskList)
4996foreach (Task task in notificationTasks)
5013foreach (Task task in tasks) AddExceptionsForCompletedTask(ref exceptions, task);
5038private static bool WaitAllBlockingCore(List<Task> tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5047foreach (Task task in tasks)
5057foreach (Task task in tasks)
5091public void Invoke(Task completingTask)
5105internal static void AddExceptionsForCompletedTask(ref List<Exception>? exceptions, Task t)
5121/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5124/// An array of <see cref="Task"/> instances on which to wait.
5134public static int WaitAny(params Task[] tasks)
5142/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5145/// An array of <see cref="Task"/> instances on which to wait.
5167public static int WaitAny(Task[] tasks, TimeSpan timeout)
5179/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5182/// An array of <see cref="Task"/> instances on which to wait.
5200public static int WaitAny(Task[] tasks, CancellationToken cancellationToken)
5206/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5209/// An array of <see cref="Task"/> instances on which to wait.
5230public static int WaitAny(Task[] tasks, int millisecondsTimeout)
5236/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5239/// An array of <see cref="Task"/> instances on which to wait.
5266public static int WaitAny(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) =>
5271private static int WaitAnyCore(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5291Task task = tasks[taskIndex];
5308Task<Task> firstCompleted = TaskFactory.CommonCWAnyLogic(tasks, isSyncBlocking: true);
5395public static Task FromException(Exception exception)
5399var task = new Task();
5419/// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified token.</summary>
5422public static Task FromCanceled(CancellationToken cancellationToken)
5440/// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified exception.</summary>
5443internal static Task FromCanceled(OperationCanceledException exception)
5447var task = new Task();
5479public static Task Run(Action action)
5497public static Task Run(Action action, CancellationToken cancellationToken)
5544public static Task Run(Func<Task?> function)
5562public static Task Run(Func<Task?> function, CancellationToken cancellationToken)
5571Task<Task?> task1 = Task<Task?>.Factory.StartNew(function, cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
5639public static Task Delay(TimeSpan delay) => Delay(delay, TimeProvider.System, default);
5648public static Task Delay(TimeSpan delay, TimeProvider timeProvider) => Delay(delay, timeProvider, default);
5668public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) =>
5679public static Task Delay(TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken)
5696public static Task Delay(int millisecondsDelay) => Delay(millisecondsDelay, default);
5716public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken)
5727private static Task Delay(uint millisecondsDelay, TimeProvider timeProvider, CancellationToken cancellationToken) =>
5883public static Task WhenAll(IEnumerable<Task> tasks)
5890if (tasks is ICollection<Task> taskCollection)
5892if (tasks is Task[] taskArray)
5894return WhenAll((ReadOnlySpan<Task>)taskArray);
5897if (tasks is List<Task> taskList)
5902taskArray = new Task[taskCollection.Count];
5904return WhenAll((ReadOnlySpan<Task>)taskArray);
5908var taskList = new List<Task>();
5909foreach (Task task in tasks)
5944public static Task WhenAll(params Task[] tasks)
5951return WhenAll((ReadOnlySpan<Task>)tasks);
5976public static Task WhenAll(/*params*/ ReadOnlySpan<Task> tasks) =>
5985internal WhenAllPromise(ReadOnlySpan<Task> tasks)
5996foreach (Task task in tasks)
6016foreach (Task task in tasks)
6029public void Invoke(Task? completedTask)
6053if (failedOrCanceled is List<Task> list)
6063Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
6064Task first = (Task)failedOrCanceled;
6065failedOrCanceled = Interlocked.CompareExchange(ref m_stateObject, new List<Task> { first, completedTask }, first);
6072Debug.Assert(failedOrCanceled is List<Task>);
6101Task? canceledTask = null;
6103void HandleTask(Task task)
6118if (failedOrCanceled is List<Task> list)
6120foreach (Task task in list)
6127Debug.Assert(failedOrCanceled is Task);
6128HandleTask((Task)failedOrCanceled);
6358public void Invoke(Task ignored)
6369Task? canceledTask = null;
6455public static Task<Task> WhenAny(params Task[] tasks)
6459return WhenAnyCore((ReadOnlySpan<Task>)tasks);
6474public static Task<Task> WhenAny(/*params*/ ReadOnlySpan<Task> tasks) =>
6489private static Task<TTask> WhenAnyCore<TTask>(ReadOnlySpan<TTask> tasks) where TTask : Task
6527public static Task<Task> WhenAny(Task task1, Task task2) =>
6528WhenAny<Task>(task1, task2);
6541private static Task<TTask> WhenAny<TTask>(TTask task1, TTask task2) where TTask : Task
6558private sealed class TwoTaskWhenAnyPromise<TTask> : Task<TTask>, ITaskCompletionAction where TTask : Task
6593public void Invoke(Task completingTask)
6595Task? task1;
6598Task? task2 = _task2;
6647public static Task<Task> WhenAny(IEnumerable<Task> tasks) =>
6648WhenAny<Task>(tasks);
6662private static Task<TTask> WhenAny<TTask>(IEnumerable<TTask> tasks) where TTask : Task
6804public static IAsyncEnumerable<Task> WhenEach(params Task[] tasks)
6807return WhenEach((ReadOnlySpan<Task>)tasks);
6810/// <inheritdoc cref="WhenEach(Task[])"/>
6811public static IAsyncEnumerable<Task> WhenEach(ReadOnlySpan<Task> tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params
6812WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));
6814/// <inheritdoc cref="WhenEach(Task[])"/>
6815public static IAsyncEnumerable<Task> WhenEach(IEnumerable<Task> tasks) =>
6816WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));
6818/// <inheritdoc cref="WhenEach(Task[])"/>
6825/// <inheritdoc cref="WhenEach(Task[])"/>
6827WhenEachState.Iterate<Task<TResult>>(WhenEachState.Create(ReadOnlySpan<Task>.CastUp(tasks)));
6829/// <inheritdoc cref="WhenEach(Task[])"/>
6834private sealed class WhenEachState : Queue<Task>, IValueTaskSource, ITaskCompletionAction
6850void ITaskCompletionAction.Invoke(Task completingTask)
6874public static WhenEachState? Create(ReadOnlySpan<Task> tasks)
6881foreach (Task task in tasks)
6896/// <inheritdoc cref="Create(ReadOnlySpan{Task})"/>
6897public static WhenEachState? Create(IEnumerable<Task> tasks)
6903IEnumerator<Task> e = tasks.GetEnumerator();
6909Task task = e.Current;
6925public static async IAsyncEnumerable<T> Iterate<T>(WhenEachState? waiter, [EnumeratorCancellation] CancellationToken cancellationToken = default) where T : Task
6942Task? next;
6979internal static Task<TResult> CreateUnwrapPromise<TResult>(Task outerTask, bool lookForOce)
7009if (continuationObject is Task continuationTask)
7020return new Delegate[] { new Action<Task>(singleCompletionAction.Invoke) };
7047private static Task? GetActiveTaskFromId(int taskId)
7049Task? task = null;
7058private readonly Task m_completingTask;
7060internal CompletionActionInvoker(ITaskCompletionAction action, Task completingTask)
7075private readonly Task m_task;
7077public SystemThreadingTasks_TaskDebugView(Task task)
7291void Invoke(Task completingTask);
7321public UnwrapPromise(Task outerTask, bool lookForOce)
7347public void Invoke(Task completingTask)
7367private void InvokeCore(Task completingTask)
7387private void InvokeCoreAsync(Task completingTask)
7396var tuple = (TupleSlim<UnwrapPromise<TResult>, Task>)state!;
7398}, new TupleSlim<UnwrapPromise<TResult>, Task>(this, completingTask));
7403private void ProcessCompletedOuterTask(Task task)
7424taskOfTaskOfTResult.Result : ((Task<Task>)task).Result);
7433private bool TrySetFromTask(Task task, bool lookForOce)
7480private void ProcessInnerTask(Task? task)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (49)
12private Task? m_antecedent;
15Task antecedent, Delegate action, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
18Debug.Assert(action is Action<Task> || action is Action<Task, object?>,
30Task? antecedent = m_antecedent;
40if (m_action is Action<Task> action)
46if (m_action is Action<Task, object?> actionWithState)
58private Task? m_antecedent;
61Task antecedent, Delegate function, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
64Debug.Assert(function is Func<Task, TResult> || function is Func<Task, object?, TResult>,
76Task? antecedent = m_antecedent;
86if (m_action is Func<Task, TResult> func)
92if (m_action is Func<Task, object?, TResult> funcWithState)
207internal abstract void Run(Task completedTask, bool canInlineContinuationTask);
214protected static void InlineIfPossibleOrElseQueue(Task task, bool needsProtection)
229task.m_stateFlags |= (int)Task.TaskStateFlags.Started;
262internal Task? m_task;
272internal ContinueWithTaskContinuation(Task task, TaskContinuationOptions options, TaskScheduler scheduler)
282if (Task.s_asyncDebuggingEnabled)
283Task.AddToActiveTasks(m_task);
289internal override void Run(Task completedTask, bool canInlineContinuationTask)
294Task? continuationTask = m_task;
341Task.ContingentProperties? cp = continuationTask.m_contingentProperties; // no need to volatile read, as we only care about the token, which is only assignable at construction
392internal sealed override void Run(Task task, bool canInlineContinuationTask)
398RunCallback(GetInvokeActionCallback(), m_action, ref Task.t_currentTask);
406m_continuationId = Task.NewId();
409RunCallback(GetPostActionCallback(), this, ref Task.t_currentTask);
473internal sealed override void Run(Task ignored, bool canInlineContinuationTask)
493Task task = CreateTask(static state =>
501Task.ThrowAsync(exception, targetContext: null);
547protected Task CreateTask(Action<object?> action, object? state, TaskScheduler scheduler)
563internal override void Run(Task task, bool canInlineContinuationTask)
572RunCallback(GetInvokeActionCallback(), m_action, ref Task.t_currentTask); // any exceptions from m_action will be handled by s_callbackRunAction
579m_continuationId = Task.NewId();
681protected void RunCallback(ContextCallback callback, object? state, ref Task? currentTask)
684Debug.Assert(currentTask == Task.t_currentTask);
688Task? prevCurrentTask = currentTask;
707Task.ThrowAsync(exception, targetContext: null);
729ref Task? currentTask = ref Task.t_currentTask;
730Task? prevCurrentTask = currentTask;
747Task.ThrowAsync(exception, targetContext: null);
765ref Task? currentTask = ref Task.t_currentTask;
766Task? prevCurrentTask = currentTask;
799Task.ThrowAsync(exception, targetContext: null);
810internal static void UnsafeScheduleAction(Action action, Task? task)
817atc.m_continuationId = Task.NewId();
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskFactory.cs (238)
21/// <see cref="Task">Tasks</see>.
31/// <see cref="Task.Factory">Task.Factory</see> property.
45private TaskScheduler GetDefaultScheduler(Task? currTask)
263/// Creates and starts a <see cref="Task">Task</see>.
266/// <returns>The started <see cref="Task">Task</see>.</returns>
272/// <see cref="Task.Start()">Start</see> to schedule it for execution. However,
276public Task StartNew(Action action)
278Task? currTask = Task.InternalCurrent;
279return Task.InternalStartNew(currTask, action, null, m_defaultCancellationToken, GetDefaultScheduler(currTask),
284/// Creates and starts a <see cref="Task">Task</see>.
288/// <returns>The started <see cref="Task">Task</see>.</returns>
297/// <see cref="Task.Start()">Start</see> to schedule it for execution. However,
301public Task StartNew(Action action, CancellationToken cancellationToken)
303Task? currTask = Task.InternalCurrent;
304return Task.InternalStartNew(currTask, action, null, cancellationToken, GetDefaultScheduler(currTask),
309/// Creates and starts a <see cref="Task">Task</see>.
314/// <see cref="Task">Task.</see></param>
315/// <returns>The started <see cref="Task">Task</see>.</returns>
325/// <see cref="Task.Start()">Start</see> to schedule it for execution.
329public Task StartNew(Action action, TaskCreationOptions creationOptions)
331Task? currTask = Task.InternalCurrent;
332return Task.InternalStartNew(currTask, action, null, m_defaultCancellationToken, GetDefaultScheduler(currTask), creationOptions,
337/// Creates and starts a <see cref="Task">Task</see>.
340/// <param name="cancellationToken">The <see cref="CancellationToken"/> that will be assigned to the new <see cref="Task"/></param>
343/// <see cref="Task">Task.</see></param>
347/// cref="Task">Task</see>.</param>
348/// <returns>The started <see cref="Task">Task</see>.</returns>
364/// <see cref="Task.Start()">Start</see> to schedule it for execution.
368public Task StartNew(Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
370return Task.InternalStartNew(
371Task.InternalCurrentIfAttached(creationOptions), action, null, cancellationToken, scheduler, creationOptions,
377/// Creates and starts a <see cref="Task">Task</see>.
382/// <returns>The started <see cref="Task">Task</see>.</returns>
389/// <see cref="Task.Start()">Start</see> to schedule it for execution.
393public Task StartNew(Action<object?> action, object? state)
395Task? currTask = Task.InternalCurrent;
396return Task.InternalStartNew(currTask, action, state, m_defaultCancellationToken, GetDefaultScheduler(currTask),
402/// Creates and starts a <see cref="Task">Task</see>.
407/// <param name="cancellationToken">The <see cref="CancellationToken"/> that will be assigned to the new <see cref="Task"/></param>
408/// <returns>The started <see cref="Task">Task</see>.</returns>
418/// <see cref="Task.Start()">Start</see> to schedule it for execution.
422public Task StartNew(Action<object?> action, object? state, CancellationToken cancellationToken)
424Task? currTask = Task.InternalCurrent;
425return Task.InternalStartNew(currTask, action, state, cancellationToken, GetDefaultScheduler(currTask),
430/// Creates and starts a <see cref="Task">Task</see>.
437/// <see cref="Task">Task.</see></param>
438/// <returns>The started <see cref="Task">Task</see>.</returns>
448/// <see cref="Task.Start()">Start</see> to schedule it for execution.
452public Task StartNew(Action<object?> action, object? state, TaskCreationOptions creationOptions)
454Task? currTask = Task.InternalCurrent;
455return Task.InternalStartNew(currTask, action, state, m_defaultCancellationToken, GetDefaultScheduler(currTask),
460/// Creates and starts a <see cref="Task">Task</see>.
468/// <see cref="Task">Task.</see></param>
472/// cref="Task">Task</see>.</param>
473/// <returns>The started <see cref="Task">Task</see>.</returns>
489/// <see cref="Task.Start()">Start</see> to schedule it for execution.
493public Task StartNew(Action<object?> action, object? state, CancellationToken cancellationToken,
496return Task.InternalStartNew(
497Task.InternalCurrentIfAttached(creationOptions), action, state, cancellationToken, scheduler,
516/// <see cref="Task.Start()">Start</see> to schedule it for execution.
522Task? currTask = Task.InternalCurrent;
536/// <param name="cancellationToken">The <see cref="CancellationToken"/> that will be assigned to the new <see cref="Task"/></param>
547/// <see cref="Task.Start()">Start</see> to schedule it for execution.
553Task? currTask = Task.InternalCurrent;
579/// <see cref="Task.Start()">Start</see> to schedule it for execution.
585Task? currTask = Task.InternalCurrent;
622/// <see cref="Task.Start()">Start</see> to schedule it for execution.
629Task.InternalCurrentIfAttached(creationOptions), function, cancellationToken,
650/// <see cref="Task.Start()">Start</see> to schedule it for execution.
656Task? currTask = Task.InternalCurrent;
672/// <param name="cancellationToken">The <see cref="CancellationToken"/> that will be assigned to the new <see cref="Task"/></param>
683/// <see cref="Task.Start()">Start</see> to schedule it for execution.
689Task? currTask = Task.InternalCurrent;
717/// <see cref="Task.Start()">Start</see> to schedule it for execution.
723Task? currTask = Task.InternalCurrent;
762/// <see cref="Task.Start()">Start</see> to schedule it for execution.
770Task.InternalCurrentIfAttached(creationOptions), function, state, cancellationToken,
779/// Creates a <see cref="Task">Task</see> that executes an end method action
790/// <returns>A <see cref="Task">Task</see> that represents the asynchronous
792public Task FromAsync(
800/// Creates a <see cref="Task">Task</see> that executes an end method action
808/// created <see cref="Task">Task</see>.</param>
816/// <returns>A <see cref="Task">Task</see> that represents the asynchronous
818public Task FromAsync(
827/// Creates a <see cref="Task">Task</see> that executes an end method action
837/// created <see cref="Task">Task</see>.</param>
847/// <returns>A <see cref="Task">Task</see> that represents the asynchronous
849public Task FromAsync(
859/// Creates a <see cref="Task">Task</see> that represents a pair of begin
870/// <returns>The created <see cref="Task">Task</see> that represents the
875public Task FromAsync(
884/// Creates a <see cref="Task">Task</see> that represents a pair of begin
890/// created <see cref="Task">Task</see>.</param>
900/// <returns>The created <see cref="Task">Task</see> that represents the
905public Task FromAsync(
913/// Creates a <see cref="Task">Task</see> that represents a pair of begin
929/// <returns>The created <see cref="Task">Task</see> that represents the
934public Task FromAsync<TArg1>(
944/// Creates a <see cref="Task">Task</see> that represents a pair of begin
955/// created <see cref="Task">Task</see>.</param>
965/// <returns>The created <see cref="Task">Task</see> that represents the
970public Task FromAsync<TArg1>(
979/// Creates a <see cref="Task">Task</see> that represents a pair of begin
999/// <returns>The created <see cref="Task">Task</see> that represents the
1004public Task FromAsync<TArg1, TArg2>(
1013/// Creates a <see cref="Task">Task</see> that represents a pair of begin
1028/// created <see cref="Task">Task</see>.</param>
1038/// <returns>The created <see cref="Task">Task</see> that represents the
1043public Task FromAsync<TArg1, TArg2>(
1052/// Creates a <see cref="Task">Task</see> that represents a pair of begin
1076/// <returns>The created <see cref="Task">Task</see> that represents the
1081public Task FromAsync<TArg1, TArg2, TArg3>(
1090/// Creates a <see cref="Task">Task</see> that represents a pair of begin
1109/// created <see cref="Task">Task</see>.</param>
1119/// <returns>The created <see cref="Task">Task</see> that represents the
1124public Task FromAsync<TArg1, TArg2, TArg3>(
1547private sealed class CompleteOnCountdownPromise : Task<Task[]>, ITaskCompletionAction
1549private readonly Task[] _tasks;
1552internal CompleteOnCountdownPromise(Task[] tasksCopy)
1565public void Invoke(Task completingTask)
1596internal static Task<Task[]> CommonCWAllLogic(Task[] tasksCopy)
1635public void Invoke(Task completingTask)
1683/// Creates a continuation <see cref="Task">Task</see>
1689/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1698public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction)
1706/// Creates a continuation <see cref="Task">Task</see>
1714/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1726public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken)
1734/// Creates a continuation <see cref="Task">Task</see>
1742/// the created continuation <see cref="Task">Task</see>.</param>
1743/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1760public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, TaskContinuationOptions continuationOptions)
1768/// Creates a continuation <see cref="Task">Task</see>
1778/// the created continuation <see cref="Task">Task</see>.</param>
1781/// cref="Task">Task</see>.</param>
1782/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1804public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken,
1813/// Creates a continuation <see cref="Task">Task</see>
1820/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1829public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction)
1838/// Creates a continuation <see cref="Task">Task</see>
1847/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1859public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
1868/// Creates a continuation <see cref="Task">Task</see>
1877/// the created continuation <see cref="Task">Task</see>.</param>
1878/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1895public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
1904/// Creates a continuation <see cref="Task">Task</see>
1915/// the created continuation <see cref="Task">Task</see>.</param>
1918/// cref="Task">Task</see>.</param>
1919/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
1941public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
1950/// Creates a continuation <see cref="Task">Task</see>
1969public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction)
1978/// Creates a continuation <see cref="Task">Task</see>
2002public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
2040public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
2088public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken,
2264internal sealed class CompleteOnInvokePromise<TTask> : Task<TTask>, ITaskCompletionAction where TTask : Task
2290public void Invoke(Task completingTask)
2336internal static Task<TTask> CommonCWAnyLogic<TTask>(IList<TTask> tasks, bool isSyncBlocking = false) where TTask : Task
2349Task task = tasks[i];
2393internal static void CommonCWAnyLogicCleanup(Task<Task> continuation)
2397((CompleteOnInvokePromise<Task>)continuation).Invoke(null!);
2401/// Creates a continuation <see cref="Task">Task</see>
2407/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2416public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction)
2424/// Creates a continuation <see cref="Task">Task</see>
2432/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2444public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken)
2452/// Creates a continuation <see cref="Task">Task</see>
2460/// the created continuation <see cref="Task">Task</see>.</param>
2461/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2478public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
2486/// Creates a continuation <see cref="Task">Task</see>
2496/// the created continuation <see cref="Task">Task</see>.</param>
2499/// cref="Task">Task</see>.</param>
2500/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2522public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken,
2551public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction)
2583public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
2621public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
2669public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
2831/// Creates a continuation <see cref="Task">Task</see>
2838/// <returns>The new continuation <see cref="Task"/>.</returns>
2847public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction)
2855/// Creates a continuation <see cref="Task">Task</see>
2864/// <returns>The new continuation <see cref="Task"/>.</returns>
2876public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2885/// Creates a continuation <see cref="Task">Task</see>
2894/// the created continuation <see cref="Task">Task</see>.</param>
2895/// <returns>The new continuation <see cref="Task"/>.</returns>
2912public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2921/// Creates a continuation <see cref="Task">Task</see>
2932/// the created continuation <see cref="Task">Task</see>.</param>
2936/// <returns>The new continuation <see cref="Task"/>.</returns>
2958public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2968internal static Task[] CheckMultiContinuationTasksAndCopy(Task[] tasks)
2975Task[] tasksCopy = new Task[tasks.Length];
System.Private.DataContractSerialization (74)
System\Xml\XmlDictionaryAsyncCheckWriter.cs (29)
18private Task? _lastTask;
43private Task SetLastTask(Task task)
91public override Task FlushAsync()
109public override Task WriteAttributesAsync(XmlReader reader, bool defattr)
121public override Task WriteBase64Async(byte[] buffer, int index, int count)
133public override Task WriteBinHexAsync(byte[] buffer, int index, int count)
145public override Task WriteCDataAsync(string? text)
157public override Task WriteCharEntityAsync(char ch)
169public override Task WriteCharsAsync(char[] buffer, int index, int count)
181public override Task WriteCommentAsync(string? text)
193public override Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
211public override Task WriteEndDocumentAsync()
223public override Task WriteEndElementAsync()
235public override Task WriteEntityRefAsync(string name)
247public override Task WriteFullEndElementAsync()
259public override Task WriteNameAsync(string name)
271public override Task WriteNmTokenAsync(string name)
283public override Task WriteNodeAsync(XmlReader reader, bool defattr)
295public override Task WriteProcessingInstructionAsync(string name, string? text)
307public override Task WriteQualifiedNameAsync(string localName, string? ns)
325public override Task WriteRawAsync(string data)
331public override Task WriteRawAsync(char[] buffer, int index, int count)
355public override Task WriteStartDocumentAsync()
361public override Task WriteStartDocumentAsync(bool standalone)
373public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
385public override Task WriteStringAsync(string? text)
397public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
463public override Task WriteWhitespaceAsync(string? ws)
System.Private.Xml (538)
System\Xml\AsyncHelper.cs (19)
10public static readonly Task<bool> DoneTaskTrue = Task.FromResult(true);
12public static readonly Task<bool> DoneTaskFalse = Task.FromResult(false);
14public static readonly Task<int> DoneTaskZero = Task.FromResult(0);
16public static bool IsSuccess(this Task task)
21public static Task CallVoidFuncWhenFinishAsync<TArg>(this Task task, Action<TArg> func, TArg arg)
26return Task.CompletedTask;
34private static async Task CallVoidFuncWhenFinishCoreAsync<TArg>(this Task task, Action<TArg> func, TArg arg)
40public static Task<bool> ReturnTrueTaskWhenFinishAsync(this Task task)
47private static async Task<bool> ReturnTrueTaskWhenFinishCoreAsync(this Task task)
53public static Task CallTaskFuncWhenFinishAsync<TArg>(this Task task, Func<TArg, Task> func, TArg arg)
60private static async Task CallTaskFuncWhenFinishCoreAsync<TArg>(Task task, Func<TArg, Task> func, TArg arg)
66public static Task<bool> CallBoolTaskFuncWhenFinishAsync<TArg>(this Task task, Func<TArg, Task<bool>> func, TArg arg)
73private static async Task<bool> CallBoolTaskFuncWhenFinishCoreAsync<TArg>(this Task task, Func<TArg, Task<bool>> func, TArg arg)
System\Xml\Base64EncoderAsync.cs (6)
12internal abstract Task WriteCharsAsync(char[] chars, int index, int count);
14internal Task EncodeAsync(byte[] buffer, int index, int count)
23async Task Core(byte[] buffer, int index, int count)
76internal async Task FlushAsync()
89internal override Task WriteCharsAsync(char[] chars, int index, int count)
97internal override Task WriteCharsAsync(char[] chars, int index, int count)
System\Xml\Core\XmlAsyncCheckWriter.cs (60)
12private Task _lastTask = Task.CompletedTask;
347public override Task WriteStartDocumentAsync()
350var task = _coreWriter.WriteStartDocumentAsync();
355public override Task WriteStartDocumentAsync(bool standalone)
358var task = _coreWriter.WriteStartDocumentAsync(standalone);
363public override Task WriteEndDocumentAsync()
366var task = _coreWriter.WriteEndDocumentAsync();
371public override Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
374var task = _coreWriter.WriteDocTypeAsync(name, pubid, sysid, subset);
379public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
382var task = _coreWriter.WriteStartElementAsync(prefix, localName, ns);
387public override Task WriteEndElementAsync()
390var task = _coreWriter.WriteEndElementAsync();
395public override Task WriteFullEndElementAsync()
398var task = _coreWriter.WriteFullEndElementAsync();
403protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
406var task = _coreWriter.WriteStartAttributeAsync(prefix, localName, ns);
411protected internal override Task WriteEndAttributeAsync()
414var task = _coreWriter.WriteEndAttributeAsync();
419public override Task WriteCDataAsync(string? text)
422var task = _coreWriter.WriteCDataAsync(text);
427public override Task WriteCommentAsync(string? text)
430var task = _coreWriter.WriteCommentAsync(text);
435public override Task WriteProcessingInstructionAsync(string name, string? text)
438var task = _coreWriter.WriteProcessingInstructionAsync(name, text);
443public override Task WriteEntityRefAsync(string name)
446var task = _coreWriter.WriteEntityRefAsync(name);
451public override Task WriteCharEntityAsync(char ch)
454var task = _coreWriter.WriteCharEntityAsync(ch);
459public override Task WriteWhitespaceAsync(string? ws)
462var task = _coreWriter.WriteWhitespaceAsync(ws);
467public override Task WriteStringAsync(string? text)
470var task = _coreWriter.WriteStringAsync(text);
475public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
478var task = _coreWriter.WriteSurrogateCharEntityAsync(lowChar, highChar);
483public override Task WriteCharsAsync(char[] buffer, int index, int count)
486var task = _coreWriter.WriteCharsAsync(buffer, index, count);
491public override Task WriteRawAsync(char[] buffer, int index, int count)
494var task = _coreWriter.WriteRawAsync(buffer, index, count);
499public override Task WriteRawAsync(string data)
502var task = _coreWriter.WriteRawAsync(data);
507public override Task WriteBase64Async(byte[] buffer, int index, int count)
510var task = _coreWriter.WriteBase64Async(buffer, index, count);
515public override Task WriteBinHexAsync(byte[] buffer, int index, int count)
518var task = _coreWriter.WriteBinHexAsync(buffer, index, count);
523public override Task FlushAsync()
526var task = _coreWriter.FlushAsync();
531public override Task WriteNmTokenAsync(string name)
534var task = _coreWriter.WriteNmTokenAsync(name);
539public override Task WriteNameAsync(string name)
542var task = _coreWriter.WriteNameAsync(name);
547public override Task WriteQualifiedNameAsync(string localName, string? ns)
550var task = _coreWriter.WriteQualifiedNameAsync(localName, ns);
555public override Task WriteAttributesAsync(XmlReader reader, bool defattr)
558var task = _coreWriter.WriteAttributesAsync(reader, defattr);
563public override Task WriteNodeAsync(XmlReader reader, bool defattr)
566var task = _coreWriter.WriteNodeAsync(reader, defattr);
571public override Task WriteNodeAsync(XPathNavigator navigator, bool defattr)
574var task = _coreWriter.WriteNodeAsync(navigator, defattr);
System\Xml\Core\XmlCharCheckingWriterAsync.cs (14)
19public override Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
58public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
74protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
91public override async Task WriteCDataAsync(string? text)
116public override Task WriteCommentAsync(string? text)
133public override Task WriteProcessingInstructionAsync(string name, string? text)
156public override Task WriteEntityRefAsync(string name)
165public override Task WriteWhitespaceAsync(string? ws)
187public override Task WriteStringAsync(string? text)
205public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
210public override Task WriteCharsAsync(char[] buffer, int index, int count)
235public override Task WriteNmTokenAsync(string name)
245public override Task WriteNameAsync(string name)
254public override Task WriteQualifiedNameAsync(string localName, string? ns)
System\Xml\Core\XmlEncodedRawTextWriterAsync.cs (69)
33internal override async Task WriteXmlDeclarationAsync(XmlStandalone standalone)
63internal override Task WriteXmlDeclarationAsync(string xmldecl)
72return Task.CompletedTask;
132public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
174public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
182Task task;
202internal override Task WriteEndElementAsync(string prefix, string localName, string ns)
233return Task.CompletedTask;
237internal override Task WriteFullEndElementAsync(string prefix, string localName, string ns)
259protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
271Task task;
291protected internal override Task WriteEndAttributeAsync()
301return Task.CompletedTask;
304internal override async Task WriteNamespaceDeclarationAsync(string prefix, string namespaceName)
314internal override async Task WriteStartNamespaceDeclarationAsync(string prefix)
343internal override Task WriteEndNamespaceDeclarationAsync()
354return Task.CompletedTask;
359public override async Task WriteCDataAsync(string? text)
397public override async Task WriteCommentAsync(string? text)
417public override async Task WriteProcessingInstructionAsync(string name, string? text)
440public override async Task WriteEntityRefAsync(string name)
460public override async Task WriteCharEntityAsync(char ch)
489public override Task WriteWhitespaceAsync(string? ws)
508public override Task WriteStringAsync(string? text)
526public override async Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
545public override Task WriteCharsAsync(char[] buffer, int index, int count)
567public override async Task WriteRawAsync(char[] buffer, int index, int count)
583public override async Task WriteRawAsync(string data)
596public override async Task FlushAsync()
616protected virtual async Task FlushBufferAsync()
678private async Task EncodeCharsAsync(int startOffset, int endOffset, bool writeAllToStream)
705private Task FlushEncoderAsync()
719return Task.CompletedTask;
875protected async Task WriteAttributeTextBlockAsync(char[] chars, int index, int count)
892protected Task WriteAttributeTextBlockAsync(string text)
906return Task.CompletedTask;
909private async Task _WriteAttributeTextBlockAsync(string text, int curIndex, int leftCount)
1086protected async Task WriteElementTextBlockAsync(char[] chars, int index, int count)
1111protected Task WriteElementTextBlockAsync(string text)
1130return Task.CompletedTask;
1133private async Task _WriteElementTextBlockAsync(bool newLine, string text, int curIndex, int leftCount)
1249protected Task RawTextAsync(string text)
1254Task.CompletedTask;
1257protected Task RawTextAsync(string text1, string? text2 = null, string? text3 = null, string? text4 = null)
1310return Task.CompletedTask;
1313private async Task _RawTextAsync(
1485protected async Task WriteRawWithCharCheckingAsync(char[] chars, int index, int count)
1509protected async Task WriteRawWithCharCheckingAsync(string text)
1687protected async Task WriteCommentOrPiAsync(string text, int stopChar)
1871protected async Task WriteCDataSectionAsync(string text)
1908public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
1919public override async Task WriteStartElementAsync(string? prefix, string localName, string? ns)
1935internal override async Task WriteEndElementAsync(string prefix, string localName, string ns)
1953internal override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
1972protected internal override async Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
1985internal override async Task WriteStartNamespaceDeclarationAsync(string prefix)
1997public override Task WriteCDataAsync(string? text)
2004public override async Task WriteCommentAsync(string? text)
2015public override async Task WriteProcessingInstructionAsync(string target, string? text)
2026public override Task WriteEntityRefAsync(string name)
2033public override Task WriteCharEntityAsync(char ch)
2040public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
2047public override Task WriteWhitespaceAsync(string? ws)
2054public override Task WriteStringAsync(string? text)
2061public override Task WriteCharsAsync(char[] buffer, int index, int count)
2068public override Task WriteRawAsync(char[] buffer, int index, int count)
2075public override Task WriteRawAsync(string data)
2082public override Task WriteBase64Async(byte[] buffer, int index, int count)
2090private async Task WriteIndentAsync()
System\Xml\Core\XmlRawWriterAsync.cs (32)
46public override Task WriteStartDocumentAsync()
51public override Task WriteStartDocumentAsync(bool standalone)
56public override Task WriteEndDocumentAsync()
61public override Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
63return Task.CompletedTask;
67public override Task WriteEndElementAsync()
73public override Task WriteFullEndElementAsync()
79public override Task WriteBase64Async(byte[] buffer, int index, int count)
88public override Task WriteNmTokenAsync(string name)
94public override Task WriteNameAsync(string name)
100public override Task WriteQualifiedNameAsync(string localName, string? ns)
106public override Task WriteCDataAsync(string? text)
112public override Task WriteCharEntityAsync(char ch)
118public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
124public override Task WriteWhitespaceAsync(string? ws)
130public override Task WriteCharsAsync(char[] buffer, int index, int count)
136public override Task WriteRawAsync(char[] buffer, int index, int count)
142public override Task WriteRawAsync(string data)
148public override Task WriteAttributesAsync(XmlReader reader, bool defattr)
153public override Task WriteNodeAsync(XmlReader reader, bool defattr)
158public override Task WriteNodeAsync(System.Xml.XPath.XPathNavigator navigator, bool defattr)
168internal virtual Task WriteXmlDeclarationAsync(XmlStandalone standalone)
170return Task.CompletedTask;
172internal virtual Task WriteXmlDeclarationAsync(string xmldecl)
174return Task.CompletedTask;
181internal virtual Task WriteEndElementAsync(string prefix, string localName, string ns)
186internal virtual Task WriteFullEndElementAsync(string prefix, string localName, string ns)
191internal virtual async Task WriteQualifiedNameAsync(string prefix, string localName, string? ns)
204internal virtual Task WriteNamespaceDeclarationAsync(string prefix, string ns)
209internal virtual Task WriteStartNamespaceDeclarationAsync(string prefix)
214internal virtual Task WriteEndNamespaceDeclarationAsync()
220internal virtual Task WriteEndBase64Async()
System\Xml\Core\XmlTextReaderImplAsync.cs (57)
37return Task.FromResult(_curNode.StringValue);
57private Task FinishInitAsync()
70return Task.CompletedTask;
75private async Task FinishInitUriStringAsync()
114private async Task FinishInitStreamAsync()
138private async Task FinishInitTextReaderAsync()
240return Task.FromResult(ParseFragmentAttribute());
307public override async Task SkipAsync()
743internal async Task DtdParserProxy_ParsePIAsync(StringBuilder? sb)
759internal async Task DtdParserProxy_ParseCommentAsync(StringBuilder? sb)
860private Task InitStreamInputAsync(Uri baseUri, Stream stream, Encoding? encoding)
866private async Task InitStreamInputAsync(Uri? baseUri, string baseUriStr, Stream stream, byte[]? bytes, int byteCount, Encoding? encoding)
975private Task ProcessDtdFromParserContextAsync(XmlParserContext context)
995return Task.CompletedTask;
999private Task SwitchEncodingAsync(Encoding newEncoding)
1010return Task.CompletedTask;
1013private Task SwitchEncodingToUTF8Async()
1856private Task ParseElementAsync()
1926private Task ParseElementAsync_ContinueWithSetElement(Task<(int, int)> task)
1941private async Task _ParseElementAsync_ContinueWithSetElement(Task<(int, int)> task)
1949private Task ParseElementAsync_SetElement(int colonPos, int pos)
2001private Task ParseElementAsync_NoAttributes()
2047return Task.CompletedTask;
2050private async Task ParseElementAsync_ReadData(int pos)
2060private Task ParseEndElementAsync()
2075private async Task _ParseEndElmentAsync()
2081private async Task ParseEndElmentAsync_PrepareData()
2098private Task ParseEndElementAsync_CheckNameAndParse()
2138private Task ParseEndElementAsync_Finish(int nameLen, NodeData startTagNode, LineInfo endTagLineInfo)
2140Task task = ParseEndElementAsync_CheckEndTag(nameLen, startTagNode, endTagLineInfo);
2162private async Task ParseEndElementAsync_Finish(Task task, int nameLen, NodeData startTagNode, LineInfo endTagLineInfo)
2181private Task ParseEndElementAsync_CheckEndTag(int nameLen, NodeData startTagNode, LineInfo endTagLineInfo)
2193return Task.CompletedTask;
2242return Task.CompletedTask;
2267return Task.CompletedTask;
2270private async Task ParseEndElementAsync_ReadData()
2280private async Task ThrowTagMismatchAsync(NodeData startTag)
2305private async Task ParseAttributesAsync()
2603private async Task ParseAttributeValueSlowAsync(int curPos, char quoteChar, NodeData attr)
3164private readonly Task<(int, int, int, bool)> _parseText_dummyTask = Task.FromResult((0, 0, 0, false));
3527private async Task FinishPartialValueAsync()
3560private async Task FinishOtherValueIteratorAsync()
3607private async Task SkipPartialTextValueAsync()
3623private Task FinishReadValueChunkAsync()
3638return Task.CompletedTask;
3642private async Task FinishReadContentAsBinaryAsync()
3663private async Task FinishReadElementContentAsBinaryAsync()
3716private async Task ParseEntityReferenceAsync()
4189private Task ParseCDataAsync()
4195private async Task ParseCDataOrCommentAsync(XmlNodeType type)
4467private async Task ParseDtdAsync()
4482private async Task SkipDtdAsync()
4591private Task SkipPublicOrSystemIdLiteralAsync()
4604private async Task SkipUntilAsync(char stopChar, bool recognizeLiterals)
5100private async Task PushExternalEntityOrSubsetAsync(string? publicId, string? systemId, Uri? baseUri, string? entityName)
5253private async Task ParseDtdFromParserContextAsync()
System\Xml\Core\XmlUtf8RawTextWriterAsync.cs (66)
33internal override async Task WriteXmlDeclarationAsync(XmlStandalone standalone)
62internal override Task WriteXmlDeclarationAsync(string xmldecl)
71return Task.CompletedTask;
110public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
150public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
156Task task;
176internal override Task WriteEndElementAsync(string prefix, string localName, string ns)
205return Task.CompletedTask;
209internal override Task WriteFullEndElementAsync(string prefix, string localName, string ns)
229protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
239Task task;
259protected internal override Task WriteEndAttributeAsync()
267return Task.CompletedTask;
270internal override async Task WriteNamespaceDeclarationAsync(string prefix, string namespaceName)
280internal override async Task WriteStartNamespaceDeclarationAsync(string prefix)
305internal override Task WriteEndNamespaceDeclarationAsync()
314return Task.CompletedTask;
319public override async Task WriteCDataAsync(string? text)
355public override async Task WriteCommentAsync(string? text)
373public override async Task WriteProcessingInstructionAsync(string name, string? text)
394public override async Task WriteEntityRefAsync(string name)
412public override async Task WriteCharEntityAsync(char ch)
439public override Task WriteWhitespaceAsync(string? ws)
456public override Task WriteStringAsync(string? text)
472public override async Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
489public override Task WriteCharsAsync(char[] buffer, int index, int count)
509public override async Task WriteRawAsync(char[] buffer, int index, int count)
523public override async Task WriteRawAsync(string data)
534public override async Task FlushAsync()
549protected virtual async Task FlushBufferAsync()
745protected async Task WriteAttributeTextBlockAsync(char[] chars, int index, int count)
762protected Task WriteAttributeTextBlockAsync(string text)
776return Task.CompletedTask;
779private async Task _WriteAttributeTextBlockAsync(string text, int curIndex, int leftCount)
955protected async Task WriteElementTextBlockAsync(char[] chars, int index, int count)
980protected Task WriteElementTextBlockAsync(string text)
999return Task.CompletedTask;
1002private async Task _WriteElementTextBlockAsync(bool newLine, string text, int curIndex, int leftCount)
1117protected Task RawTextAsync(string text)
1122Task.CompletedTask;
1125protected Task RawTextAsync(string text1, string? text2 = null, string? text3 = null, string? text4 = null)
1178return Task.CompletedTask;
1181private async Task _RawTextAsync(
1352protected async Task WriteRawWithCharCheckingAsync(char[] chars, int index, int count)
1376protected async Task WriteRawWithCharCheckingAsync(string text)
1553protected async Task WriteCommentOrPiAsync(string text, int stopChar)
1736protected async Task WriteCDataSectionAsync(string text)
1773public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
1784public override async Task WriteStartElementAsync(string? prefix, string localName, string? ns)
1800internal override async Task WriteEndElementAsync(string prefix, string localName, string ns)
1818internal override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
1837protected internal override async Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
1850internal override async Task WriteStartNamespaceDeclarationAsync(string prefix)
1862public override Task WriteCDataAsync(string? text)
1869public override async Task WriteCommentAsync(string? text)
1880public override async Task WriteProcessingInstructionAsync(string target, string? text)
1891public override Task WriteEntityRefAsync(string name)
1898public override Task WriteCharEntityAsync(char ch)
1905public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
1912public override Task WriteWhitespaceAsync(string? ws)
1919public override Task WriteStringAsync(string? text)
1926public override Task WriteCharsAsync(char[] buffer, int index, int count)
1933public override Task WriteRawAsync(char[] buffer, int index, int count)
1940public override Task WriteRawAsync(string data)
1947public override Task WriteBase64Async(byte[] buffer, int index, int count)
1955private async Task WriteIndentAsync()
System\Xml\Core\XmlWellFormedWriterAsync.cs (84)
21public override Task WriteStartDocumentAsync()
26public override Task WriteStartDocumentAsync(bool standalone)
31public override async Task WriteEndDocumentAsync()
59public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
125private Task TryReturnTask(Task task)
129return Task.CompletedTask;
137private async Task _TryReturnTask(Task task)
151private Task SequenceRun<TArg>(Task task, Func<TArg, Task> nextTaskFun, TArg arg)
163private async Task _SequenceRun<TArg>(Task task, Func<TArg, Task> nextTaskFun, TArg arg)
177public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
185Task task = AdvanceStateAsync(Token.StartElement);
202private Task WriteStartElementAsync_NoAdvanceState(string? prefix, string localName, string? ns)
241Task task = _writer.WriteStartElementAsync(prefix, localName, ns);
250return Task.CompletedTask;
259private async Task WriteStartElementAsync_NoAdvanceState(Task task, string? prefix, string localName, string? ns)
302private async Task WriteStartElementAsync_FinishWrite(Task t, string prefix, string localName, string ns)
316public override Task WriteEndElementAsync()
320Task task = AdvanceStateAsync(Token.EndElement);
331private Task WriteEndElementAsync_NoAdvanceState()
340Task task;
360private Task WriteEndElementAsync_FinishWrite()
392return Task.CompletedTask;
395public override Task WriteFullEndElementAsync()
399Task task = AdvanceStateAsync(Token.EndElement);
410private Task WriteFullEndElementAsync_NoAdvanceState()
419Task task;
439protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? namespaceName)
458Task task = AdvanceStateAsync(Token.StartAttribute);
475private Task WriteStartAttributeAsync_NoAdvanceState(string? prefix, string localName, string? namespaceName)
585return Task.CompletedTask;
594private async Task WriteStartAttributeAsync_NoAdvanceState(Task task, string? prefix, string localName, string? namespaceName)
609protected internal override Task WriteEndAttributeAsync()
613Task task = AdvanceStateAsync(Token.EndAttribute);
623private Task WriteEndAttributeAsync_NoAdvance()
643private async Task WriteEndAttributeAsync_SepcialAtt()
753public override async Task WriteCDataAsync(string? text)
769public override async Task WriteCommentAsync(string? text)
785public override async Task WriteProcessingInstructionAsync(string name, string? text)
830public override async Task WriteEntityRefAsync(string name)
855public override async Task WriteCharEntityAsync(char ch)
881public override async Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
907public override async Task WriteWhitespaceAsync(string? ws)
935public override Task WriteStringAsync(string? text)
941return Task.CompletedTask;
944Task task = AdvanceStateAsync(Token.Text);
962private Task WriteStringAsync_NoAdvanceState(string text)
969return Task.CompletedTask;
983private async Task WriteStringAsync_NoAdvanceState(Task task, string text)
997public override async Task WriteCharsAsync(char[] buffer, int index, int count)
1023public override async Task WriteRawAsync(char[] buffer, int index, int count)
1049public override async Task WriteRawAsync(string data)
1075public override Task WriteBase64Async(byte[] buffer, int index, int count)
1084Task task = AdvanceStateAsync(Token.Base64);
1102private async Task WriteBase64Async_NoAdvanceState(Task task, byte[] buffer, int index, int count)
1116public override async Task FlushAsync()
1129public override async Task WriteQualifiedNameAsync(string localName, string? ns)
1174public override async Task WriteBinHexAsync(byte[] buffer, int index, int count)
1192private async Task WriteStartDocumentImplAsync(XmlStandalone standalone)
1229private Task AdvanceStateAsync_ReturnWhenFinish(Task task, State newState)
1234return Task.CompletedTask;
1242private async Task _AdvanceStateAsync_ReturnWhenFinish(Task task, State newState)
1248private Task AdvanceStateAsync_ContinueWhenFinish(Task task, State newState, Token token)
1261private async Task _AdvanceStateAsync_ContinueWhenFinish(Task task, State newState, Token token)
1269private Task AdvanceStateAsync(Token token)
1286Task task;
1374return Task.CompletedTask;
1378private async Task StartElementContentAsync_WithNS()
1392private Task StartElementContentAsync()
1401return Task.CompletedTask;
System\Xml\Core\XmlWrappingWriterAsync.cs (22)
15public override Task WriteStartDocumentAsync()
20public override Task WriteStartDocumentAsync(bool standalone)
25public override Task WriteEndDocumentAsync()
30public override Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
35public override Task WriteStartElementAsync(string? prefix, string localName, string? ns)
40public override Task WriteEndElementAsync()
45public override Task WriteFullEndElementAsync()
50protected internal override Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
55protected internal override Task WriteEndAttributeAsync()
60public override Task WriteCDataAsync(string? text)
65public override Task WriteCommentAsync(string? text)
70public override Task WriteProcessingInstructionAsync(string name, string? text)
75public override Task WriteEntityRefAsync(string name)
80public override Task WriteCharEntityAsync(char ch)
85public override Task WriteWhitespaceAsync(string? ws)
90public override Task WriteStringAsync(string? text)
95public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
100public override Task WriteCharsAsync(char[] buffer, int index, int count)
105public override Task WriteRawAsync(char[] buffer, int index, int count)
110public override Task WriteRawAsync(string data)
115public override Task WriteBase64Async(byte[] buffer, int index, int count)
120public override Task FlushAsync()
System\Xml\Core\XmlWriterAsync.cs (39)
18public virtual Task WriteStartDocumentAsync()
25public virtual Task WriteStartDocumentAsync(bool standalone)
32public virtual Task WriteEndDocumentAsync()
39public virtual Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
46public virtual Task WriteStartElementAsync(string? prefix, string localName, string? ns)
53public virtual Task WriteEndElementAsync()
60public virtual Task WriteFullEndElementAsync()
66public Task WriteAttributeStringAsync(string? prefix, string localName, string? ns, string? value)
68Task task = WriteStartAttributeAsync(prefix, localName, ns);
77private async Task WriteAttributeStringAsyncHelper(Task task, string? value)
86protected internal virtual Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
93protected internal virtual Task WriteEndAttributeAsync()
100public virtual Task WriteCDataAsync(string? text)
107public virtual Task WriteCommentAsync(string? text)
114public virtual Task WriteProcessingInstructionAsync(string name, string? text)
121public virtual Task WriteEntityRefAsync(string name)
128public virtual Task WriteCharEntityAsync(char ch)
135public virtual Task WriteWhitespaceAsync(string? ws)
142public virtual Task WriteStringAsync(string? text)
149public virtual Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
156public virtual Task WriteCharsAsync(char[] buffer, int index, int count)
163public virtual Task WriteRawAsync(char[] buffer, int index, int count)
170public virtual Task WriteRawAsync(string data)
177public virtual Task WriteBase64Async(byte[] buffer, int index, int count)
183public virtual Task WriteBinHexAsync(byte[] buffer, int index, int count)
190public virtual Task FlushAsync()
199public virtual Task WriteNmTokenAsync(string name)
207public virtual Task WriteNameAsync(string name)
213public virtual async Task WriteQualifiedNameAsync(string localName, string? ns)
231public virtual Task WriteAttributesAsync(XmlReader reader, bool defattr)
236async Task Core(XmlReader reader, bool defattr)
280public virtual Task WriteNodeAsync(XmlReader reader, bool defattr)
296internal async Task WriteNodeAsync_CallSyncReader(XmlReader reader, bool defattr)
358internal async Task WriteNodeAsync_CallAsyncReader(XmlReader reader, bool defattr)
419public virtual Task WriteNodeAsync(XPathNavigator navigator, bool defattr)
424async Task Core(XPathNavigator navigator, bool defattr)
545public async Task WriteElementStringAsync(string? prefix, string localName, string? ns, string value)
557private async Task WriteLocalNamespacesAsync(XPathNavigator nsNav)
System.Private.Xml.Linq (37)
System.Runtime (1)
System.Runtime.InteropServices.JavaScript (2)
System.Security.Cryptography (11)
System.Security.Cryptography.Cose (4)
System.Security.Principal.Windows (2)
System.Text.Json (22)
System.Text.RegularExpressions (11)
System\Threading\StackHelper.cs (11)
39Task.Run(() => action(arg1))
50Task.Run(() => action(arg1, arg2))
63Task.Run(() => action(arg1, arg2, arg3))
78Task.Run(() => action(arg1, arg2, arg3, arg4))
95Task.Run(() => action(arg1, arg2, arg3, arg4, arg5))
114Task.Run(() => action(arg1, arg2, arg3, arg4, arg5, arg6))
122Task.Run(() => func())
132Task.Run(() => func(arg1))
144Task.Run(() => func(arg1, arg2))
158Task.Run(() => func(arg1, arg2, arg3))
174Task.Run(() => func(arg1, arg2, arg3, arg4))
System.Text.RegularExpressions.Generator (12)
src\libraries\System.Text.RegularExpressions\src\System\Threading\StackHelper.cs (11)
39Task.Run(() => action(arg1))
50Task.Run(() => action(arg1, arg2))
63Task.Run(() => action(arg1, arg2, arg3))
78Task.Run(() => action(arg1, arg2, arg3, arg4))
95Task.Run(() => action(arg1, arg2, arg3, arg4, arg5))
114Task.Run(() => action(arg1, arg2, arg3, arg4, arg5, arg6))
122Task.Run(() => func())
132Task.Run(() => func(arg1))
144Task.Run(() => func(arg1, arg2))
158Task.Run(() => func(arg1, arg2, arg3))
174Task.Run(() => func(arg1, arg2, arg3, arg4))
System.Threading.Channels (38)
System.Threading.RateLimiting (6)
System.Threading.Tasks (1)
System.Threading.Tasks.Dataflow (122)
Internal\Common.cs (9)
106Task? t = Common.GetPotentiallyNotSupportedCompletionTask(block);
176CancellationToken cancellationToken, Task completionTask, Action<object?, CancellationToken> completeAction, object completeState)
384internal static Task? GetPotentiallyNotSupportedCompletionTask(IDataflowBlock block)
452internal static Exception? StartTaskSafe(Task task, TaskScheduler scheduler)
470private static Exception? StartTaskSafeCore(Task task, TaskScheduler scheduler)
546internal static void PropagateCompletion(Task sourceCompletionTask, IDataflowBlock target, Action<Exception>? exceptionHandler)
569private static void PropagateCompletionAsContinuation(Task sourceCompletionTask, IDataflowBlock target)
580internal static void PropagateCompletionOnceCompleted(Task sourceCompletionTask, IDataflowBlock target)
675internal Task? TaskForInputProcessing;
System.Threading.Tasks.Parallel (45)
System\Threading\Tasks\Parallel.cs (14)
221ParallelEtwProvider.Log.ParallelInvokeBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
332Task[] tasks = new Task[actionsCopy.Length];
340tasks[i] = Task.Factory.StartNew(actionsCopy[i], parallelOptions.CancellationToken, TaskCreationOptions.None,
352Task.WaitAll(tasks);
367ParallelEtwProvider.Log.ParallelInvokeEnd(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
973ParallelEtwProvider.Log.ParallelLoopBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
1010ParallelEtwProvider.Log.ParallelFork(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
1110ParallelEtwProvider.Log.ParallelJoin(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
1155ParallelEtwProvider.Log.ParallelLoopEnd(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID, long.CreateTruncating(nTotalIterations));
2540ParallelEtwProvider.Log.ParallelLoopBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
2601ParallelEtwProvider.Log.ParallelFork(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
2747ParallelEtwProvider.Log.ParallelJoin(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
2795ParallelEtwProvider.Log.ParallelLoopEnd(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID, 0);
System\Threading\Tasks\Parallel.ForEachAsync.cs (29)
20public static Task ForAsync<T>(T fromInclusive, T toExclusive, Func<T, CancellationToken, ValueTask> body)
38public static Task ForAsync<T>(T fromInclusive, T toExclusive, CancellationToken cancellationToken, Func<T, CancellationToken, ValueTask> body)
56public static Task ForAsync<T>(T fromInclusive, T toExclusive, ParallelOptions parallelOptions, Func<T, CancellationToken, ValueTask> body)
77private static Task ForAsync<T>(T fromInclusive, T toExclusive, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<T, CancellationToken, ValueTask> body)
87return Task.FromCanceled(cancellationToken);
92return Task.CompletedTask;
120Func<object, Task> taskBody = static async o =>
211return Task.FromException(e);
222public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
238public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
253public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
271private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
280return Task.FromCanceled(cancellationToken);
284Func<object, Task> taskBody = static async o =>
366return Task.FromException(e);
377public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
393public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
408public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
426private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
435return Task.FromCanceled(cancellationToken);
439Func<object, Task> taskBody = static async o =>
521return Task.FromException(e);
543private readonly Func<object, Task> _taskBody;
564protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
605Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
615public Task AcquireLock()
715IEnumerable<TSource> source, Func<object, Task> taskBody,
737IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
760T fromExclusive, T toExclusive, Func<object, Task> taskBody,
System.Windows.Presentation (3)
SystemdTestApp (1)
TagHelpersWebSite (6)
Templates.Blazor.Tests (36)
Templates.Blazor.WebAssembly.Auth.Tests (43)
Templates.Blazor.WebAssembly.Tests (43)
Templates.Mvc.Tests (84)
MvcTemplateTest.cs (15)
33public async Task MvcTemplate_NoAuthFSharp() => await MvcTemplateCore(languageOverride: "F#");
36public async Task MvcTemplate_NoAuthNoHttpsFSharp() => await MvcTemplateCore(languageOverride: "F#", args: new[] { ArgConstants.NoHttps } );
40public async Task MvcTemplate_NoAuthCSharp() => await MvcTemplateCore(languageOverride: null);
44public async Task MvcTemplate_NoAuthNoHttpsCSharp() => await MvcTemplateCore(languageOverride: null, new[] { ArgConstants.NoHttps });
48public async Task MvcTemplate_ProgramMainNoAuthCSharp() => await MvcTemplateCore(languageOverride: null, new[] { ArgConstants.UseProgramMain });
52public async Task MvcTemplate_ProgramMainNoAuthNoHttpsCSharp() => await MvcTemplateCore(languageOverride: null, new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps });
54private async Task MvcTemplateCore(string languageOverride, string[] args = null)
136public Task MvcTemplate_IndividualAuth_LocalDb(bool useProgramMain, bool noHttps) => MvcTemplate_IndividualAuth_Core(useLocalDB: true, useProgramMain, noHttps);
144public Task MvcTemplate_IndividualAuth(bool useProgramMain, bool noHttps) => MvcTemplate_IndividualAuth_Core(useLocalDB: false, useProgramMain, noHttps);
146private async Task MvcTemplate_IndividualAuth_Core(bool useLocalDB, bool useProgramMain, bool noHttps)
272public async Task MvcTemplate_SingleFileExe()
321public Task MvcTemplate_IdentityWeb_IndividualB2C_BuildsAndPublishes(string auth, string[] args) => MvcTemplateBuildsAndPublishes(auth: auth, args: args);
329public Task MvcTemplate_IdentityWeb_IndividualB2C_NoHttps_BuildsAndPublishes(string auth, string[] args) => MvcTemplateBuildsAndPublishes(auth: auth, args: args);
339public Task MvcTemplate_IdentityWeb_SingleOrg_BuildsAndPublishes(string auth, string[] args) => MvcTemplateBuildsAndPublishes(auth: auth, args: args);
349public Task MvcTemplate_IdentityWeb_SingleOrg_NoHttps_BuildsAndPublishes(string auth, string[] args) => MvcTemplateBuildsAndPublishes(auth: auth, args: args);
RazorPagesTemplateTest.cs (7)
43public async Task RazorPagesTemplate_NoAuth(bool useProgramMain, bool noHttps)
126public Task RazorPagesTemplate_IndividualAuth_LocalDb(bool useProgramMain, bool noHttps) => RazorPagesTemplate_IndividualAuth_Core(useLocalDB: true, useProgramMain, noHttps);
134public Task RazorPagesTemplate_IndividualAuth(bool useProgramMain, bool noHttps) => RazorPagesTemplate_IndividualAuth_Core(useLocalDB: false, useProgramMain, noHttps);
136private async Task RazorPagesTemplate_IndividualAuth_Core(bool useLocalDB, bool useProgramMain, bool noHttps)
269public Task RazorPagesTemplate_IdentityWeb_IndividualB2C_BuildsAndPublishes(string auth, string[] args) => BuildAndPublishRazorPagesTemplateIdentityWeb(auth: auth, args: args);
280public Task RazorPagesTemplate_IdentityWeb_SingleOrg_BuildsAndPublishes(string auth, string[] args) => BuildAndPublishRazorPagesTemplateIdentityWeb(auth: auth, args: args);
287public Task RazorPagesTemplate_IdentityWeb_SingleOrg_CallsGraph_BuildsAndPublishes(string auth, string[] args) => BuildAndPublishRazorPagesTemplateIdentityWeb(auth: auth, args: args);
WebApiTemplateTest.cs (21)
43public Task WebApiTemplateCSharp_IdentityWeb_IndividualB2C_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
51public Task WebApiTemplateCSharp_IdentityWeb_IndividualB2C_NoHttps_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
59public Task WebApiTemplateCSharp_IdentityWeb_IndividualB2C_ProgramMain_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
67public Task WebApiTemplateCSharp_IdentityWeb_IndividualB2C_ProgramMain_NoHttps_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
77public Task WebApiTemplateCSharp_IdentityWeb_SingleOrg_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
87public Task WebApiTemplateCSharp_IdentityWeb_SingleOrg_NoHttps_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
97public Task WebApiTemplateCSharp_IdentityWeb_SingleOrg_ProgramMain_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
108public Task WebApiTemplateCSharp_IdentityWeb_SingleOrg_ProgramMain_NoHttps_BuildsAndPublishes(string auth, string[] args) => PublishAndBuildWebApiTemplate(languageOverride: null, auth: auth, args: args);
111public Task WebApiTemplateFSharp() => WebApiTemplateCore(languageOverride: "F#");
114public Task WebApiTemplateNoHttpsFSharp() => WebApiTemplateCore(languageOverride: "F#", args: new[] { ArgConstants.NoHttps });
118public Task WebApiTemplateCSharp() => WebApiTemplateCore(languageOverride: null);
122public Task WebApiTemplateNoHttpsCSharp() => WebApiTemplateCore(languageOverride: null, new[] { ArgConstants.NoHttps });
126public Task WebApiTemplateProgramMainCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseProgramMain });
130public Task WebApiTemplateProgramMainNoHttpsCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps });
134public Task WebApiTemplateControllersCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseControllers });
138public Task WebApiTemplateControllersNoHttpsCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseControllers, ArgConstants.NoHttps });
142public Task WebApiTemplateProgramMainControllersCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseProgramMain, ArgConstants.UseControllers });
146public Task WebApiTemplateProgramMainControllersNoHttpsCSharp() => WebApiTemplateCore(languageOverride: null, args: new[] { ArgConstants.UseProgramMain, ArgConstants.UseControllers, ArgConstants.NoHttps });
154public async Task WebApiTemplateCSharp_WithoutOpenAPI(bool useProgramMain, bool useControllers)
183public async Task WebApiTemplateCSharpNoHttps_WithoutOpenAPI(bool useProgramMain, bool useControllers)
246private async Task WebApiTemplateCore(string languageOverride, string[] args = null)
Templates.Tests (60)
TestContentPackage (1)
Wasm.Performance.ConsoleHost (10)
Wasm.Performance.Driver (4)
Wasm.Performance.TestApp (1)
WebSocketSample (6)
WebTransportInteractiveSampleApp (3)
WelcomePageSample (1)
WsFedSample (4)
xunit.console (2)
ConsoleRunner.cs (2)
284var tasks = project.Assemblies.Select(assembly => Task.Run(() => ExecuteAssembly(consoleLock, assembly, serialize, needsXml, parallelizeTestCollections, maxThreadCount, diagnosticMessages, noColor, appDomains, failSkips, stopOnFail, project.Filters, internalDiagnosticMessages)));
285var results = Task.WhenAll(tasks).GetAwaiter().GetResult();
Xunit.NetCore.Extensions (4)