7 types derived from Task
System.Private.CoreLib (7)
37 instantiations of Task
Microsoft.Extensions.Hosting.Testing.Tests (2)
Microsoft.TestPlatform.CoreUtilities (1)
System.Linq.Parallel (6)
System.Private.CoreLib (13)
src\runtime\src\coreclr\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncHelpers.CoreCLR.cs (1)
1361Task task = new();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (1)
566return new Task(
System.Threading.Tasks.Dataflow (9)
System.Threading.Tasks.Parallel (3)
testhost (1)
testhost.arm64 (1)
testhost.x86 (1)
31064 references to Task
aspire (575)
Backchannel\AppHostCliBackchannel.cs (21)
17Task RequestStopAsync(CancellationToken cancellationToken);
18Task NotifyAppHostReadyAsync(CancellationToken cancellationToken);
22Task WaitForDisconnectAsync(CancellationToken cancellationToken);
23Task ConnectAsync(string socketPath, int retryCount, CancellationToken cancellationToken);
24Task ConnectAsync(string socketPath, bool autoReconnect, int retryCount, CancellationToken cancellationToken);
27Task CompletePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken);
28Task UpdatePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken);
59public async Task WaitForDisconnectAsync(CancellationToken cancellationToken)
61Task disconnectTask;
70public async Task RequestStopAsync(CancellationToken cancellationToken)
89public async Task NotifyAppHostReadyAsync(CancellationToken cancellationToken)
253private async Task WaitForReconnectionAsync(CancellationToken cancellationToken)
281await Task.Delay(100, cancellationToken).ConfigureAwait(false);
294await Task.Delay(500, cancellationToken).ConfigureAwait(false);
300public Task ConnectAsync(string socketPath, int retryCount, CancellationToken cancellationToken)
303public async Task ConnectAsync(string socketPath, bool autoReconnect, int retryCount, CancellationToken cancellationToken)
406_ = Task.Run(async () =>
444private async Task ReconnectInternalAsync()
470await Task.Delay(500, _cancellationToken).ConfigureAwait(false);
508public async Task CompletePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
523public async Task UpdatePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
Backchannel\ExtensionBackchannel.cs (41)
23Task ConnectAsync(CancellationToken cancellationToken);
24Task DisplayMessageAsync(string emojiName, string message, CancellationToken cancellationToken);
25Task DisplaySuccessAsync(string message, CancellationToken cancellationToken);
26Task DisplaySubtleMessageAsync(string message, CancellationToken cancellationToken);
27Task DisplayErrorAsync(string error, CancellationToken cancellationToken);
28Task DisplayEmptyLineAsync(CancellationToken cancellationToken);
29Task DisplayIncompatibleVersionErrorAsync(string requiredCapability, string appHostHostingSdkVersion, CancellationToken cancellationToken);
30Task DisplayCancellationMessageAsync(CancellationToken cancellationToken);
31Task DisplayLinesAsync(IEnumerable<DisplayLineState> lines, CancellationToken cancellationToken);
32Task DisplayDashboardUrlsAsync(DashboardUrlsState dashboardUrls, CancellationToken cancellationToken);
33Task ShowStatusAsync(string? status, CancellationToken cancellationToken);
40Task OpenEditorAsync(string path, CancellationToken cancellationToken);
41Task LogMessageAsync(LogLevel logLevel, string message, CancellationToken cancellationToken);
44Task LaunchAppHostAsync(string projectFile, List<string> arguments, List<EnvVar> environment, bool debug, CancellationToken cancellationToken);
45Task NotifyAppHostStartupCompletedAsync(CancellationToken cancellationToken);
46Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug, DebugSessionOptions? options, CancellationToken cancellationToken);
47Task DisplayPlainTextAsync(string text, CancellationToken cancellationToken);
48Task WriteDebugSessionMessageAsync(string message, bool stdout, string? textStyle, CancellationToken cancellationToken);
64private readonly Func<CancellationToken, Task>? _connectCoreAsyncOverride;
75Func<CancellationToken, Task>? connectCoreAsyncOverride)
99public async Task ConnectAsync(CancellationToken cancellationToken)
173await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
229async Task ConnectCoreAsync()
339public async Task DisplayMessageAsync(string emojiName, string message, CancellationToken cancellationToken)
355public async Task DisplaySuccessAsync(string message, CancellationToken cancellationToken)
371public async Task DisplaySubtleMessageAsync(string message, CancellationToken cancellationToken)
387public async Task DisplayErrorAsync(string error, CancellationToken cancellationToken)
403public async Task DisplayEmptyLineAsync(CancellationToken cancellationToken)
419public async Task DisplayIncompatibleVersionErrorAsync(string requiredCapability, string appHostHostingSdkVersion, CancellationToken cancellationToken)
436public async Task DisplayCancellationMessageAsync(CancellationToken cancellationToken)
452public async Task DisplayLinesAsync(IEnumerable<DisplayLineState> lines, CancellationToken cancellationToken)
468public async Task DisplayDashboardUrlsAsync(DashboardUrlsState dashboardUrls, CancellationToken cancellationToken)
484public async Task ShowStatusAsync(string? status, CancellationToken cancellationToken)
654public async Task OpenEditorAsync(string path, CancellationToken cancellationToken)
670public async Task LogMessageAsync(LogLevel logLevel, string message, CancellationToken cancellationToken)
689public async Task DisplayPlainTextAsync(string text, CancellationToken cancellationToken)
705public async Task WriteDebugSessionMessageAsync(string message, bool stdout, string? textStyle, CancellationToken cancellationToken)
745public async Task LaunchAppHostAsync(string projectFile, List<string> arguments, List<EnvVar> environment, bool debug, CancellationToken cancellationToken)
761public async Task NotifyAppHostStartupCompletedAsync(CancellationToken cancellationToken)
777public async Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug,
795public async Task StopDebuggingAsync()
Commands\AppHostLauncher.cs (27)
285private async Task StopLaunchedAppHostAsync(LaunchResult result, TimeSpan delay, CancellationToken cancellationToken)
289await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
356private async Task StopExistingInstancesAsync(FileInfo effectiveAppHostFile, CancellationToken cancellationToken)
370await Task.WhenAll(stopTasks).ConfigureAwait(false);
585var timeoutTask = Task.Delay(remainingTimeout, timeProvider, cancellationToken);
587var completedTask = await Task.WhenAny(readinessTask, childExitTask, timeoutTask).ConfigureAwait(false);
645var waitTask = Task.Delay(TimeSpan.FromMilliseconds(500), timeProvider, cancellationToken);
646var completedWaitTask = await Task.WhenAny(childExitTask, waitTask).ConfigureAwait(false);
684private Task RequestGracefulShutdownThenForceKillAsync(IProcessExecution childProcess, DateTimeOffset? childStartedAt)
719Task childExitTask,
738var completedTask = await Task.WhenAny(
740Task.Delay(stabilityWindow, timeProvider, cancellationToken)).ConfigureAwait(false);
748Task childExitTask,
758var timeoutTask = Task.Delay(stabilityWindow, timeProvider, cancellationToken);
769probeTask = Task.FromException<List<ResourceSnapshot>>(ex);
772var completedTask = await Task.WhenAny(probeTask, childExitTask, timeoutTask).ConfigureAwait(false);
800var delayTask = Task.Delay(s_legacyDetachedStartupProbeInterval, timeProvider, cancellationToken);
801completedTask = await Task.WhenAny(delayTask, childExitTask, timeoutTask).ConfigureAwait(false);
817private static void ObserveFaults(Task task)
Commands\RenderCommand.cs (11)
265await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
280await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
295await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
338private async Task TestMixedMethodsAsync(CancellationToken cancellationToken)
356await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
412var loggingTask = Task.Run(async () =>
419await Task.Delay(200, cts.Token).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
423await Task.Delay(500, cancellationToken); // Let a few logs accumulate before starting the prompt
595await Task.CompletedTask; // Async iterator
823protected override Task<string[]> GetRunArgumentsAsync(string? fullyQualifiedOutputPath, string[] unmatchedTokens, string? targetStep, ParseResult parseResult, CancellationToken cancellationToken) => Task.FromResult(Array.Empty<string>());
Commands\RunCommand.cs (18)
407var pendingLogCapture = Task.CompletedTask;
556pendingLogCapture = Task.CompletedTask;
724var completedTask = await Task.WhenAny(
726Task.Delay(s_startupFailureObservationWindow, cancellationToken)).ConfigureAwait(false);
765private static void ObserveFaults(Task task)
804if (await Task.WhenAny(happyPathTask, pendingRun).ConfigureAwait(false) == pendingRun)
901var pendingLogCapture = CaptureAppHostLogsAsync(_fileLoggerProvider, backchannel, InteractionService, logCaptureCancellationSource.Token);
936Task PendingLogCapture);
987var delayTask = Task.Delay(delay, cancellationToken);
988var completedTask = await Task.WhenAny(delayTask, pendingRun).ConfigureAwait(false);
1111internal static async Task CaptureAppHostLogsAsync(FileLoggerProvider fileLoggerProvider, IAppHostCliBackchannel backchannel, IInteractionService interactionService, CancellationToken cancellationToken)
1115await Task.Yield();
1253private async Task CancelAppHostStartupAsync(CancellationTokenSource runCancellationTokenSource, Task<int> pendingRun, CancellationToken cancellationToken)
1278private async Task ObserveAppHostRunFailureAsync(Task<int> pendingRun)
Documentation\ApiDocs\ApiDocsCache.cs (8)
50public Task SetAsync(string key, string content, CancellationToken cancellationToken = default)
68public Task SetETagAsync(string url, string? etag, CancellationToken cancellationToken = default)
76public Task InvalidateAsync(string key, CancellationToken cancellationToken = default)
92public Task SetIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
108public Task SetIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
124public Task SetMemberIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
140public Task SetMemberIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
164public Task SetIndexedMemberContainerIdsAsync(string[] containerIds, CancellationToken cancellationToken = default)
Interaction\ExtensionInteractionService.cs (14)
18Task FlushAsync(CancellationToken cancellationToken = default);
21Task LaunchAppHostAsync(string projectFile, List<string> arguments, List<EnvVar> environment, bool debug);
25Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug, DebugSessionOptions? options = null);
36private readonly Channel<Func<Task>> _extensionTaskChannel;
43internal Task PumpTask { get; }
54_extensionTaskChannel = Channel.CreateUnbounded<Func<Task>>(new UnboundedChannelOptions
62PumpTask = Task.Run(ProcessExtensionTaskChannelAsync, CancellationToken.None);
65public async Task FlushAsync(CancellationToken cancellationToken = default)
74return Task.CompletedTask;
527public Task DisplayLiveAsync(IRenderable initialRenderable, Func<Action<IRenderable>, Task> callback)
538public Task LaunchAppHostAsync(string projectFile, List<string> arguments, List<EnvVar> environment, bool debug)
559public Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug, DebugSessionOptions? options = null)
570private async Task ProcessExtensionTaskChannelAsync()
Packaging\NuGetConfigMerger.cs (6)
33public static async Task CreateOrUpdateAsync(DirectoryInfo targetDirectory, PackageChannel channel, Func<FileInfo, XmlDocument?, XmlDocument, CancellationToken, Task<bool>>? confirmationCallback = null, CancellationToken cancellationToken = default)
51public static async Task CreateOrUpdateAsync(
81private static async Task CreateNewNuGetConfigAsync(DirectoryInfo targetDirectory, PackageMapping[] mappings, bool configureGlobalPackagesFolder, Func<FileInfo, XmlDocument?, XmlDocument, CancellationToken, Task<bool>>? confirmationCallback, CancellationToken cancellationToken)
115private static async Task UpdateExistingNuGetConfigAsync(FileInfo nugetConfigFile, PackageMapping[] mappings, bool configureGlobalPackagesFolder, Func<FileInfo, XmlDocument?, XmlDocument, CancellationToken, Task<bool>>? confirmationCallback, CancellationToken cancellationToken)
799private static async Task SaveConfigAsync(FileInfo nugetConfigFile, XDocument document)
942private static async Task AddGlobalPackagesFolderToConfigAsync(FileInfo configFile)
Projects\ProjectUpdater.cs (22)
282return Task.CompletedTask;
290return Task.CompletedTask;
362private Task AnalyzeAppHostAsync(UpdateContext context, CancellationToken cancellationToken)
370return Task.CompletedTask;
401private async Task AnalyzeAppHostSdkAsync(UpdateContext context, CancellationToken cancellationToken)
538private static async Task RemoveLegacyAppHostPackageReferencesAsync(
569await Task.CompletedTask;
658internal static async Task UpdateSdkVersionInAppHostAsync(FileInfo projectFile, NuGetPackageCli package, IInteractionService interactionService, SdkMigrationInfo migrationInfo)
688internal static async Task UpdateSdkVersionInProjectAppHostAsync(FileInfo projectFile, NuGetPackageCli package)
748await Task.CompletedTask;
868private static async Task UpdateSdkVersionInSingleFileAppHostAsync(FileInfo projectFile, NuGetPackageCli package)
920private static async Task RemoveLegacyAppHostPackageDirectiveAsync(FileInfo projectFile)
931private async Task AnalyzeProjectAsync(FileInfo projectFile, UpdateContext context, CancellationToken cancellationToken)
1043private async Task AnalyzePackageForTraditionalManagementAsync(string packageId, string packageVersion, FileInfo projectFile, UpdateContext context, CancellationToken cancellationToken)
1071private async Task AnalyzePackageForCentralPackageManagementAsync(string packageId, FileInfo projectFile, FileInfo directoryPackagesPropsFile, UpdateContext context, CancellationToken cancellationToken)
1207private static async Task UpdatePackageVersionInDirectoryPackagesProps(string packageId, string newVersion, FileInfo directoryPackagesPropsFile)
1221await Task.CompletedTask;
1224private async Task UpdatePackageReferenceInProject(FileInfo projectFile, NuGetPackageCli package, CancellationToken cancellationToken)
1490internal abstract record UpdateStep(string Description, Func<Task> Callback)
1503Func<Task> Callback,
1521Func<Task> Callback,
1550internal record AnalyzeStep(string Description, Func<Task> Callback);
Templating\DotNetTemplateFactory.cs (5)
287private async Task PromptForDevLocalhostTldOptionAsync(ParseResult result, List<string> extraArgs, CancellationToken cancellationToken)
303private async Task PromptForRedisCacheOptionAsync(ParseResult result, List<string> extraArgs, CancellationToken cancellationToken)
319private async Task PromptForTestFrameworkOptionsAsync(ParseResult result, List<string> extraArgs, CancellationToken cancellationToken)
363private async Task PromptForXUnitVersionOptionsAsync(ParseResult result, List<string> extraArgs, CancellationToken cancellationToken)
409return await ApplyTemplateAsync(template, inputs, parseResult, (_, _) => Task.FromResult(Array.Empty<string>()), cancellationToken);
aspire-managed (17)
Aspire.Acquisition.Tests (312)
Aspire.Azure.AI.OpenAI.Tests (4)
Aspire.Azure.Messaging.EventHubs.Tests (2)
Aspire.Azure.Messaging.WebPubSub.Tests (1)
Aspire.Azure.Search.Documents.Tests (1)
Aspire.Azure.Security.KeyVault.Tests (2)
Aspire.Cli.EndToEnd.Tests (264)
Aspire.Cli.Tests (3921)
Commands\AddCommandTests.cs (157)
24public async Task AddCommandWithHelpArgumentReturnsZero()
38public async Task IntegrationAddCommandWithHelpArgumentReturnsZero()
52public async Task IntegrationSearchCommandWithJsonOptionDoesNotEmitDiscoveryJson()
83public async Task IntegrationSearchCommandRequiresQuery()
114public async Task IntegrationListCommandFormatJsonReturnsAvailableIntegrationsWithoutPromptingOrAddingPackage()
136return Task.FromResult(new AppHostProjectSearchResult(null, []));
201public async Task IntegrationDiscoveryCommandFormatJsonReturnsEmptyArrayWhenNoIntegrationsAreAvailable(string commandLine)
233public async Task IntegrationDiscoveryCommandReturnsSearchFailureExitCodeWhenPackageDiscoveryFails()
257public async Task IntegrationSearchCommandFormatJsonFiltersAvailableIntegrationsWithoutAddingPackage()
314public async Task IntegrationSearchCommandFormatJsonUsesFuzzyIntegrationMatching()
358public async Task IntegrationSearchCommandFormatJsonWithTypeScriptAppHostPinnedToChannelAlsoSearchesImplicitChannel()
405return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")]);
413return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")]);
422GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
428services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
449public async Task IntegrationSearchCommandFormatJsonWithTypeScriptAppHostPinnedToStagingChannelAlsoSearchesImplicitChannel()
476return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")]);
484return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")]);
494GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
500services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
519public async Task IntegrationSearchCommandFormatJsonWithTypeScriptAppHostPinnedToStableChannelStillSurfacesPrereleaseOnlyPackages()
557return Task.FromResult<IEnumerable<NuGetPackage>>(
571return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")]);
581GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
587services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
616public async Task IntegrationSearchCommandTypeScriptAppHostPersistedChannelExpandsDiscoveryWithoutChangingPreferredResult(string? configFileChannelJson, bool expectExplicitChannelHit)
659return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")]);
667return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")]);
676GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
682services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
715public async Task IntegrationSearchCommandFormatJsonWithAppHostOutsideLaunchDirectoryUsesConfiguredStagingChannelWithRealPackagingService()
735GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")])
744services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
760public async Task IntegrationSearchCommandFormatJsonWithUnpinnedAppHostUsesImplicitChannelUnderStagingCli()
774GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")])
778GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")])
787GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
793services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
809public async Task IntegrationSearchCommandStagingStampedCliWithPinnedStagingApphostQueriesBothImplicitAndStagingChannelsAndSurfacesPrereleaseOnlyPackages()
860return Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Foundry", "13.4.0-rc.1")]);
862return Task.FromResult<IEnumerable<NuGetPackage>>([]);
876services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
903public async Task IntegrationListCommandFormatJsonPrefersImplicitChannelWhenMultipleChannelsContainSameIntegration()
916GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "1.0.0")])
920GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Redis", "2.0.0")])
929GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
950public async Task IntegrationSearchCommandFormatJsonReturnsEmptyArrayWhenNoIntegrationsMatch()
1003public async Task AddCommandInteractiveFlowSmokeTest()
1068public async Task AddCommandDoesNotPromptForIntegrationArgumentIfSpecifiedOnCommandLine()
1144public async Task AddCommandDoesNotPromptForVersionIfSpecifiedOnCommandLine()
1228public async Task AddCommandInteractiveDoesNotPromptForVersionIfSpecifiedOnCommandLine()
1308public async Task AddCommandDoesNotPromptForVersionWhenSpecifiedVersionIsFoundViaExactMatchSearch()
1386public async Task AddCommandInteractiveDoesNotPromptForVersionWhenSpecifiedVersionIsFoundViaExactMatchSearch()
1474public async Task AddCommandInteractiveDoesNotPromptForIntegrationWhenExactMatchIsFound(string integrationName)
1542public async Task AddCommandSearchesEachPackageIdOnceWhenExactMatchFallsBackAcrossSharedChannel()
1615public async Task AddCommandWithoutIntegrationNameDoesNotPromptForVersionWhenSpecifiedVersionIsFoundViaExactMatchSearch()
1689public async Task AddCommandShowsStatusWhenSearchingForSpecifiedVersionAfterPackageSelection()
1760public async Task AddCommandFailsWhenSpecifiedVersionDoesNotExist()
1831public async Task AddCommandInteractiveFailsWhenSpecifiedVersionDoesNotExist()
1909public async Task AddCommandPromptsForDisambiguation()
1995public async Task AddCommandPreservesSourceArgumentInBothCommands()
2061public async Task AddCommand_EmptyPackageList_DisplaysErrorMessage()
2094public async Task AddCommand_NoMatchingPackages_DisplaysNoMatchesMessage()
2190public async Task AddCommandPrompter_FiltersToHighestVersionPerPackageId()
2238public async Task AddCommandPrompter_FiltersToHighestVersionPerChannel()
2286public async Task AddCommandPrompter_ShowsHighestVersionPerChannelWhenMultipleChannels()
2338public async Task AddCommandPrompter_ShowsConfiguredChannelAsFirstChoiceWhenChannelPinned()
2392public async Task AddCommandPrompter_StagingChannelPreservesAllChannelChoices()
2436public async Task AddCommandPrompter_StagingChannelSelectsHighestVersionAcrossPackageQualities(
2445Task.FromResult<IEnumerable<NuGetPackage>>(
2477public async Task AddCommandNonInteractiveSelectsExpectedVersionAcrossLanguageAndChannelMatrix(
2520return Task.FromResult(true);
2555GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
2580public async Task AddCommandNonInteractiveTypeScriptAppHostPinnedToDailyPrefersDailyChannelOverImplicitStable()
2609GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Azure.Storage", "13.4.3")])
2613GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([CreatePackage("Aspire.Hosting.Azure.Storage", "13.5.0-preview.1")])
2616var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
2621return Task.FromResult(true);
2630GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
2651public async Task AddCommand_WithoutHives_UsesImplicitChannelWithoutPrompting()
2709public async Task AddCommand_WithHives_PrefersImplicitChannelVersionInNonInteractiveMode()
2776public async Task AddCommand_WithPrHive_PrefersCurrentCliVersion()
2801public async Task AddCommand_WithLocalHive_PrefersCurrentCliVersion()
2826public async Task AddCommand_WithLocalAndPrHives_PrefersHiveMatchingCurrentCliVersion()
2868public async Task AddCommand_WithIdentityPackagesOverrideEmulatingStable_PrefersCurrentCliVersion()
3002public async Task AddCommandPolyglotAppHostRejectsNamedNonPolyglotIntegration()
3015GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3017GetPackagesAsyncCallback = (_, query, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3021var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
3025return Task.FromResult(true);
3036GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3054public async Task AddCommandPolyglotAppHostAddsPolyglotIntegration()
3065GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3067GetPackagesAsyncCallback = (_, query, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3071var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
3075return Task.FromResult(true);
3086GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3104public async Task AddCommandPolyglotAppHostWithAllOptionAddsNonPolyglotIntegration()
3115GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3121var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
3125return Task.FromResult(true);
3136GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3154public async Task IntegrationListPolyglotAppHostListsOnlyPolyglotIntegrations()
3169GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3171GetPackagesAsyncCallback = (_, query, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3182GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3187services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
3201public async Task IntegrationListPolyglotAppHostShowsHiddenIntegrationCountMessage()
3217GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3219GetPackagesAsyncCallback = (_, query, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3230GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3235services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
3248public async Task IntegrationListPolyglotAppHostWithNoCompatibleIntegrationsShowsAllHint()
3265GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3267GetPackagesAsyncCallback = (_, _, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([])
3277GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3282services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
3296public async Task IntegrationSearchPolyglotAppHostWithSearchTermMismatchReportsSearchTermError()
3313GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3315GetPackagesAsyncCallback = (_, query, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3326GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3331services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
3346public async Task AddCommandPolyglotAppHostWithFilterDisabledOffersAllIntegrations()
3365GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3368GetPackagesAsyncCallback = (_, _, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([])
3371var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
3375return Task.FromResult(true);
3384GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3404public async Task AddCommandPolyglotAppHostWithFilterDisabledDoesNotIssuePolyglotTagSearch()
3416GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3425return Task.FromResult<IEnumerable<NuGetPackage>>([]);
3429var tsFactory = new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true));
3430tsFactory.Project.AddPackageAsyncCallback = (_, _) => Task.FromResult(true);
3438GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3456public async Task IntegrationListPolyglotAppHostWithFilterDisabledListsAllIntegrations()
3474GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>(
3476GetPackagesAsyncCallback = (_, _, _, _, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([])
3484GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([
3489services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
3523Task.FromResult<IEnumerable<NuGetPackage>>(prerelease || !isPrerelease ? [package] : [])
3566{ } callback => Task.FromResult(callback(packages)),
3567_ => Task.FromResult(packages.First()) // If no callback is provided just accept the first package.
3575{ } callback => Task.FromResult(callback(packages)),
3576_ => Task.FromResult(packages.First()) // If no callback is provided just accept the first package.
3584public async Task AddCommand_WithStartsWith_FindsMatchUsingFuzzySearch()
3668public async Task AddCommand_NonInteractive_NoExactMatchWithoutVersion_FailsInsteadOfFuzzyAutoPick_Regression17724()
3736public async Task AddCommand_NonInteractive_ExactMatchWithoutVersion_StillSucceeds()
3788public async Task AddCommand_Interactive_SingleFuzzyMatchPromptsBeforeAdding_Regression17724()
3847public async Task AddCommand_Interactive_NoFuzzyMatchSinglePackagePromptsBeforeAdding()
3913public async Task AddCommand_WithVersionAndNonExactPackageName_FailsInsteadOfUsingFuzzySearch()
3965public async Task AddCommand_WithVersionAndNoMatchingPackageName_FailsInNonInteractiveMode()
4017public async Task AddCommand_WithPartialMatch_FiltersUsingFuzzySearch()
4103public async Task AddCommand_WithVersionAndNonExactPackageName_Interactive_UsesFuzzySearch()
4186public async Task AddCommand_WithVersionAndNonExactPackageName_Interactive_FailsWhenSelectedPackageDoesNotContainVersion()
4269public async Task AddCommand_WithVersionAndNoMatches_Interactive_PromptsAllPackagesAndPreservesVersion()
4358public async Task AddCommand_WithVersionAndNoMatches_Interactive_FailsWhenSelectedPackageDoesNotContainVersion()
4445public async Task AddCommand_WithTypo_FindsMatchUsingFuzzySearch()
Commands\AppHostLauncherTests.cs (47)
124public async Task WaitForAppHostReadyAsync_ReturnsNullWhenReadinessIsUnavailable()
134public async Task WaitForAppHostReadyAsync_PropagatesReadinessFailures()
147public async Task WaitForLegacyDetachedStartupStabilityAsync_ReturnsFalseWhenChildExitsDuringStabilityWindow()
151Task.CompletedTask,
160public async Task WaitForLegacyDetachedStartupStabilityAsync_ReturnsTrueWhenChildStaysAliveForStabilityWindow()
162var childExitTask = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously).Task;
175public async Task LaunchDetachedAsync_WaitsForReadinessRpcBeforeReportingSuccess()
201Assert.NotSame(launchTask, await Task.WhenAny(launchTask, Task.Delay(TimeSpan.FromMilliseconds(100))).DefaultTimeout());
221public async Task LaunchDetachedAsync_PropagatesPersistentSelectionOriginToChild(
232WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
257public async Task LaunchDetachedAsync_ExplicitFalseFromLinkedWorktree_ForwardsFalse()
265WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
286public async Task LaunchDetachedAsync_OmittedFromLinkedWorktree_DoesNotInferIsolation()
294WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
315public async Task LaunchDetachedAsync_ExplicitTrue_ForwardsFlag()
322WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
343public async Task LaunchDetachedAsync_OmittedFromPrimaryCheckout_DoesNotForwardOption()
350WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
371public async Task LaunchDetachedAsync_DeletesDeadPidSocketBeforeStartingChildProcess()
379WaitForAppHostReadyHandler = _ => Task.FromResult<WaitForAppHostReadyResponse?>(new WaitForAppHostReadyResponse { IsReady = true })
401public async Task LaunchDetachedAsync_ReportsFailureWhenReadinessWaitIsInterruptedByChildExit()
410await Task.Delay(Timeout.InfiniteTimeSpan, ct);
442public async Task LaunchDetachedAsync_UpdatesStatusAndWaitsForChildExitWhenReadinessRpcFails()
479Assert.NotSame(launchTask, await Task.WhenAny(launchTask, Task.Delay(TimeSpan.FromMilliseconds(100))).DefaultTimeout());
493public async Task WaitForLegacyDetachedStartupStabilityAsync_UsesV2ResourceSnapshotProbeWhenAvailable()
496var childExitTask = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously).Task;
503return Task.FromResult<List<ResourceSnapshot>>([]);
519public async Task WaitForLegacyDetachedStartupStabilityAsync_RetriesV2ProbeUntilChildExits()
551public async Task LaunchDetachedAsync_ReportsSuccessWhenLegacyV2ProbeSucceeds()
563return Task.FromResult<List<ResourceSnapshot>>([]);
588public async Task LaunchDetachedAsync_ReportsFailureWhenLegacyV2ProbeDoesNotSucceedBeforeChildExit()
626public async Task LaunchDetachedAsync_ReportsForkProcessExitCodeWhenChildExitsBeforeMonitorAndStartTimeIsUnavailable()
702public async Task LaunchDetachedAsync_ForwardsCancellationTokenToDetachedLauncher()
741public async Task LaunchDetachedAsync_DisposesExecutionWhenDetachedStartFails()
768public async Task LaunchDetachedAsync_CleansUpChildProcessWhenCancelledAfterStart()
808public async Task LaunchDetachedAsync_UsesSingleUncancelledChildExitObservationWhileWaitingForBackchannel()
813harness.ProcessFactory.StartHandler = (_, _, _, _, _, _) => Task.FromResult<IProcessExecution>(execution);
958public async Task ReadChildLogTail_ReturnsBoundedRelevantNonEmptyTail()
986public async Task ReadChildLogTail_IncludesBuildOutput()
1009public async Task ReadChildLogReplayTail_ReturnsRicherBoundedRelevantTail()
1071public async Task ReadChildLogReplayTail_IncludesBuildOutput()
1192Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile])
1351return Task.FromResult<IProcessExecution>(new MonitoredProcessExecutionAdapter(StartedProcess));
1493return Task.FromResult(true);
1559return Task.FromResult(true);
Commands\DashboardRunCommandTests.cs (18)
26public async Task DashboardRunCommand_BundleNotAvailable_DisplaysError()
49public async Task DashboardRunCommand_Help_ReturnsSuccess()
131public async Task DashboardRunCommand_DefaultOptions_DoesNotEmitAllowAnonymous()
151public async Task DashboardRunCommand_BundleAvailableWithinDelay_DoesNotDisplayBundleStatus()
169public async Task DashboardRunCommand_BundleUnavailableAfterDelay_DisplaysBundleStatus()
207public async Task DashboardRunCommand_DefaultOptions_PassesDefaultArgsToProcess()
237public async Task DashboardRunCommand_IndividualOption_PassesCorrectArgToProcess(string cliArgs, string expectedArg)
257public async Task DashboardRunCommand_WithoutAllowAnonymous_SetsBrowserTokenEnvVar()
281public async Task DashboardRunCommand_UnmatchedTokens_ForwardedToProcess()
307public async Task DashboardRunCommand_CombinedOptions_PassesAllArgsToProcess()
334public async Task DashboardRunCommand_ProcessExitsWithError_ReturnsFailure()
352public async Task DashboardRunCommand_ProcessFailsToStart_DisplaysErrorAndReturnsFailure()
367(_, _, _) => Task.FromResult((0, (string?)null)),
388public async Task DashboardRunCommand_WhenCancelled_DisplaysCancellationMessageAndReturnsSuccess(bool slowShutdown)
406new TestProcessExecution("fake", [], null, options, (_, _, _) => Task.FromResult((0, (string?)null)), () => 0)
414await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken).ConfigureAwait(false);
444var firstCompletedTask = await Task.WhenAny(stoppingMessageDisplayedTcs.Task, pendingRun).DefaultTimeout();
Commands\DoctorCommandTests.cs (41)
22public async Task DoctorCommand_Help_Works()
38public async Task DoctorCommand_Json_IncludesCliVersionStatus()
46GetVersionStatusAsyncCallback = (_, _) => Task.FromResult(new CliVersionStatus("13.0.0", "13.1.0", "aspire update"))
62public async Task DoctorCommand_Json_IncludesOperatingSystemStatus()
83public async Task DoctorCommand_Json_OnLinux_UsesOsReleaseValues()
118public async Task DoctorCommand_Json_VersionUpdateBanner_IsSuppressed()
163public async Task DoctorCommand_Json_IncludesAppHostVersionWhenAppHostExists()
175GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.0.0")
190public async Task DoctorCommand_Json_IncludesTypeScriptAppHostVersionFromAspireConfig()
214GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.1.0")
239public async Task DoctorCommand_Json_DoesNotDiscoverNestedAppHostWithoutConfig()
255return Task.FromResult<string?>("unexpected");
266public async Task DoctorCommand_Json_DoesNotShowAppHostVersionForNonAppHostProject()
283return Task.FromResult<string?>("unexpected");
294public async Task DoctorCommand_Json_DoesNotDiscoverNestedAppHostWhenAnotherProjectExists()
311GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.2.0")
320public async Task DoctorCommand_Json_DoesNotChooseBetweenMultipleDirectAppHostsWithoutConfig()
336return Task.FromResult<string?>("unexpected");
347public async Task DoctorCommand_Json_PreservesCliVersionWhenAppHostVersionResolutionFails()
378public async Task DoctorCommand_Json_PreservesCliVersionWhenAppHostDiscoveryFails()
401public async Task DoctorCommand_Json_UsesConfiguredAppHostBeyondLanguageDetectionLimit()
422GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.2.0")
439public async Task DoctorCommand_Json_CliVersion_IncludesIdentityChannelFromReader()
450GetVersionStatusAsyncCallback = (_, _) => Task.FromResult(new CliVersionStatus("13.0.0", LatestVersion: null, UpdateCommand: null))
466public async Task DoctorCommand_Json_CliVersion_OmitsIdentityChannelWhenReaderThrows()
474GetVersionStatusAsyncCallback = (_, _) => Task.FromResult(new CliVersionStatus("13.0.0", LatestVersion: null, UpdateCommand: null))
492public async Task DoctorCommand_Json_AppHostVersion_IncludesPinnedChannelFromAspireConfig()
511GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.0.0")
522public async Task DoctorCommand_Json_AppHostVersion_IncludesPinnedChannelFromAspireConfigWhenAppHostIsNested()
545GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.0.0")
557public async Task DoctorCommand_Json_AppHostVersion_OmitsPinnedChannelWhenAspireConfigAbsent()
570GetAspireHostingVersionAsyncCallback = (_, _) => Task.FromResult<string?>("13.0.0")
581public async Task DoctorCommand_Json_CliVersion_IncludesLatestVersionChannel_WhenUpdateAvailable()
593GetVersionStatusAsyncCallback = (_, _) => Task.FromResult(new CliVersionStatus(
626public async Task DoctorCommand_Json_IncludesDiscoveredInstallations()
677public async Task DoctorCommand_HumanReadable_Self_RendersOnlyRunningInstallationAndSkipsChecks()
746public async Task DoctorCommand_HumanReadable_AppendsInstallationsAfterSummary()
809public async Task DoctorCommand_HumanReadable_EscapesUnknownPathStatus()
870public async Task DoctorCommand_Json_Self_ReturnsOnlyRunningInstallation()
904public async Task DoctorCommand_Json_WhenInstallDiscoveryFails_StillReturnsDoctorResults()
931public async Task DoctorCommand_HumanReadable_RendersMissingInstallationValuesBasedOnStatus(string status, string expectedPlaceholder)
Commands\NewCommandTests.cs (131)
32public async Task NewCommandWithHelpArgumentReturnsZero()
103public async Task NewCommand_CSharpEmptyTemplateUnderStagingIdentity_WritesStagingConfiguration()
123Task.FromResult<IEnumerable<NuGetPackage>>(
163public async Task NewCommandInteractiveFlowSmokeTest()
180public async Task NewCommandForwardsLocalizedTestFrameworkSelection(string testFramework, string? expectedTestFramework)
220public async Task NewCommandDerivesProjectNameFromTemplateNameForStarterTemplate()
259public async Task NewCommandDoesNotPromptForProjectNameIfSpecifiedOnCommandLine()
291public async Task NewCommandDoesNotPromptForOutputPathIfSpecifiedOnCommandLine()
323public async Task NewCommandWithChannelOptionUsesSpecifiedChannel()
356return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
364return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
370return Task.FromResult<IEnumerable<PackageChannel>>([stableChannel, dailyChannel]);
404public async Task NewCommandWithChannelOptionAutoSelectsHighestVersion()
442return Task.FromResult<IEnumerable<NuGetPackage>>(packages);
446return Task.FromResult<IEnumerable<PackageChannel>>([stableChannel]);
481public async Task NewCommandWithPrChannelPrefersCurrentCliVersion()
519return Task.FromResult<IEnumerable<NuGetPackage>>(packages);
523return Task.FromResult<IEnumerable<PackageChannel>>([prChannel]);
562public async Task NewCommandDoesNotPromptForTemplateIfSpecifiedOnCommandLine()
594public async Task NewCommandDoesNotPromptForTemplateVersionIfSpecifiedOnCommandLine()
626public async Task NewCommand_EmptyPackageList_DisplaysErrorMessage()
660public async Task NewCommand_WhenCertificateServiceThrows_ReturnsNonZeroExitCode()
699public async Task NewCommandWithExitCode73ShowsUserFriendlyError()
806public async Task NewCommandPromptsForTemplateVersionBeforeTemplateOptions()
871public async Task NewCommandEscapesMarkupInProjectNameAndOutputPath()
925public async Task NewCommandWithoutTemplateCanCreateTypeScriptEmptyTemplate()
967return Task.FromResult(true);
1006public async Task NewCommandWithoutTemplatePromptsWithSingleGenericEmptyTemplate()
1052public async Task NewCommandWithEmptyTemplateOmitsDisabledLanguagesFromLanguagePrompt()
1092public async Task NewCommandWithEmptyTemplatePromptsForEnabledLanguages()
1133return Task.FromResult(true);
1154public async Task NewCommandWithEmptyTemplateIgnoresConfiguredLanguage()
1196return Task.FromResult(true);
1211public async Task NewCommandWithExplicitLanguageAfterEmptyTemplateSubcommandCreatesTypeScriptAppHost()
1224return Task.FromResult(true);
1239public async Task NewCommandWithCSharpEmptyTemplateAndSourceOverrideUsesSourceForTemplateDiscovery()
1269return Task.FromResult<IEnumerable<NuGetPackage>>(
1287GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([channel])
1304public async Task NewCommandWithCSharpEmptyTemplateAndRelativeLocalSourceOverrideDiscoversTemplatesFromResolvedDirectory()
1332GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([channel])
1352public async Task NewCommandWithEmptyTemplateAndSourceOverridePersistsSourceForLaterRestore(string language, string? featureFlag, string scaffoldFileName)
1381return Task.FromResult(true);
1400public async Task NewCommandWithCSharpEmptyTemplateAndSourceOverridePersistsSourceForLaterRestore()
1423public async Task NewCommandWithCredentialBearingHttpSourceFailsBeforeCreatingProject(string sourceOverride)
1439return Task.FromResult(true);
1457public async Task NewCommandWithMissingLocalSourceFailsBeforeCreatingProject()
1473return Task.FromResult(true);
1492public async Task NewCommandWithEmptyTemplateWithoutSourceOverrideDoesNotWarn()
1507return Task.FromResult(true);
1524public async Task NewCommandWithExplicitJavaEmptyTemplateCreatesJavaAppHost()
1546return Task.FromResult(true);
1561public async Task NewCommandWithExplicitPythonEmptyTemplateCreatesPythonAppHost()
1582return Task.FromResult(true);
1597public async Task NewCommandWithExplicitCSharpEmptyTemplateCreatesCSharpAppHost()
1613public async Task NewCommandWaitsForBundleExtractionAfterCreatingAppHost()
1651public async Task NewCommandWithCSharpEmptyTemplateEmitsAppHostRunJsonAndAspireConfigJsonWithoutDuplicateProfiles()
1685public async Task NewCommandWithCSharpEmptyTemplateAndLocalhostTldEmitsAppHostRunJsonWithDevLocalhostUrls()
1731public async Task NewCommandWithEmptyTemplateAndCSharpPromptsForLocalhostTldAndUsesConfirmation()
1790public async Task NewCommandWithTypeScriptEmptyTemplateUsesScaffolding()
1802return Task.FromResult(true);
1816public async Task NewCommandWithTypeScriptEmptyTemplatePassesResolvedVersionAndChannelToScaffolding()
1833return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
1837return Task.FromResult<IEnumerable<PackageChannel>>([stableChannel]);
1850return Task.FromResult(true);
1865public async Task NewCommandWithEmptyTemplateNormalizesDefaultOutputPath()
1890return Task.FromResult(true);
1912public async Task NewCommandWithEmptyTemplateAndTypeScriptPromptsForLocalhostTldAndUsesConfirmation()
1989public async Task NewCommandWithTypeScriptStarterGeneratesSdkArtifacts()
2029return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
2034return Task.FromResult<IEnumerable<PackageChannel>>([dailyChannel]);
2049return Task.FromResult(true);
2066public async Task NewCommandWithTypeScriptStarterReturnsFailedToBuildArtifactsWhenSdkGenerationFails()
2104return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
2109return Task.FromResult<IEnumerable<PackageChannel>>([dailyChannel]);
2115services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((directory, cancellationToken, _) => Task.FromResult(false)));
2129public async Task NewCommandWithTypeScriptStarterAndSourceOverridePersistsSourceAndPlumbsOverride()
2159return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
2163return Task.FromResult<IEnumerable<PackageChannel>>([dailyChannel]);
2172return Task.FromResult(true);
2192public async Task NewCommandWithDotNetTemplateAndSourceOverridePersistsSourceForLaterRestore()
2236public async Task NewCommandWithTypeScriptStarterAndFailedRestoreDoesNotWarnAboutSourceOverride()
2270return Task.FromResult<IEnumerable<NuGetPackage>>([package]);
2274return Task.FromResult<IEnumerable<PackageChannel>>([dailyChannel]);
2279services.AddSingleton<IAppHostProjectFactory>(new TestTypeScriptStarterProjectFactory((directory, cancellationToken, _) => Task.FromResult(false)));
2295public async Task NewCommandNonInteractiveDoesNotPrompt()
2322public async Task NewCommandNonInteractive_WithSkillLocationsNone_DoesNotInstallAgentSkills()
2347public async Task NewCommandNonInteractive_WithSkillLocationsAndSkills_InstallsOnlySpecifiedSkills()
2375public async Task NewCommandNonInteractiveWithoutTemplate_DisplaysErrorWithAvailableTemplates()
2423public async Task NewCommandNonInteractiveUsesDefaultNameWhenNotProvided()
2467public async Task NewCommandNonInteractiveWithAllOptions_Succeeds()
2513public async Task NewCommandNonInteractiveWithAllOptions_SuppressAgentInitTrue_SkipsAgentInit()
2553public async Task NewCommand_WhenCSharpTemplateApplyFails_DisplaysCreationErrorMessage()
2601public async Task NewCommand_WhenTypeScriptTemplateApplyFails_ReturnsNonZeroExitCode()
2620return Task.FromResult(false); // Simulate failure for TypeScript template
2636public async Task NewCommandInExtensionModeAppendsProjectNameToOutputPath()
2647HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
2695public async Task NewCommandInExtensionModeDoesNotDoubleAppendProjectName()
2706HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
2754public async Task NewCommandInConsoleModeDoesNotAppendProjectName()
2811public async Task NewCommandInExtensionModeHandlesTrailingDirectorySeparator()
2815async Task AssertOutputPathAsync(Func<string, string> selectedPathFactory, Func<string, string> expectedPathFactory)
2826HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
2881public async Task NewCommandInExtensionModeAppendsProjectNameToCliTemplateOutputPath()
2894HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
2915return Task.FromResult(true);
2934public async Task NewCommandInExtensionModeValidatesAdjustedCliTemplateOutputPath()
2951HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
2978return Task.FromResult(true);
2998public async Task NewCommandInExtensionModeRetriesFolderPickerAfterProjectSubdirectoryCollision()
3014HasCapabilityAsyncCallback = (capability, _) => Task.FromResult(
3019return Task.FromResult(selectedParents.Dequeue());
3024return Task.CompletedTask;
3079public async Task NewCommandInExtensionModePromptsBeforeFolderPickerForCliTemplateSubdirectory()
3107HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
3131return Task.FromResult(true);
3151public async Task NewCommandInExtensionModeUsesSelectedCliTemplateOutputPathWhenSubdirectoryDeclined()
3179HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
3200return Task.FromResult(true);
3220public async Task NewCommandInExtensionModeDoesNotDoubleAppendProjectNameToCliTemplateOutputPath()
3233HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "baseline.v1"),
3254return Task.FromResult(true);
3273public async Task NewCommandNonInteractive_SuppressAgentInitTrue_SkipsAgentInit()
3299public async Task NewCommandNonInteractive_SuppressAgentInitFalse_RunsAgentInit()
3327public async Task NewCommandNonInteractive_NoSuppressAgentInitOption_DefaultsToRunAgentInit()
3355public async Task NewCommandRejectsExplicitOutputToNonEmptyDirectory()
3386public async Task NewCommandAllowsExplicitOutputToEmptyDirectory()
3404public async Task NewCommandDefaultOutputPathUsesUniqueProjectNameWhenDirectoryExists()
3440public async Task NewCommandRejectsExplicitOutputWithInvalidPathCharacters()
3468public async Task NewCommandCreatesProjectInCurrentDirectoryWithOutputDot()
3524public async Task NewCommandWhenChannelTemplateSearchFailsDisplaysFriendlyError()
3545GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([implicitChannel])
Commands\PublishCommandPromptingIntegrationTests.cs (51)
22public async Task PublishCommand_TextInputPrompt_SendsCorrectKeyPresses()
68public async Task PublishCommand_SecretTextPrompt_SendsCorrectKeyPresses()
114public async Task PublishCommand_ChoicePrompt_SendsCorrectSelection()
167public async Task PublishCommand_BooleanPrompt_SendsCorrectAnswer()
213public async Task PublishCommand_NumberPrompt_SendsCorrectNumericValue()
259public async Task PublishCommand_FilePrompt_RejectsMissingPathAndSendsFileMetadata()
302public async Task PublishCommand_FilePrompt_TreatsOptionalWhitespaceAsEmpty()
333public async Task PublishCommand_MultiplePrompts_HandlesSequentialInteractions()
408public async Task PublishCommand_SinglePromptWithMultipleInputs_HandlesAllInputs()
492public async Task PublishCommand_TextInputWithDefaultValue_UsesDefaultCorrectly()
544public async Task PublishCommand_TextInputWithValidationErrors_UsesValidationErrorsCorrectly()
599public async Task PublishCommand_MarkdownPromptText_ConvertsToSpectreMarkup()
670public async Task PublishCommand_DebugMode_HandlesPromptsWithoutProgressUI()
714public async Task PublishCommand_SingleInputPrompt_ShowsBothStatusTextAndLabel()
757public async Task PublishCommand_SingleInputPrompt_WhenStatusTextEqualsLabel_ShowsOnlyOnce()
798public async Task PublishCommand_FilePrompt_RejectsOversizedFileAndRePrompts()
845public async Task PublishCommand_FilePrompt_RejectsWrongExtensionAndRePrompts()
891public async Task PublishCommand_FilePrompt_SuccessfulUpload()
938public async Task FileInput_CompoundExtension_MatchesFilter()
977public async Task PublishCommand_UnsupportedInputType_FailsWithError()
1027public Task WaitForCompletion() => _completionSource.Task;
1072public Task CompletePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
1077public Task UpdatePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
1082private Task CompletePromptResponseCoreAsync(string promptId, PublishingPromptInputAnswer[] answers, bool updateResponse)
1091return Task.CompletedTask;
1095public Task RequestStopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
1096public Task NotifyAppHostReadyAsync(CancellationToken cancellationToken) => Task.CompletedTask;
1098Task.FromResult(new DashboardUrlsState
1107await Task.CompletedTask; // Suppress CS1998
1112await Task.CompletedTask; // Suppress CS1998
1115public Task ConnectAsync(string socketPath, int retryCount, CancellationToken cancellationToken) => Task.CompletedTask;
1116public Task ConnectAsync(string socketPath, bool autoReconnect, int retryCount, CancellationToken cancellationToken) => Task.CompletedTask;
1117public Task WaitForDisconnectAsync(CancellationToken cancellationToken) => Task.CompletedTask;
1118public Task<string[]> GetCapabilitiesAsync(CancellationToken cancellationToken) => Task.FromResult(new[] { "baseline.v2" });
1121Task.FromResult(new GetPipelineStepsResponse { Steps = [] });
1126return Task.FromResult(new UploadFileResponse { FileId = "testfileid0000000000000000000000" });
1171return Task.FromResult(response.response);
1174return Task.FromResult(binding?.DefaultValue ?? string.Empty);
1193return Task.FromResult(matchingChoice);
1197return Task.FromResult(choices.First());
1211return Task.FromResult<IReadOnlyList<T>>(preSelected.ToList());
1215return Task.FromResult<IReadOnlyList<T>>(choices.ToList());
1230return Task.FromResult(bool.Parse(response.response));
1233return Task.FromResult(defaultValue);
1256public Task DisplayLiveAsync(IRenderable initialRenderable, Func<Action<IRenderable>, Task> callback) => callback(_ => { });
Commands\RunCommandTests.cs (164)
43public async Task RunCommandWithHelpArgumentReturnsZero()
74public async Task RunCommand_RejectsLaunchProfileForUnsupportedAppHostType()
82Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
109public async Task RunCommand_DetachedRejectsLaunchProfileForUnsupportedAppHostBeforeStoppingOrLaunching()
117Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
153public async Task RunCommand_MissingExplicitLaunchProfileFallsBackToDotNet()
180Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
202public async Task RunCommand_ExistingUnsupportedOrMalformedLaunchProfileFallsBackToDotNet(string profile)
226Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
245public async Task RunCommand_PassesSelectedLaunchProfileToProjectContext()
252Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
261return Task.FromResult(42);
281public async Task RunCommand_RejectsInvalidStartupTimeoutEnvironmentVariable()
307public async Task RunCommand_WhenAppHostStartupTimesOut_DisplaysTimeoutGuidance()
321await Task.Delay(Timeout.InfiniteTimeSpan, ct);
325await Task.Delay(50, CancellationToken.None);
363public async Task RunCommand_WhenCancelledDuringStartupTimeout_ExitsWithoutWaitingForFullTimeout()
379Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
391await Task.Delay(TimeSpan.FromSeconds(30), CancellationToken.None);
424public async Task RunCommand_DetachedChild_WhenLauncherDiesBeforeReadiness_CancelsRun()
443Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
457await Task.Delay(Timeout.InfiniteTimeSpan, ct);
506public async Task RunCommand_DetachedChild_WhenLauncherDiesAfterBackchannelEstablished_DoesNotCancelRun()
531Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
617public async Task RunCommand_DetachedChild_WhenSignaledBeforeReadiness_AwaitsAppHostTeardownBeforeExit()
636Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
659await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
713public async Task RunCommand_StartupTimeoutBudgetIncludesBuildAndBackchannelWaits()
729await Task.Delay(Timeout.InfiniteTimeSpan, ct);
764public async Task RunCommand_WhenNoProjectFileFound_ReturnsNonZeroExitCode()
781public async Task RunCommand_WhenMultipleProjectFilesFound_NonInteractive_ReturnsFailedToFindProject()
812public async Task RunCommand_WhenMultipleProjectFilesFound_ReturnsNonZeroExitCode()
829public async Task RunCommand_WhenProjectFileDoesNotExist_ReturnsNonZeroExitCode()
887public async Task RunCommand_WhenExplicitAppHostCannotBeEvaluated_SurfacesMSBuildDiagnosticsAndBuildFailureExitCode()
913public async Task RunCommand_WhenConfiguredAppHostCannotBeEvaluated_SurfacesMSBuildDiagnosticsAndBuildFailureExitCode()
943public async Task RunCommand_WhenAmbientDiscoveryOnlyFindsUnbuildableAppHosts_ReportsProjectResolutionFailure()
976public async Task RunCommand_WhenExplicitAppHostCannotBeEvaluated_TagsRunActivityAsBuildFailure()
1002public async Task RunCommand_WhenUnverifiedAppHostBuildsButIsNotAnAppHost_FailsInsteadOfWaitingForBackchannel()
1043await Task.Delay(Timeout.InfiniteTimeSpan, ct);
1062public async Task RunCommand_WithDetachFlag_DoesNotShowUpdateNotification()
1083public async Task RunCommand_DetachedChild_DoesNotStartCliMetadataPrefetching()
1092Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1122return Task.CompletedTask;
1156public async Task RunCommand_DetachedChild_PreservesOptionShapedLaunchProfileAndAppHostArguments(string launchProfileOption)
1174Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1207public async Task RunCommand_WithoutDetachFlag_ShowsUpdateNotification()
1281public Task<FileInfo?> GetAppHostFromSettingsAsync(CancellationToken cancellationToken = default) => Task.FromResult<FileInfo?>(null);
1285public async Task RunCommand_WhenCertificateServiceThrows_ReturnsNonZeroExitCode()
1317public async Task RunCommand_WhenBackchannelDisconnectsDuringStartup_WaitsForAppHostExitAndSurfacesWrappedError()
1334Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1393public async Task RunCommand_WhenDashboardRpcHandlerFaultsButConnectionStaysAlive_SurfacesImmediatelyWithoutWaiting()
1410Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1462public async Task RunCommand_WhenAppHostRunFaultsDuringStartup_ReturnsFailureExitCode()
1474Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1491await Task.Delay(Timeout.InfiniteTimeSpan, ct);
1524public async Task RunCommand_DetachedEarlyExit_PropagatesExitCodeWithoutUnexpectedErrorWrapper()
1536Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1549GetDashboardUrlsAsyncCallback = _ => Task.FromResult(new DashboardUrlsState { DashboardHealthy = true })
1554await Task.Delay(50, cancellationToken);
1581public async Task RunCommand_WhenCancelledDuringStartupRpc_CompletesSuccessfully()
1594Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1608return Task.FromCanceled<DashboardUrlsState>(ct);
1642public async Task RunCommand_WhenStartupRpcThrowsUnrelatedCancellationAfterUserCancellation_DoesNotTreatRunAsSuccessful()
1656Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1671return Task.FromCanceled<DashboardUrlsState>(unrelatedCts.Token);
1705public async Task RunCommand_WhenAppHostExitsDuringStartup_DisplaysCapturedAppHostOutput()
1717Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1734await Task.Delay(Timeout.InfiniteTimeSpan, ct);
1768public async Task RunCommand_WhenAppHostExitsBeforeBackchannelConnects_DisplaysCapturedAppHostOutput()
1789Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1829public async Task RunCommand_WhenBackchannelFailsBeforeConnection_ReportsUnknownExitWithoutSentinel()
1841Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1891public async Task RunCommand_WhenAppHostExitsDuringStartup_CancelsAndObservesLogCapture()
1903Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1920await Task.Delay(Timeout.InfiniteTimeSpan, ct);
1957await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
2003public Task<FileInfo?> GetAppHostFromSettingsAsync(CancellationToken cancellationToken = default) => Task.FromResult<FileInfo?>(null);
2028public Task<FileInfo?> GetAppHostFromSettingsAsync(CancellationToken cancellationToken = default) => Task.FromResult<FileInfo?>(null);
2037await Task.Delay(1000, cancellationToken);
2052await Task.Yield();
2057public async Task RunCommand_CompletesSuccessfully()
2088await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2121public async Task RunCommand_InRemoteExtensionHost_DisplaysDashboardUrlsBeforeLiveEndpointDisplayCompletes()
2146await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2189var completedTask = await Task.WhenAny(dashboardUrlsDisplayed.Task, Task.Delay(TimeSpan.FromSeconds(1))).DefaultTimeout();
2203public async Task RunCommand_WhenAppHostReturnsCancelled_CompletesSuccessfully()
2215return Task.FromResult(CliExitCodes.Cancelled);
2227GetDashboardUrlsAsyncCallback = _ => Task.FromResult(new DashboardUrlsState
2246public async Task RunCommand_WithCaptureProfile_TreatsRequestedStopAsSuccess()
2277return Task.CompletedTask;
2295public async Task RunCommand_WithCaptureProfile_PreservesExitCodeWhenRunCompletesBeforeStop()
2309return Task.FromResult(123);
2338public async Task RunCommand_WithCaptureProfile_PropagatesFailureExitCodeAfterStop()
2371return Task.CompletedTask;
2389public async Task RunCommand_WithNoResources_CompletesSuccessfully()
2412await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2484public async Task RunCommand_WhenDashboardFailsToStart_ContinuesWithWarning()
2493return Task.FromResult(new DashboardUrlsState
2520await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2564public async Task AppHostHelper_BuildAppHostAsync_IncludesRelativePathInStatusMessage()
2590public async Task RunCommand_SkipsBuild_WhenBuildDotNetUsingCliCapabilityIsAvailable()
2595extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(new[] { "devkit" });
2598appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
2623await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2660public async Task RunCommand_SkipsBuild_WhenRunningInExtension_AndNoBuildInCliCapability()
2665extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(Array.Empty<string>());
2668appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
2693await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2730public async Task RunCommand_Builds_WhenExtensionHasBuildDotnetUsingCliCapability()
2736extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(new[] { "build-dotnet-using-cli" });
2739appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
2762await Task.Delay(Timeout.InfiniteTimeSpan, ct);
2803public async Task RunCommand_WhenExtensionNoDebugBuildFails_DoesNotRunAppHost()
2809extensionBackchannel.HasCapabilityAsyncCallback = (capability, ct) => Task.FromResult(capability == KnownCapabilities.BuildDotnetUsingCli);
2825return Task.FromResult(0);
2857public async Task RunCommand_WhenExtensionBuildFails_WaitsForBuildOutputToFlush()
2865extensionBackchannel.HasCapabilityAsyncCallback = (capability, ct) => Task.FromResult(capability == KnownCapabilities.BuildDotnetUsingCli);
2932public async Task RunCommand_WhenSingleFileAppHostAndDefaultWatchEnabled_DoesNotUseWatchMode()
2953await Task.Delay(100, ct);
2989public async Task RunCommand_WhenDefaultWatchEnabledFeatureFlagIsTrue_UsesWatchMode()
3010await Task.Delay(100, ct);
3048public async Task RunCommand_WhenDefaultWatchEnabledFeatureFlagIsTrueAndBuildFails_ReturnsBuildFailure()
3066return Task.FromResult(0);
3101public async Task RunCommand_WhenDefaultWatchEnabledFeatureFlagIsFalse_DoesNotUseWatchMode()
3122await Task.Delay(100, ct);
3160public async Task RunCommand_WhenDefaultWatchEnabledFeatureFlagNotSet_DefaultsToFalse()
3181await Task.Delay(100, ct);
3219public async Task DotNetCliRunner_RunAsync_WhenWatchIsTrue_IncludesNonInteractiveFlag()
3267public async Task DotNetCliRunner_RunAsync_WhenWatchIsFalse_DoesNotIncludeNonInteractiveFlag()
3311public async Task DotNetCliRunner_RunAsync_WhenWatchIsTrueAndDebugIsTrue_IncludesVerboseFlag()
3359public async Task DotNetCliRunner_RunAsync_WhenWatchIsTrueAndDebugIsFalse_DoesNotIncludeVerboseFlag()
3402public async Task DotNetCliRunner_RunAsync_WhenWatchIsFalseAndDebugIsTrue_DoesNotIncludeVerboseFlag()
3446public async Task DotNetCliRunner_RunAsync_WhenWatchIsTrue_SetsSuppressLaunchBrowserEnvironmentVariable()
3490public async Task DotNetCliRunner_RunAsync_WhenWatchIsFalse_DoesNotSetSuppressLaunchBrowserEnvironmentVariable()
3539return Task.FromResult<List<AppHostProjectCandidate>>([new(appHostFile, "test")]);
3544return Task.FromResult<List<FileInfo>>([new FileInfo("/tmp/apphost.cs")]);
3549return Task.FromResult(new AppHostProjectSearchResult(new FileInfo("/tmp/apphost.cs"), [new FileInfo("/tmp/apphost.cs")]));
3555return Task.FromResult<FileInfo?>(new FileInfo("/tmp/apphost.cs"));
3558public Task<FileInfo?> GetAppHostFromSettingsAsync(CancellationToken cancellationToken = default) => Task.FromResult<FileInfo?>(null);
3567public async Task RunCommand_WithNoBuildOption_SkipsBuildAndPassesNoBuildAndNoRestoreToRunner()
3596await Task.Delay(100, ct);
3628public async Task RunCommand_WithIsolatedOption_SetsRandomizePortsAndIsolatesUserSecrets()
3736public async Task RunCommand_WithNoBuildAndWatchModeEnabled_ReturnsInvalidCommandError()
3784public async Task CaptureAppHostLogsAsync_WritesCategoryWithAppHostPrefix()
3841await Task.CompletedTask;
3846public async Task CaptureAppHostLogsAsync_ConnectionLostException_TreatedAsNormalCompletion()
3880await Task.CompletedTask;
3902public async Task RunCommand_WhenDelegatingToExtension_CarriesAppHostSelectionOrigin(bool explicitAppHost, string expectedOrigin)
3948public async Task RunCommand_WhenRunningInExtension_ForwardsExplicitArgumentsInSemanticOrder()
4015public async Task RunCommand_WhenRunningInExtensionInLinkedWorktree_DoesNotInferIsolation()
4043public async Task RunCommand_WhenRunningInExtension_SynthesizesSeparatorBeforeDelimiterFreeAppHostArguments()
4081public async Task DelegatedCommands_RecordTransferStateOnlyAfterSuccessfulHandoff(
4090public async Task RunCommand_NonInteractive_SkipsExtensionDelegation()
4099extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(Array.Empty<string>());
4102appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
4131await Task.Delay(Timeout.InfiniteTimeSpan, ct);
4167public async Task RunCommand_AllowsNoBuildInActiveExtensionDebugSession()
4173extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(Array.Empty<string>());
4176appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
4206await Task.Delay(Timeout.InfiniteTimeSpan, ct);
4245public async Task RunCommand_RecordsRunAppHostTelemetryActivity(bool detached, bool isolated)
4292private async Task AssertProfileTransferAsync(
Commands\StopCommandTests.cs (50)
30public async Task StopCommand_Help_Works()
45public async Task StopCommand_RejectsPositionalResourceArgument()
59public async Task StopCommand_WithInvalidExplicitAppHost_ReturnsFailedToFindProject()
81public async Task StopCommand_WithExplicitAppHost_UsesProjectLocatorResolution()
97return Task.FromResult(new AppHostProjectSearchResult(resolvedProjectFile, [resolvedProjectFile]));
117public async Task StopCommand_AllIncludesEachAppHostPathInMessages()
152public async Task StopCommand_AllIncludesProcessIdWhenAppHostPathsCollide()
189public async Task StopCommand_SingleAppHostIncludesIdentifierInStatusAndSuccessMessages()
222public async Task StopCommand_WithoutAppHost_DoesNotStopNestedLinkedWorktreeInstance()
275public async Task StopCommand_WithExplicitAppHostFileDoesNotUseProjectLocatorBeforeSocketLookup()
309public async Task StopCommand_SingleAppHostInDifferentWorktreeWithoutOverrideDoesNotPromptOrStop()
352public async Task StopCommand_SingleAppHostOutsideWorkingDirectoryInSameWorktreePromptsAndStops()
392public async Task StopCommand_AllEmitsProfilingActivities()
444public async Task StopCommand_NoRunningAppHosts_ReturnsSuccess(string commandLine)
469public async Task StopCommand_ForceInvokesDcpCleanupForResolvedAppHost()
503public async Task StopCommand_ForceInvokesDcpCleanupFromDiscoveredLayoutWhenBundleUnavailable()
516Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
535public async Task StopCommand_ForceWithoutAppHostUsesRunningAppHostPathBeforeProjectDiscovery()
559return Task.FromResult(new AppHostProjectSearchResult(discoveredAppHostFile, [discoveredAppHostFile]));
587public async Task StopCommand_ForceWithExplicitAppHostFileCleansUpWithoutProjectValidation()
619public async Task StopCommand_ForceNonInteractiveWithoutRunningAppHostFallsBackToProjectDiscovery()
632Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
654public async Task StopCommand_ForceNonInteractiveWithOnlyOutOfScopeAppHostsFallsBackToProjectDiscovery()
671Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
694public async Task StopCommand_ForceReturnsFailureWhenDcpCleanupFails()
710Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
729public async Task StopCommand_ForceWarnsAndCleansUpForUnsupportedNonBundleAppHost()
742Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
769public async Task StopCommand_ForceWarnsAndCleansUpWhenAppHostVersionCannotBeDetermined()
782Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
809public async Task StopCommand_ForceWarnsAndCleansUpWhenAppHostInfoCannotBeInspected()
822Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
848public async Task StopCommand_ForceSkipsCompatibilityWarningForGuestAppHost()
862Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
894public async Task StopCommand_ForceAllowsUnsupportedVersionWhenAppHostUsesCliBundle()
907Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
931public async Task StopCommand_ForceReturnsCleanupFailureWhenDcpCannotStart()
945(_, _, _) => Task.FromResult((0, (string?)null)),
954Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
976public async Task StopCommand_ForceReturnsCleanupFailureWhenBundleLayoutCannotBeAcquired()
988Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1014public async Task StopCommand_ForceReturnsCleanupFailureWhenDcpCleanupThrowsUnexpectedException()
1026Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1052public async Task StopCommand_ForceReturnsFailureWhenDcpIsUnavailable()
1064Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
1084public async Task StopCommand_ForceReportsUnknownAppHostPathAfterNormalStop()
1098Task.FromResult(new AppHostProjectSearchResult(null, []))
1120public async Task StopCommand_ForceUsesStoppedConnectionPathForCleanupWhenProjectDiscoveryFails()
1158public async Task StopCommand_ForceAndAllAreMutuallyExclusive()
1180public async Task StopCommand_DeletesSocketFile_AfterSuccessfulStop()
Commands\UpdateCommandTests.cs (169)
32public async Task UpdateCommandWithHelpArgumentReturnsZero()
64public async Task UpdateCommandFailsFastWhenNonInteractiveWithoutYes(string commandLine)
81public async Task UpdateCommand_WhenExplicitAppHostHasUnresolvableSdk_ReachesProjectUpdater()
114return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
133public async Task UpdateCommand_WhenProjectOptionSpecified_PassesProjectFileToProjectLocator()
147return Task.FromResult<FileInfo?>(projectFile);
159return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
249public async Task UpdateCommand_WhenNoProjectFound_PromptsForCliSelfUpdate()
295public async Task UpdateCommand_WhenProjectUpdatedSuccessfully_AndChannelSupportsCliDownload_PromptsForCliUpdate()
307return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
327return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
345return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel });
372public async Task UpdateCommand_GuestProject_WhenTargetSdkNewerThanCli_PromptsForCliUpdateBeforeProjectUpdateAndSkipsWhenAccepted()
396UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(new FileInfo(appHostPath))
408return Task.FromResult(new UpdatePackagesResult { UpdatesApplied = true });
415GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
436public async Task UpdateCommand_GuestProject_WhenTargetSdkNewerThanCliAndCliUpdateDeclined_ContinuesProjectUpdate()
448UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(new FileInfo(appHostPath))
460return Task.FromResult(new UpdatePackagesResult { UpdatesApplied = true });
474GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
491public async Task UpdateCommand_GuestProject_WhenChannelCannotDownloadCli_DoesNotPromptBeforeProjectUpdate()
503UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(new FileInfo(appHostPath))
515return Task.FromResult(new UpdatePackagesResult { UpdatesApplied = true });
529GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
546public async Task UpdateCommand_WhenProjectUpdatedSuccessfullyAndRunningAsDotnetTool_DisplaysDotnetToolUpdateCommand()
564return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
575return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
592return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel });
606return Task.FromResult(string.Empty);
623public async Task UpdateCommand_WhenProjectUpdatedSuccessfullyAndRunningAsCustomToolPathDotnetTool_DisplaysToolPathUpdateCommand()
643return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
654return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
671return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel });
685return Task.FromResult(string.Empty);
702public async Task UpdateCommand_WhenProjectUpdatedSuccessfullyAndRunningFromNpm_DisplaysNpmUpdateCommand()
720return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
731return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
748return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel });
762return Task.FromResult(string.Empty);
780public async Task UpdateCommand_WithoutAutoConfirmOption_UsesFalseConfirmationDefault()
793return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
803return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
823public async Task UpdateCommand_WithYesOption_ResolvesConfirmationFromCli()
836return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
846return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
866public async Task UpdateCommand_WhenChannelHasNoCliDownloadUrl_DoesNotPromptForCliUpdate()
877return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
896return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
914return Task.FromResult<IEnumerable<PackageChannel>>(new[] { prChannel });
939public async Task UpdateCommand_WhenProjectUpdatedSuccessfully_AndMigrationPending_DisplaysAdvisory()
961return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
973return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
992return Task.FromResult<IEnumerable<PackageChannel>>(new[] { prChannel });
1019public async Task UpdateCommand_WithMigrateFlagAndYes_AppliesPendingMigration()
1050public async Task UpdateCommand_WithMigrateFlag_WhenDeclined_DoesNotApplyMigration()
1082public async Task UpdateCommand_WithMigrateFlag_AndNothingPending_ReportsNothingToMigrate()
1119return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1131return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
1150return Task.FromResult<IEnumerable<PackageChannel>>(new[] { prChannel });
1160public async Task UpdateCommand_SelfUpdate_WhenRunningAsNativeAotDotnetTool_DisplaysDotnetToolUpdateCommand()
1182public async Task UpdateCommand_SelfUpdate_WhenRunningFromNpm_DisplaysNpmUpdateCommand()
1198return Task.FromResult(string.Empty);
1216public async Task UpdateCommand_SelfUpdate_WhenRunningFromNix_DisplaysNixUpdateGuidance()
1233return Task.FromResult(string.Empty);
1253public async Task UpdateCommand_WhenRunningFromNix_DisplaysNixUpdateGuidanceForSelfUpdateEntryPoints(NixSelfUpdateEntryPoint entryPoint)
1292return Task.FromResult(string.Empty);
1301UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")))
1308return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
1313GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
1336UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(new FileInfo(appHostPath))
1347return Task.FromResult(new UpdatePackagesResult { UpdatesApplied = true });
1352GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>(
1379public async Task UpdateCommand_SelfUpdate_WhenRunningAsCustomToolPathDotnetTool_DisplaysToolPathUpdateCommand()
1404public async Task UpdateCommand_WhenNoProjectFoundAndRunningAsDotnetTool_DoesNotPromptForArchiveSelfUpdate()
1442public async Task UpdateCommand_SelfUpdate_WithChannelOption_DoesNotPromptForChannel()
1468return Task.FromResult(archivePath);
1488public async Task UpdateCommand_SelfUpdate_PersistsSelectedChannelInInstallSidecar()
1507DownloadLatestCliAsyncCallback = (_, _) => Task.FromResult(archivePath)
1530public async Task UpdateCommand_SelfUpdate_WhenSidecarUpdateFails_RestoresPreviousExecutable()
1551DownloadLatestCliAsyncCallback = (_, _) => Task.FromResult(archivePath)
1567public async Task UpdateCommand_SelfUpdate_WithQualityOption_DoesNotPromptForQuality()
1593return Task.FromResult(archivePath);
1612public async Task UpdateCommand_SelfUpdate_WithChannelOption_TracksChannelParameter()
1634return Task.FromResult(archivePath);
1653public async Task UpdateCommand_ProjectUpdate_WithChannelOption_DoesNotPromptForChannel()
1666return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1686return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
1697return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel, dailyChannel });
1718public async Task UpdateCommand_ProjectUpdate_WithQualityOption_DoesNotPromptForChannel()
1731return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1751return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
1762return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel, dailyChannel });
1783public async Task UpdateCommand_ProjectUpdate_WithInvalidQuality_DisplaysError()
1795return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1816return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel, dailyChannel });
1840public async Task UpdateCommand_ProjectUpdate_ChannelTakesPrecedenceOverQuality()
1853return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1873return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = true });
1883return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel, dailyChannel });
1904public async Task UpdateCommand_ProjectUpdate_WhenCancelled_DisplaysCancellationMessage()
1930return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1943return Task.FromResult<IEnumerable<PackageChannel>>(new[] { stableChannel });
1962public async Task UpdateCommand_WithoutHives_UsesImplicitChannelWithoutPrompting()
1975return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
1995return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
2005return Task.FromResult<IEnumerable<PackageChannel>>(new[] { implicitChannel });
2025public async Task UpdateCommand_LocalConfiguredChannel_IsUsed()
2044public async Task UpdateCommand_GlobalConfiguredChannel_IsUsed()
2065public async Task UpdateCommand_ExplicitChannelOverridesConfiguredChannel()
2083public async Task UpdateCommand_LocalConfiguredChannel_OverridesGlobalConfiguredChannel()
2105public async Task UpdateCommand_WithoutHives_ConfiguredChannel_TakesPrecedenceOverImplicitFallback()
2127public async Task UpdateCommand_ConfiguredChannelNotInChannelList_ThrowsChannelNotFound()
2142return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
2157return Task.FromResult<IEnumerable<PackageChannel>>(new[]
2176public async Task UpdateCommand_ChannelStagingRequestedButPackagingServiceReportsUnavailable_SurfacesStagingReason()
2195Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")))
2215return Task.FromResult<IEnumerable<PackageChannel>>(new[]
2241public async Task UpdateCommand_ProjectInOtherDirectory_UsesProjectLocalConfiguredChannel()
2263public async Task UpdateCommand_ProjectInOtherDirectory_UsesNearestParentConfiguredChannelWhenProjectDirectoryHasNoConfig()
2288public async Task UpdateCommand_ProjectInOtherDirectory_PrefersProjectLocalConfigOverCwdConfig()
2315public async Task UpdateCommand_ProjectInOtherDirectory_ProjectLocalConfigWithoutChannel_FallsBackToGlobalConfig()
2345public async Task UpdateCommand_WithHivesAndConfiguredChannel_DoesNotPromptForSelection()
2368public async Task UpdateCommand_WithHivesAndLocallyConfiguredChannel_DoesNotPromptForSelection()
2392public async Task UpdateCommand_WithHives_PromptOffersChannelsInPackagingServiceOrder()
2416return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
2436return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
2449return Task.FromResult<IEnumerable<PackageChannel>>(new[] { implicitChannel, stableChannel, dailyChannel, hiveChannel });
2496public async Task UpdateCommand_WhenAppHostSdkVersionUnresolvable_UsesSettingsLookup()
2511return Task.FromResult<FileInfo?>(resolved);
2518return Task.FromResult<FileInfo?>(null);
2561public async Task UpdateCommand_WhenStagingIdentityRegistersChannel_UsesStagingForUnpinnedProject()
2587return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
2608return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
2626public async Task UpdateCommand_WhenAppHostOutsideLaunchDirectoryConfiguresStaging_UsesStagingFromRealPackagingService()
2645UseOrFindAppHostProjectFileAsyncCallback = (_, _, _) => Task.FromResult<FileInfo?>(appHostFile)
2661return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
2682public async Task UpdateCommand_WhenIdentityChannelMatchesRegisteredChannel_UsesItWithoutPrompting(string identityChannel, string expectedChannelName)
2703public async Task UpdateCommand_WhenIdentityChannelIsLocal_StillPromptsWhenHivesExist()
2725public async Task UpdateCommand_WhenIdentityChannelHasNoMatchingChannel_FallsThroughToPrompt()
2745public async Task UpdateCommand_ExplicitChannelFlagOverridesIdentityChannel()
2766public async Task UpdateCommand_PerProjectConfigChannelOverridesIdentityChannel()
2828return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(projectDirectory.FullName, "AppHost.csproj")));
2848return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
2882return Task.FromResult<IEnumerable<PackageChannel>>(channels);
2897public async Task UpdateCommand_SelfUpdate_WhenCancelled_DisplaysCancellationMessage()
2938public async Task UpdateCommand_SelfUpdate_WhenStagingFeatureFlagDisabled_DoesNotShowStagingChannel()
2961return Task.FromResult(archivePath);
2981public async Task UpdateCommand_SelfUpdate_WhenStagingFeatureFlagEnabled_ShowsStagingChannel()
3006return Task.FromResult(archivePath);
3026public async Task UpdateCommand_SelfUpdate_WhenIdentityChannelIsStaging_ShowsStagingChannel()
3051return Task.FromResult(archivePath);
3071public async Task UpdateCommand_SelfOption_IsAvailableAndParseable()
3084return Task.FromResult(archivePath);
3100public async Task UpdateCommand_NonInteractive_WithYesAndChannel_SucceedsWithoutPrompting()
3115return Task.FromResult<FileInfo?>(new FileInfo(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj")));
3141return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
3151return Task.FromResult<IEnumerable<PackageChannel>>([stableChannel, dailyChannel]);
3175public async Task UpdateCommand_SelfUpdate_NonInteractive_WhenIdentityChannelMatchesKnownChannel_UsesItWithoutPrompting(string identityChannel, string expectedChannel)
3187public async Task UpdateCommand_SelfUpdate_NonInteractive_WhenIdentityChannelIsLocal_DefaultsToStable()
3199public async Task UpdateCommand_SelfUpdate_NonInteractive_WhenIdentityChannelIsStalePr_RequiresExplicitChannel()
3215public async Task UpdateCommand_SelfUpdate_ExplicitChannelOverridesIdentityChannel()
3227public async Task UpdateCommand_SelfUpdate_NonInteractive_WhenIdentityChannelIsStalePr_ExplicitChannelSucceeds()
3271return Task.FromResult(archivePath);
3416public async Task UpdateCommand_SelfUpdate_DoesNotWriteChannelToGlobalConfiguration(string commandLine)
3437return Task.FromResult(archivePath);
3466Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
3552public Task DisplayLiveAsync(IRenderable initialRenderable, Func<Action<IRenderable>, Task> callback) => _innerService.DisplayLiveAsync(initialRenderable, callback);
3568return Task.FromResult(new ProjectUpdateResult { UpdatedApplied = false });
Interaction\ConsoleInteractionServiceTests.cs (59)
37public async Task PromptForSelectionAsync_EmptyChoices_ThrowsEmptyChoicesException()
49public async Task PromptForSelectionsAsync_EmptyChoices_ThrowsEmptyChoicesException()
263public async Task ShowStatusAsync_InDebugMode_DisplaysSubtleMessageInsteadOfSpinner()
279var statusValue = await interactionService.ShowStatusAsync(statusText, () => Task.FromResult(GetInStatus(interactionService))).DefaultTimeout();
288public async Task ShowDynamicStatusAsync_InDebugMode_DisplaysSubtleMessagesInsteadOfSpinner()
303return Task.FromResult(GetInStatus(interactionService));
318public async Task StatusMethods_WithConsoleLogging_DoNotStartSpinner(LogLevel consoleLogLevel)
330var asyncStatusValue = await interactionService.ShowStatusAsync("Working...", () => Task.FromResult(GetInStatus(interactionService))).DefaultTimeout();
334return Task.FromResult(GetInStatus(interactionService));
347public async Task ShowStatusAsync_WithConsoleLoggingDisabled_StartsSpinner()
351var statusValue = await interactionService.ShowStatusAsync("Working...", () => Task.FromResult(GetInStatus(interactionService))).DefaultTimeout();
383public async Task PromptForStringAsync_WhenInteractiveInputNotSupported_ThrowsInvalidOperationException()
395public async Task PromptForSelectionAsync_WhenInteractiveInputNotSupported_ThrowsInvalidOperationException()
408public async Task PromptForSelectionsAsync_WhenInteractiveInputNotSupported_ThrowsInvalidOperationException()
421public async Task ConfirmAsync_WhenInteractiveInputNotSupported_ThrowsInvalidOperationException()
433public async Task ShowStatusAsync_NestedCall_DoesNotThrowException()
454return await interactionService.ShowStatusAsync(innerStatusText, () => Task.FromResult(expectedResult));
497public async Task ShowStatusAsync_FallbackPath_DoesNotLeaveInStatusFlagSet()
515await interactionService.ShowStatusAsync("Working...", () => Task.FromResult(0)).DefaultTimeout();
521public async Task ShowStatusAsync_FallbackPathWithEmptyText_DoesNotLeaveInStatusFlagSet()
526await interactionService.ShowStatusAsync(string.Empty, () => Task.FromResult(0)).DefaultTimeout();
532public async Task ShowDynamicStatusAsync_FallbackPath_DoesNotLeaveInStatusFlagSet()
537await interactionService.ShowDynamicStatusAsync<int>("Working...", _ => Task.FromResult(0)).DefaultTimeout();
990public async Task ShowStatusAsync_WithMarkupCharacters_AutoEscapesByDefault()
1009interactionService.ShowStatusAsync(statusText, () => Task.FromResult(0)));
1045public async Task ShowStatusAsync_WithAllowMarkupTrue_PassesThroughMarkup()
1064interactionService.ShowStatusAsync(statusText, () => Task.FromResult(0), allowMarkup: true));
1073public async Task ShowStatusAsync_WithAllowMarkupTrue_UnescapedDynamicContent_Throws()
1093interactionService.ShowStatusAsync(statusText, () => Task.FromResult(0), allowMarkup: true));
1100public async Task ShowStatusAsync_WithEmojiName_PrependsEmojiAndAutoEscapes()
1119interactionService.ShowStatusAsync(statusText, () => Task.FromResult(0), emoji: KnownEmojis.Rocket));
1252public async Task ConfirmAsync_DisplaysCapitalizedDefaultChoice(bool defaultValue, string expectedChoiceSuffix)
1270public async Task ConfirmAsync_WhenUserPressesEnter_ReturnsDefaultValue(bool defaultValue)
1289public async Task ConfirmAsync_WhenUserPressesYWithoutEnter_ReturnsTrue(bool defaultValue, string input)
1306public async Task ConfirmAsync_WhenUserPressesNWithoutEnter_ReturnsFalse(bool defaultValue, string input)
1319public async Task PromptForStringAsync_CliProvidedValue_RunsValidator()
1337public async Task PromptForStringAsync_CliProvidedEmptyValue_ThrowsWhenRequired()
1350public async Task PromptForStringAsync_NonInteractive_DefaultValuePassesValidation_ReturnsDefault()
1366public async Task PromptForStringAsync_WhenUserAcceptsEscapedDisplayDefault_ReturnsRawDefault()
1382public async Task ConfirmAsync_NonInteractive_WithoutExplicitDefault_Throws()
1398public async Task ConfirmAsync_NonInteractive_WithExplicitDefault_ReturnsDefault()
1412public async Task ConfirmAsync_NonInteractive_WithSeparateNonInteractiveDefault_ReturnsNonInteractiveDefault()
1429public async Task ConfirmAsync_Interactive_WithSeparateNonInteractiveDefault_UsesInteractiveDefault()
1555public async Task ConfirmAsync_WithNullBinding_DefaultsToTrue()
1568public async Task PromptForSelectionAsync_NonInteractive_CliProvidedInvalidValue_ShowsAvailableChoices()
1590public async Task PromptForSelectionsAsync_NonInteractive_CliProvidedInvalidValue_ShowsAvailableChoices()
1612public async Task PromptForSelectionsAsync_NonInteractive_CliProvidedInvalidValue_OmitsItemsOutsideBindingChoices()
1639public async Task PromptForSelectionsAsync_NonInteractive_CliProvidedInvalidValue_StripsSpectreMarkupFromChoiceLabels()
1673public async Task PromptForSelectionsAsync_NonInteractive_CliProvidedInvalidValue_WithUnescapedClosingBracketInChoiceLabel_DoesNotThrowInvalidOperationException()
1701public async Task PromptForSelectionAsync_NonInteractive_WithDefaultValue_ReturnsMatch()
1719public async Task PromptForSelectionAsync_CliProvidedValidValue_ReturnsMatch()
1737public async Task PromptForSelectionsAsync_CliProvidedCommaSeparated_ReturnsMatches()
1816public async Task PromptForStringAsync_NonInteractive_NoBinding_ThrowsInvalidOperationException()
1828public async Task PromptForSelectionAsync_NonInteractive_WithoutBinding_ThrowsInvalidOperationException()
1843public async Task PromptForSelectionAsync_BindingProvided_DoesNotEchoSelection()
1862public async Task PromptForSelectionsAsync_BindingProvided_DoesNotEchoSelection()
1881public async Task PromptForSelectionAsync_NonInteractiveDefault_DoesNotEchoSelection()
1900public async Task PromptForSelectionsAsync_NonInteractiveDefault_DoesNotEchoSelection()
1992=> Task.FromResult(ReadKey(intercept));
Mcp\ApiDocs\ApiDocsFetcherTests.cs (26)
24public async Task FetchSitemapAsync_CachesContentWithFriendlyKey()
50public async Task FetchPageAsync_CachesContentWithFriendlyKey()
76public async Task FetchPageAsync_StripsMemberAnchorFromMarkdownFetchAndCacheKey()
113=> Task.FromResult(_content.TryGetValue(key, out var value) ? value : null);
115public Task SetAsync(string key, string content, CancellationToken cancellationToken = default)
118return Task.CompletedTask;
122=> Task.FromResult(_etags.TryGetValue(url, out var value) ? value : null);
124public Task SetETagAsync(string url, string? etag, CancellationToken cancellationToken = default)
135return Task.CompletedTask;
138public Task InvalidateAsync(string key, CancellationToken cancellationToken = default)
141return Task.CompletedTask;
145=> Task.FromResult(_index);
147public Task SetIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
150return Task.CompletedTask;
154=> Task.FromResult(_indexFingerprint);
156public Task SetIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
159return Task.CompletedTask;
163=> Task.FromResult(_memberIndex);
165public Task SetMemberIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
168return Task.CompletedTask;
172=> Task.FromResult(_memberIndexFingerprint);
174public Task SetMemberIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
177return Task.CompletedTask;
181=> Task.FromResult(_indexedMemberContainerIds);
183public Task SetIndexedMemberContainerIdsAsync(string[] containerIds, CancellationToken cancellationToken = default)
186return Task.CompletedTask;
Mcp\ApiDocs\ApiDocsIndexServiceTests.cs (41)
18public async Task ListAsync_BuildsHierarchyForBothLanguages()
70public async Task SearchAsync_RespectsLanguageFilterAndFindsDirectRouteItems()
84public async Task SearchAsync_FindsMembersParsedFromGroupedMemberLinks()
98public async Task SearchAsync_LoadsMemberIndexWhenBaseRouteHitsExist()
114public async Task SearchAsync_PrefersTypesForBroadIdentifierQueries()
129public async Task SearchAsync_LoadsOnlyNeededMemberContainers()
188public async Task ListAsync_ForMemberGroupScope_ReturnsParsedMembers()
213public async Task GetAsync_ForDirectRouteItem_ReturnsRawMarkdown()
227public async Task GetAsync_ForParsedMember_ReturnsAnchoredUrlAndRawMarkdown()
241public async Task GetAsync_RebasesConfiguredHostForFetchedContentAndReturnedUrl()
285public async Task GetAsync_RewritesBracketedMemberSignatureLinksFromDistributedApplicationPage()
325public async Task GetAsync_ForTypeScriptDirectRouteItem_ReturnsMarkdownFromConfiguredHost()
361public async Task EnsureIndexedAsync_RebuildsCachedIndexWhenSitemapChangesAcrossInstances()
396public async Task EnsureIndexedAsync_UsesCachedIndexWhenSitemapUnavailableAfterInitialLoad()
591=> Task.FromResult<string?>(sitemapContent);
604return Task.FromResult(pageContent.TryGetValue(cachePageUrl, out var content) ? content : pageContent.TryGetValue(markdownUrl, out content) ? content : null);
613=> Task.FromResult(_sitemapContents.Count > 0 ? _sitemapContents.Dequeue() : null);
616=> Task.FromResult<string?>(null);
631=> Task.FromResult(_content.TryGetValue(key, out var value) ? value : null);
633public Task SetAsync(string key, string content, CancellationToken cancellationToken = default)
636return Task.CompletedTask;
640=> Task.FromResult(_etags.TryGetValue(url, out var value) ? value : null);
642public Task SetETagAsync(string url, string? etag, CancellationToken cancellationToken = default)
653return Task.CompletedTask;
656public Task InvalidateAsync(string key, CancellationToken cancellationToken = default)
659return Task.CompletedTask;
663=> Task.FromResult(Index);
665public Task SetIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
668return Task.CompletedTask;
672=> Task.FromResult(_indexSourceFingerprint);
674public Task SetIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
677return Task.CompletedTask;
681=> Task.FromResult(MemberIndex);
683public Task SetMemberIndexAsync(ApiReferenceItem[] documents, CancellationToken cancellationToken = default)
686return Task.CompletedTask;
690=> Task.FromResult(_memberIndexSourceFingerprint);
692public Task SetMemberIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
695return Task.CompletedTask;
699=> Task.FromResult(_indexedMemberContainerIds);
701public Task SetIndexedMemberContainerIdsAsync(string[] containerIds, CancellationToken cancellationToken = default)
704return Task.CompletedTask;
Mcp\Docs\DocsIndexServiceTests.cs (92)
27public async Task ListDocumentsAsync_ReturnsAllDocuments()
52public async Task ListDocumentsAsync_WhenFetchFails_ReturnsEmptyList()
63public async Task SearchAsync_FindsDocumentByTitle()
87public async Task SearchAsync_FindsDocumentBySummary()
106public async Task SearchAsync_FindsDocumentBySectionHeading()
130public async Task SearchAsync_TitleMatchScoresHigherThanBodyMatch()
155public async Task SearchAsync_PreFilterHaystack_CoversEveryScorableField()
204public async Task SearchAsync_FindsCodeIdentifiers()
229public async Task SearchAsync_RespectsTopKLimit()
267public async Task SearchAsync_WithEmptyQuery_ReturnsEmptyResults()
283public async Task SearchAsync_WithWhitespaceQuery_ReturnsEmptyResults()
299public async Task SearchAsync_MultiWordQuery_FindsAllTerms()
324public async Task GetDocumentAsync_BySlug_ReturnsDocument()
344public async Task GetDocumentAsync_CaseInsensitive()
363public async Task GetDocumentAsync_UnknownSlug_ReturnsNull()
381public async Task GetDocumentAsync_WithSection_ReturnsOnlySection()
407public async Task GetDocumentAsync_WithPartialSectionName_FindsSection()
427public async Task GetDocumentAsync_ReturnsSectionsList()
456public async Task GetDocumentAsync_NormalizesInlineMarkdownAndRewritesLinks()
488public async Task GetDocumentAsync_KeepsMinifiedSingleLineCodeBlocksOnSingleLine()
513public async Task EnsureIndexedAsync_OnlyFetchesOnce()
531public async Task EnsureIndexedAsync_RevalidatesCachedIndexAcrossInstances()
564public async Task EnsureIndexedAsync_UsesCachedIndexWhenSourceUnavailableAfterInitialLoad()
587public async Task EnsureIndexedAsync_RefreshesCachedIndexWhenSourceContentChanges()
624public async Task GetDocumentAsync_NormalizesMinifiedInlineTables()
645public async Task SearchAsync_OrdersResultsByScore()
678public async Task SearchAsync_WithNullQuery_ReturnsEmptyResults()
696public async Task GetDocumentAsync_WithNullSlug_ReturnsNull()
714public async Task GetDocumentAsync_WithEmptySlug_ReturnsNull()
732public async Task GetDocumentAsync_WithWhitespaceSlug_ReturnsNull()
750public async Task ListDocumentsAsync_WhenFetchReturnsEmpty_ReturnsEmptyList()
761public async Task ListDocumentsAsync_WhenFetchReturnsWhitespace_ReturnsEmptyList()
772public async Task SearchAsync_WhenNoDocsIndexed_ReturnsEmptyResults()
783public async Task GetDocumentAsync_WhenNoDocsIndexed_ReturnsNull()
794public async Task ListDocumentsAsync_WhenFetcherThrows_PropagatesException()
803public async Task SearchAsync_WhenFetcherThrows_PropagatesException()
812public async Task GetDocumentAsync_WhenFetcherThrows_PropagatesException()
821public async Task EnsureIndexedAsync_WhenCancelled_ThrowsOperationCanceledException()
834public async Task EnsureIndexedAsync_WhenFetcherThrows_PropagatesException()
843public async Task SearchAsync_WithSpecialCharactersInQuery_HandlesGracefully()
863public async Task SearchAsync_WithVeryLongQuery_HandlesGracefully()
884public async Task GetDocumentAsync_WithNonExistentSection_ReturnsFullDocument()
907public async Task SearchAsync_WithZeroTopK_ReturnsEmptyResults()
925public async Task SearchAsync_WithNegativeTopK_ReturnsEmptyResults()
943public async Task SearchAsync_SlugExactMatch_RanksHigher()
969public async Task SearchAsync_SlugPhraseMatch_RanksHigher()
996public async Task SearchAsync_TitleAndSlugPhraseMatch_OutranksRepeatedBodyAndCodeMatches()
1023public async Task SearchAsync_CommandTitleAndSlug_OutrankReleaseNotesForCommonTerms()
1049public async Task SearchAsync_TitlePhrase_OutranksRepeatedCommonAzureTerms()
1075public async Task SearchAsync_WhatsNewPenalty_RanksLower()
1102public async Task SearchAsync_PartialSlugMatch_StillRanksReasonably()
1128public async Task SearchAsync_ChangelogPenalty_AppliesCorrectly()
1154public async Task SearchAsync_ReleaseNotesIdentityMatch_RequiresTokenBoundaryMatch()
1179public async Task SearchAsync_MultiWordQuery_MatchesSlugSegments()
1204public async Task SearchAsync_SingleWordQuery_UsesSegmentMatching()
1234public async Task SearchAsync_HyphenatedQuery_MatchesSlugWithExtraSegments()
1260public async Task SearchAsync_ChangelogQuery_DoesNotApplyPenalty()
1290public async Task SearchAsync_WhatsNewQuery_RanksReleaseNotesAboveNoisyMatches(string query)
1328public async Task SearchAsync_ReleaseNotesPenalty_StillAppliesToIncidentalFeatureMatches()
1355public async Task SearchAsync_VersionQuery_MatchesSlugWithCollapsedVersion(string query)
1382return Task.FromResult(content);
1390return Task.FromResult(contentProvider());
1400return Task.FromResult(_contents.Count > 0 ? _contents.Dequeue() : null);
1693await Task.Delay(delay, cancellationToken);
1700public Task<string?> GetAsync(string key, CancellationToken cancellationToken = default) => Task.FromResult<string?>(null);
1701public Task SetAsync(string key, string content, CancellationToken cancellationToken = default) => Task.CompletedTask;
1702public Task<string?> GetETagAsync(string url, CancellationToken cancellationToken = default) => Task.FromResult<string?>(null);
1703public Task SetETagAsync(string url, string? etag, CancellationToken cancellationToken = default) => Task.CompletedTask;
1704public Task<LlmsDocument[]?> GetIndexAsync(CancellationToken cancellationToken = default) => Task.FromResult<LlmsDocument[]?>(null);
1705public Task SetIndexAsync(LlmsDocument[] documents, CancellationToken cancellationToken = default) => Task.CompletedTask;
1706public Task<string?> GetIndexSourceFingerprintAsync(CancellationToken cancellationToken = default) => Task.FromResult<string?>(null);
1707public Task SetIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default) => Task.CompletedTask;
1708public Task InvalidateAsync(string key, CancellationToken cancellationToken = default) => Task.CompletedTask;
1721return Task.FromResult(value);
1724public Task SetAsync(string key, string content, CancellationToken cancellationToken = default)
1727return Task.CompletedTask;
1733return Task.FromResult(value);
1736public Task SetETagAsync(string url, string? etag, CancellationToken cancellationToken = default)
1747return Task.CompletedTask;
1751=> Task.FromResult(_index);
1753public Task SetIndexAsync(LlmsDocument[] documents, CancellationToken cancellationToken = default)
1756return Task.CompletedTask;
1760=> Task.FromResult(_indexSourceFingerprint);
1762public Task SetIndexSourceFingerprintAsync(string fingerprint, CancellationToken cancellationToken = default)
1765return Task.CompletedTask;
1768public Task InvalidateAsync(string key, CancellationToken cancellationToken = default)
1771return Task.CompletedTask;
ProfileCaptureServiceTests.cs (23)
35public async Task StartAsync_LaunchesPrivateDashboardWithConfiguredPortsAndCollectorEnvironment()
87public async Task StartAsync_UsesBundleLayoutManagedPath_WhenOverrideIsAbsent()
114public async Task StartAsync_ThrowsManagedBinaryNotFound_WhenNoManagedBinaryCanBeResolved()
132public async Task StartAsync_WrapsProcessFactoryFailure()
155public async Task StartAsync_WrapsProcessStartFailureAndDisposesExecution()
165process = new TestProcessExecution(fileName, args, env, options, (_, _, _) => Task.FromResult((0, (string?)null)), () => 1)
187public async Task StartAsync_DisposesDashboardProcess_WhenReadinessTimesOut()
216public async Task WaitForDashboardAsync_ReturnsAfterTransientConnectionFailures()
239public async Task WaitForDashboardAsync_ThrowsDashboardExited_WhenProcessExitsBeforeReady()
242var process = CreateStartedProcess((_, _) => Task.FromResult(42));
255public async Task WaitForDashboardAsync_ThrowsTimeout_WhenDashboardNeverResponds()
275public async Task DisposeAsync_StopsWaitingForExitAfterBoundedTimeout()
286attemptCallback: (_, _, _) => Task.FromResult((0, (string?)null)),
300var disposeTask = session.DisposeAsync().AsTask();
307await Task.Yield();
318public async Task ExportAsync_WritesArchiveAfterSessionSpansReachSteadyState()
354public async Task ExportAsync_WritesArchiveWhenDcpSessionSpansUseDcpSessionAttribute()
377public async Task ExportAsync_ReturnsFailure_WhenNoResourceSpansAreExported()
398public async Task ExportAsync_ReturnsFailure_WhenOnlyOtherSessionSpansAreExported()
414public async Task ExportAsync_ThrowsHttpRequestException_WhenTelemetryApiReturnsHtmlFallback()
430public async Task ExportAsync_ThrowsJsonException_WhenTelemetryApiReturnsInvalidJson()
555attemptCallback: (_, _, _) => Task.FromResult((0, (string?)null)),
576(_, _, _) => Task.FromResult((0, (string?)null)),
Projects\ProjectLocatorTests.cs (140)
59public async Task UseOrFindAppHostProjectFilePreservesExistingDefaultForInvocationScopedSelection(string selectionOrigin)
90public async Task UseOrFindAppHostProjectFilePreservesExistingDefaultForExplicitAppHost()
119public async Task UseOrFindAppHostProjectFilePreservesExistingDefaultForEmptySelectionOrigin()
152public async Task UseOrFindAppHostProjectFileReplacesExistingDefaultForPersistentSelectionOrigin(string selectionOrigin)
185public async Task UseOrFindAppHostProjectFilePersistsSelectionFromExplicitDirectoryPrompt(string? selectionOrigin)
218public async Task UseOrFindAppHostProjectFilePreservesExistingDefaultForSingleAppHostDirectory()
247public async Task UseOrFindAppHostProjectFileEstablishesDefaultForLaunchConfiguration()
271public async Task UseOrFindAppHostProjectFileEstablishesDefaultForExplicitAppHost()
293public async Task ConcurrentLaunchConfigurationsEstablishWorkspaceDefaultOnce()
330var results = await Task.WhenAll(callers).DefaultTimeout();
366public async Task UseOrFindAppHostProjectFileReplacesDeletedDefaultForInvocationScopedSelection(string selectionOrigin)
397public async Task UseOrFindAppHostProjectFilePreservesInvalidExistingDefaultForLaunchConfiguration()
433public async Task UseOrFindAppHostProjectFileReplacesDeletedDefaultForExplicitAppHost()
483public async Task UseOrFindAppHostProjectFileThrowsIfExplicitProjectFileDoesNotExist()
500public async Task UseOrFindAppHostProjectFileKeepsExplicitAppHostThatCannotBeEvaluated()
533public async Task UseOrFindAppHostProjectFileKeepsConfiguredAppHostThatCannotBeEvaluatedAndIgnoresHealthyDecoy()
583public async Task UseOrFindAppHostProjectFileKeepsConfiguredAppHostOutsideAmbientDiscoveryRoot()
620public async Task UseOrFindAppHostProjectFileThrowsWhenAmbientDiscoveryOnlyFindsUnbuildableAppHosts()
656public async Task UseOrFindAppHostProjectFileThrowsSpecificDiagnosticWhenExplicitFileIsMissing()
687public async Task UseOrFindAppHostProjectFileThrowsSpecificDiagnosticWhenExplicitFileIsDefinitelyNotAnAppHost()
715public async Task UseOrFindAppHostProjectFileUsesCachedSettingsWhenStillValidAmongMultipleAppHosts()
748public async Task UseOrFindAppHostProjectFileUsesAppHostSpecifiedInSettings()
776public async Task UseOrFindAppHostProjectFileUsesAppHostSpecifiedInSettingsWalksTree()
806public async Task UseOrFindAppHostProjectFileFallsBackWhenSettingsFileSpecifiesNonexistentAppHost()
847public async Task UseOrFindAppHostProjectFileFallsBackWhenSettingsFileSpecifiesExistingNonAppHost()
896public async Task UseOrFindAppHostProjectFileFallsBackToSingleFileAppHostWhenLegacySettingsFileSpecifiesMissingAppHostPath()
922public async Task UseOrFindAppHostProjectFileFallsBackToSingleFileAppHostWhenConfigFileSpecifiesMissingAppHostPath()
958public async Task UseOrFindAppHostProjectFileUsesValidSettingsWithoutScanning()
996public async Task UseOrFindAppHostProjectFileUsesValidSettingsWithoutScanningInThrowMode()
1034public async Task UseOrFindAppHostProjectFileUsesValidGuestAppHostSettingsWithoutScanning()
1070public async Task UseOrFindAppHostProjectFileFallsBackToDiscoveryWhenConfiguredAppHostIsUnsupported()
1119public async Task UseOrFindAppHostProjectFileKeepsConfiguredAppHostThatCannotBeEvaluatedWhenListingCandidates()
1175public async Task UseOrFindAppHostProjectFileScansWhenCandidateListingModeHasValidSettings()
1212public async Task UseOrFindAppHostProjectFileIncludesSettingsAppHostInCandidatesWhenOutsideDiscovery()
1252public async Task UseOrFindAppHostProjectFileTreatsSettingsAppHostWithoutProjectHandlerAsUnsupported()
1286public async Task UseOrFindAppHostProjectFileNormalizesForwardSlashesInSettings()
1318public async Task UseOrFindAppHostProjectFilePromptsWhenMultipleFilesFound()
1336public async Task UseOrFindAppHostProjectFileOnlyConsidersValidAppHostProjects()
1364public async Task UseOrFindAppHostProjectFileThrowsIfNoProjectWasFound()
1382public async Task UseOrFindAppHostProjectFileReturnsExplicitProjectIfExistsAndProvided(string projectFileExtension)
1397public async Task UseOrFindAppHostProjectFileResultUsesOnDiskCasingForExplicitPath()
1429public async Task UseOrFindAppHostProjectFileReturnsProjectFileInDirectoryIfNotExplicitlyProvided()
1443public async Task UseOrFindAppHostProjectFileUpdatesStaleConfigForExplicitProjectFile()
1468projectFactory: new TestTypeScriptStarterProjectFactory((_, _, _) => Task.FromResult(true)));
1480public async Task CreateSettingsFileIfNotExistsAsync_UsesForwardSlashPathSeparator()
1519public async Task UseOrFindAppHostProjectFile_UpdatesAppHostAdjacentConfigWhenDiscoveredFromParent()
1586public async Task UseOrFindAppHostProjectFile_UpdatesSelectedAppHostAdjacentConfigWhenMultipleAppHostsFound()
1656public async Task UseOrFindAppHostProjectFile_HealsStaleAppHostPathInAdjacentConfig()
1703public async Task UseOrFindAppHostProjectFile_MigratesLegacySettingsToAspireConfigJson()
1748public async Task FindAppHostProjectFilesAsync_DiscoversSingleFileAppHostInRootDirectory()
1773public async Task FindAppHostProjectFilesAsync_DiscoversSingleFileAppHostInSubdirectory()
1798public async Task FindAppHostProjectFilesAsync_IgnoresSingleFileAppHostWhenSiblingCsprojExists()
1854public async Task FindAppHostProjectFilesAsync_IgnoresSingleFileAppHostWithoutDirective()
1873public async Task FindAppHostProjectFilesAsync_HandlesMixedAppHostAndSingleFile()
1916public async Task FindAppHostProjectFilesAsync_DoesNotDuplicateFilesThatMatchMultiplePatterns()
1943public async Task UseOrFindAppHostProjectFileAsync_AcceptsExplicitSingleFileAppHost()
1966public async Task UseOrFindAppHostProjectFileAsync_RejectsInvalidSingleFileAppHost()
1988public async Task UseOrFindAppHostProjectFileAsync_PreservesSilentDiscoveryWhenInvalidAppHostCsFallsBackToParentDirectory()
2014public async Task UseOrFindAppHostProjectFileAsync_AllowsSingleFileAppHostWithSiblingCsproj()
2040public async Task UseOrFindAppHostProjectFileAsync_RejectsInvalidFileExtension()
2059public async Task UseOrFindAppHostProjectFileAsync_ThrowsMultipleProjectsWhenBothCsprojAndSingleFileFound()
2100public Task SetConfigurationAsync(string key, string value, bool isGlobal = false, CancellationToken cancellationToken = default)
2103return Task.CompletedTask;
2109return Task.FromResult(false);
2114return Task.FromResult(new Dictionary<string, string>());
2119return Task.FromResult(new Dictionary<string, string>());
2124return Task.FromResult(new Dictionary<string, string>());
2130return Task.FromResult<string?>(null);
2135return Task.FromResult<string?>(null);
2152=> Task.FromResult<string?>(null);
2155=> Task.FromResult<LanguageId?>(null);
2158=> Task.FromResult<LanguageId?>(null);
2202=> Task.FromResult<string[]>([supportedFileName]);
2207public Task ScaffoldAsync(DirectoryInfo directory, string? projectName, CancellationToken cancellationToken)
2220=> Task.FromResult(new AppHostValidationResult(IsValid: appHostFile.Name.Equals(supportedFileName, StringComparison.OrdinalIgnoreCase)));
2223=> Task.FromResult<string?>(VersionHelper.GetDefaultTemplateVersion());
2232=> Task.FromResult(RunningInstanceResult.NoRunningInstance);
2235=> Task.FromResult<string?>(null);
2250public async Task UseOrFindAppHostProjectFileAcceptsDirectoryPathWithSingleProject()
2282public async Task UseOrFindAppHostProjectFileThrowsWhenDirectoryHasNoProjects()
2304public async Task UseOrFindAppHostProjectFileKeepsSingleUnbuildableAppHostInExplicitDirectory()
2333public async Task UseOrFindAppHostProjectFileThrowsWhenExplicitDirectoryHasMultipleUnbuildableAppHosts()
2373public async Task UseOrFindAppHostProjectFileDoesNotSelectUnbuildableConfiguredAppHostOutsideExplicitDirectory()
2416public async Task UseOrFindAppHostProjectFileIgnoresBuildableConfiguredAppHostOutsideExplicitDirectory()
2459public async Task UseOrFindAppHostProjectFileListsOnlyExplicitDirectoryProjectsWhenSelectionIsDisabled()
2504public async Task UseOrFindAppHostProjectFileIgnoresUnsupportedConfiguredAppHostOutsideExplicitDirectory()
2555public async Task UseOrFindAppHostProjectFileKeepsUnbuildableConfiguredAppHostWhenMultipleHealthyAppHostsExist()
2607public async Task UseOrFindAppHostProjectFilePromptsWhenDirectoryHasMultipleProjects()
2644public async Task UseOrFindAppHostProjectFileAcceptsDirectoryPathWithSingleFileAppHost()
2671public async Task UseOrFindAppHostProjectFileAcceptsDirectoryPathWithRecursiveSearch()
2709public async Task FindAppHostProjectFilesAsync_DoesNotDetectAppHostCsWithoutSdkDirective()
2752public async Task FindAppHostProjectFilesAsync_DoesNotDetectAppHostCsWithSiblingCsproj()
2795public async Task FindAppHostProjectFilesAsync_DetectsValidSingleFileAppHost()
2821public async Task FindAppHostProjectFilesAsync_ExcludesDotNetProjectsWhenSdkNotAvailable()
2842public async Task FindAppHostProjectFilesAsync_IncludesDotNetProjectsWhenSdkAvailable()
2864public async Task FindAppHostProjectsAsync_WritesSdkWarningToErrorStreamWhenFindingCandidatesForLs()
2890public async Task FindAppHostProjectFilesAsync_DoesNotCheckSdkWhenNoDotNetProjects()
2915public async Task FindAppHostProjectFilesAsync_ExcludesProjectsInsideNuGetCache()
2952public async Task FindAppHostProjectFilesAsync_FindsProjectsOutsideNuGetCache()
2983public async Task FindAppHostProjectFilesAsync_RespectsCustomNuGetPackagesEnvVar()
3020public async Task FindAppHostProjectFilesAsync_DoesNotExcludeSiblingDirectoriesOfNuGetCache()
3060public async Task UseOrFindAppHostProjectFile_SingleAspireConfigJson_FindsAppHost()
3083public async Task UseOrFindAppHostProjectFile_MultipleAspireConfigJsonFiles_FallsThroughToScan()
3113public async Task UseOrFindAppHostProjectFile_AspireConfigJsonPointsToNonexistentFile_FallsThroughToScan()
3137public async Task UseOrFindAppHostProjectFile_MultipleAppHosts_NoConfig_ThrowBehavior_Throws()
3160public async Task UseOrFindAppHostProjectFile_MultipleAppHosts_NoConfig_ThrowBehavior_CancelsRemainingValidationEarly()
3186await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
3217public async Task UseOrFindAppHostProjectFile_WithSettingsAndMultipleAppHosts_ThrowBehavior_UsesCachedSelection()
3250public async Task UseOrFindAppHostProjectFile_WithSettingsAndMultipleAppHosts_PromptBehavior_UsesCachedSelection()
3285public async Task FindAppHostProjectsAsync_DefaultFiltered_ExcludesNodeModulesByDefault_NonGitRepo()
3314public async Task FindAppHostProjectsAsync_AllFilesScope_IncludesEverything()
3343public async Task FindAppHostProjectFilesAsync_LegacyStringOverload_UsesAllFilesScope()
3372public async Task FindAppHostProjectsAsync_IncludesCandidateStatus()
3410public async Task FindAppHostProjectsAsync_ExplicitDirectoryScope_AppliesSkipListButNotGit()
3433GetIncludedFilesAsyncCallback = (_, _) => Task.FromResult<IReadOnlySet<string>?>(new HashSet<string>
3450public async Task FindAppHostProjectFilesAsync_ExplicitDirectoryScope_DoesNotIncludeParentConfiguredAppHost()
3485public async Task FindAppHostProjectsAsync_DefaultFiltered_GitMode_OnlyIncludesGitListedFiles()
3505GetIncludedFilesAsyncCallback = (_, _) => Task.FromResult<IReadOnlySet<string>?>(new HashSet<string>
3521public async Task FindAppHostProjectsAsync_DefaultFiltered_GitMode_AppliesSkipListEvenWhenGitIncludesPath()
3541GetIncludedFilesAsyncCallback = (_, _) => Task.FromResult<IReadOnlySet<string>?>(new HashSet<string>
3558public async Task FindAppHostProjectsAsync_DefaultFiltered_GitMode_DropsDeletedTrackedFiles()
3576GetIncludedFilesAsyncCallback = (_, _) => Task.FromResult<IReadOnlySet<string>?>(new HashSet<string>
3614public async Task GetAppHostFromSettings_ReturnsConfiguredAppHostEvenWhenValidationWouldFail()
3639ValidateAppHostAsyncCallback = (_, _) => Task.FromResult(new AppHostValidationResult(IsValid: false))
3652public async Task GetAppHostFromSettings_ReturnsNullWhenConfiguredFileDoesNotExist()
3678public async Task GetAppHostFromSettings_ReturnsNullWhenNoHandlerCanProcessFile()
3709public async Task UseOrFindAppHostProjectFile_RejectsUnbuildableSettingsAppHost()
3735ValidateAppHostAsyncCallback = (_, _) => Task.FromResult(new AppHostValidationResult(IsValid: false))
3751public async Task GetAppHostFromSettings_LegacyFile_WarningNamesSettingsJsonNotAspireConfigJson()
3790public async Task GetAppHostFromSettings_AspireConfigJson_WithNulByteInPath_ReportsValidationErrorAndDoesNotCrash()
3825public async Task GetAppHostFromSettings_LegacySettings_WithNulByteInPath_ReportsValidationErrorAndDoesNotCrash()
3850public async Task GetAppHostFromSettings_AspireConfigJson_WithEmptyPath_ReportsValidationErrorAndDoesNotCrash()
3878public async Task GetAppHostFromSettings_LegacySettings_WithEmptyPath_ReportsValidationErrorAndDoesNotCrash()
3903public async Task GetAppHostFromSettings_MalformedConfig_SilentProbeLogsWarning()
3932public async Task GetAppHostFromSettings_MalformedLegacySettings_SilentProbeLogsWarning()
3962public async Task GetAppHostFromSettings_LegacySettingsWithNonStringPath_ReportsValidationErrorAndDoesNotCrash()
3989public async Task GetAppHostFromSettings_LegacySettingsWithNonObjectRoot_ReportsValidationErrorAndDoesNotCrash()
4016public async Task FindAppHostProjectsAsync_DeduplicatesSettingsCandidateAcrossSymlink()
4086public async Task FindAppHostProjectsAsync_DeduplicatesAspireConfigCandidateWithDifferentCasing()
4124public async Task FindAppHostProjectsAsync_DefaultFiltered_IncludesSettingsCandidateUnderSkippedDirectory()
Telemetry\InternalMicrosoftDetectorTests.cs (32)
19public async Task IsInternalMicrosoftMachineAsync_UsesFreshCache()
43return Task.FromResult(InternalMicrosoftProbeResult.NotDetected);
58public async Task IsInternalMicrosoftMachineAsync_RunsProbesWhenCacheIsStaleAndUpdatesCache()
74[new InternalMicrosoftProbe("positive", _ => Task.FromResult(new InternalMicrosoftProbeResult(IsInternalMicrosoft: true, Alias: "stale.alias", Domain: "STALE")))]
93public async Task IsInternalMicrosoftMachineAsync_RunsNextStageOnlyWhenPreviousStageDoesNotDetect()
104return Task.FromResult(InternalMicrosoftProbeResult.NotDetected);
109return Task.FromResult(new InternalMicrosoftProbeResult(IsInternalMicrosoft: true, Alias: "stage.alias", Domain: "STAGE"));
114return Task.FromResult(new InternalMicrosoftProbeResult(IsInternalMicrosoft: true, Alias: "unused.alias", Domain: "UNUSED"));
128public async Task IsInternalMicrosoftMachineAsync_CancelsOtherProbesInStageAfterSuccessfulProbe()
149await Task.Delay(TimeSpan.FromMinutes(5), cancellationToken);
172public async Task IsInternalMicrosoftMachineAsync_ReturnsPositiveResultWhenCancelledProbeFaultsDuringDrain()
192await Task.Delay(TimeSpan.FromMinutes(5), cancellationToken);
213public async Task IsInternalMicrosoftMachineAsync_RunsLaterStagesWhenProbeThrowsUnexpectedException()
221[new InternalMicrosoftProbe("positive", _ => Task.FromResult(new InternalMicrosoftProbeResult(IsInternalMicrosoft: true, Alias: "later.alias", Domain: "LATER")))]
233public async Task CheckWindowsUserDnsDomainAsync_UsesExecutionContextEnvironment()
254public async Task CheckWindowsWorkplaceJoinAsync_UsesExecutionContextEnvironmentAndProcessFactory()
291public async Task CheckWindowsWorkplaceJoinAsync_ReturnsNotDetectedWhenProcessStartTimesOutInternally()
321public async Task CheckGitHubMembershipWithTokenAsync_ReturnsFalseWhenUserRequestFails()
325Task.FromResult(request.RequestUri?.AbsolutePath switch
343public async Task CheckGitHubMembershipWithTokenAsync_ReturnsTrueForActivePrivateMembership()
347Task.FromResult(request.RequestUri?.AbsolutePath switch
366public async Task CheckGitHubMembershipWithTokenAsync_ReturnsTrueForExplicitPublicMembership()
370Task.FromResult(request.RequestUri?.AbsolutePath switch
390public async Task CheckGitHubMembershipWithTokenAsync_ReturnsFalseForNonMember()
394Task.FromResult(request.RequestUri?.AbsolutePath switch
414public async Task CheckCopilotCliAsync_ChecksTokenCandidatesWithoutCopilotCommand()
418Task.FromResult(request.RequestUri?.AbsolutePath switch
443public async Task CheckCopilotCliAsync_LimitsGitHubTokenCandidates()
447Task.FromResult(request.RequestUri?.AbsolutePath switch
470public async Task CheckCopilotCliAsync_UsesOverallGitHubTokenCandidateTimeout()
475await Task.Delay(TimeSpan.FromMinutes(1), cancellationToken);
511public async Task CheckCopilotCliAsync_ProbesGitHubTokenCandidatesConcurrently()
Templating\TemplateNuGetConfigServiceTests.cs (58)
26public async Task CreateOrUpdateNuGetConfigForSourceOverrideAsync_CreatesSelfContainedConfigWithoutAmbientSources()
71public async Task CreateOrUpdateNuGetConfigForSourceOverrideAsync_PreservesRequestedChannelFallbackMappings()
94return Task.FromResult<IEnumerable<PackageChannel>>([channel]);
110public async Task CreateOrUpdateNuGetConfigForSourceOverrideAsync_UpdatesOnlyProjectLocalConfig()
153public async Task CreateOrUpdateNuGetConfigForSourceOverrideAsync_NullSourceShortCircuits()
171public async Task CreateOrUpdateNuGetConfigForSourceOverrideAsync_CredentialBearingHttpSourceThrows(string sourceOverride)
183public async Task PromptToCreateOrUpdateNuGetConfigAsync_NullChannelName_ShortCircuits()
195public async Task CreateOrUpdateNuGetConfigWithoutPromptAsync_NullChannelName_ShortCircuits()
215public async Task ResolveTemplatePackageAsync_NullRequestedChannel_UsesImplicitChannelOnly()
228GetIntegrationPackagesAsyncCallback = (_, _, _, _) => Task.FromResult(Enumerable.Empty<Aspire.Shared.NuGetPackageCli>())
230return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh]);
251public async Task ResolveTemplatePackage_RequestedChannel_NotFound_Throws()
263return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh]);
280public async Task ResolveTemplatePackage_RequestedChannel_Matches_ReturnsThatChannel()
296GetTemplatePackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
302return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh, stableCh]);
322public async Task ResolveTemplatePackageAsync_RequestedChannelWithSourceOverride_ReplacesAspireSource()
340return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
365return Task.FromResult<IEnumerable<PackageChannel>>([channel]);
379public async Task ResolveTemplatePackageAsync_SourceOverrideWithoutRequestedChannel_UsesImplicitChannelOnly()
398return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
422return Task.FromResult<IEnumerable<PackageChannel>>([implicitChannel, hiveChannel]);
440public async Task ResolveTemplatePackageAsync_LocalSourceOverrideDoesNotFilterToChannelPin()
463GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([channel])
480public async Task InstallTemplatePackageAsync_SourceOverride_UsesExclusiveSource()
538public async Task ResolveTemplatePackageAsync_NonExistentRequestedChannel_NotLocal_StillThrowsChannelNotFound()
548return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh]);
581public async Task ResolveTemplatePackageAsync_IncludePrHives_RespectsHiveGate(
604GetTemplatePackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
617return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh, hiveCh]);
640public async Task ResolveTemplatePackageAsync_UnqualifiedLocalIdentityWithoutMatchingIdentityChannelPackage_ThrowsActionableError()
661GetTemplatePackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
695return Task.FromResult<IEnumerable<PackageChannel>>([implicitChannel, stagingChannel, prChannel, localChannel]);
717public async Task ResolveTemplatePackageAsync_LocalIdentityWithExplicitLocalChannel_UsesRequestedChannelVersion()
737GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([localChannel])
754public async Task ResolveTemplatePackageAsync_InitLocalChannelDoesNotFilterToPinnedVersion()
780GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([localChannel])
796public async Task ResolveTemplatePackageAsync_ExplicitVersionFindsExactLocalPackageBelowNewerPinnedVersion()
816GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([localChannel])
832public async Task ResolveTemplatePackageAsync_ExplicitVersionNotFound_ThrowsInsteadOfSelectingAnotherVersion()
851GetChannelsAsyncCallback = _ => Task.FromResult<IEnumerable<PackageChannel>>([localChannel])
873public async Task ResolveTemplatePackageAsync_UnqualifiedLocalIdentity_PrefersMatchingLocalPackage()
904return Task.FromResult<IEnumerable<PackageChannel>>([stagingChannel, localChannel]);
922public async Task ResolveTemplatePackageAsync_LocalIdentityWithExplicitChannel_UsesRequestedChannel()
942return Task.FromResult<IEnumerable<PackageChannel>>([stagingChannel]);
974public async Task ResolveTemplatePackageAsync_IdentityPackagesOverride_IncludesLocalChannelEvenWhenPrHivesSuppressed()
992GetTemplatePackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>(
1005return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh, localStableCh]);
1025public async Task ResolveTemplatePackageAsync_ImplicitDiscovery_FindsHierarchicalTemplateFromFileUriMappedLocalChannel()
1056return Task.FromResult<IEnumerable<PackageChannel>>([implicitCh, localChannel]);
1095public async Task PromptToCreateOrUpdateNuGetConfigAsync_ExplicitChannelRequiringConfig_CreatesConfig()
1114return Task.FromResult<IEnumerable<PackageChannel>>([dailyCh]);
1135public async Task PromptToCreateOrUpdateNuGetConfigAsync_StableChannel_DoesNotCreateConfig()
1152return Task.FromResult<IEnumerable<PackageChannel>>([stableCh]);
1165public async Task PromptToCreateOrUpdateNuGetConfigAsync_StableChannel_UpdatesExistingConfig()
1197return Task.FromResult<IEnumerable<PackageChannel>>([stableCh]);
1220public async Task CreateOrUpdateNuGetConfigWithoutPromptAsync_StableChannel_RespectsExistingConfig(bool hasExistingConfig)
1254return Task.FromResult<IEnumerable<PackageChannel>>([stableCh]);
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
TestServices\TestAppHostCliBackchannel.cs (14)
12public Func<Task>? RequestStopAsyncCallback { get; set; }
25public Func<string, CancellationToken, Task>? ConnectAsyncCallback { get; set; }
37public Task RequestStopAsync(CancellationToken cancellationToken)
46return Task.CompletedTask;
50public Task NotifyAppHostReadyAsync(CancellationToken cancellationToken)
53return Task.CompletedTask;
61: Task.FromResult(
107public Task ConnectAsync(string socketPath, int retryCount, CancellationToken cancellationToken)
110public async Task ConnectAsync(string socketPath, bool autoReconnect, int retryCount, CancellationToken cancellationToken)
119public async Task WaitForDisconnectAsync(CancellationToken cancellationToken)
254public Task CompletePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
256return Task.CompletedTask;
259public Task UpdatePromptResponseAsync(string promptId, PublishingPromptInputAnswer[] answers, CancellationToken cancellationToken)
261return Task.CompletedTask;
TestServices\TestDotNetCliRunner.cs (24)
36? Task.FromResult(AddPackageAsyncCallback(projectFilePath, packageName, packageVersion, nugetSource, noRestore, options, cancellationToken))
43? Task.FromResult(AddProjectToSolutionAsyncCallback(solutionFile, projectFile, options, cancellationToken))
44: Task.FromResult(0); // If not overridden, just return success.
50? Task.FromResult(BuildAsyncCallback(projectFilePath, noRestore, options, cancellationToken))
57? Task.FromResult(RestoreAsyncCallback(projectFilePath, options, cancellationToken))
58: Task.FromResult(0); // If not overridden, just return success.
66? Task.FromResult(GetAppHostInformationAsyncCallback(projectFile, options, cancellationToken))
67: Task.FromResult<(int, bool, string?)>((0, true, informationalVersion));
73? Task.FromResult(GetNuGetConfigPathsAsyncCallback(workingDirectory, options, cancellationToken))
74: Task.FromResult((0, GetGlobalNuGetPaths())); // If not overridden, return success with no config paths which will blow up.
96return Task.FromResult(GetProjectItemsAndPropertiesAsyncCallbackWithTargets(projectFile, items, properties, targets, options, cancellationToken));
106return Task.FromResult(GetProjectItemsAndPropertiesAsyncCallback(projectFile, items, properties, options, cancellationToken));
126return Task.FromResult<(int, JsonDocument?)>((exitCode, JsonDocument.Parse(json)));
141return Task.FromResult<(int, JsonDocument?)>((0, JsonDocument.Parse(defaultJson)));
147? Task.FromResult(InstallTemplateAsyncCallback(packageName, version, nugetConfigFile, nugetSource, force, options, cancellationToken))
148: Task.FromResult<(int, string?)>((0, version)); // If not overridden, just return success for the version specified.
156? Task.FromResult(NewProjectAsyncCallback(templateName, name, outputPath, options, cancellationToken))
157: Task.FromResult(0); // If not overridden, just return success.
182? Task.FromResult(SearchPackagesAsyncCallback(workingDirectory, query, exactMatch, prerelease, take, skip, nugetConfigFile, useCache, options, cancellationToken))
189? Task.FromResult(GetSolutionProjectsAsyncCallback(solutionFile, options, cancellationToken))
190: Task.FromResult<(int, IReadOnlyList<FileInfo>)>((0, Array.Empty<FileInfo>()));
196? Task.FromResult(AddProjectReferenceAsyncCallback(projectFile, referencedProject, options, cancellationToken))
197: Task.FromResult(0);
201=> Task.FromResult(0);
TestServices\TestExtensionBackchannel.cs (59)
17public Func<string, string, Task>? DisplayMessageAsyncCallback { get; set; }
20public Func<string, Task>? DisplaySuccessAsyncCallback { get; set; }
23public Func<string, Task>? DisplaySubtleMessageAsyncCallback { get; set; }
26public Func<string, Task>? DisplayErrorAsyncCallback { get; set; }
29public Func<Task>? DisplayEmptyLineAsyncCallback { get; set; }
32public Func<string, string, Task>? DisplayIncompatibleVersionErrorAsyncCallback { get; set; }
35public Func<Task>? DisplayCancellationMessageAsyncCallback { get; set; }
38public Func<IEnumerable<DisplayLineState>, Task>? DisplayLinesAsyncCallback { get; set; }
41public Func<DashboardUrlsState, Task>? DisplayDashboardUrlsAsyncCallback { get; set; }
44public Func<string?, Task>? ShowStatusAsyncCallback { get; set; }
63public Func<string, Task>? OpenEditorAsyncCallback { get; set; }
66public Func<LogLevel, string, Task>? LogMessageAsyncCallback { get; set; }
75public Func<string, List<string>, List<EnvVar>, bool, Task>? LaunchAppHostAsyncCallback { get; set; }
80public Func<string, string?, bool, DebugSessionOptions?, Task>? StartDebugSessionAsyncCallback { get; set; }
83public Func<string, Task>? DisplayPlainTextAsyncCallback { get; set; }
86public Func<string, bool, string?, Task>? WriteDebugSessionMessageAsyncCallback { get; set; }
88public Task ConnectAsync(CancellationToken cancellationToken)
92return Task.CompletedTask;
95public Task DisplayMessageAsync(string emojiName, string message, CancellationToken cancellationToken)
98return DisplayMessageAsyncCallback?.Invoke(emojiName, message) ?? Task.CompletedTask;
101public Task DisplaySuccessAsync(string message, CancellationToken cancellationToken)
104return DisplaySuccessAsyncCallback?.Invoke(message) ?? Task.CompletedTask;
107public Task DisplaySubtleMessageAsync(string message, CancellationToken cancellationToken)
110return DisplaySubtleMessageAsyncCallback?.Invoke(message) ?? Task.CompletedTask;
113public Task DisplayErrorAsync(string errorMessage, CancellationToken cancellationToken)
116return DisplayErrorAsyncCallback?.Invoke(errorMessage) ?? Task.CompletedTask;
119public Task DisplayEmptyLineAsync(CancellationToken cancellationToken)
122return DisplayEmptyLineAsyncCallback?.Invoke() ?? Task.CompletedTask;
125public Task DisplayIncompatibleVersionErrorAsync(string appHostHostingVersion, string errorMessage, CancellationToken cancellationToken)
128return DisplayIncompatibleVersionErrorAsyncCallback?.Invoke(appHostHostingVersion, errorMessage) ?? Task.CompletedTask;
131public Task DisplayCancellationMessageAsync(CancellationToken cancellationToken)
134return DisplayCancellationMessageAsyncCallback?.Invoke() ?? Task.CompletedTask;
137public Task DisplayLinesAsync(IEnumerable<DisplayLineState> lines, CancellationToken cancellationToken)
140return DisplayLinesAsyncCallback?.Invoke(lines) ?? Task.CompletedTask;
143public Task DisplayDashboardUrlsAsync(DashboardUrlsState dashboardUrls, CancellationToken cancellationToken)
146return DisplayDashboardUrlsAsyncCallback?.Invoke(dashboardUrls) ?? Task.CompletedTask;
149public Task ShowStatusAsync(string? status, CancellationToken cancellationToken)
152return ShowStatusAsyncCallback?.Invoke(status) ?? Task.CompletedTask;
160: Task.FromResult(defaultValue);
172return Task.FromResult(choices.First());
184return Task.FromResult<IReadOnlyList<T>>(choices.ToList());
192: Task.FromResult(true);
200: Task.FromResult(defaultValue ?? string.Empty);
208: Task.FromResult(string.Empty);
211public Task OpenEditorAsync(string projectPath, CancellationToken cancellationToken)
216: Task.CompletedTask;
219public Task LogMessageAsync(LogLevel logLevel, string message, CancellationToken cancellationToken)
224: Task.CompletedTask;
232: Task.FromResult(Array.Empty<string>());
248public Task LaunchAppHostAsync(string projectPath, List<string> arguments, List<EnvVar> envVars, bool debug, CancellationToken cancellationToken)
253: Task.CompletedTask;
256public Task NotifyAppHostStartupCompletedAsync(CancellationToken cancellationToken)
259return Task.CompletedTask;
262public Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug,
268: Task.CompletedTask;
271public Task DisplayPlainTextAsync(string text, CancellationToken cancellationToken)
276: Task.CompletedTask;
279public Task WriteDebugSessionMessageAsync(string message, bool stdout, string? textStyle, CancellationToken cancellationToken)
284: Task.CompletedTask;
TestServices\TestExtensionInteractionService.cs (18)
29public Func<IRenderable, Func<Action<IRenderable>, Task>, Task>? DisplayLiveAsyncCallback { get; set; }
35public Task FlushAsync(CancellationToken cancellationToken = default)
38return Task.CompletedTask;
63return Task.FromResult(binding?.DefaultValue ?? string.Empty);
85return Task.FromResult(matchingChoice);
89return Task.FromResult(choicesArray.First());
101return Task.FromResult<IReadOnlyList<T>>(preSelected.ToList());
104return Task.FromResult<IReadOnlyList<T>>(choices.ToList());
140public Task StartDebugSessionAsync(string workingDirectory, string? projectFile, bool debug, DebugSessionOptions? options = null)
143return Task.CompletedTask;
162return Task.FromResult(ConfirmCallback?.Invoke(promptText, defaultValue) ?? true);
207public Task DisplayLiveAsync(IRenderable initialRenderable, Func<Action<IRenderable>, Task> callback)
226public Task RequestAppHostAttachAsync(int processId, string projectName)
229return Task.CompletedTask;
239public Task LaunchAppHostAsync(string projectFile, List<string> arguments, List<EnvVar> environment, bool debug)
242return Task.CompletedTask;
Utils\CliUpdateNotificationServiceTests.cs (19)
19public async Task PrereleaseWillRecommendUpgradeToPrereleaseOnSameVersionFamily()
29var cache = new FakeNuGetPackageCache { GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
66public async Task PrereleaseWillRecommendUpgradeToStableInCurrentVersionFamily()
76var cache = new FakeNuGetPackageCache { GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
110public async Task StableWillOnlyRecommendGoingToNewerStable()
120var cache = new FakeNuGetPackageCache { GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
180public async Task NotifyIfUpdateAvailable_UsesDotnetToolCommandForNativeAotToolStorePath()
191GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
216public async Task NotifyIfUpdateAvailable_UsesToolPathCommandForCustomToolPath()
229GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
254public async Task NotifyIfUpdateAvailable_UsesAspireUpdateCommandForStandaloneArchivePath()
265GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
290public async Task NotifyIfUpdateAvailable_UsesNpmCommandForNpmInstall()
302GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
327public async Task StableWillNotRecommendUpdatingToPreview()
336var cache = new FakeNuGetPackageCache { GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
364public async Task NotifyIfUpdateAvailableAsync_WithNewerStableVersion_DoesNotThrow()
373GetCliPackagesAsyncCallback = (_, _, _, _) => Task.FromResult<IEnumerable<NuGetPackage>>([
389public async Task NotifyIfUpdateAvailableAsync_WithEmptyPackages_DoesNotThrow()
Utils\DevCertsCheckTests.cs (20)
63AsyncAttemptCallback = (_, _, _) => Task.FromResult((0, (string?)hash))
326public async Task CheckAsync_LinuxWithoutCertUtil_ReturnsCertUtilWarning()
355public async Task CheckAsync_LinuxWithCertUtil_DoesNotReturnCertUtilWarning()
393public async Task CheckAsync_LinuxWithMatchingOpenSslCertificateCache_DoesNotReturnOpenSslCertificateCacheWarning()
441public async Task CheckAsync_LinuxWithFailedOpenSslHashProbeAndMatchingHashStyleEntry_ReturnsOpenSslCertificateCacheWarning()
473AsyncAttemptCallback = (_, _, _) => Task.FromResult((1, (string?)null))
492public async Task CheckAsync_LinuxWithOpenSslHashProbeStartFailure_ReturnsOpenSslCertificateCacheWarning()
525new TestProcessExecution(fileName, args, env, options, (_, _, _) => Task.FromResult((0, (string?)"12345678")), () => 1)
547public async Task CheckAsync_LinuxWithMissingOpenSslHashEntry_ReturnsOpenSslCertificateCacheWarning()
596public async Task CheckAsync_LinuxWithCallerCanceledOpenSslHashProbeAndKillFailure_ThrowsOperationCanceledException()
633await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
656public async Task CheckAsync_LinuxWithOpenSslHashProbeFailureAndKillFailure_ReturnsOpenSslCertificateCacheWarning()
714public async Task CheckAsync_LinuxWithMissingOpenSslHashEntryAndNoOpenSsl_DoesNotReturnOpenSslCertificateCacheWarning()
756public async Task CheckAsync_LinuxWithMissingOpenSslCertificateCacheDirectory_ReturnsOpenSslCertificateCacheWarning()
800public async Task CheckAsync_LinuxWithMissingOpenSslCertificateCacheEntry_ReturnsOpenSslCertificateCacheWarning()
844public async Task CheckAsync_LinuxWithCorruptOpenSslCertificateCache_ReturnsOpenSslCertificateCacheWarning()
890public async Task CheckAsync_LinuxWithUntrustedCertificateAndCorruptOpenSslCertificateCache_ReturnsOpenSslCertificateCacheWarning()
936public async Task CheckAsync_LinuxWithUnrelatedCorruptOpenSslCertificateCache_DoesNotReturnOpenSslCertificateCacheWarning()
979public async Task CheckAsync_LinuxWithStaleOpenSslCertificateCache_ReturnsOpenSslCertificateCacheWarning()
1025public async Task CheckAsync_NonLinux_DoesNotReadEnvironmentVariablesForCertUtilWarning()
Aspire.Components.Common.TestUtilities (2)
Aspire.Confluent.Kafka (1)
Aspire.Confluent.Kafka.Tests (8)
Aspire.Dashboard (477)
Components\Pages\Resources.razor.cs (30)
110private Task? _resourceSubscriptionTask;
135private async Task OnAllFilterVisibilityCheckedChangedAsync()
142private async Task OnResourceFilterVisibilityChangedAsync(string resourceType, bool isVisible)
149private async Task HandleSearchFilterChangedAsync()
154private async Task VisibleResourcesChangedAsync()
180protected override async Task OnInitializedAsync()
257async Task SubscribeResourcesAsync()
272_resourceSubscriptionTask = Task.Run(async () =>
362protected override async Task OnAfterRenderAsync(bool firstRender)
398private async Task UpdateResourceGraphResourcesAsync()
413public async Task SelectResource(string id)
426public async Task ResourceContextMenu(string id, int screenWidth, int screenHeight, int clientX, int clientY)
561protected override async Task OnParametersSetAsync()
591await Task.Delay(200, _cts.Token);
617private async Task ShowContextMenuAsync(ResourceViewModel resource, int screenWidth, int screenHeight, int clientX, int clientY)
649private async Task ShowResourceDetailsAsync(ResourceViewModel resource, string? focusElementId)
698private async Task ClearSelectedResourceAsync(bool causedByUserAction = false)
746private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
764private async Task OnToggleCollapse(ResourceGridViewModel viewModel)
784private async Task OnToggleCollapseAll()
811private async Task OnToggleResourceType()
836private Task OnTabChangeAsync(FluentTab newTab)
845return Task.CompletedTask;
851private async Task OnViewChangedAsync(ResourceViewKind newView)
889private async Task UpdateResourceGraphSelectedAsync()
945public Task UpdateViewModelFromQueryAsync(ResourcesViewModel viewModel)
953return Task.CompletedTask;
996private async Task ContextMenuClosedAsync(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
1001private async Task ContextMenuOpenChangedAsync(bool open)
1012private async Task CloseContextMenuAsync(bool closeMenu)
Otlp\Storage\TelemetryRepository.cs (7)
280public Subscription OnNewResources(Func<Task> callback)
285public Subscription OnNewLogs(ResourceKey? resourceKey, SubscriptionType subscriptionType, Func<Task> callback)
290public Subscription OnNewMetrics(ResourceKey? resourceKey, SubscriptionType subscriptionType, Func<Task> callback)
295public Subscription OnNewTraces(ResourceKey? resourceKey, SubscriptionType subscriptionType, Func<Task> callback)
300private Subscription AddSubscription(string name, ResourceKey? resourceKey, SubscriptionType subscriptionType, Func<Task> callback, List<Subscription> subscriptions)
2160private Task OnPeerChanged()
2184return Task.CompletedTask;
Telemetry\DashboardTelemetrySender.cs (5)
18private readonly Channel<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)> _channel;
19private Task? _sendLoopTask;
38_channel = Channel.CreateBounded<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)>(channelOptions);
45_sendLoopTask = Task.Run(async () =>
162public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Aspire.Dashboard.Components.Tests (177)
Layout\MainLayoutTests.cs (21)
27public async Task OnInitialize_UnsecuredOtlp_NotDismissed_DisplayMessageBar()
41return Task.CompletedTask;
91public async Task OnInitialize_UnsecuredOtlp_Dismissed_NoMessageBar(bool unsecuredTelemetryMessageDismissedKey, bool unsecuredEndpointMessageDismissedKey)
103return Task.CompletedTask;
128var timeoutTask = Task.Delay(100);
129var completedTask = await Task.WhenAny(messageShownTcs.Task, timeoutTask).DefaultTimeout();
140public async Task OnInitialize_UnsecuredOtlp_SuppressConfigured_NoMessageBar(bool expectMessageBar, bool telemetrySuppressUnsecuredMessage)
155return Task.CompletedTask;
181var timeoutTask = Task.Delay(100);
182var completedTask = await Task.WhenAny(messageShownTcs.Task, timeoutTask).DefaultTimeout();
199public async Task NavMenuExpanded_RestoresAndPersistsToggledState(bool storedExpanded)
238public async Task HeaderDialogClose_RestoresFocusToLaunchButton(bool isDesktop, string launchButtonId, string expectedDialogId, string expectedFocusId)
245return Task.FromResult<IDialogReference>(new DialogReference(parameters.Id, dialogService!));
289public async Task HeaderDialogClose_AfterViewportChange_RestoresFocusToVisibleLaunchButton(
301return Task.FromResult<IDialogReference>(new DialogReference(parameters.Id, dialogService!));
350public async Task HeaderDialogShortcutClose_RestoresFocusToLaunchButton(AspireKeyboardShortcut shortcut, string launchButtonId, string expectedDialogId)
357return Task.FromResult<IDialogReference>(new DialogReference(parameters.Id, dialogService!));
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
tests\Shared\TestDialogService.cs (11)
26public Task CloseAsync(IDialogReference dialog) => throw new NotImplementedException();
27public Task CloseAsync(IDialogReference dialog, DialogResult result) => throw new NotImplementedException();
28public EventCallback<DialogResult> CreateDialogCallback(object receiver, Func<DialogResult, Task> callback) => throw new NotImplementedException();
29public void ShowConfirmation(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null) => throw new NotImplementedException();
30public Task<IDialogReference> ShowConfirmationAsync(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null) => throw new NotImplementedException();
94public void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
95public void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent> => throw new NotImplementedException();
96public void ShowSplashScreen(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
97public Task<IDialogReference> ShowSplashScreenAsync(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
99public Task<IDialogReference> ShowSplashScreenAsync<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent> => throw new NotImplementedException();
101public Task<IDialogReference> ShowSplashScreenAsync(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
Aspire.Dashboard.Tests (417)
Integration\Playwright\AccessibilityTests.cs (15)
76public Task DashboardPage_HasNoSeriousOrCriticalWcagViolations(string relativeUrl, string theme)
89public Task DashboardHomePage_IsAccessibleAcrossViewports(string viewportName, int width, int height)
103public Task DashboardDialog_HasNoSeriousOrCriticalWcagViolations(string surface, string theme)
119public async Task FluentDelegatedInput_ShowsVisibleFocusIndicator(string theme, string controlName, string partName)
168public async Task DarkAccentButtonInteractionStates_MeetWcagAaContrast()
233private static readonly IReadOnlyDictionary<string, (string StartUrl, string Label, Func<IPage, Task> OpenSurfaceAsync)> s_dialogSurfaces =
234new Dictionary<string, (string, string, Func<IPage, Task>)>(StringComparer.Ordinal)
240private static async Task OpenSettingsFlyoutAsync(IPage page)
253private static async Task OpenAddFilterDialogAsync(IPage page)
276public async Task CodeblockSyntaxColors_MeetWcagAaContrast(string theme)
328private async Task AssertNoBlockingWcagViolationsAsync(string relativeUrl, string theme, ViewportSize viewport, string? viewportLabel = null, Func<IPage, Task>? openSurfaceAsync = null, string? surfaceLabel = null)
430private static async Task WaitForComponentsAndFontsAsync(IPage page)
448private static Task WaitForPageContentAsync(IPage page, string relativeUrl)
529private static async Task AssertVisibleFocusIndicatorAsync(ILocator host, string partName)
Model\DashboardClientTests.cs (47)
45public async Task SubscribeResources_OnCancel_ChannelRemoved()
60var readTask = Task.Run(async () =>
75public async Task SubscribeResources_OnDispose_ChannelRemoved()
88var readTask = Task.Run(async () =>
103public async Task SubscribeResources_ThrowsIfDisposed()
113public async Task SubscribeResources_IncreasesSubscriberCount()
132public async Task SubscribeResources_HasInitialData_InitialDataReturned()
157public async Task SubscribeInteractions_OnCancel_ChannelRemoved()
171var readTask = Task.Run(async () =>
186public async Task SubscribeInteractions_OnDispose_ChannelRemoved()
198var readTask = Task.Run(async () =>
213public async Task SubscribeInteractions_ThrowsIfDisposed()
223public async Task SubscribeInteractions_IncreasesSubscriberCount()
241public async Task WhenConnected_InteractionMethodUnimplemented_InteractionWatchCompleted()
252public async Task ConnectionState_InitialState_IsConnecting()
262public async Task ConnectionState_SetConnected_FiresEvent()
278public async Task ConnectionState_DuplicateState_DoesNotFireEvent()
293public async Task ConnectionState_DisconnectedResetsWhenConnected()
312public async Task ReconnectAsync_CancelsDelay()
323public async Task ConnectionState_ConcurrentSetSameState_FiresEventOnce()
332var tasks = Enumerable.Range(0, 10).Select(_ => Task.Run(() =>
336await Task.WhenAll(tasks).DefaultTimeout();
343public async Task WatchWithRecovery_RepeatedFailures_FiresMultipleDisconnectedEvents()
374public async Task ConnectWithRetry_LogsErrorWithTroubleshootingLink()
404public async Task ConnectWithRetry_UnsupportedDashboardVersion_SetsUnsupportedState()
456public async Task ConnectWithRetry_CompatibleMinVersion_SetsConnectedState(string minDashboardVersion)
479public async Task ExecuteResourceCommandAsync_AppHostUnavailable_ReturnsClearFailure()
497public async Task ExecuteResourceCommandAsync_ClientCancellation_ReturnsAppHostDisconnectedFailure()
531Task.FromResult(new Metadata()),
542Task.FromException<ApplicationInformationResponse>(new RpcException(new Status(StatusCode.Unavailable, "Service unavailable"))),
543Task.FromResult(new Metadata()),
550Task.FromResult(new ApplicationInformationResponse
555Task.FromResult(new Metadata()),
567Task.FromResult(new Metadata()),
576Task.FromException<ResourceCommandResponse>(new RpcException(new Status(StatusCode.Unavailable, "Service unavailable"))),
577Task.FromResult(new Metadata()),
584Task.FromResult(new ResourceCommandResponse
588Task.FromResult(new Metadata()),
598await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
616Task.FromResult(new Metadata()),
639return Task.FromResult(false);
647public Task CompleteAsync()
652public Task WriteAsync(T message)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
tests\Shared\TestDialogService.cs (11)
26public Task CloseAsync(IDialogReference dialog) => throw new NotImplementedException();
27public Task CloseAsync(IDialogReference dialog, DialogResult result) => throw new NotImplementedException();
28public EventCallback<DialogResult> CreateDialogCallback(object receiver, Func<DialogResult, Task> callback) => throw new NotImplementedException();
29public void ShowConfirmation(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null) => throw new NotImplementedException();
30public Task<IDialogReference> ShowConfirmationAsync(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null) => throw new NotImplementedException();
94public void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
95public void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent> => throw new NotImplementedException();
96public void ShowSplashScreen(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
97public Task<IDialogReference> ShowSplashScreenAsync(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
99public Task<IDialogReference> ShowSplashScreenAsync<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent> => throw new NotImplementedException();
101public Task<IDialogReference> ShowSplashScreenAsync(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) => throw new NotImplementedException();
Aspire.Deployment.EndToEnd.Tests (161)
Aspire.EndToEnd.Tests (32)
tests\Shared\TemplatesTesting\AspireProject.cs (19)
163public async Task StartAppHostAsync(string[]? extraArgs = default, Action<ProcessStartInfo>? configureProcess = null, bool noBuild = true, bool waitForDashboardUrl = true, CancellationToken token = default)
270var tasksToWaitFor = new List<Task> { appRunning.Task, projectsParsed.Task };
276var successfulStartupTask = Task.WhenAll(tasksToWaitFor);
277var startupTimeoutTask = Task.Delay(TimeSpan.FromSeconds(AppStartupWaitTimeoutSecs), token);
280var resultTask = await Task.WhenAny(successfulStartupTask, AppExited.Task, startupTimeoutTask).ConfigureAwait(false);
299var allOutputCompleteTask = Task.WhenAll(stdoutComplete.Task, stderrComplete.Task);
300var allOutputCompleteTimeoutTask = Task.Delay(TimeSpan.FromSeconds(5), token);
301var completedTask = await Task.WhenAny(allOutputCompleteTask, allOutputCompleteTimeoutTask).ConfigureAwait(false);
399public Task WaitForDashboardToBeAvailableAsync(CancellationToken cancellationToken = default)
409public static async Task WaitForDashboardToBeAvailableAsync(string dashboardUrl, ITestOutputHelper testOutput, CancellationToken token = default)
418public async Task StopAppHostAsync(CancellationToken token = default)
447public async Task DumpDockerInfoAsync(ITestOutputHelper? testOutputArg = null, CancellationToken cancellationToken = default)
464public async Task DumpComponentLogsAsync(string component, ITestOutputHelper? testOutputArg = null)
Aspire.Hosting (712)
ApplicationModel\CommandsConfigurationExtensions.cs (5)
237await Task.WhenAll(replicasToStop.Select(name => orchestrator.StopResourceAsync(name, context.CancellationToken))).ConfigureAwait(false);
251var logForwardTask = ForwardLogsAsync(loggerService, rebuilderInstanceName, mainLogger, buildOutput, logCts.Token);
406private static async Task StopLogForwardingAsync(CancellationTokenSource logCts, Task logForwardTask)
438private static async Task ForwardLogsAsync(ResourceLoggerService loggerService, string sourceResourceName, ILogger targetLogger, BuildOutputCollector buildOutput, CancellationToken cancellationToken)
ApplicationModel\Docker\DockerfileStatements.cs (16)
25public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
47public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
65public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
85public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
107public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
127public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
145public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
163public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
186public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
212public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
234public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
259public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
271public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
293public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
317public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
335public override async Task WriteStatementAsync(StreamWriter writer, CancellationToken cancellationToken = default)
ApplicationModel\ResourceNotificationService.cs (29)
100/// <returns>A <see cref="Task"/> representing the wait operation.</returns>
103public Task WaitForResourceAsync(string resourceName, string? targetState = null, CancellationToken cancellationToken = default)
142private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
298private async Task WaitUntilCompletionAsync(IResource resource, IResource dependency, int exitCode, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
304var tasks = new Task[names.Length];
317await Task.WhenAll(tasks).ConfigureAwait(false);
325async Task Core(string displayName, string resourceId)
372private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior,
373Func<ILogger, string, string, ResourceEvent, Task> postRunningAction, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
379var tasks = new Task[names.Length];
387await Task.WhenAll(tasks).ConfigureAwait(false);
389async Task Core(string displayName, string resourceId)
448private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
459return Task.CompletedTask;
476public async Task WaitForDependenciesAsync(IResource resource, CancellationToken cancellationToken)
516async Task OnDependencyReadyAsync(string dependencyName)
561await Task.WhenAll(pendingDependencies).ConfigureAwait(false);
597private Task PublishWaitingForDependenciesAsync(IResource resource, IEnumerable<string> dependencyNames)
626private Task ClearWaitingForDependenciesAsync(IResource resource)
828public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
878return Task.CompletedTask;
951return Task.CompletedTask;
1040private static async Task RecordResourceStartupAsync(
1047Task readyEventTask)
1229public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
Ats\EventingExports.cs (15)
23public static void AddEventingSubscriber(this IDistributedApplicationBuilder builder, Func<EventingSubscriberRegistrationContext, Task> subscribe)
37public static void TryAddEventingSubscriber(this IDistributedApplicationBuilder builder, Func<EventingSubscriberRegistrationContext, Task> subscribe)
72internal static IResourceBuilder<T> OnBeforeResourceStarted<T>(this IResourceBuilder<T> builder, Func<BeforeResourceStartedEvent, Task> callback)
88internal static IResourceBuilder<T> OnResourceStopped<T>(this IResourceBuilder<T> builder, Func<ResourceStoppedEvent, Task> callback)
104internal static IResourceBuilder<T> OnConnectionStringAvailable<T>(this IResourceBuilder<T> builder, Func<ConnectionStringAvailableEvent, Task> callback)
120internal static IResourceBuilder<T> OnInitializeResource<T>(this IResourceBuilder<T> builder, Func<InitializeResourceEvent, Task> callback)
136internal static IResourceBuilder<T> OnResourceEndpointsAllocated<T>(this IResourceBuilder<T> builder, Func<ResourceEndpointsAllocatedEvent, Task> callback)
152internal static IResourceBuilder<T> OnResourceReady<T>(this IResourceBuilder<T> builder, Func<ResourceReadyEvent, Task> callback)
168public static DistributedApplicationEventSubscription OnBeforeStart(this EventingSubscriberRegistrationContext context, Func<BeforeStartEvent, Task> callback)
183public static DistributedApplicationEventSubscription OnBeforePublish(this EventingSubscriberRegistrationContext context, Func<BeforePublishEvent, Task> callback)
198public static DistributedApplicationEventSubscription OnAfterPublish(this EventingSubscriberRegistrationContext context, Func<AfterPublishEvent, Task> callback)
213public static DistributedApplicationEventSubscription OnAfterResourcesCreated(this EventingSubscriberRegistrationContext context, Func<AfterResourcesCreatedEvent, Task> callback)
221private sealed class CallbackEventingSubscriber(Func<EventingSubscriberRegistrationContext, Task> subscribe) : IDistributedApplicationEventingSubscriber
223public bool Matches(Func<EventingSubscriberRegistrationContext, Task> otherSubscribe)
228public Task SubscribeAsync(IDistributedApplicationEventing eventing, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
Ats\PipelineExports.cs (8)
28Func<PipelineStepContext, Task> callback,
47Func<PipelineConfigurationContext, Task> callback)
125public static Task CompleteStep(this IReportingStep reportingStep, string completionText, string completionState = "completed", CancellationToken cancellationToken = default)
137public static Task CompleteStepMarkdown(this IReportingStep reportingStep, string markdownString, string completionState = "completed", CancellationToken cancellationToken = default)
149public static Task UpdateTask(this IReportingTask reportingTask, string statusText, CancellationToken cancellationToken = default)
161public static Task UpdateTaskMarkdown(this IReportingTask reportingTask, string markdownString, CancellationToken cancellationToken = default)
173public static Task CompleteTask(this IReportingTask reportingTask, string? completionMessage = null, string completionState = "completed", CancellationToken cancellationToken = default)
184public static Task CompleteTaskMarkdown(this IReportingTask reportingTask, string markdownString, string completionState = "completed", CancellationToken cancellationToken = default)
ContainerResourceBuilderExtensions.cs (9)
536return Task.CompletedTask;
544/// This is intended to pass additional arguments to the underlying container runtime run command to enable advanced features such as exposing GPUs to the container. To pass runtime arguments to the actual container, use the <see cref="ResourceBuilderExtensions.WithArgs{T}(IResourceBuilder{T}, Func{CommandLineArgsCallbackContext, Task})"/> method.
552public static IResourceBuilder<T> WithContainerRuntimeArgs<T>(this IResourceBuilder<T> builder, Func<ContainerRuntimeArgsCallbackContext, Task> callback) where T : ContainerResource
781return builder.WithDockerfileFactory(contextPath, context => Task.FromResult(dockerfileFactory(context)), stage);
1032public static IResourceBuilder<ContainerResource> AddDockerfileBuilder(this IDistributedApplicationBuilder builder, [ResourceName] string name, string contextPath, Func<DockerfileBuilderCallbackContext, Task> callback, string? stage = null)
1398Callback = (_, _) => Task.FromResult(entries),
1513Callback = (_, _) => Task.FromResult(ContainerDirectory.GetFileSystemItemsFromPath(sourceFullPath, searchOptions: SearchOption.AllDirectories)),
1698public static IResourceBuilder<T> WithDockerfileBuilder<T>(this IResourceBuilder<T> builder, string contextPath, Func<DockerfileBuilderCallbackContext, Task> callback, string? stage = null) where T : ContainerResource
1810return Task.CompletedTask;
Dcp\ContainerCreator.cs (9)
257public async Task CreateObjectAsync(RenderedModelResource<Container> cr, ContainerCreationContext cctx, ILogger logger, IDcpObjectFactory factory, CancellationToken cancellationToken)
298private async Task BuildAndCreateContainerAsync(RenderedModelResource<Container> cr, ILogger logger, IDcpObjectFactory factory, CancellationToken cToken)
406async Task IObjectCreator<ContainerExec, EmptyCreationContext>.CreateObjectAsync(RenderedModelResource<ContainerExec> er, EmptyCreationContext context, ILogger _, IDcpObjectFactory factory, CancellationToken cancellationToken)
500internal async Task EnsureHostConnectivityAsync(ImmutableArray<HostResourceWithEndpoints> hostDependencies, ContainerCreationContext cctx, IDcpObjectFactory factory, CancellationToken cancellationToken)
531await Task.WhenAll([cctx.ContainerPrerequisitesReady, cctx.ContainerTunnelPrerequisitesReady]).WaitAsync(cancellationToken).ConfigureAwait(false);
581private async Task WaitForTunnelProxyAsync(
663internal async Task CreateHostDependentContainerAsync(RenderedModelResource<Container> cr, ImmutableArray<HostResourceWithEndpoints> hostDependencies, ContainerCreationContext cctx, IDcpObjectFactory factory, CancellationToken cToken)
674await Task.WhenAll(hostEndpointAllocatedTasks).ConfigureAwait(false);
929private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, DistributedApplicationExecutionContext executionContext, ILogger logger, CancellationToken cancellationToken)
Dcp\DcpExecutor.cs (34)
140public async Task RunApplicationAsync(CancellationToken ct = default)
196var createServices = Task.Run(() => CreateAllDcpObjectsAsync<Service>(ct), ct);
198var getProxyAddresses = Task.Run(async () =>
208var createContainerNetworks = Task.Run(() => CreateAllDcpObjectsAsync<ContainerNetwork>(ct), ct);
210var createWorkloadEndpoints = Task.Run(async () =>
212await Task.WhenAll([getProxyAddresses, createContainerNetworks]).WaitAsync(ct).ConfigureAwait(false);
247var createExecutables = Task.Run(async () =>
258var createContainers = Task.Run(async () =>
266await Task.WhenAll(createExecutables, createContainers).WaitAsync(ct).ConfigureAwait(false);
277public async Task StopAsync(CancellationToken cancellationToken)
386Task IDcpObjectFactory.UpdateWithEffectiveAddressInfo(IEnumerable<Service> services, CancellationToken cancellationToken, TimeSpan? timeout)
472private async Task UpdateWithEffectiveAddressInfo(IEnumerable<Service> services, CancellationToken cancellationToken, TimeSpan? timeout = null)
595private Task CreateAllDcpObjectsAsync<RT>(CancellationToken cancellationToken) where RT : CustomResource, IKubernetesStaticMetadata
601Task IDcpObjectFactory.CreateDcpObjectsAsync<T>(IEnumerable<T> objects, CancellationToken cancellationToken)
617private async Task CreateDcpObjectsAsync<RT>(IEnumerable<RT> objects, CancellationToken cancellationToken) where RT : CustomResource, IKubernetesStaticMetadata
628var tasks = new List<Task>();
632tasks.Add(Task.Run(async () =>
637await Task.WhenAll(tasks).WaitAsync(cancellationToken).ConfigureAwait(false);
883public async Task CreateRenderedResourcesAsync<TDcpResource, TContext>(
902var tasks = new List<Task>();
908tasks.Add(Task.Run(() => CreateResourceReplicasAsync(groupKey, groupList, creator, context, cancellationToken), cancellationToken));
910await Task.WhenAll(tasks).WaitAsync(cancellationToken).ConfigureAwait(false);
917private async Task CreateResourceReplicasAsync<TDcpResource, TContext>(
1035async Task CreateReplicaAsync(RenderedModelResource<TDcpResource> er)
1125public async Task StopResourceAsync(IResourceReference resourceReference, CancellationToken cancellationToken)
1194public async Task StartResourceAsync(IResourceReference resourceReference, CancellationToken cancellationToken)
1269private async Task EnsureResourceDeletedAsync<T>(IResourceReference resource, CancellationToken cancellationToken) where T : CustomResource, IKubernetesStaticMetadata
1380private async Task PublishConnectionStringAvailableEventAsync(IResource resource, CancellationToken ct)
Dcp\DcpResourceWatcher.cs (25)
54private Task? _resourceWatchTask;
66internal Task? GetLogStreamTask(string resourceName)
121var watchResourcesTask = Task.Run(async () =>
125await Task.WhenAll(
126Task.Run(() => WatchKubernetesResourceAsync<Executable>((t, r) => ProcessResourceChange(t, r, _resourceState.ExecutablesMap, Model.Dcp.ExecutableKind, (e, s) => _snapshotBuilder.ToSnapshot(e, s)))),
127Task.Run(() => WatchKubernetesResourceAsync<Container>((t, r) => ProcessResourceChange(t, r, _resourceState.ContainersMap, Model.Dcp.ContainerKind, (c, s) => _snapshotBuilder.ToSnapshot(c, s)))),
128Task.Run(() => WatchKubernetesResourceAsync<ContainerExec>((t, r) => ProcessResourceChange(t, r, _resourceState.ContainerExecsMap, Model.Dcp.ContainerExecKind, (c, s) => _snapshotBuilder.ToSnapshot(c, s)))),
129Task.Run(() => WatchKubernetesResourceAsync<Service>(ProcessServiceChange)),
130Task.Run(() => WatchKubernetesResourceAsync<Endpoint>(ProcessEndpointChange))).ConfigureAwait(false);
136var watchSubscribersTask = Task.Run(async () =>
148var watchInformationChannelTask = Task.Run(async () =>
197_resourceWatchTask = Task.WhenAll(watchResourcesTask, watchSubscribersTask, watchInformationChannelTask);
199async Task WatchKubernetesResourceAsync<T>(Func<WatchEventType, T, Task> handler) where T : CustomResource, IKubernetesStaticMetadata
237public async Task StopAsync(CancellationToken cancellationToken)
239var tasks = new List<Task>();
253await Task.WhenAll(tasks).WaitAsync(cancellationToken).ConfigureAwait(false);
271private async Task ProcessResourceChange<T>(WatchEventType watchEventType, T resource, ConcurrentDictionary<string, T> resourceByName, string resourceKind, Func<T, CustomResourceSnapshot, CustomResourceSnapshot> snapshotFactory) where T : CustomResource, IKubernetesStaticMetadata
630_ = Task.Run(async () =>
854private async Task ProcessEndpointChange(WatchEventType watchEventType, Endpoint endpoint)
872private async Task ProcessServiceChange(WatchEventType watchEventType, Service service)
1034public Task Task => _completion.Task;
Dcp\ResourceLogSource.cs (14)
55async Task StreamLogsAsync(Stream stream, bool isError, bool parseDcpLogs)
106var streamTasks = new List<Task>();
111var startupStdoutStreamTask = Task.Run(() => StreamLogsAsync(startupStdoutStream, isError: false, parseDcpLogs: false), cancellationToken);
114var startupStderrStreamTask = Task.Run(() => StreamLogsAsync(startupStderrStream, isError: false, parseDcpLogs: false), cancellationToken);
120var stdoutStreamTask = Task.Run(() => StreamLogsAsync(stdoutStream, isError: false, parseDcpLogs: false), cancellationToken);
123var stderrStreamTask = Task.Run(() => StreamLogsAsync(stderrStream, isError: true, parseDcpLogs: false), cancellationToken);
128var systemStreamTask = Task.Run(() => StreamLogsAsync(systemStream, isError: false, parseDcpLogs: true), cancellationToken);
132async Task WaitForStreamsToCompleteAsync()
134await Task.WhenAll(streamTasks).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
DistributedApplicationEventingExtensions.cs (11)
23public static T OnBeforeStart<T>(this T builder, Func<BeforeStartEvent, CancellationToken, Task> callback)
35public static T OnBeforePublish<T>(this T builder, Func<BeforePublishEvent, CancellationToken, Task> callback)
47public static T OnAfterPublish<T>(this T builder, Func<AfterPublishEvent, CancellationToken, Task> callback)
60public static IResourceBuilder<T> OnBeforeResourceStarted<T>(this IResourceBuilder<T> builder, Func<T, BeforeResourceStartedEvent, CancellationToken, Task> callback)
73public static IResourceBuilder<T> OnResourceStopped<T>(this IResourceBuilder<T> builder, Func<T, ResourceStoppedEvent, CancellationToken, Task> callback)
86public static IResourceBuilder<T> OnConnectionStringAvailable<T>(this IResourceBuilder<T> builder, Func<T, ConnectionStringAvailableEvent, CancellationToken, Task> callback)
99public static IResourceBuilder<T> OnInitializeResource<T>(this IResourceBuilder<T> builder, Func<T, InitializeResourceEvent, CancellationToken, Task> callback)
112public static IResourceBuilder<T> OnResourceEndpointsAllocated<T>(this IResourceBuilder<T> builder, Func<T, ResourceEndpointsAllocatedEvent, CancellationToken, Task> callback)
125public static IResourceBuilder<T> OnResourceReady<T>(this IResourceBuilder<T> builder, Func<T, ResourceReadyEvent, CancellationToken, Task> callback)
129private static T OnApplicationEvent<T, TEvent>(this T builder, Func<TEvent, CancellationToken, Task> callback)
137private static IResourceBuilder<TResource> OnResourceEvent<TResource, TEvent>(this IResourceBuilder<TResource> builder, Func<TResource, TEvent, CancellationToken, Task> callback)
Eventing\DistributedApplicationEventing.cs (17)
18public Task PublishAsync<T>(T @event, CancellationToken cancellationToken = default) where T : IDistributedApplicationEvent
25public async Task PublishAsync<T>(T @event, EventDispatchBehavior dispatchBehavior, CancellationToken cancellationToken = default) where T : IDistributedApplicationEvent
31var pendingSubscriptionCallbacks = new List<Task>(subscriptions.Count);
34var pendingSubscriptionCallback = InvokeSubscriptionCallbackAsync(subscription, @event, dispatchBehavior, cancellationToken);
41_ = Task.Run(async () =>
43await Task.WhenAll(pendingSubscriptionCallbacks).ConfigureAwait(false);
49await Task.WhenAll(pendingSubscriptionCallbacks).ConfigureAwait(false);
57_ = Task.Run(async () =>
77private static Task InvokeSubscriptionCallbackAsync<T>(
86var callbackTask = subscription.Callback(@event, cancellationToken);
90return Task.CompletedTask;
102static async Task AwaitSubscriptionCallbackAsync(Task callbackTask, ProfilingTelemetry.ActivityScope activity)
119/// <inheritdoc cref="IDistributedApplicationEventing.Subscribe{T}(Func{T, CancellationToken, Task})" />
120public DistributedApplicationEventSubscription Subscribe<T>(Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationEvent
158/// <inheritdoc cref="IDistributedApplicationEventing.Subscribe{T}(Func{T, CancellationToken, Task})" />
159public DistributedApplicationEventSubscription Subscribe<T>(IResource resource, Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationResourceEvent
Orchestrator\ApplicationOrchestrator.cs (24)
82private async Task PublishConnectionStringValue(ConnectionStringAvailableEvent @event, CancellationToken token)
114private async Task WaitForInBeforeResourceStartedEvent(BeforeResourceStartedEvent @event, CancellationToken cancellationToken)
172var waitForDependenciesTask = _notificationService.WaitForDependenciesAsync(@event.Resource, cts.Token);
180var completedTask = await Task.WhenAny(waitForDependenciesTask, waitForNonWaitingStateTask).ConfigureAwait(false);
199private Task OnEndpointsAllocated(OnEndpointsAllocatedContext context)
203return Task.CompletedTask;
206private async Task PublishResourceEndpointUrls(IResource resource, CancellationToken cancellationToken)
234private async Task OnResourceStarting(OnResourceStartingContext context)
283static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
291private async Task OnResourcesPrepared(OnResourcesPreparedContext context)
296private async Task OnConnectionStringAvailable(OnConnectionStringAvailableContext context)
301private async Task ProcessResourceUrlCallbacks(IResource resource, CancellationToken cancellationToken)
573private async Task OnResourceEndpointsAllocated(ResourceEndpointsAllocatedEvent @event, CancellationToken cancellationToken)
578private async Task OnResourceChanged(OnResourceChangedContext context)
611private async Task OnResourceFailedToStart(OnResourceFailedToStartContext context)
632public async Task RunApplicationAsync(CancellationToken cancellationToken = default)
645public async Task StopAsync(CancellationToken cancellationToken)
652public async Task StartResourceAsync(string resourceName, CancellationToken cancellationToken)
681public async Task StopResourceAsync(string resourceName, CancellationToken cancellationToken)
687private async Task SetChildResourceAsync(IResource resource, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp)
710private async Task PublishResourcesInitialStateAsync(CancellationToken cancellationToken)
753private async Task PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken)
779private async Task PublishEventToHierarchy<TEvent>(Func<IResource, TEvent> createEvent, IResource resource, CancellationToken cancellationToken)
Orchestrator\ParameterProcessor.cs (16)
35private Task? _parameterResolutionTask;
52public async Task InitializeParametersAsync(IEnumerable<ParameterResource> parameterResources, bool waitForResolution = false)
68var task = EnsureParameterResolutionTaskRunningAsync();
77private Task EnsureParameterResolutionTaskRunningAsync()
85_parameterResolutionTask = Task.Run(async () =>
111public async Task InitializeParametersAsync(DistributedApplicationModel model, bool waitForResolution = false, CancellationToken cancellationToken = default)
134private async Task CollectDependentParameterResourcesAsync(DistributedApplicationModel model, Dictionary<string, ParameterResource> referencedParameters, CancellationToken cancellationToken)
151private async Task ProcessParameterAsync(ParameterResource parameterResource)
216return Task.CompletedTask;
232return Task.CompletedTask;
332public async Task SetParameterAsync(ParameterResource parameterResource, CancellationToken cancellationToken = default)
377public async Task DeleteParameterAsync(ParameterResource parameterResource, CancellationToken cancellationToken = default)
498private async Task ApplyParameterValueAsync(ParameterResource parameterResource, string inputValue, bool saveToDeploymentState, CancellationToken cancellationToken = default)
548internal async Task HandleUnresolvedParametersAsync(IList<ParameterResource> unresolvedParameters, CancellationToken allParametersResolvedToken)
673private async Task SaveParametersToDeploymentStateAsync(IEnumerable<ParameterResource> parameters, CancellationToken cancellationToken)
701private async Task UpdateParameterStateAsync(ParameterResource parameterResource, string value, ResourceStateSnapshot? state)
Pipelines\DistributedApplicationPipeline.cs (26)
29private readonly List<Func<PipelineConfigurationContext, Task>> _configurationCallbacks = [];
44Action = _ => Task.CompletedTask,
147Action = _ => Task.CompletedTask,
154Action = context => Task.CompletedTask
200await Task.Delay(TimeSpan.FromSeconds(2), timeProvider, waitCts.Token).ConfigureAwait(false);
223Action = _ => Task.CompletedTask
304Action = _ => Task.CompletedTask
311Action = _ => Task.CompletedTask,
321return Task.CompletedTask;
347Action = _ => Task.CompletedTask
357return Task.CompletedTask;
380Action = _ => Task.CompletedTask,
459Func<PipelineStepContext, Task> action,
541public void AddPipelineConfiguration(Func<PipelineConfigurationContext, Task> callback)
573public async Task ExecuteAsync(PipelineContext context)
594internal async Task ExecuteStepSequentiallyAsync(
770private async Task ExecuteConfigurationCallbacksAsync(
775var callbacks = new List<Func<PipelineConfigurationContext, Task>>();
846private static async Task ExecuteStepsAsTaskDag(
863async Task ExecuteStepWithDependencies(PipelineStep step)
875await Task.WhenAll(depTasks).ConfigureAwait(false);
941var allStepTasks = new Task[steps.Count];
945allStepTasks[i] = Task.Run(() => ExecuteStepWithDependencies(step));
951await Task.WhenAll(allStepTasks).ConfigureAwait(false);
990private static async Task ExecuteStepsSequentially(
1132private static async Task ExecuteStepAsync(PipelineStep step, PipelineStepContext stepContext)
Pipelines\NullPipelineActivityReporter.cs (19)
20return Task.FromResult<IReportingStep>(new NullPublishingStep());
24public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
26return Task.CompletedTask;
31public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
33return Task.CompletedTask;
42return Task.FromResult<IReportingTask>(new NullPublishingTask());
47return Task.FromResult<IReportingTask>(new NullPublishingTask());
67public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
69return Task.CompletedTask;
72public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
74return Task.CompletedTask;
86public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
88return Task.CompletedTask;
91public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
93return Task.CompletedTask;
96public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
98return Task.CompletedTask;
101public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
103return Task.CompletedTask;
Pipelines\PipelineActivityReporter.cs (10)
24private readonly Task _interactionServiceSubscriber;
31_interactionServiceSubscriber = Task.Run(() => SubscribeToInteractionsAsync(_cancellationTokenSource.Token));
119public async Task CompleteStepAsync(ReportingStep step, string completionText, CompletionState completionState, bool enableMarkdown, CancellationToken cancellationToken)
142public async Task UpdateTaskAsync(ReportingTask task, string statusText, bool enableMarkdown, CancellationToken cancellationToken)
208public async Task CompleteTaskAsync(ReportingTask task, CompletionState completionState, string? completionMessage, bool enableMarkdown, CancellationToken cancellationToken)
249public async Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
281public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
312private async Task SubscribeToInteractionsAsync(CancellationToken cancellationToken)
327private async Task WriteInteractionUpdateToClientAsync(Interaction interaction, CancellationToken cancellationToken)
405internal async Task CompleteInteractionAsync(string promptId, PublishingPromptInputAnswer[]? responses, bool updateResponse = false, CancellationToken cancellationToken = default)
Publishing\ContainerRuntimeBase.cs (9)
49public abstract Task BuildImageAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken);
51public virtual async Task TagImageAsync(string localImageName, string targetImageName, CancellationToken cancellationToken)
64public virtual async Task RemoveImageAsync(string imageName, CancellationToken cancellationToken)
77public virtual async Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
98public virtual async Task LoginToRegistryAsync(string registryServer, string username, string password, CancellationToken cancellationToken)
158protected async Task ExecuteContainerCommandAsync(
342public virtual async Task ComposeUpAsync(ComposeOperationContext context, CancellationToken cancellationToken)
398public virtual async Task ComposeDownAsync(ComposeOperationContext context, CancellationToken cancellationToken)
599protected async Task EnsureRuntimeAvailableAsync()
Publishing\DockerContainerRuntime.cs (3)
22private async Task RunDockerBuildAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken)
129public override async Task BuildImageAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken)
194private async Task CreateBuildkitInstanceAsync(string builderName, CancellationToken cancellationToken)
Publishing\IContainerRuntime.cs (7)
37Task BuildImageAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken);
45Task TagImageAsync(string localImageName, string targetImageName, CancellationToken cancellationToken);
52Task RemoveImageAsync(string imageName, CancellationToken cancellationToken);
59Task PushImageAsync(IResource resource, CancellationToken cancellationToken);
68Task LoginToRegistryAsync(string registryServer, string username, string password, CancellationToken cancellationToken);
76Task ComposeUpAsync(ComposeOperationContext context, CancellationToken cancellationToken);
84Task ComposeDownAsync(ComposeOperationContext context, CancellationToken cancellationToken);
Publishing\PodmanContainerRuntime.cs (3)
145private async Task RunPodmanBuildAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken)
237private async Task RunPodmanSaveAsync(string imageName, ContainerImageBuildOptions options, CancellationToken cancellationToken)
284public override async Task BuildImageAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken)
Publishing\ResourceContainerImageManager.cs (9)
143Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default);
151Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default);
158Task PushImageAsync(IResource resource, CancellationToken cancellationToken);
209public async Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default)
239public async Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default)
300private async Task BuildProjectContainerImageAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken)
327private async Task ExecuteDotnetPublishAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken)
451private async Task BuildContainerImageFromDockerfileAsync(IResource resource, DockerfileBuildAnnotation dockerfileBuildAnnotation, string imageName, ResolvedContainerBuildOptions options, CancellationToken cancellationToken)
542public async Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
ResourceBuilderExtensions.cs (15)
383public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, Func<EnvironmentCallbackContext, Task> callback) where T : IResourceWithEnvironment
729return Task.CompletedTask;
741public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, Func<CommandLineArgsCallbackContext, Task> callback) where T : IResourceWithArgs
776public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
2002public static IResourceBuilder<T> WithUrls<T>(this IResourceBuilder<T> builder, Func<ResourceUrlsCallbackContext, Task> callback)
2829return Task.CompletedTask;
4144public static IResourceBuilder<TResource> WithCertificateTrustConfiguration<TResource>(this IResourceBuilder<TResource> builder, Func<CertificateTrustConfigurationCallbackAnnotationContext, Task> callback)
4279public static IResourceBuilder<TResource> WithHttpsCertificateConfiguration<TResource>(this IResourceBuilder<TResource> builder, Func<HttpsCertificateConfigurationCallbackAnnotationContext, Task> callback)
4356return Task.CompletedTask;
4829return Task.CompletedTask;
4845/// <typeparamref name="TLaunchConfiguration"/> is a <see cref="Task"/> or <see cref="ValueTask"/>. Use an
4866if (typeof(Task).IsAssignableFrom(typeof(TLaunchConfiguration)) || IsValueTask(typeof(TLaunchConfiguration)))
4875(mode, _) => Task.FromResult(launchConfigurationProducer(mode)),
4926/// <see cref="Task.FromResult{TResult}(TResult)"/>. Process execution does not generally require a producer, but
5287Func<ContainerImagePushOptionsCallbackContext, Task> callback)
Aspire.Hosting.Analyzers.Tests (119)
Aspire.Hosting.Azure (127)
AzureProvisioningController.cs (57)
382private static async Task LoadTenantArgumentOptionsAsync(LoadInputContext context)
410private static async Task LoadSubscriptionArgumentOptionsAsync(LoadInputContext context)
443private static async Task LoadResourceGroupArgumentOptionsAsync(LoadInputContext context)
471private static async Task LoadLocationArgumentOptionsAsync(LoadInputContext context, string? deploymentStateResourceName = null)
525private static Task ValidateAzureContextCommandArguments(InputsDialogValidationContext validationContext)
536return Task.CompletedTask;
548public async Task ResetStateAsync(DistributedApplicationModel model, CancellationToken cancellationToken = default)
555public async Task ForgetResourceStateAsync(DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken = default)
578public Task EnsureProvisionedAsync(DistributedApplicationModel model, CancellationToken cancellationToken = default)
592public async Task DeleteAzureResourcesAsync(DistributedApplicationModel model, CancellationToken cancellationToken = default)
599public async Task CheckForDriftAsync(DistributedApplicationModel model, CancellationToken cancellationToken = default)
638public async Task CancelResourceAsync(DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken = default)
646public async Task DeleteAzureResourceAsync(DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken = default)
804() => Task.CompletedTask,
905return Task.FromResult(false);
1008private async Task RunOperationAsync(DistributedApplicationModel model, AzureIntent intent, CancellationToken cancellationToken)
1040var afterProvisionTasks = new List<Task>(azureResources.Count);
1070await Task.WhenAll(afterProvisionTasks).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
1144private async Task ResetResourcesAsync(
1211private async Task DeleteSectionAsync(string sectionName, CancellationToken cancellationToken)
1427internal Task ProcessQueuedOperationForTesting(QueuedOperationForTesting queuedOperation)
1443_ = Task.Run(async () =>
1451await Task.Delay(DriftCheckInterval, _timeProvider, stoppingToken).ConfigureAwait(false);
1471_ = Task.Run(async () =>
1486private async Task ProcessOperationLoopAsync(CancellationToken stoppingToken)
1525private async Task ProcessQueuedOperationAsync(QueuedOperation queuedOperation)
1624_ = Task.Run(async () =>
1644private async Task PromptForMissingAzureContextAsync(DistributedApplicationModel model, CancellationToken cancellationToken)
2023private async Task CancelResourceCoreAsync(DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken)
2376private static async Task<ExecuteCommandResult> ExecuteCommandAsync(Func<Task> action, string successMessage, Func<Task<CommandResultData>> createResultData, string? failureOperation = null)
2737private async Task ApplyResourceOverridesAsync(IAzureResource azureResource, CancellationToken cancellationToken)
2774private async Task SetResourceLocationOverrideAsync(string resourceName, string location, CancellationToken cancellationToken)
2834private async Task MarkCachedDeploymentCanceledAsync(string sectionName, string deploymentId, CancellationToken cancellationToken)
2869private async Task CancelCachedDeploymentAsync(string deploymentId, ILogger resourceLogger, CancellationToken cancellationToken)
2921private async Task AddDeploymentOperationTargetResourceIdsAsync(AzureBicepResource resource, HashSet<string> resourceIds, CancellationToken cancellationToken)
2946private async Task DeleteAzureResourceIdsAsync(IReadOnlyList<string> resourceIds, string resourceName, string? resourceLocation, string? fallbackResourceLocation, bool allowKeyVaultPurgeTimeout, CancellationToken cancellationToken)
3467private async Task DeleteCachedResourceForLocationChangeAsync(
3573private async Task ClearCachedDeploymentStateAsync(
3632private async Task RefreshCommandStatesAsync(DistributedApplicationModel model, CancellationToken cancellationToken)
3673private async Task PublishUpdateToResourceTreeAsync(
3678async Task PublishAsync(IResource targetResource)
3713private async Task AfterProvisionAsync(
3765private async Task PublishSyntheticProvisioningFailureAsync(
3883private async Task ProvisionAzureResourcesAsync(
3894var tasks = new List<Task>(azureResources.Count);
3901var task = Task.WhenAll(tasks);
3905private async Task ProcessResourceAsync(
4031private static async Task WaitForProvisioningDependenciesAsync(
4061await Task.WhenAll(dependencies
4064.OfType<Task>()).ConfigureAwait(false);
4095private async Task PublishConnectionStringAvailableEventAsync(
4131private async Task PublishAzureEnvironmentStateAsync(
4142private async Task PublishAzureEnvironmentStateAsync(
4154private async Task PublishAzureEnvironmentStateAsync(
4349Func<InputsDialogValidationContext, Task>? ValidateArguments = null);
4362Func<InputsDialogValidationContext, Task>? ValidateArguments = null);
AzurePublishingContext.cs (8)
83public async Task WriteModelAsync(DistributedApplicationModel model, AzureEnvironmentResource environment, CancellationToken cancellationToken = default)
116private async Task WriteAzureArtifactsOutputAsync(IReportingStep step, DistributedApplicationModel model, AzureEnvironmentResource environment, CancellationToken cancellationToken)
450private async Task MapParameterAsync(object candidate, CancellationToken cancellationToken = default)
495private static Task VisitAsync(object? value, Func<object, CancellationToken, Task> visitor, CancellationToken cancellationToken = default) =>
498private static async Task VisitAsync(object? value, Func<object, CancellationToken, Task> visitor, HashSet<object> visited, CancellationToken cancellationToken = default)
521private async Task SaveToDiskAsync(string outputDirectoryPath)
Provisioning\Internal\DefaultArmClientProvider.cs (7)
223public async Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
237public async Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
269private static async Task WaitForKeyVaultToBeDeletedAsync(GenericResource keyVault, TimeProvider timeProvider, CancellationToken cancellationToken)
291await Task.Delay(s_keyVaultDeletePollInterval, timeProvider, linkedCts.Token).ConfigureAwait(false);
300private static async Task WaitForDeletedKeyVaultToBePurgedAsync(DeletedKeyVaultResource deletedVault, TimeProvider timeProvider, CancellationToken cancellationToken)
322await Task.Delay(s_keyVaultPurgePollInterval, timeProvider, linkedCts.Token).ConfigureAwait(false);
392var operationGroups = await Task.WhenAll(
Provisioning\Internal\IProvisioningServices.cs (9)
92Task PersistProvisioningOptionsAsync(CancellationToken cancellationToken = default);
118public Task<bool> EnsureProvisioningOptionsAsync(bool forcePrompt, CancellationToken cancellationToken = default) => Task.FromResult(false);
120=> Task.FromResult(new AzureProvisioningOptionsState(null, null, null, null));
121public Task PersistProvisioningOptionsAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
123=> Task.FromResult(new AzureProvisioningOptionsState(options.SubscriptionId, options.ResourceGroup, options.Location, options.TenantId));
186Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default);
204Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default);
336Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default);
Provisioning\Provisioners\BicepProvisioner.cs (11)
287await Task.Delay(s_deploymentOperationPollingInterval, _timeProvider, cancellationToken).ConfigureAwait(false);
319private async Task PublishCachedRunningDeploymentStateAsync(
439private async Task PersistReconciledProvisioningStateAsync(DeploymentStateSection stateSection, string provisioningState, CancellationToken cancellationToken)
445private async Task PublishReconciledTerminalStateAsync(AzureBicepResource resource, string state)
453private async Task ClearCachedRunningDeploymentStateAsync(DeploymentStateSection stateSection, CancellationToken cancellationToken)
506public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
705var deploymentOperationTrackingTask = context.ExecutionContext.IsRunMode
707: Task.CompletedTask;
941private async Task TrackDeploymentOperationsAsync(
952await Task.Delay(s_deploymentOperationPollingInterval, _timeProvider, cancellationToken).ConfigureAwait(false);
1034await Task.WhenAll(enrichmentTasks.Select(static enrichment => enrichment.EnrichmentTask)).ConfigureAwait(false);
Aspire.Hosting.Azure.AppContainers (10)
Aspire.Hosting.Azure.AppService (10)
Aspire.Hosting.Azure.ContainerRegistry (2)
Aspire.Hosting.Azure.CosmosDB (3)
Aspire.Hosting.Azure.EventHubs (2)
Aspire.Hosting.Azure.Functions (1)
Aspire.Hosting.Azure.Kubernetes (13)
Aspire.Hosting.Azure.Kubernetes.Tests (72)
AzureKubernetesInfrastructureTests.cs (38)
26public async Task NoUserPool_CreatesDefaultWorkloadPool()
53public async Task ExplicitUserPool_NoDefaultCreated()
76public async Task ExplicitAffinity_NotOverridden()
97public async Task ComputeResource_GetsDeploymentTargetFromKubernetesInfrastructure()
121private static extern Task ExecuteBeforeStartHooksAsync(DistributedApplication app, CancellationToken cancellationToken);
124public async Task MultiEnv_ResourcesMatchCorrectEnvironment()
167public async Task KubernetesPipelineStepsFlowThroughAksEnvironment()
199public async Task DeploymentScopeUsesCurrentDeploymentState()
226public async Task DeploymentScopeRequiresSubscription()
251public async Task GetResourceGroupUsesDeploymentStateWithoutQueryingAzure()
264return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "unexpected-rg", ""));
272public async Task GetResourceGroupQueryIsScopedToDeploymentSubscription()
286return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "queried-rg\n", ""));
296public async Task GetResourceGroupThrowsWhenClusterNameIsAmbiguous()
307(path, arguments) => Task.FromResult(
318public async Task GetResourceGroupThrowsWhenClusterIsNotFound()
327(path, arguments) => Task.FromResult(
337public async Task FetchKubeConfigIsScopedToDeploymentSubscription()
350return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "kubeconfig-content", ""));
360public async Task FetchKubeConfigThrowsWhenAzureCliFails()
368(path, arguments) => Task.FromResult(
377public async Task GetCredentialsStepScopesEveryAzureCliCallToDeploymentSubscription()
406return Task.FromResult(arguments.StartsWith("resource list", StringComparison.Ordinal)
473public async Task GetCredentialsStepUsesExistingClusterScopeInsteadOfDeploymentState()
503return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "kubeconfig-content", ""));
554public async Task DeploymentScopeFallsBackToDeploymentStateWhenResourcePinsNothing()
568public async Task DeploymentScopeKeepsDeploymentResourceGroupWhenResourcePinsSameSubscription()
582public async Task DeploymentScopeDropsDeploymentResourceGroupWhenResourcePinsAnotherSubscription()
599public async Task DeploymentScopeUsesDeploymentSubscriptionWhenResourcePinsOnlyResourceGroup()
613public async Task DeploymentScopeIgnoresDeploymentStateWhenResourcePinsBothValues()
630public async Task DeploymentScopeResolvesParameterBackedScopeValues()
647public async Task DeploymentScopeThrowsWhenScopeProviderResolvesNull()
666public async Task DeploymentScopeThrowsWhenScopeProviderResolvesEmpty()
685public async Task GetCredentialsStepPrefersExplicitScopeOverExistingResourceAnnotation()
715return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "kubeconfig-content", ""));
756public async Task GetCredentialsStepFallsBackToDeploymentStateForSubscriptionScopedResources()
784return Task.FromResult(new AzureKubernetesEnvironmentResource.AzCommandResult(0, "kubeconfig-content", ""));
826public async Task DeploymentScopeThrowsWhenScopeValueIsEmptyString()
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Azure.Kusto (1)
Aspire.Hosting.Azure.Kusto.Tests (26)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Azure.PostgreSQL (1)
Aspire.Hosting.Azure.Redis (2)
Aspire.Hosting.Azure.ServiceBus (2)
Aspire.Hosting.Azure.Sql (1)
Aspire.Hosting.Azure.Storage (1)
Aspire.Hosting.Azure.Tests (1032)
AzureBicepProvisionerTests.cs (75)
60public async Task NestedChildResourcesShouldGetUpdated()
119public async Task GetOrCreateResourceAsync_InPublishMode_ThrowsForUnknownPrincipalParameters()
153public async Task GetOrCreateResourceAsync_InRunMode_PopulatesPrincipalTypeFromContext(string principalType)
204public async Task GetOrCreateResourceAsync_WithSubscriptionScope_UsesSubscriptionDeploymentCollection()
239public async Task GetOrCreateResourceAsync_WithTenantScope_UsesTenantDeploymentCollection()
274public async Task GetOrCreateResourceAsync_WithResourceGroupAndSubscriptionScope_UsesScopedResourceGroupDeploymentCollection()
307public async Task GetOrCreateResourceAsync_WithDefaultScope_UsesResourceGroupDeploymentCollection()
337public async Task GetOrCreateResourceAsync_WithSubscriptionScopeInRunMode_UsesSubscriptionDeploymentCollection()
372public async Task GetOrCreateResourceAsync_InPublishMode_DoesNotQueryDeploymentOperationsAfterSuccessfulDeployment()
418public async Task GetOrCreateResourceAsync_InPublishMode_EnrichesDeploymentStartFailures()
462public async Task GetOrCreateResourceAsync_InPublishMode_UsesDeploymentOperationDetailsWhenWaitingFails()
541public async Task GetOrCreateResourceAsync_InPublishMode_EnrichesDeploymentOperationFailuresInParallel()
654public async Task GetOrCreateResourceAsync_UsesEffectiveResourceLocationInSnapshot()
688public async Task GetOrCreateResourceAsync_PublishesPredictedDeploymentIdBeforeDeploymentStarts()
718public async Task GetOrCreateResourceAsync_PublishesSubscriptionScopedPredictedDeploymentIdAndUrlWhileWaiting()
757public async Task ConfigureResourceAsync_DoesNotReuseOverrideOnlyDeploymentState()
787public async Task ConfigureResourceAsync_DoesNotReuseInProgressDeploymentState()
823public async Task ConfigureResourceAsync_PublishesAzureIdentityPropertiesFromDeploymentState()
874public async Task ConfigureResourceAsync_PublishesResourceGroupFromCachedDeploymentId()
920public async Task GetOrCreateResourceAsync_PreservesLocationOverrideInDeploymentState()
954public async Task GetOrCreateResourceAsync_ClearsStaleLocationOverrideWhenEffectiveLocationChanges()
986public async Task GetOrCreateResourceAsync_SavesInProgressDeploymentStateBeforeWaiting()
1019public async Task GetOrCreateResourceAsync_PublishesFailedDeploymentOperationDetailsWhenWaitingFails()
1178public async Task GetOrCreateResourceAsync_ClearsStaleDeploymentOperationDetailsWhenDeploymentStartFails()
1237public async Task GetOrCreateResourceAsync_CancelsStartedDeploymentWhenWaitIsCanceled()
1270public async Task GetOrCreateResourceAsync_CancelsPendingDeploymentWhenStartIsCanceled()
1303public async Task GetOrCreateResourceAsync_PersistsCanceledStateWhenCancelFindsAlreadyInactiveDeployment()
1335public async Task GetOrCreateResourceAsync_AdoptsActiveCachedDeploymentWhenCreateReportsDeploymentActive()
1370public async Task GetOrCreateResourceAsync_DoesNotAdoptActiveDeploymentWhenCachedChecksumDoesNotMatch()
1397public async Task GetOrCreateResourceAsync_SavesTerminalDeploymentStateWhenDeploymentFails()
1428public async Task BicepCliExecutor_CompilesBicepToArm()
1482public async Task TestTokenCredential_ProvidesAccessTokenAsync()
1500public async Task ReconcileDeploymentStateAsync_ConfiguresSucceededDeploymentFromArm()
1532public async Task ReconcileDeploymentStateAsync_WaitsForRunningDeploymentBeforeConfiguring()
1560public async Task ReconcileDeploymentStateAsync_ClearsStaleRunningStateWhenDeploymentIsMissing()
1584public async Task ReconcileDeploymentStateAsync_LeavesRunningStateWhenArmCannotBeQueried()
1611public async Task ReconcileDeploymentStateAsync_LeavesRunningStateWhenArmFailsDuringWait()
1640public async Task ReconcileDeploymentStateAsync_PersistsFailedStateAndThrowsWhenDeploymentFailed()
1665public async Task ReconcileDeploymentStateAsync_PersistsCanceledStateAndThrowsWhenDeploymentCanceled()
1694public async Task ReconcileDeploymentStateAsync_ReturnsFalseWhenSucceededDeploymentChecksumDoesNotMatch()
1768private static async Task SeedRunningDeploymentStateAsync(IDeploymentStateManager deploymentStateManager, AzureBicepResource resource, string deploymentId)
1835return Task.FromResult(CompilationResult);
1878return Task.FromResult(new DeploymentStateSection(sectionName, [], 0));
1881public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1883return Task.CompletedTask;
1886public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1888return Task.CompletedTask;
1891public Task ClearAllStateAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
1902Task.FromResult<ArmOperation>(new TestDeleteArmOperation());
1906await Task.CompletedTask;
1925return Task.FromResult<ArmOperation>(new TestDeleteArmOperation());
1930await Task.CompletedTask;
1955Task.FromResult<ArmOperation<ArmDeploymentResource>>(new WaitingThrowingArmDeploymentOperation());
1957public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
1998public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
2014return Task.FromException<ArmOperation<ArmDeploymentResource>>(new RequestFailedException(
2021public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
2031Task.FromException<ArmOperation<ArmDeploymentResource>>(new RequestFailedException(
2037public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
2050Task.FromResult<ArmOperation<ArmDeploymentResource>>(new CancelingArmDeploymentOperation());
2052public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default)
2056return Task.CompletedTask;
2099Task.FromException<ArmOperation<ArmDeploymentResource>>(new OperationCanceledException(cancellationToken));
2101public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default)
2105return Task.CompletedTask;
2118Task.FromResult<ArmOperation<ArmDeploymentResource>>(new CancelingArmDeploymentOperation());
2120public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default)
2134Task.FromResult<ArmOperation<ArmDeploymentResource>>(new TestArmOperation<ArmDeploymentResource>(
2137public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
AzureEnvironmentResourceExtensionsTests.cs (173)
171public async Task ChangeAzureContextCommand_DynamicArgumentsLoadAzureContextOptions()
227public async Task ChangeAzureContextCommand_TenantChangeReloadsSubscriptionOptionsForSelectedTenant()
272public async Task ChangeAzureContextCommand_CustomResourceGroupEnablesLocationChoices()
304public async Task ResetProvisioningStateCommand_ClearsCachedStateAndResetsSnapshots()
393public async Task ResetProvisioningStateCommand_ReentersProvisioningAndPromptsWhenAzureConfigMissing()
434public async Task MissingAzureContextNotification_ReappearsWhenConfigureDialogIsCanceled()
481public async Task EnsureProvisionedAsync_UsesControllerProvisioningFlow()
502public async Task EnsureProvisionedAsync_CompletesExistingPendingProvisioningWaiters()
531public async Task RunModeInitializeResource_ProvisionsAzureResourcesAfterPrepareStep()
575public async Task EnsureProvisioned_UsesCachedStateWhenMissingResourceProbeCannotAuthenticate()
611public async Task EnsureProvisioned_UsesCachedStateWhenMissingResourceProbeFailsTransiently()
640public async Task OnBeforeStartAsync_AddsPerResourceCommandsToDeployableAzureResourcesOnly()
690public async Task ChangeLocationCommand_IsHiddenForKeyVaultResources()
718public async Task ChangeLocationCommand_IsEnabledForResourcesWithImplicitKeyVaultChildren()
766public async Task GetAzureResourceCommand_ReturnsCachedDeploymentStateAndLiveStatus()
878public async Task GetAzureResourceCommand_ReturnsMissingLiveResourceReasonWhenCachedResourceDoesNotExist()
1155public async Task GetAzureResourceCommand_ReturnsMissingResourceIdReasonWhenCachedStateHasNoOutputId()
1211public async Task GetAzureResourceCommand_ReturnsStructuredRequestFailureWhenLiveProbeFails()
1272public async Task GetAzureResourceCommand_ReturnsCredentialUnavailableReasonWhenLiveProbeCannotAuthenticate()
1327public async Task CancelCommand_RetriesStateConflictAndMarksCachedDeploymentCanceled()
1390public async Task CancelCommand_IsEnabledDuringActiveDeploymentOperation()
1413var provisioningTask = controller.EnsureProvisionedAsync(model, CancellationToken.None);
1434public async Task CancelCommand_FastPathCancelsDuringActiveOperation()
1490var provisioningTask = controller.EnsureProvisionedAsync(model, CancellationToken.None);
1524public async Task MutatingResourceCommands_FailFastDuringConflictingActiveOperation()
1582public async Task MutatingResourceCommands_FailFastDuringConflictingQueuedOperation()
1642public async Task CancelCommand_IsHiddenWhenResourceIsNotWaitingForDeployment()
1674public async Task CancelCommand_DoesNotMarkCompletedDeploymentCanceled()
1728public async Task DeleteAzureResourceCommand_DeletesCachedOutputAndDeploymentOperationTargets()
1834public async Task DeleteAzureResourceCommand_SucceedsWhenKeyVaultPurgeTimesOutAfterDelete()
1913public async Task DeleteAzureResourceCommand_UpdatesCommandStatesWhileOperationIsActive()
1989public async Task DeleteAzureResourceCommand_PublishesCanceledWhenOperationIsCanceled()
2067public async Task ForgetStateCommand_ClearsOnlyTargetedResourceStateAndSnapshots()
2146public async Task ReprovisionCommand_ReprovisionsOnlyTargetedResource()
2205public async Task ReprovisionCommand_UpdatesCommandStatesWhileOperationIsActive()
2268public async Task ReprovisionCommand_ReenablesCommandStatesWhenOperationFails()
2326public async Task QueuedOperation_CancelledDuringInitialCommandStateRefreshCompletesAndReenablesCommands()
2347public async Task MutatingResourceCommands_ExecuteSequentiallyWhenInvokedConcurrently()
2407public async Task CancelCommand_FastPathCancelsActiveOperation()
2495public async Task CancelCommand_DoesNotMarkCompletedSiblingsCancelingDuringAllResourceOperation()
2532var provisioningTask = controller.EnsureProvisionedAsync(model, CancellationToken.None);
2569public async Task CancelCommand_FailsWhenNoOperationOrDeploymentIsActive()
2605public async Task CancelCommand_DoesNotCancelUnaffectedActiveOperation()
2679public async Task ChangeLocationCommand_UpdatesCommandStatesWhileOperationIsActive()
2753public async Task ChangeLocationCommand_PersistsOverrideAndReprovisionsTargetedResource()
2808public async Task ChangeLocationCommand_WithArguments_DoesNotPromptAndReturnsJsonResult()
2865public async Task ChangeLocationCommand_ForAnnotatedResource_PersistsOverrideUnderBicepResourceName()
2916public async Task ChangeLocationCommand_UsesPersistedAzureContextForSelectableLocations()
2984public async Task ChangeLocationCommand_RequiresConfirmationBeforeDeletingCachedResource()
3049public async Task ChangeLocationCommand_DeletesCachedResourceBeforeReprovisioningNewLocation()
3110public async Task ChangeLocationCommand_DeletesCachedResourceUsingPersistedLocationWhenSnapshotLocationIsMissing()
3174public async Task ChangeLocationCommand_UsesRequestedLocationWhenChangingExistingOverride()
3239public async Task ChangeLocationCommand_TreatsDeletedCachedResourceAsAlreadyAbsent()
3301public async Task ChangeLocationCommand_DoesNotRequireConfirmationWhenCachedResourceIsAlreadyAbsent()
3366public async Task ReprovisionAllCommand_PreservesAzureContextState()
3423public async Task ChangeAzureContextCommand_WithArguments_PersistsContextAndReturnsJsonResult()
3493public async Task ChangeAzureContextCommand_WithArgumentsWithoutTenant_ClearsPersistedTenant()
3542public async Task ChangeAzureContextCommand_FailsWhenLocationChangeWouldReprovisionKeyVault()
3587public async Task ChangeAzureContextCommand_DoesNotInferResourceLocationOverrides()
3641public async Task ReprovisionAllCommand_NormalizesPersistedLocationOverride()
3682public async Task ReprovisionAllCommand_PreservesLocationOverrideFromPersistedParameters()
3728public async Task ReprovisionResourceCommand_PreservesInMemoryLocationOverrideWhenCachedStateIsMissing()
3787public async Task ForgetResourceStateCommand_ClearsInMemoryLocationParameter()
3825public async Task ReprovisionResourceCommand_FailsWhenProvisioningFails()
3861public async Task ReprovisionResourceCommand_PurgesDeletedKeyVaultAndRetriesWhenSoftDeleteConflictOccurs()
3940public async Task ReprovisionResourceCommand_FailsWithDiagnosticWhenSoftDeleteConflictTombstoneIsNotDiscoverable()
4047public async Task ReprovisionResourceCommand_ProvisionsImplicitKeyVaultBeforePasswordAuthenticatedPostgres()
4099public async Task ChangeLocationCommand_FailsWhenProvisioningFails()
4147public async Task ChangeLocationCommand_FailsForKeyVaultWithoutProvisioning(bool includeLocationArgument)
4189public async Task ReprovisionCommand_ReturnsStructuredProviderFailureDetailsWhenProvisioningFails()
4264public async Task ResourceCommandCancellation_ReturnsCanceledResult()
4299public async Task CheckForDriftAsync_MarksResourceMissingInAzure()
4347public async Task CheckForDriftAsync_LeavesRunningResourcesWhenAzureResourcesStillExist()
4393public async Task CheckForDriftAsync_MarksOnlyMissingResourceWhenOtherAzureResourcesStillExist()
4456public async Task CheckForDriftAsync_SkipsResourcesWithoutCachedResourceIds()
4495public async Task DeleteAzureResourcesCommand_DeletesCurrentResourceGroupAndPreservesAzureContextState()
4551public async Task DeleteAzureResourcesCommand_DoesNotDeleteConfiguredResourceGroupWhenPersistedContextIsMissing()
4596public async Task DeleteAzureResourcesCommand_TreatsMissingResourceGroupAsSuccessAndClearsState()
4642public async Task DeleteAzureResourcesCommand_PublishesFailureWhenResourceGroupDeleteFails()
4692public async Task EnsureProvisioned_WaitsForReferencedAzureResources()
4713var reprovisionTask = controller.EnsureProvisionedAsync(model, CancellationToken.None);
4728public async Task EnsureProvisioned_FaultsDependentsWhenDependencyProvisioningFails()
4759public async Task EnsureProvisioned_PublishesCanceledWhenFastPathCanceledDeploymentFaults()
4801var provisioningTask = controller.EnsureProvisionedAsync(model, CancellationToken.None);
4834public async Task EnsureProvisioned_AddsFailedResourceBreadcrumbsToAzureEnvironment()
5013private static Task LoadInputAsync(IServiceProvider services, InteractionInputCollection inputs, InteractionInput input)
5124private static async Task WaitForSignalBeforeOperationCompletesAsync(Task signalTask, Task operationTask, string completionMessage)
5127Task completedTask;
5131completedTask = await Task.WhenAny(signalTask, operationTask).WaitAsync(watchdog.Token).ConfigureAwait(false);
5153private static async Task WaitForResourceStateAsync(ResourceNotificationService notifications, string resourceName, string expectedState)
5166await Task.Delay(TimeSpan.FromMilliseconds(20), watchdog.Token).ConfigureAwait(false);
5247return Task.FromResult<(ISubscriptionResource, ITenantResource)>((subscription, tenant));
5253return Task.FromResult(result);
5259return Task.FromResult(result);
5269return Task.FromResult(result);
5277return Task.FromResult<ISubscriptionResource>(subscription);
5282return Task.FromResult<IEnumerable<(string Name, string DisplayName)>>(_locations);
5292return Task.FromResult(result);
5296=> Task.FromResult<IEnumerable<string>>([]);
5304public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
5310public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
5318await Task.CompletedTask;
5327await Task.CompletedTask;
5383return Task.FromResult(new DeploymentStateSection(sectionName, data, version: 0));
5386public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
5393return Task.CompletedTask;
5396public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
5410return Task.CompletedTask;
5413public Task ClearAllStateAsync(CancellationToken cancellationToken = default)
5420return Task.CompletedTask;
5476return Task.FromResult(false);
5479public Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5491return Task.CompletedTask;
5495=> Task.FromResult(false);
5508return Task.FromResult(true);
5511public Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5514return Task.CompletedTask;
5518=> Task.FromResult(false);
5540return Task.FromResult(_context);
5546public Task<bool> EnsureProvisioningOptionsAsync(bool forcePrompt, CancellationToken cancellationToken = default) => Task.FromResult(true);
5558public Task PersistProvisioningOptionsAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
5599public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5602=> Task.FromResult(false);
5604public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5629public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5632=> Task.FromResult(false);
5634public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5649public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5652=> Task.FromResult(false);
5654public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5666public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5669=> Task.FromResult(false);
5671public Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5672=> Task.FromException(_exception);
5683public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5686=> Task.FromResult(false);
5688public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5709public Task<bool> ConfigureResourceAsync(AzureBicepResource resource, CancellationToken cancellationToken) => Task.FromResult(false);
5712=> Task.FromResult(false);
5714public Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5733return Task.FromException(new AzureProvisioningFailureException(failure, new InvalidOperationException("Key Vault is soft-deleted.")));
5737return Task.CompletedTask;
5766=> Task.FromResult(false);
5769=> Task.FromResult(false);
5771public async Task GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken)
5839=> Task.FromResult<IEnumerable<string>>([]);
5847public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
5853public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
5861await Task.CompletedTask;
5870await Task.CompletedTask;
5924=> Task.FromResult<IEnumerable<string>>([]);
5930=> Task.FromResult(true);
5932public async Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
5944=> Task.FromResult(true);
5946public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
5947=> Task.CompletedTask;
5954await Task.CompletedTask;
5963await Task.CompletedTask;
6001=> Task.FromResult<IEnumerable<string>>([]);
6007=> Task.FromException<bool>(new global::Azure.Identity.CredentialUnavailableException("Credential unavailable."));
6009public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
6015public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
6029await Task.CompletedTask;
6075=> Task.FromException<bool>(exception);
6077public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
6083public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
6137=> Task.FromResult(string.Equals(resourceId, existingResourceId, StringComparison.OrdinalIgnoreCase));
6139public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
6141? Task.FromException(deleteException)
6147public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
ProvisioningTestHelpers.cs (42)
295return Task.FromResult<(ISubscriptionResource, ITenantResource)>((subscription, tenant));
304return Task.FromResult<IEnumerable<ITenantResource>>(tenants);
313return Task.FromResult<IEnumerable<ISubscriptionResource>>(subscriptions);
325return Task.FromResult<IEnumerable<ISubscriptionResource>>(subscriptions);
344return Task.FromResult(subscription);
356return Task.FromResult<IEnumerable<(string, string)>>(locations);
367return Task.FromResult<IEnumerable<(string, string)>>(resourceGroups);
392return Task.FromResult(exists);
395public Task DeleteResourceAsync(string resourceId, CancellationToken cancellationToken = default)
399return Task.CompletedTask;
407return Task.FromException<bool>(_purgeDeletedKeyVaultException);
410return Task.FromResult(_purgeDeletedKeyVaultResult);
413public Task CancelDeploymentAsync(string deploymentId, CancellationToken cancellationToken = default)
416return Task.CompletedTask;
426return Task.FromException<AzureDeploymentState?>(GetDeploymentException);
434Exception ex => Task.FromException<AzureDeploymentState?>(ex),
435AzureDeploymentState deployment => Task.FromResult<AzureDeploymentState?>(deployment),
436null => Task.FromResult<AzureDeploymentState?>(null),
444return Task.FromResult(deployment);
447return Task.FromResult<AzureDeploymentState?>(new(
455await Task.CompletedTask;
475await Task.CompletedTask;
592return Task.FromResult(Response.FromValue<IResourceGroupResource>(_resourceGroup, new MockResponse(200)));
604return Task.FromResult(Response.FromValue<IResourceGroupResource>(resourceGroup, new MockResponse(200)));
619return Task.FromResult<ArmOperation<IResourceGroupResource>>(operation);
676return Task.FromException<ArmOperation>(_deleteException);
679return Task.FromResult<ArmOperation>(new TestDeleteArmOperation());
685await Task.CompletedTask;
713return Task.FromResult<ArmOperation<RoleAssignmentResource>>(new TestArmOperation<RoleAssignmentResource>(default!));
765return Task.FromResult<ArmOperation<ArmDeploymentResource>>(operation);
774public Task CancelAsync(string deploymentName, CancellationToken cancellationToken = default) => Task.CompletedTask;
1023return Task.FromResult(@"{
1043return Task.FromResult(new DeploymentStateSection(sectionName, sectionData, 0));
1046public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1048return Task.CompletedTask;
1051public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1054return Task.CompletedTask;
1057public Task ClearAllStateAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
1065return Task.FromResult(principal);
1111var resultTask = Task.FromResult(result);
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Blazor (5)
Aspire.Hosting.Blazor.Tests (48)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Browsers (72)
Aspire.Hosting.Browsers.Tests (214)
BrowserLogsBuilderExtensionsTests.cs (45)
82public async Task WithBrowserLogs_ConfigureCommandInputsDefaultToCurrentConfiguration()
137public async Task WithBrowserLogs_ConfigureCommandProfileInputDefaultsToCurrentConfigurationBeforeDependenciesLoad()
425public async Task WithBrowserLogs_CommandStartsTrackedSession()
460public async Task WithBrowserLogs_ConfigureCommandSavesResourceScopedBrowserSettingsAndAppliesImmediately()
500public async Task WithBrowserLogs_ConfigureCommandAppliesRuntimeSettingsWhenUserSecretsAreUnavailable()
543public async Task WithBrowserLogs_ConfigureCommandDoesNotOverrideExplicitBuilderSettings()
581public async Task WithBrowserLogs_ConfigureCommandSavesGlobalSettingsAndClearsProfile()
622public async Task WithBrowserLogs_ConfigureCommandDoesNotApplyRuntimeSettingsWhenUserSecretSaveFails()
667public async Task WithBrowserLogs_ConfigureCommandRefreshesAllBrowserLogsResourcesForGlobalSettings()
717public async Task WithBrowserLogs_ConfigureCommandValidatesEffectiveConfigurationBeforeSaving()
755public async Task WithBrowserLogs_CaptureScreenshotCommandReturnsArtifactResult()
818public async Task WithBrowserLogs_CaptureScreenshotCommandReturnsClearFailureWhenNoSessionIsActive()
845public async Task WithBrowserLogs_CaptureScreenshotCommandWritesPngArtifact()
917public async Task WithBrowserLogs_CommandUsesLatestConfiguredSettingsAndRefreshesProperties()
975public async Task WithBrowserLogs_CommandRefreshesBrowserExecutablePropertyWhenRelaunchFails()
1060public async Task WithBrowserLogs_CommandRemovesStaleBrowserExecutablePropertyWhenBrowserCannotBeResolved()
1132public async Task WithBrowserLogs_CommandPublishesFailureDiagnosticsWhenLaunchFailsBeforeAnySession()
1188public async Task WithBrowserLogs_CommandClearsLastErrorAfterSuccessfulLaunch()
1247public async Task WithBrowserLogs_CommandSurfacesAdoptedBrowserDiagnostics()
1297public async Task WithBrowserLogs_CommandFailsWhenEndpointIsMissing()
1325public async Task WithBrowserLogs_CommandBecomesEnabledWhenParentReady()
1371public async Task WithBrowserLogs_CommandTracksMultipleSessionsWithUniqueIds()
1506public async Task WithBrowserLogs_PreservesLastErrorWhenOneOfMultipleSessionsFails()
1574public async Task WithBrowserLogs_DisposeWaitsForCompletionObservers()
1614var disposeTask = app.DisposeAsync().AsTask();
1633public async Task BrowserEventLogger_LogsSuccessfulNetworkRequests()
1691public async Task BrowserEventLogger_LogsFailedNetworkRequests()
1791public Task StartSessionAsync(BrowserLogsResource resource, BrowserConfiguration configuration, string resourceName, Uri url, CancellationToken cancellationToken)
1794return Task.CompletedTask;
1800return Task.FromResult(ScreenshotResult);
1828return Task.FromException<IBrowserLogsRunningSession>(exception);
1846return Task.FromResult<IBrowserLogsRunningSession>(session);
1860private Task? _completionObserverTask;
1880public Task CompletionObserverStarted => CompletionObserverStartedSource.Task;
1884public Task StartCompletionObserver(Func<int?, Exception?, Task> onCompleted)
1890public Task StopAsync(CancellationToken cancellationToken)
1894return Task.CompletedTask;
1899return Task.FromResult(ScreenshotBytes);
1902public async Task CompleteAsync(int exitCode, Exception? error = null)
1905await (_completionObserverTask ?? Task.CompletedTask);
1919private async Task ObserveCompletionAsync(Func<int?, Exception?, Task> onCompleted)
1978public Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default) => Task.CompletedTask;
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.CodeGeneration.Go.Tests (18)
Aspire.Hosting.CodeGeneration.Java.Tests (18)
Aspire.Hosting.CodeGeneration.Python.Tests (18)
Aspire.Hosting.CodeGeneration.Rust.Tests (19)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (22)
Aspire.Hosting.Containers.Tests (56)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.DevTunnels (29)
Aspire.Hosting.DevTunnels.Tests (43)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Docker (19)
Aspire.Hosting.Docker.Tests (98)
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Dotnet (2)
Aspire.Hosting.Dotnet.Tests (51)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.DotnetTool.Tests (29)
Aspire.Hosting.EntityFrameworkCore (14)
Aspire.Hosting.EntityFrameworkCore.Tests (25)
Aspire.Hosting.Foundry (38)
Aspire.Hosting.Foundry.Tests (54)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Garnet (1)
Aspire.Hosting.Garnet.Tests (15)
Aspire.Hosting.GitHub.Models.Tests (19)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Go.Tests (57)
Aspire.Hosting.Java (5)
Aspire.Hosting.Java.Tests (160)
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.JavaScript (10)
Aspire.Hosting.JavaScript.Tests (118)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Kafka (1)
Aspire.Hosting.Kafka.Tests (26)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Keycloak (1)
Aspire.Hosting.Keycloak.Tests (5)
Aspire.Hosting.Kubernetes (42)
Aspire.Hosting.Kubernetes.Tests (155)
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Maui (26)
Lifecycle\MauiBuildQueueEventSubscriber.cs (10)
41public Task SubscribeAsync(IDistributedApplicationEventing eventing, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
44return Task.CompletedTask;
47private async Task OnBeforeResourceStartedAsync(BeforeResourceStartedEvent @event, CancellationToken cancellationToken)
135internal virtual async Task RunBuildAsync(IResource resource, ILogger logger, CancellationToken cancellationToken)
189var stdoutTask = PipeOutputAsync(process.StandardOutput, logger, LogLevel.Information, token);
190var stderrTask = PipeOutputAsync(process.StandardError, logger, LogLevel.Warning, token);
212await Task.WhenAll(stdoutTask, stderrTask).ConfigureAwait(false);
224private static async Task PipeOutputAsync(System.IO.StreamReader reader, ILogger logger, LogLevel level, CancellationToken cancellationToken)
282internal virtual async Task ReleaseSemaphoreAfterLaunchAsync(
393_ = Task.Run(async () =>
Aspire.Hosting.Maui.Tests (126)
MauiBuildQueueTests.cs (91)
49public async Task SingleResource_AcquiresSemaphore()
54var eventTask = Task.Run(() => env.Eventing.PublishAsync(
68public async Task SingleResource_ReleasesSemaphoreAfterBuild()
83public async Task SecondResource_BlocksUntilBuildCompletes()
87var task1 = Task.Run(() => env.Eventing.PublishAsync(
93var queued = WaitForStateAsync(env, env.MacCatalyst, "Queued");
94var task2 = Task.Run(() => env.Eventing.PublishAsync(
111public async Task SecondResource_ShowsQueuedState()
115var task1 = Task.Run(() => env.Eventing.PublishAsync(
124_ = Task.Run(async () =>
136var task2 = Task.Run(() => env.Eventing.PublishAsync(
151public async Task SingleResource_ShowsBuildingState()
158_ = Task.Run(async () =>
170var eventTask = Task.Run(() => env.Eventing.PublishAsync(
182public async Task ResourcesFromDifferentProjects_RunConcurrently()
187var task1 = Task.Run(() => env.Eventing.PublishAsync(
191var task2 = Task.Run(() => env.Eventing.PublishAsync(
207await Task.WhenAll(task1, task2).WaitAsync(TimeSpan.FromSeconds(5));
211public async Task FailedBuild_ReleasesQueueAndThrows()
228public async Task CancelledQueuedResource_DoesNotDeadlock()
232var task1 = Task.Run(() => env.Eventing.PublishAsync(
239var queued = WaitForStateAsync(env, env.MacCatalyst, "Queued");
240var task2 = Task.Run(() => env.Eventing.PublishAsync(
255var task3 = env.Eventing.PublishAsync(
262public async Task ThreeResources_ExecuteInSequence()
267var task1 = Task.Run(async () =>
277var macCatalystQueued = WaitForStateAsync(env, env.MacCatalyst, "Queued");
278var iosSimulatorQueued = WaitForStateAsync(env, env.IOSSimulator, "Queued");
280var task2 = Task.Run(async () =>
288var task3 = Task.Run(async () =>
296await Task.WhenAll(macCatalystQueued, iosSimulatorQueued);
311var macTask = env.Subscriber.WaitForBuildStartedAsync(env.MacCatalyst, TimeSpan.FromSeconds(30));
312var iosTask = env.Subscriber.WaitForBuildStartedAsync(env.IOSSimulator, TimeSpan.FromSeconds(30));
313var secondStarted = await Task.WhenAny(macTask, iosTask);
344public async Task NonMauiResource_IsNotAffected()
348var task1 = Task.Run(() => env.Eventing.PublishAsync(
355var parentTask = env.Eventing.PublishAsync(
366public async Task ResourceRestart_CanBuildSameResourceTwice()
390public async Task MissingBuildQueueAnnotation_SkipsQueue()
420public async Task MissingBuildInfoAnnotation_ThrowsAndReleasesSemaphore()
463public async Task UnexpectedException_ReleasesSemaphore()
510public async Task CancelQueuedResource_CompletesGracefullyAndDoesNotAcquireSemaphore()
515var task1 = Task.Run(() => env.Eventing.PublishAsync(
522var queued = WaitForStateAsync(env, env.MacCatalyst, "Queued");
523var task2 = Task.Run(() => env.Eventing.PublishAsync(
549public async Task StopCommand_QueuedOrBuildingResource_CancelsBuild()
554var eventTask = Task.Run(() => env.Eventing.PublishAsync(
572var exitedSeen = WaitForStateAsync(env, env.Android, KnownResourceStates.Exited);
582public async Task StopCommand_RunningResource_DelegatesToOriginalStopCommand()
606public async Task CancelBuildingResource_ReleasesSemaphore()
611var task1 = Task.Run(() => env.Eventing.PublishAsync(
634public async Task ReleaseSemaphoreAfterLaunchAsync_SkipsReplayStateAndReleasesOnStableState()
649var releaseTask = subscriber.ReleaseSemaphoreAfterLaunchAsync(
668public async Task CancelQueuedResource_NextResourceProceeds()
673var task1 = Task.Run(() => env.Eventing.PublishAsync(
680var macCatalystQueued = WaitForStateAsync(env, env.MacCatalyst, "Queued");
681var iosSimulatorQueued = WaitForStateAsync(env, env.IOSSimulator, "Queued");
683var task2 = Task.Run(() => env.Eventing.PublishAsync(
687var task3 = Task.Run(() => env.Eventing.PublishAsync(
691await Task.WhenAll(macCatalystQueued, iosSimulatorQueued);
712public async Task BuildTimeout_ThrowsTimeoutException()
748return Task.FromResult(CommandResults.Success());
784private static async Task WaitForStateAsync(BuildQueueTestEnvironment env, IResource resource, string state)
818public Task WaitForBuildStartedAsync(IResource resource, TimeSpan? timeout = null)
849internal override async Task RunBuildAsync(IResource resource, ILogger logger, CancellationToken cancellationToken)
884internal override Task ReleaseSemaphoreAfterLaunchAsync(IResource resource, SemaphoreSlim semaphore, string? stateAtCallTime, ILogger logger, CancellationToken cancellationToken)
887return Task.CompletedTask;
910internal override Task ReleaseSemaphoreAfterLaunchAsync(IResource resource, SemaphoreSlim semaphore, string? stateAtCallTime, ILogger logger, CancellationToken cancellationToken)
913return Task.CompletedTask;
Aspire.Hosting.Milvus.Tests (7)
Aspire.Hosting.MongoDB.Tests (13)
Aspire.Hosting.MySql (1)
Aspire.Hosting.MySql.Tests (38)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Nats.Tests (16)
Aspire.Hosting.OpenAI.Tests (25)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Oracle.Tests (15)
Aspire.Hosting.Orleans.Tests (3)
Aspire.Hosting.PostgreSQL (1)
Aspire.Hosting.PostgreSQL.Tests (47)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Python (5)
Aspire.Hosting.Python.Tests (45)
Aspire.Hosting.Qdrant.Tests (15)
Aspire.Hosting.RabbitMQ.Tests (25)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Radius (25)
Publishing\RadCredentialRegisterStep.cs (7)
65internal async Task ExecuteAsync(PipelineStepContext context)
124_ => Task.FromResult(("--tenant-id", sp.TenantId)),
125_ => Task.FromResult(("--client-id", sp.ClientId)),
138_ => Task.FromResult(("--client-id", wi.ClientId)),
139_ => Task.FromResult(("--tenant-id", wi.TenantId)),
164_ => Task.FromResult(("--iam-role", irsa.IamRoleArn)),
249private static async Task RunRadAsync(
Aspire.Hosting.Radius.Tests (75)
Secrets\SealedSecretApplyStepTests.cs (41)
217public async Task WaitForSealedSecretSynced_TransientStatusProbeFailure_RetriesUntilSynced()
237? Task.FromResult((ExitCode: 1, StdOut: "", StdErr: "Unable to connect to the server: dial tcp 127.0.0.1:6443: connect: connection refused"))
238: Task.FromResult((ExitCode: 0, StdOut: """
255secretExists: _ => Task.FromResult(true),
262public async Task GetSealedSecretStatus_PermanentFailure_ThrowsImmediately()
277return Task.FromResult((ExitCode: 1, StdOut: "", StdErr: "Error from server (Forbidden): sealedsecrets.bitnami.com \"db-creds\" is forbidden: User cannot get resource"));
285public async Task GetSealedSecretStatus_NotFound_ReturnsEmptyStatusForRetry()
294(_, _) => Task.FromResult((ExitCode: 1, StdOut: "", StdErr: "Error from server (NotFound): sealedsecrets.bitnami.com \"db-creds\" not found")));
305public async Task GetSealedSecretStatus_TransientFailure_ReturnsEmptyStatusForRetry(string stderr)
312(_, _) => Task.FromResult((ExitCode: 1, StdOut: "", StdErr: stderr)));
319public async Task SecretExists_ExitZero_ReturnsTrue()
326(_, _) => Task.FromResult((ExitCode: 0, StdOut: "{}", StdErr: "")));
336public async Task SecretExists_NotFoundOrTransientFailure_ReturnsFalseForRetry(string stderr)
346(_, _) => Task.FromResult((ExitCode: 1, StdOut: "", StdErr: stderr)));
355public async Task SecretExists_PermanentFailure_Throws(string stderr)
364(_, _) => Task.FromResult((ExitCode: 1, StdOut: "", StdErr: stderr))));
389public async Task WaitForSealedSecretSynced_ReturnsOnceObservedGenerationMatchesSyncedTrueAndSecretExists()
401return Task.FromResult(statusCalls == 1
411return Task.FromResult(secretCalls >= 2);
420public async Task WaitForSealedSecretSynced_FailsFastWhenSyncedFalseForAppliedGeneration()
428getStatus: _ => Task.FromResult(new SealedSecretApplyStep.SealedSecretStatusSnapshot(
432secretExists: _ => Task.FromResult(false),
440public async Task WaitForSealedSecretSynced_TimesOutWhenStatusNeverMatches_Throws_ASPIRERADIUS058()
448getStatus: _ => Task.FromResult(new SealedSecretApplyStep.SealedSecretStatusSnapshot(4, 3, [])),
449secretExists: _ => Task.FromResult(false),
459public async Task WaitForSealedSecretSynced_ConcurrentReapplyAdvancesGeneration_SyncsAgainstLiveGeneration()
470getStatus: _ => Task.FromResult(new SealedSecretApplyStep.SealedSecretStatusSnapshot(
474secretExists: _ => Task.FromResult(true),
479public async Task WaitForSealedSecretSynced_StatusMatchesButSecretAbsent_KeepsWaitingThenTimesOut()
495getStatus: _ => Task.FromResult(new SealedSecretApplyStep.SealedSecretStatusSnapshot(
507await Task.Delay(Timeout.Infinite, ct).ConfigureAwait(false);
517public async Task WaitForSealedSecretSynced_HangingProbeTimesOutWith_ASPIRERADIUS058()
528await Task.Delay(Timeout.Infinite, ct);
531secretExists: _ => Task.FromResult(false),
540public async Task WaitForSealedSecretSynced_CancellationDuringPolling_ThrowsOperationCanceledException()
551getStatus: _ => Task.FromResult(new SealedSecretApplyStep.SealedSecretStatusSnapshot(4, null, [])),
552secretExists: _ => Task.FromResult(false),
796public async Task InvokeProbeWithRemainingBudget_HangingApply_CancelledWithin_ASPIRERADIUS066()
803await Task.Delay(Timeout.Infinite, ct);
818public async Task InvokeProbeWithRemainingBudget_CallerCancellation_SurfacesOperationCanceled()
829await Task.Delay(Timeout.Infinite, ct);
Aspire.Hosting.Redis (5)
Aspire.Hosting.Redis.Tests (39)
Aspire.Hosting.RemoteHost (28)
JsonRpcServer.cs (8)
49protected override async Task ExecuteAsync(CancellationToken stoppingToken)
78private async Task StartNamedPipeServerAsync(RemoteHostProfilingTelemetry.ActivityScope listenActivity, CancellationToken cancellationToken)
119_ = Task.Run(() => HandleClientStreamAsync(pipeServer, ownsStream: true, cancellationToken), cancellationToken);
129await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
136private async Task StartUnixSocketServerAsync(RemoteHostProfilingTelemetry.ActivityScope listenActivity, CancellationToken cancellationToken)
181_ = Task.Run(() => HandleClientStreamAsync(stream, ownsStream: true, cancellationToken), cancellationToken);
191await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
198private async Task HandleClientStreamAsync(Stream clientStream, bool ownsStream, CancellationToken cancellationToken)
Aspire.Hosting.RemoteHost.Tests (92)
CapabilityDispatcherTests.cs (28)
18CapabilityHandler handler = (args, handles) => Task.FromResult<JsonNode?>(JsonValue.Create("result"));
37dispatcher.Register("test/cap1@1", (_, _) => Task.FromResult<JsonNode?>(null));
38dispatcher.Register("test/cap2@1", (_, _) => Task.FromResult<JsonNode?>(null));
54return Task.FromResult<JsonNode?>(JsonValue.Create("success"));
70return Task.FromResult<JsonNode?>(null);
82dispatcher.Register("test/capability@1", (_, _) => Task.FromResult<JsonNode?>(JsonValue.Create(42)));
109return Task.FromResult<JsonNode?>(null);
128return Task.FromResult<JsonNode?>(null);
146return Task.FromResult<JsonNode?>(null);
161Task.FromException<JsonNode?>(
2127return Task.FromResult(default(TResult)!);
2130public Task InvokeAsync(string callbackId, JsonNode? args, CancellationToken cancellationToken = default)
2135return Task.CompletedTask;
2166public static async Task AsyncVoidMethod(string value)
2168await Task.Delay(1);
2176await Task.Delay(1);
2184await Task.Delay(1);
2192await Task.Delay(1);
2318await Task.Delay(1);
2324await Task.Delay(1);
2359public static void InvokeCallback(Func<Task> callback)
2369public static void InvokeTypedCallback(Func<string, Task> callback)
2412return Task.FromResult(Environment.CurrentManagedThreadId);
2417public static Task NonGenericTaskBackgroundThreadProbe()
2420return Task.CompletedTask;
2440public static Task InvokeSyncCallbackFromAsyncBackgroundThreadProbe(Func<Task> callback)
2445return Task.CompletedTask;
Aspire.Hosting.Rust (7)
Aspire.Hosting.Rust.Tests (100)
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.Sdk.Tests (46)
Aspire.Hosting.Seq.Tests (9)
Aspire.Hosting.SqlServer (2)
Aspire.Hosting.SqlServer.Tests (15)
Aspire.Hosting.Tasks (1)
Aspire.Hosting.Testing (12)
Aspire.Hosting.Testing.Tests (107)
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (10)
23public static Task WaitForTextAsync(this DistributedApplication app, string logText, string? resourceName = null, CancellationToken cancellationToken = default)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
47public static Task WaitForTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
62public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, CancellationToken cancellationToken = default)
73public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, string? resourceName = null, CancellationToken cancellationToken = default)
84_ = Task.Run(() => WatchNotifications(app, resourceName, predicate, tcs, watchCts), watchCts.Token);
97public static async Task WaitForAllTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource)
128var logWatchTasks = new List<Task>();
160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Tests (2311)
Dashboard\DashboardEventHandlersTests.cs (12)
31public async Task WatchDashboardLogs_WrittenToHostLoggerFactory(DateTime? timestamp, string logMessage, string expectedMessage, string expectedCategory, LogLevel expectedLevel)
79public async Task WatchDashboardLogs_AspireDashboardWarningsShown_ThirdPartyWarningsSuppressed(
182public async Task BeforeStartAsync_ExcludeLifecycleCommands_CommandsNotAddedToDashboard()
206public async Task BeforeStartAsync_DashboardContainsDebugSessionInfo(string? debugSessionPort, int? expectedDebugSessionPort, string? debugSessionToken, string? debugSessionCert, string? dcpInstanceIdPrefix, string? expectedDcpInstanceId, bool? telemetryEnabled)
276public async Task ConfigureEnvironmentVariables_HasAspireDashboardEnvVars_CopiedToDashboard()
315public async Task ResourceReadyEvent_LogsDashboardUrlFromAllocatedEndpoint(string configuredUrl, string expectedHost, int allocatedPort, string expectedScheme, string expectedOtlpHost)
400public async Task ResourceReadyEvent_LogsConfiguredOtlpUrlsWhenConfigured()
460public async Task AddDashboardResource_CreatesExecutableResourceWithCustomRuntimeConfig()
550public async Task AddDashboardResource_WithExecutablePath_CreatesCorrectArguments()
619public async Task AddDashboardResource_WithUnixExecutablePath_CreatesCorrectArguments()
688public async Task AddDashboardResource_WithDirectDllPath_CreatesCorrectArguments()
905return Task.FromResult("http://localhost:1010");
Dashboard\DashboardResourceTests.cs (23)
26public async Task DashboardIsAutomaticallyAddedAsHiddenResource(string showDashboardResourcesKey)
66public async Task DashboardIsAddedFirst()
89public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard(string dashboardOtlpGrpcEndpointUrlKey)
185public async Task DashboardWithBlankOtlpEndpoint_AutoConfiguresDynamicOtlpPorts(string dashboardOtlpGrpcEndpointUrlKey)
220public async Task DashboardWithBlankOtlpEndpointAndUnsecuredTransport_UsesHttpScheme()
256public async Task DashboardWithDashboardUrls_OtlpEndpointsInheritTargetHost(string dashboardUrls, bool? allowUnsecuredTransport, string expectedTargetHost)
292public async Task DashboardWithNoApplicationUrl_UsesDynamicFrontendEndpointWithExpectedScheme(bool allowUnsecuredTransport, string expectedEndpointName)
318public async Task DashboardWithDllPathLaunchesDotnet()
353public async Task DashboardAuthConfigured_EnvVarsPresent(string dashboardOtlpGrpcEndpointUrlKey)
394public async Task DashboardAuthRemoved_EnvVarsUnsecured(string dashboardOtlpGrpcEndpointUrlKey)
431public async Task DashboardResourceServiceUriIsSet(string dashboardOtlpGrpcEndpointUrlKey)
466public async Task DashboardResource_OtlpHttpEndpoint_CorsEnvVarSet(string? explicitCorsAllowedOrigins, string otlpHttpEndpointUrlKey, string corsAllowedOriginsKey)
514public async Task DashboardResource_DynamicOtlpHttpEndpoint_CorsEnvVarSet(string? explicitCorsAllowedOrigins, string corsAllowedOriginsKey)
561public async Task DashboardResource_OtlpGrpcEndpoint_CorsEnvVarNotSet(string? explicitCorsAllowedOrigins, string otlpGrpcEndpointUrlKey, string corsAllowedOriginsKey)
598public async Task DashboardResource_HttpsEndpoint_ConfiguresKestrelCertificateCallback()
625public async Task DashboardIsNotAddedInPublishMode()
645public async Task DashboardIsNotAddedIfDisabled()
683public async Task DashboardLifecycleEventsWatchesLogs(LogLevel logLevel)
707var watchForLogSubs = Task.Run(async () =>
764public async Task DashboardIsExcludedFromManifestInPublishModeEvenIfAddedExplicitly()
791public async Task DashboardResource_UrlsIncludeTokenQuerystringWhenConfigured(string? browserToken, string expectedHttpUrl, string expectedHttpsUrl)
927return Task.FromResult("http://localhost:5000");
Dcp\DcpExecutorTests.cs (263)
46public async Task ContainersArePassedOtelServiceName()
68public async Task DockerfileContainerBuildSpecIncludesPlatform()
93public async Task DockerfileContainerBuildSpec_RunMode_DefaultsToHostPlatform()
115public async Task ResourceStarted_ProjectHasReplicas_EventRaisedOnce()
135return Task.CompletedTask;
159var watchResourceTask = Task.Run(async () =>
180public async Task CreateExecutable_LaunchProfileHasCommandLineArgs_AnnotationsAdded(string executionType, bool addAppHostArgs, string[]? expectedArgs, string[]? expectedAnnotations)
235public async Task CreateExecutable_ToolHasCommandLineArgs_AnnotationsAdded(params string[] toolArgs)
272public async Task DotnetToolResource_ExtensionMode_OwnedLaunchToolArgsAreWithheldAndRespectCommandLineVisibility(bool showInCommandLine)
326public async Task DotnetToolResource_ProcessMode_LaunchToolArgsReplaceBuiltInInvocation(bool showInCommandLine)
363public async Task CreateExecutable_ProjectArgsResolvedInSnapshot_UsesEffectiveArgsFromCreatorIndexes()
404public async Task CreateContainer_ArgsResolvedInSnapshot_UsesEffectiveArgsFromCreatorIndexes()
452public async Task RunApplicationAsync_ThrowsWhenContainerResourceNameConflictsWithContainerTunnelName(string containerName)
473public async Task RunApplicationAsync_ThrowsWhenExplicitContainerNameConflictsWithContainerTunnelName(string containerName)
495public async Task RunApplicationAsync_ThrowsWhenNetworkAliasConflictsWithContainerTunnelName(string alias)
515public async Task RunApplicationAsync_AllowsContainerNameMatchingContainerTunnelNameWhenContainerTunnelDisabled()
540public async Task ResourceRestarted_EnvironmentCallbacksApplied()
573return Task.CompletedTask;
615public async Task EndpointPortsExecutableNotReplicatedProxiedNoPortNoTargetPort()
646public async Task EndpointPortsExecutableNotReplicatedProxiedPortSetNoTargetPort()
678public async Task EndpointPortsExecutableNotReplicatedProxiedNoPortTargetPortSet()
710public async Task EndpointPortsExecutableNotReplicatedProxiedPortAndTargetPortSet()
747public async Task UnsupportedEndpointPortsExecutableNotReplicatedProxied()
765public async Task EndpointPortsExecutableWithEndpointProxySupportUsesProxylessEndpoint()
794public async Task EndpointPortsExecutableWithEndpointProxySupportOverridesExplicitProxiedEndpoint()
823public async Task EndpointPortsPersistentExecutableDefaultsToProxylessEndpoint()
858public async Task EndpointPortsPersistentExecutableDefaultsToProxiedEndpointWhenPortsAreRandomized()
896public async Task EndpointPortsPersistentExecutableExplicitProxylessStaysProxylessWhenPortsAreRandomized()
932public async Task EndpointPortsExecutableNotReplicatedProxylessPortSetNoTargetPort()
963public async Task EndpointPortsExecutableNotReplicatedProxylessNoPortTargetPortSet()
995public async Task EndpointPortsExecutableNotReplicatedProxylessPortAndTargetPortSet()
1026public async Task EndpointPortsExecutableNotReplicatedProxylessNoPortNoTargetPortAllocated()
1055public async Task ProxylessPortAllocatorExcludesFixedPublicPorts()
1093public async Task PersistentProxylessExecutableWithUnspecifiedPortPersistsAllocatedPort(int? port)
1130public async Task PersistentProxylessContainerWithUnspecifiedPortPersistsAllocatedPort(int? port)
1169public async Task PersistentProxylessWithoutPortLogsWarningButStillAllocatesWhenPersistenceFails()
1213public async Task ProxylessExecutableAllocatedPortIsStableOnResourceRestart()
1250public async Task ProxylessContainerAllocatedHostPortIsStableOnResourceRestart()
1288public async Task PersistedProxylessEndpointPortIsReusedAndExcludedFromDynamicAllocation()
1334public async Task UnsupportedEndpointPortsExecutableNotReplicatedProxyless()
1372public async Task EndpointOtelServiceName(int replicaCount, string expectedName)
1399public async Task ResourceLogging_MultipleStreams_StreamedOverTime()
1492public async Task ResourceLogging_ReplayBacklog_SentInBatch()
1571public async Task ResourceLogging_LateSubscriberReceivesFailedToStartLogsWithoutWatchReplay()
1610return Task.CompletedTask;
1647public async Task ResourceLogging_ActiveSubscriberReceivesFailedToStartLogsAfterSnapshot()
1729public async Task ResourceLogging_TerminalStateFollowsLogsBeforeNotification()
1774return Task.CompletedTask;
1804public async Task ResourceLogging_TerminalLogFlushTimeoutDoesNotBlockOtherResourceNotifications()
1864return Task.CompletedTask;
1903public async Task ResourceLogging_ActiveSubscriberContinuesAfterTerminalFlushTimeout()
1990public async Task ResourceLogging_FollowStreamDeduplicatesOnlyPendingTerminalFlush()
2076public async Task ResourceLogging_CompletedFollowStreamIsRemovedAndCanRestartWithExistingSubscriber()
2135var firstLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(container.Metadata.Name);
2158public async Task ResourceLogging_OverlappingSameUidStreamCannotClearNewDeduplicationState()
2225return Task.CompletedTask;
2251var previousLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2276var currentLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2318public async Task ResourceLogging_CanceledSameUidStreamCannotClearHandedOffDeduplicationState()
2381return Task.CompletedTask;
2407var previousLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2432var currentLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2470public async Task ResourceWatch_ResourceWithoutResourceVersionIsAlwaysProcessed()
2493return Task.CompletedTask;
2523public async Task ResourceWatch_UnchangedResourceNotificationIsIgnored()
2546return Task.CompletedTask;
2579public async Task ResourceWatch_RecreatedResourceWithPreviouslySeenVersionIsProcessed()
2602return Task.CompletedTask;
2633public async Task ResourceWatch_RecreatedResourceAfterMissedDeleteIsProcessedAndResetsLogState()
2699return Task.CompletedTask;
2738var previousLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2768var replacementLogStreamTask = appExecutor.ResourceWatcher.GetLogStreamTask(dcpResourceName);
2797public async Task ResourceWatch_WatchRestartDoesNotRepublishUnchangedResources()
2820return Task.CompletedTask;
2855public async Task ResourceWatch_FailedToStartLogsAreRetriedForEachChangedTerminalNotification()
2894return Task.CompletedTask;
2925public async Task ResourceWatch_TerminalLogsAreFlushedOnlyOncePerTerminalPeriod()
2979return Task.CompletedTask;
3043public async Task ResourceLogging_SystemStream_FormatsWithSysPrefix()
3109public async Task ResourceLogging_CarriageReturnProgressOutput_NormalizesOverwrittenLines()
3169public async Task ResourceLogging_SystemStreamWithCarriageReturnInMessage_ParsesCorrectly()
3279public async Task EndpointPortsProjectNoPortNoTargetPort()
3326public async Task EndpointPortsProjectPortSetNoTargetPort()
3367public async Task EndpointPortsProjectWithEndpointProxySupportUsesProxylessEndpoint()
3398public async Task EndpointPortsPersistentProjectDefaultsToProxylessEndpoint()
3435public async Task EndpointPortsPersistentProjectDefaultsToProxiedEndpointWhenPortsAreRandomized()
3475public async Task EndpointPortsConainerProxiedNoPortTargetPortSet()
3509public async Task EndpointPortsContainerProxiedPortAndTargetPortSet()
3547public async Task UnsupportedEndpointPortsContainer()
3594public async Task EndpointPortsContainerProxylessPortSetNoTargetPort()
3627public async Task EndpointPortsContainerProxylessNoPortTargetPortSet()
3659public async Task EndpointPortsContainerProxylessNoPortTargetPortSetPublishesAllocatedEndpoint()
3683return Task.CompletedTask;
3694return Task.CompletedTask;
3703return Task.CompletedTask;
3733public async Task EndpointPortsContainerProxylessNoPortTargetPortSetAllocatesHostPortAndInjectsTargetPortForContainerSelfReference()
3752return Task.CompletedTask;
3781public async Task EndpointPortsContainerProxylessNoPortTargetPortSetAllocatesHostPortAndInjectsTargetHostAndPortForContainerSelfReference()
3810public async Task EndpointPortsContainerProxylessNoPortTargetPortSetCanBeResolvedWhileDependentResourceIsStarting()
3857public async Task EndpointPortsContainerProxylessNoPortTargetPortSetCanBeResolvedWithoutCallerWhileDependentResourceIsStarting()
3899public async Task ResourceEndpointsAllocatedEventSubscribersBlockDcpStartup()
3923var runTask = appExecutor.RunApplicationAsync();
3934public async Task EndpointPortsContainerProxylessPortAndTargetPortSet()
3968public async Task EndpointPortsContainerWithEndpointProxySupportOverridesExplicitProxiedEndpoint()
4000public async Task EndpointPortsContainerProxylessProtocolSet()
4034public async Task ErrorIfResourceNotDeletedBeforeRestart()
4047return Task.CompletedTask;
4069public async Task AddsDefaultsCommandsToResources()
4088public async Task ContainersArePassedExpectedImagePullPolicy()
4134public async Task ServiceProducerHasCorrectAddress(string bindingAddress, string serviceAddress)
4165public async Task ProjectLaunchConfiguration_Populated_WhenLaunchProfileSpecified_InDebugSession()
4201public async Task ProjectLaunchConfiguration_RespectsDebugSessionRunMode(string runMode, string expectedMode)
4232public async Task ProjectLaunchConfiguration_UsesProjectDebugSupportProducer_InDebugSession()
4276public async Task ProjectLaunchConfiguration_Disabled_WhenLaunchProfileExcluded_InDebugSession()
4311public async Task ProjectLaunchConfiguration_DefaultLaunchProfileAnnotationFallsBack_WhenProfileMissing_InDebugSession()
4353public async Task ProjectLaunchConfiguration_DefaultLaunchProfileAnnotationSelectsExisting_InDebugSession()
4384public async Task ProjectLaunchConfiguration_ExplicitLaunchProfileOverridesDefault_InDebugSession()
4415public async Task ProjectLaunchConfiguration_DefaultIgnoredWhenExcluded_InDebugSession()
4445public async Task ProjectLaunchConfiguration_NoProfiles_NoLaunchProfileSelected_InDebugSession()
4475public async Task ProjectLaunchConfiguration_FallbackToFirstProfileInsertionOrder_InDebugSession()
4503public async Task PlainExecutable_LaunchConfigurationProducerReceivesResolvedEnvironmentVariables()
4529return Task.FromResult(new ExecutableLaunchConfiguration("test")
4570public async Task PlainExecutable_ExtensionMode_SupportedDebugMode_RunsInIde()
4626public async Task PersistentPlainExecutable_ExtensionMode_RunsInProcess()
4661public async Task ProjectResource_WithLaunchToolArgs_ReplacesDotnetRunScaffolding_InProcessMode()
4693public async Task ProjectResource_WithDotnetToolRunLaunchArgs_DoesNotInjectProjectLaunchOptions_InProcessMode()
4730public async Task ProjectResource_EmptyLaunchToolArgs_KeepsDotnetRunScaffolding_InProcessMode()
4751public async Task ProjectResource_WithLaunchToolArgsDebugSupport_WithholdsOwnedPrefix_InDebugSession()
4794public async Task ProjectResource_EmptyOwnedLaunchToolArgs_DoesNotConfigureRuntimeFallback()
4835public async Task ProjectResource_CustomIdeLaunchWithoutProcessInvocation_UsesApplicationArgumentsOnly()
4879public async Task ProjectResource_CustomIdeLaunchWithoutProcessInvocation_DoesNotAddDotnetArgumentSeparator()
4926public async Task ProjectResource_EmptyOwnedLaunchToolArgs_LaunchConfigurationFailureFailsResource()
4951return Task.CompletedTask;
4979public async Task ProjectResource_WithoutLaunchToolArgs_DoesNotConfigureRuntimeFallback_InDebugSession()
5008public async Task PersistentDcpResourcesDoNotIncludeMonitorProcessByDefault()
5054public async Task PersistentProjectWithReplicasThrows()
5072public async Task PersistentPlainExecutableWithReplicasThrows()
5090public async Task PersistentContainerWithOtlpExporterUsesStableServiceInstanceId()
5110public async Task PersistentExecutableWithOtlpExporterUsesStableServiceInstanceId()
5159public async Task ExplicitParentProcessLifetimeIncludesMonitorProcess()
5209public async Task PersistentPlainExecutable_UsesStableCertificateOutputPath()
5251public async Task PersistentPlainExecutable_WritesCustomBundleDirectoryOwnerOnly()
5269ctx.EnvironmentVariables["TEST_BUNDLE"] = ctx.CreateCustomBundle(static (_, _) => Task.FromResult(new byte[] { 1, 2, 3 }));
5270return Task.CompletedTask;
5407public async Task PlainExecutableCertificateDirectoriesPath_IgnoresResourceSslCertDirForAppend()
5420public async Task SessionScopedExplicitStartPlainExecutable_DefersDcpObjectCreationUntilManualStart()
5444public async Task PlainExecutable_MultipleLaunchRecipes_ReportsLaunchPlanFailure()
5458return Task.CompletedTask;
5489public async Task PlainExecutable_ExtensionMode_UnsupportedDebugMode_RunsInProcess()
5525public async Task PlainExecutable_NoExtensionMode_RunInProcess()
5567public async Task CustomExecutable_NoDebugSessionInfo_RunInProcess()
5603public async Task CustomExecutable_InvalidDebugSessionInfo_RunInProcess()
5639public async Task CustomExecutable_DebugSessionInfoWithNullSupportedLaunchConfigurations_RunInProcess()
5681public async Task CustomExecutable_DebugSessionInfoNotContainingType_RunInProcess()
5723public async Task CustomExecutable_DebugSessionInfoContainsType_RunInIde()
5765public async Task ProjectExecutable_NoDebugSessionInfo_DefaultsToProjectSupport()
5798public async Task Project_WithTerminal_RunsAsProcess_InDebugSessionWhenDebugSupportIsAddedLater()
5842public async Task Project_WithTerminal_RunsAsProcess_NoDebugSessionInfo()
5878public async Task ProjectExecutable_InvalidDebugSessionInfo_DefaultsToProjectSupport()
5911public async Task ProjectExecutable_DebugSessionInfoWithNullSupportedLaunchConfigurations_DefaultsToProjectSupport()
5950public async Task ProjectExecutable_DebugSessionInfoWithoutProject_SelectsProcess()
5991public async Task ProjectWithNonProjectAnnotation_DebugSessionWithoutInfo_UsesProjectIdeExecution()
6032public async Task ProjectWithNonProjectAnnotation_VSCodeExplicitlyUnsupported_RunsInProcess()
6085public async Task ProjectWithNonProjectAnnotationAndExecutableAnnotation_VSCodeExplicitlyUnsupported_RunsInProcessWithResourceArgs(string launchConfigurationType, string[] resourceArgs)
6145public async Task ProjectWithNonProjectAnnotationAndExecutableAnnotation_NoDebugSessionInfo_RunsInProcessWithResourceArgs(string launchConfigurationType, string[] resourceArgs)
6197public async Task ProjectWithNonProjectAnnotationAndExecutableAnnotation_NoDebugSession_RunsInProcessWithResourceArgs(string launchConfigurationType, string[] resourceArgs)
6241public async Task MauiProjectWithExecutableAnnotationAndSupportedLaunchConfiguration_RunsInIdeWithLaunchMetadata()
6324public async Task MauiProjectWithLaunchArgsOverrideAndSupportedLaunchConfiguration_PreservesProjectMetadataAndAppliesMauiLaunchConfiguration(bool useContextOverload)
6352return Task.FromResult(CreateMauiLaunchConfiguration(context.Mode));
6457public async Task MauiProjectWithLaunchArgsOverride_LaunchConfigurationProducerThrows_RemainsInProcessExecution(bool useContextOverload)
6486await Task.Yield();
6530return Task.CompletedTask;
6587public async Task ProjectResource_CustomIdeLaunch_OwnedDotnetToolRunArgsPreserveLaunchProfileArgs()
6649public async Task ProjectResource_CustomIdeLaunch_ExecutableAnnotatedProjectPreservesLaunchProfileArgs(
6778public async Task ProjectResource_CustomIdeLaunch_PreservesOpaqueDotnetApplicationArguments(
6847public async Task ProjectResource_CustomIdeLaunch_ExecutableAnnotatedDotnetApplicationDoesNotConfigureRuntimeFallback(
6892public async Task ProjectWithNonProjectAnnotationAndExecutableAnnotation_LaunchProfileArgsStayAfterDotnetRunArgs()
6956public async Task ProjectWithNonProjectAnnotation_NoDebugSession_RunsInProcess()
6982public async Task ProjectWithNonProjectAnnotation_VSCodeWithMatchingSupport_RunsInIde()
7024public async Task StandardAndCustomProjects_VSScenario_BothRunInIde()
7072public async Task StandardAndCustomProjects_VSCodeScenario_BothRunInIde()
7126public async Task ProjectWithNonProjectAnnotation_VSCompatibilityLaunch_UsesApplicationArgumentsOnly()
7165public async Task ContainerNetworkAliases(params string[]? aliases)
7200public async Task ProjectExecutable_NoSupportsDebuggingAnnotation_InDebugSession_RunsInIdeMode()
7247public async Task FileBasedProjectResource_InDebugSession_UsesIdeWithoutProcessFallback()
7281public async Task ProjectExecutable_AsyncLaunchConfigurationProducer_IsAwaitedDuringCreate()
7295await Task.Yield();
7325public async Task PlainExecutable_AsyncLaunchConfigurationProducer_IsAwaitedDuringCreate()
7336await Task.Yield();
7366public async Task PlainExecutable_AsyncLaunchConfigurationProducerFaults_FailsResource()
7375await Task.Yield();
7394return Task.CompletedTask;
7411public async Task ProjectExecutable_WithLaunchArgsOverride_InDebugSession_RunsInProcessMode()
7452public async Task ProjectExecutable_WithLaunchArgsOverride_AndExecutableAnnotatedSdkRunArgs_DoesNotMutateRunArgs()
7494public async Task ProjectExecutable_WithLaunchArgsOverride_AndLeadingResourceArgumentToRemove_DropsRunBeforeExecuting()
7529public async Task ProjectExecutable_WithLaunchArgsOverride_EmptyLaunchToolArgsKeepOverride()
7564public async Task ProjectExecutable_WithLaunchArgsOverride_NonEmptyLaunchToolArgsReplaceOverride()
7610public async Task ProjectExecutable_WithLaunchArgsOverride_AndPersistentLifetime_RunsOverrideInProcessMode()
7651public async Task ProjectExecutable_NoSupportsDebuggingAnnotation_NoDebugSession_RunsInProcessMode()
7679public async Task ProjectExecutable_NoAnnotation_ExecutableLaunchProfile_InDebugSession_RunsInIdeMode()
7721public async Task ProjectExecutable_NoAnnotation_ProjectLaunchProfile_InDebugSession_RunsInIdeMode()
7755public async Task DotnetProjectExecutable_InDebugSession_GetsIdeExecutionWithProjectLaunchConfig()
7821public async Task DotnetProjectExecutable_ProjectLaunchUnsupported_RunsInProcess()
7853public async Task DotnetProjectExecutable_PersistentLifetime_InDebugSession_RunsInProcessWithoutProjectLaunchConfig()
7886public async Task DotnetProjectExecutable_ProjectLaunchConfigurationFailure_FailsResource()
7910return Task.CompletedTask;
7942public async Task PlainExecutable_ExtensionMode_LaunchToolArgsDebugSupport_WithholdsOwnedPrefix()
7995public async Task PlainExecutable_ExtensionMode_OwnedLaunchToolArgsCanBeHiddenFromCommandLine()
8040public async Task PlainExecutable_ExtensionMode_CertificateCallbackCannotShiftLaunchToolPrefixBoundary()
8060return Task.CompletedTask;
8104public async Task PlainExecutable_ExtensionMode_EmptyLaunchToolArgs_DoesNotConfigureRuntimeFallback()
8139public async Task PlainExecutable_UnownedLaunchToolArgs_AreExecutedButCanBeHiddenFromTheCommandLine()
8178public async Task PlainExecutable_ExtensionMode_UnownedLaunchToolArgs_AreNotWithheldFromTheLaunchedProgram()
8216public async Task PlainExecutable_ExtensionMode_LaunchToolArgsDebugSupport_LaunchConfigFailure_FailsResource()
8242return Task.CompletedTask;
8261public async Task PlainExecutable_ExtensionMode_RestartLaunchConfigCancellationIsPropagated()
8279return Task.FromResult(new ExecutableLaunchConfiguration("test") { Mode = mode });
8311public async Task PlainExecutable_ExtensionMode_NullLaunchToolArgument_DoesNotOmitApplicationArgument()
8347public async Task DotnetProjectExecutable_EmptyOwnedLaunchToolArgs_UsesApplicationArgumentsOnly()
8384public async Task DotnetProjectExecutable_EmptyOwnedLaunchToolArgs_LaunchConfigFailureDoesNotRunBrokenProcessCommand()
8412return Task.CompletedTask;
8451public async Task DotnetProjectExecutable_EmptyOwnedLaunchToolArgs_LaunchConfigFailureOnRestartPropagatesFailureAndRetainsDiagnostic()
8488return Task.CompletedTask;
8533public async Task PlainExecutable_ExtensionMode_LaunchToolArgumentsAreRecomputedOnRestart()
8598public async Task PlainExecutable_ExtensionMode_LaunchConfigurationFailureDoesNotReusePriorPlanOnRestart()
8659public async Task PlainExecutable_ProjectDebugSupportWithoutProjectMetadata_FailsToStart()
8683return Task.CompletedTask;
8702public async Task DotnetProjectExecutable_RespectsDebugSessionRunMode(string runMode, string expectedMode)
8738public async Task EndpointsAllocatedCorrectly(bool useTunnel, string? containerHostName, string expectedContainerHost)
8848public async Task ContainerHostUrlWithoutMatchingHostEndpointUsesContainerHostBridge()
8877public async Task ContainerHostUrlMatchingHostEndpointUsesTunnelPort()
8896return Task.CompletedTask;
8922public async Task EnvironmentCallbacksInvokedOnceOnContainer()
8955public async Task EnvironmentCallbacksInvokedAfterBeforeResourceStartEvent()
8984return Task.CompletedTask;
8997public async Task ArgsCallbacksInvokedOnceOnContainer()
9033public async Task ExecutionConfigurationCallbacksDeferredForExplicitStartExecutableUntilManualStart()
9078public async Task ExecutionConfigurationCallbacksDeferredForExplicitStartContainerUntilManualStart()
9123public async Task ExecutionConfigurationCallbacksNotReevaluatedWhenStartingCreatedExplicitStartPersistentExecutable()
9176public async Task ExecutionConfigurationCallbacksNotDeferredForExplicitStartPersistentContainer()
9231public async Task ArgsCallbacksInvokedAfterBeforeResourceStartEvent()
9261return Task.CompletedTask;
9273public async Task TunnelDependentAndIndependentContainersCanStartTogether()
9307public async Task WaitingTunnelDependentContainersDoNotBlockTunnelCreation()
9338await Task.Delay(10, context.CancellationToken).ConfigureAwait(false);
9373public async Task HostResourceCanWaitForTunnelDependentContainer()
9399await Task.Delay(10, context.CancellationToken).ConfigureAwait(false);
9407await Task.Delay(10, context.CancellationToken).ConfigureAwait(false);
9446public async Task EnvironmentCallbackThrows_OtherResourcesStillStart()
9467return Task.CompletedTask;
9483public async Task ArgsCallbackThrows_OtherResourcesStillStart()
9504return Task.CompletedTask;
9555public async Task PlainExecutable_LaunchConfigurationProducerThrows_FailsResource()
9585return Task.CompletedTask;
9602public async Task Project_NonProjectLaunchConfig_ExtensionMode_RunsInIde()
9647public async Task Project_NonProjectLaunchConfig_AnnotatorThrows_FailsResource()
9676return Task.CompletedTask;
9694public async Task Project_NonProjectLaunchConfig_UnsupportedByExtension_RunsInProcess()
9752public async Task Project_WithTerminal_PopulatesPerReplicaTerminalSpec()
9808public async Task Project_WithoutTerminal_HasNullTerminalSpec()
9825public async Task PlainExecutable_WithTerminal_PopulatesTerminalSpec()
9873public async Task Container_WithTerminal_PopulatesTerminalSpec()
DistributedApplicationTests.cs (84)
58public async Task RegisteredLifecycleHookIsExecutedWhenRunAsynchronously()
86public async Task MultipleRegisteredLifecycleHooksAreExecuted()
101return Task.CompletedTask;
133public async Task RunAsync_RecordsAppHostStartActivityForBeforeStartFailure()
165public async Task DistributedApplicationLifecycle_StopAsyncDisposesHostStartupActivityWhenStartupDoesNotComplete()
189public async Task StartResourceForcesStart()
207var startTask = app.StartAsync(token);
220var restartResourceTask = orchestrator.StartResourceAsync(resourceEvent.ResourceId, token).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
233public async Task ExplicitStart_StartExecutable()
252var startTask = app.StartAsync(token);
305public async Task BeforeResourceStartedEvent_NotFiredForExplicitStartOnInitialCreation()
317return Task.CompletedTask;
325return Task.CompletedTask;
333return Task.CompletedTask;
365public async Task BeforeResourceStartedEvent_FiredWhenExplicitStartResourceIsManuallyStarted()
376return Task.CompletedTask;
387var startTask = app.StartAsync(token);
412public async Task BeforeResourceStartedEvent_FiredForNormalResourcesOnInitialStartup()
424return Task.CompletedTask;
437public async Task StartAsync_ThrowsWhenCancelled()
446return Task.CompletedTask;
458public async Task StartAsync_ThrowsWhenStopped()
466return Task.CompletedTask;
478public async Task RunAsync_ThrowsWhenCancelled()
487return Task.CompletedTask;
499public async Task RunAsync_DoesNotThrowWhenStopped()
508return Task.CompletedTask;
518public async Task ExplicitStart_StartContainer()
541var startTask = app.StartAsync(token);
601public async Task ExplicitStart_StartPersistentContainer()
628var startTask = app.StartAsync(token);
736public async Task AfterEndpointsAllocatedLifecycleHookIsNotCalled()
755public Task AfterEndpointsAllocatedAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken = default)
759return Task.CompletedTask;
765public async Task TestServicesWithMultipleReplicas()
783await Task.WhenAll(clientA.GetStringAsync("/pid"), clientC.GetStringAsync("/pid")).DefaultTimeout(TestConstants.DefaultOrchestratorTestLongTimeout);
812await Task.Delay(100);
820public async Task VerifyContainerArgs()
848public async Task VerifyContainerCreateFile()
913public async Task VerifyRedisWithCertificateKeyPair()
971public async Task VerifyContainerIncludesExpectedDevCertificateConfiguration(bool? implicitTrust, bool? explicitTrust, bool expectDevCert, bool overridePaths, CertificateTrustScope trustScope)
1084public async Task VerifyContainerSucceedsWithCreateFileContinueOnError()
1114public async Task VerifyEnvironmentVariablesAvailableInCertificateTrustConfigCallback()
1132return Task.CompletedTask;
1159public async Task VerifyEnvironmentVariablesAppliedWithoutCertificateTrustConfig()
1172return Task.CompletedTask;
1198public async Task VerifyContainerStopStartWorks()
1248public async Task VerifyExecutableStopStartWorks()
1283public async Task SpecifyingEnvPortInEndpointFlowsToEnv()
1337public async Task StartAsync_DashboardUrls_DisplayPropertiesSet()
1367public async Task StartAsync_DashboardAuthConfig_PassedToDashboardProcess(string tokenEnvVarName)
1405public async Task StartAsync_UnsecuredAllowAnonymous_PassedToDashboardProcess()
1438public async Task StartAsync_ResourceServiceEndpointUrl_PassedToDashboardServiceHost()
1468public async Task StartAsync_ResourceServiceEndpointUrl_RandomizePortsIgnoresConfiguredPort(string host, string expectedHost)
1501public async Task VerifyDockerWithEntrypointWorks()
1528public async Task VerifyDockerWithBindMountWorksWithAbsolutePaths()
1557public async Task VerifyDockerWithBindMountWorksWithRelativePaths()
1586public async Task VerifyDockerWithVolumeWorksWithName()
1614public async Task KubernetesHasResourceNameForContainersAndExes()
1670public async Task ReplicasAndProxylessEndpointThrows()
1686public async Task ProxylessEndpointWithoutPortIsAllocated()
1708public async Task ProxylessEndpointWorks()
1745public async Task ProxylessAndProxiedEndpointBothWorkOnSameResource()
1786await Task.Delay(100, token);
1808await Task.Delay(100, token);
1816public async Task ProxylessContainerCanBeReferenced()
1895public async Task WithEndpointProxySupportDisablesProxies()
1973public async Task ProxylessContainerWithoutPortThrows()
1993public async Task PersistentNetworkCreatedIfPersistentContainers(bool createPersistentContainer)
2025public async Task ParentProcessLifetimeScopesExecutableAndContainerToParentProcess()
2074public async Task ParentProcessLifetimeReusesResourcesAcrossAppRestartsAndStopsWhenParentExits()
2108await Task.WhenAll(
2177static async Task StopAndDisposeAppAsync(DistributedApplication app, CancellationToken cancellationToken)
2192public async Task AfterResourcesCreatedLifecycleHookWorks()
2218public async Task LogStreamOptionsWork()
2287public async Task ContainerExitsImmediatelyAfterStart(int exitCode)
2302var startTask = app.StartAsync(cts.Token);
2311private static async Task EnsureLogLines(Stream stream, CancellationToken ct, long nlines, Func<long, bool>? validateLineNumber = default)
2385private static async Task KillProcessAsync(Process process, CancellationToken cancellationToken)
2406public Task HooksCompleted => _tcs.Task;
2408public Task AfterEndpointsAllocatedAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken)
2411return Task.CompletedTask;
2414public Task AfterResourcesCreatedAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken)
2417return Task.CompletedTask;
Eventing\DistributedApplicationBuilderEventingTests.cs (39)
19public async Task EventsCanBePublishedBlockSequential()
37return Task.CompletedTask;
40var pendingPublish = builder.Eventing.PublishAsync(new DummyEvent(), EventDispatchBehavior.BlockingSequential);
50public async Task EventsCanBePublishedBlockConcurrent()
73var pendingPublish = builder.Eventing.PublishAsync(new DummyEvent(), EventDispatchBehavior.BlockingConcurrent);
75await Task.WhenAll(blockAssertionSub1.Task, blockAssertionSub2.Task).DefaultTimeout();
82public async Task EventsCanBePublishedNonBlockingConcurrent()
108await Task.WhenAll(blockAssertionSub1.Task, blockAssertionSub2.Task).DefaultTimeout();
113public async Task EventsCanBePublishedNonBlockingSequential()
137return Task.CompletedTask;
150await Task.Delay(1000);
178public async Task ResourceEventsForContainersFireForSpecificResources()
189return Task.CompletedTask;
202public async Task ResourceEventsForContainersFireForAllResources()
216return Task.CompletedTask;
229public async Task LifeycleHookAnalogousEventsFire()
241return Task.CompletedTask;
249return Task.CompletedTask;
257return Task.CompletedTask;
274public async Task ObsoleteAfterEndpointsAllocatedEventSubscriptionLogsWarning()
281builder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) => Task.CompletedTask);
298public async Task ResourceStoppedEventCanBeSubscribedTo()
313return Task.CompletedTask;
340public async Task ResourceStoppedEventFiresWhenResourceStops()
352return Task.CompletedTask;
368public async Task OnBeforeStartSubscribesToBeforeStartEvent()
378return Task.CompletedTask;
391public async Task OnAfterResourcesCreatedSubscribesToAfterResourcesCreatedEvent()
401return Task.CompletedTask;
414public async Task OnBeforePublishSubscribesToBeforePublishEvent()
423return Task.CompletedTask;
437public async Task OnAfterPublishSubscribesToAfterPublishEvent()
446return Task.CompletedTask;
463var result = builder.OnBeforeStart((e, ct) => Task.CompletedTask);
472var result = builder.OnBeforePublish((e, ct) => Task.CompletedTask);
481var result = builder.OnAfterPublish((e, ct) => Task.CompletedTask);
492builder.Eventing.Subscribe<IDistributedApplicationEvent>((_, _) => Task.CompletedTask));
504builder.Eventing.Subscribe<AbstractDummyEvent>((_, _) => Task.CompletedTask));
517builder.Eventing.Subscribe<IDistributedApplicationResourceEvent>(resource.Resource, (_, _) => Task.CompletedTask));
ExpressionResolverTests.cs (8)
17public async Task ResolveInternalAsync_ResolvesCorrectly(ExpressionResolverTestData testData, Type? exceptionType, (string Value, bool IsSensitive)? expectedValue)
84public async Task ExpressionResolverGeneratesCorrectEndpointStrings(string exprName, bool sourceIsContainer, bool targetIsContainer, string expectedConnectionString)
161public async Task HostUrlPropertyGetsResolved(bool targetIsContainer, bool withTunnel, string hostUrlVal, string expectedValue)
187public async Task ContainerHostUrlIgnoresMatchingNonHostEndpoint()
228public async Task HostUrlPropertyGetsResolvedInOtlpExporterEndpoint(bool container, bool withTunnel, string expectedValue)
249public async Task ContainerToContainerEndpointShouldResolve()
276public async Task ContainerToContainerEndpointWithLocalhostNetworkIdentifierShouldResolve()
295public async Task ExpressionResolutionShouldWaitOnMissingAllocatedEndpoint()
InteractionServiceTests.cs (51)
21public async Task PromptConfirmationAsync_CompleteResult_ReturnResult()
45public async Task PromptConfirmationAsync_Cancellation_ReturnResult()
70public async Task PromptConfirmationAsync_MultipleCompleteResult_ReturnResult()
121public async Task SubscribeInteractionUpdates_MultipleCompleteResult_ReturnResult()
127var readTask = Task.Run(async () =>
164public async Task PublicApis_DashboardDisabled_ThrowErrors()
296public async Task IsAvailable_NonInteractiveScope_FlowsAcrossAsyncCalls()
306await Task.Yield();
358public async Task PromptInputAsync_ValidationCallbackInvalidData_ReturnErrors()
372return Task.CompletedTask;
395public async Task PromptInputsAsync_MissingRequiredData_ReturnErrors()
418public async Task PromptInputsAsync_ChoiceHasNonOptionValue_ReturnErrors()
441public async Task PromptInputsAsync_ChoiceHasNonOptionValueWithAllowCustomChoice_ReturnValue()
462public async Task PromptInputsAsync_NumberHasNonNumberValue_ReturnErrors()
485public async Task PromptInputsAsync_BooleanHasNonBooleanValue_ReturnErrors()
513public async Task PromptInputsAsync_TextExceedsLimit_ReturnErrors(InputType inputType, int? maxLength)
518static async Task TextExceedsLimitCoreAsync(InputType inputType, int? maxLength, bool success)
850public async Task PromptInputsAsync_WithNamedInputs_ReturnsNamedCollection()
893public async Task PromptInputsAsync_WithDynamicInput_NotDependant_LoadOnPrompt()
900var readTask = Task.Run(async () =>
946public async Task PromptInputsAsync_WithDynamicInput_Dependant_LoadOnDependantChange()
953var readTask = Task.Run(async () =>
1012public async Task ValidationContext_WithNamedInputs_AllowsNameAccess()
1039return Task.CompletedTask;
1064public async Task DependsOn_DoesNotExist_Error()
1079LoadCallback = c => Task.FromResult<IReadOnlyList<KeyValuePair<string, string>>>(new Dictionary<string, string>
1097public async Task DependsOn_LaterInput_Error()
1112LoadCallback = c => Task.FromResult<IReadOnlyList<KeyValuePair<string, string>>>(new Dictionary<string, string>
1130public async Task PromptProgressAsync_WithWork_CompletesSuccessfully()
1140await Task.Delay(10, ctx.CancellationToken);
1152public async Task PromptProgressAsync_WithWork_CancelledViaButton_ReturnsCanceled()
1165await Task.Delay(Timeout.Infinite, ctx.CancellationToken);
1182public async Task PromptProgressAsync_WithWorkThatHandlesCancellation_CancelledViaButton_ReturnsCanceled()
1199await Task.Delay(Timeout.Infinite, ctx.CancellationToken);
1218public async Task PromptProgressAsync_WithWorkThatHandlesCancellation_ExternallyCancelled_ReturnsCanceled()
1232await Task.Delay(Timeout.Infinite, ctx.CancellationToken);
1252public async Task PromptProgressAsync_WithoutWork_Cancellation_ClosesDialog()
1272public async Task PromptProgressAsync_WithoutWork_ButtonClick_ReturnsCanceled()
1293public async Task PromptProgressAsync_WithoutTitle_CreatesInteraction()
1309private static async Task CompleteInteractionAsync(InteractionService interactionService, int interactionId, InteractionCompletionState state, List<DashboardServiceData.InputDto>? inputs = null)
1347public async Task PromptInputsAsync_FileWithValue_PassesValidation()
1376public async Task PromptInputsAsync_Canceled_CancelsFileUploads()
1400public async Task PromptInputsAsync_FileInputCancellationToken_CancelsFileUploadsBeforeCompletion()
1420public async Task PromptInputsAsync_TextInputComplete_DoesNotUseFileUploadStore()
1444public async Task PromptInputsAsync_TextInputCanceled_DoesNotUseFileUploadStore()
1468public async Task PromptInputsAsync_FileRequiredEmpty_ReturnErrors()
1491public async Task PromptInputsAsync_FileOptionalEmpty_PassesValidation()
1515public async Task PromptInputsAsync_FileCount_ValidatesLimit(bool allowMultipleFiles, int fileCount, bool expectedValid)
Orchestrator\ApplicationOrchestratorTests.cs (73)
28public async Task ParentPropertySetOnChildResource()
47var watchResourceTask = Task.Run(async () =>
75public async Task ParentAnnotationOnChildResource()
95var watchResourceTask = Task.Run(async () =>
123public async Task InitializeResourceEventPublished()
143return Task.CompletedTask;
150return Task.CompletedTask;
170public async Task WithParentRelationshipSetsParentPropertyCorrectly()
195var watchResourceTask = Task.Run(async () =>
236public async Task LastWithParentRelationshipWins()
261var watchResourceTask = Task.Run(async () =>
294public async Task WithParentRelationshipWorksWithProjects()
313var watchResourceTask = Task.Run(async () =>
360public async Task GrandChildResourceWithConnectionString()
390return Task.CompletedTask;
395return Task.CompletedTask;
400return Task.CompletedTask;
411public async Task ConnectionStringAvailableEventPublishesBeforeBeforeResourceStartedEvent()
429return Task.CompletedTask;
434return Task.CompletedTask;
450public async Task ConnectionStringAvailableEventPublishesConnectionStringAndResolvableProperties()
473var watchResourceTask = Task.Run(async () =>
513public async Task OnResourceFailedToStart_WithErrorMessage_SetsErrorStyleOnState()
542public async Task OnResourceFailedToStart_WithoutErrorMessage_DoesNotSetErrorStyle()
570public async Task OnResourceStarting_ToolResourceType_TransitionsToStarting()
593public async Task SelfDrivenResourceWaitsForDependencyBeforeStarting()
630public async Task ResourceWaitingOnSelfDrivenResourceWaitsForItToStart()
656var startingTask = events.PublishAsync(new OnResourceStartingContext(
671public async Task WaitIsNotReleasedByAnotherReplicaLeavingWaitingState()
705var startingTask = events.PublishAsync(new OnResourceStartingContext(
722await Task.Delay(TimeSpan.FromMilliseconds(250), TestContext.Current.CancellationToken);
731public async Task WaitingUpdateDoesNotDisturbNotStartedReplicas()
763var startingTask = events.PublishAsync(new OnResourceStartingContext(
780public async Task StartingNotStartedReplicaIsForwardedToDcpWhileSiblingWaits()
814var startingTask = events.PublishAsync(new OnResourceStartingContext(
833public async Task ForceStartingOneReplicaDoesNotReleaseAnotherReplicasWait()
868var startingFirstReplicaTask = events.PublishAsync(new OnResourceStartingContext(
876var startingSecondReplicaTask = events.PublishAsync(new OnResourceStartingContext(
895await Task.Delay(TimeSpan.FromMilliseconds(250), TestContext.Current.CancellationToken);
904public async Task ResourceForcedOutOfWaitingStopsWaitingForItsDependency()
941public async Task ResourceForcedOutOfWaitingImmediatelyStopsWaitingForItsDependency()
972var forceStartTask = Task.Run(async () =>
987await Task.Yield();
1007public async Task ConnectionStringResourceWaitsForReferencedResourceBeforeBecomingAvailable()
1040public async Task ExplicitStartResourceWithoutDcpInstancesReportsWaitingForItsDependency()
1086private static async Task PublishReplicaStatesAsync(ResourceNotificationService notificationService, IResource resource, string state)
1101private static IResourceBuilder<CustomResourceWithWaitSupport> AddSelfDrivenResource(IDistributedApplicationBuilder builder, string name, Task? gate = null)
1126ResourceReadyEvent = new EventSnapshot(Task.CompletedTask)
1188return Task.FromResult(new DeploymentStateSection(sectionName, [], 0));
1191public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1193return Task.CompletedTask;
1196public Task ClearAllStateAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
1198public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1200return Task.CompletedTask;
1300public async Task ContainerChildResourcesWithOwnLifetimeDoNotReceiveParentStateChanges()
1347public async Task ProjectChildResourcesWithOwnLifetimeDoNotReceiveParentStateChanges()
1394public async Task WithChildRelationshipUsingResourceBuilderSetsParentPropertyCorrectly()
1418var watchResourceTask = Task.Run(async () =>
1451public async Task WithChildRelationshipUsingResourceSetsParentPropertyCorrectly()
1475var watchResourceTask = Task.Run(async () =>
1508public async Task WithChildRelationshipWorksWithProjects()
1529var watchResourceTask = Task.Run(async () =>
Orchestrator\ParameterProcessorTests.cs (76)
28public async Task InitializeParametersAsync_WithValidParameters_SetsRunningState()
53public async Task InitializeParametersAsync_WithValidParametersAndDashboardEnabled_SetsRunningState()
79public async Task InitializeParametersAsync_WithSecretParameter_MarksAsSecret()
87var watchTask = Task.Run(async () =>
109public async Task InitializeParametersAsync_WithMissingParameterValue_AddsToUnresolvedWhenInteractionAvailable()
125public async Task InitializeParametersAsync_WithMissingParameterValue_SetsExceptionWhenInteractionNotAvailable()
143public async Task InitializeParametersAsync_WithMissingParameterValueAndDashboardEnabled_LeavesUnresolved()
159public async Task InitializeParametersAsync_WithNonMissingParameterException_SetsException()
176public async Task HandleUnresolvedParametersAsync_WithMultipleUnresolvedParameters_CreatesInteractions()
201var handleTask = parameterProcessor.HandleUnresolvedParametersAsync(parameters, CancellationToken.None);
276public async Task InitializeParametersAsync_WhenUserDismissesNotification_WaitsWithoutShowingNotificationAgain()
294var initializeTask = parameterProcessor.InitializeParametersAsync([parameterWithMissingValue], waitForResolution: true);
315public async Task InitializeParametersAsync_WithEmptyParameterList_CompletesSuccessfully()
325public async Task InitializeParametersAsync_WithMissingParameterValue_LogsWarningWithoutException()
352public async Task InitializeParametersAsync_WithNonMissingParameterException_LogsErrorWithException()
376public async Task HandleUnresolvedParametersAsync_WithResolvedParameter_LogsResolutionViaInteraction()
394var handleTask = parameterProcessor.HandleUnresolvedParametersAsync([parameter], CancellationToken.None);
419public async Task HandleUnresolvedParametersAsync_WithParameterDescriptions_CreatesInputsWithDescriptions()
470public async Task HandleUnresolvedParametersAsync_WithSecretParameterWithDescription_CreatesSecretInput()
507public async Task HandleUnresolvedParametersAsync_WhenUserSecretsNotAvailable_ShowsDisabledSaveCheckbox()
546public async Task HandleUnresolvedParametersAsync_WhenUserSecretsAvailable_ShowsEnabledSaveCheckbox()
585public async Task InitializeParametersAsync_WithDistributedApplicationModel_CollectsAndInitializesAllParameters()
617public async Task InitializeParametersAsync_WithDistributedApplicationModel_EmptyModel_CompletesSuccessfully()
631public async Task InitializeParametersAsync_WithDistributedApplicationModel_NoParameterReferences_InitializesExplicitOnly()
658public async Task InitializeParametersAsync_WithDistributedApplicationModel_WithEnvironmentVariableReferences()
684public async Task InitializeParametersAsync_WithDistributedApplicationModel_WaitForResolution_True()
706public async Task InitializeParametersAsync_WithDistributedApplicationModel_WaitForResolution_False()
728public async Task InitializeParametersAsync_WithDistributedApplicationModel_WithMissingParameterValues_HandlesCorrectly()
753public async Task InitializeParametersAsync_WithDistributedApplicationModel_HandlesCircularReferences()
788public async Task InitializeParametersAsync_UsesExecutionContextOptions_DoesNotThrow()
824public async Task InitializeParametersAsync_SkipsResourcesExcludedFromPublish()
864public async Task ProcessParameterAsync_WithInteractionServiceAvailable_AddsSetParameterCommand()
884public async Task ProcessParameterAsync_WithInteractionServiceAvailable_AddsSetParameterValueArgument()
918public async Task ProcessParameterAsync_WithExistingValue_LoadsSetParameterValueArgumentOnStart()
943public async Task ProcessParameterAsync_WithExistingInputValue_DoesNotOverwriteSetParameterValueArgumentOnStart()
969public async Task ProcessParameterAsync_WithSavedState_DefaultsSaveArgumentToTrue()
1011public async Task ProcessParameterAsync_WithoutSavedState_DisablesDeleteParameterUserSecretsArgumentOnStart()
1040public async Task ProcessParameterAsync_WithSavedState_EnablesDeleteParameterUserSecretsArgumentOnStart()
1072public async Task ProcessParameterAsync_WithInteractionServiceNotAvailable_DoesNotAddSetParameterCommand()
1089public async Task SetParameterCoreAsync_WithUserInput_UpdatesParameterValue()
1106public async Task SetParameterCoreAsync_WithMissingInput_ParameterValueUnchanged()
1122public async Task SetParameterCoreAsync_ResolvingLastParameter_CancelsPromptNotification()
1142public async Task SetParameterCoreAsync_CalledTwice_UpdatesPreviousValueAndSavedState()
1163public async Task SetParameterAsync_WithUserInput_UpdatesParameterValueAndSavedState()
1174var setParameterTask = parameterProcessor.SetParameterAsync(parameter, CancellationToken.None);
1190public async Task InitializeParametersAsync_RecordsResolvedSecretValues_ForRedaction()
1210public async Task SetParameterCoreAsync_RecordsReplacedSecretValue_ForRedaction()
1306return Task.FromResult(new DeploymentStateSection(sectionName, [], 0));
1309public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1311return Task.CompletedTask;
1314public Task ClearAllStateAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
1316public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1318return Task.CompletedTask;
1353public async Task InitializeParametersAsync_WithGenerateParameterDefaultInPublishMode_DoesNotThrowWhenValueExists()
1390public async Task ConnectionStringParameterStateIsSavedWithCorrectKey()
1410var handleTask = parameterProcessor.HandleUnresolvedParametersAsync(parameters, CancellationToken.None);
1431public async Task RegularParameterStateIsSavedWithCorrectKey()
1451var handleTask = parameterProcessor.HandleUnresolvedParametersAsync(parameters, CancellationToken.None);
1472public async Task CustomConfigurationKeyParameterStateIsSavedWithCorrectKey()
1495var handleTask = parameterProcessor.HandleUnresolvedParametersAsync(parameters, CancellationToken.None);
1516public async Task DeleteParameterCoreAsync_DeletesFromDeploymentState()
1535public async Task DeleteParameterCoreAsync_WithoutDeleteFromUserSecrets_DoesNotDeleteDeploymentState()
1552public async Task DeleteParameterCoreAsync_WhenDeploymentStateDeleteFails_ReturnsFailure()
1570public async Task DeleteParameterCoreAsync_AddsParameterBackToUnresolvedAndStartsResolutionTask()
1599public async Task DeleteParameterAsync_DeletesFromDeploymentState()
1610var setParameterTask = parameterProcessor.SetParameterAsync(parameter, CancellationToken.None);
1620var deleteParameterTask = parameterProcessor.DeleteParameterAsync(parameter, CancellationToken.None);
1665return Task.FromResult(new DeploymentStateSection(sectionName, sectionData, 0));
1668public Task SaveSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1679return Task.CompletedTask;
1682public Task ClearAllStateAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
1684public Task DeleteSectionAsync(DeploymentStateSection section, CancellationToken cancellationToken = default)
1700return Task.CompletedTask;
Pipelines\DistributedApplicationPipelineTests.cs (199)
30public async Task ExecuteAsync_WithNoSteps_CompletesSuccessfully()
40public async Task ExecuteAsync_WithSingleStep_ExecutesStep()
49await Task.CompletedTask;
59public async Task ExecuteAsync_WithMultipleIndependentSteps_ExecutesAllSteps()
68await Task.CompletedTask;
74await Task.CompletedTask;
80await Task.CompletedTask;
93public async Task ExecuteAsync_WithDependsOn_ExecutesInOrder()
102await Task.CompletedTask;
108await Task.CompletedTask;
114await Task.CompletedTask;
124public async Task ExecuteAsync_WithRequiredBy_ExecutesInCorrectOrder()
133await Task.CompletedTask;
139await Task.CompletedTask;
145await Task.CompletedTask;
155public async Task ExecuteAsync_WithMixedDependsOnAndRequiredBy_ExecutesInCorrectOrder()
164await Task.CompletedTask;
170await Task.CompletedTask;
176await Task.CompletedTask;
192public async Task ExecuteAsync_WithMultipleLevels_ExecutesLevelsInOrder()
203await Task.Delay(10);
209await Task.Delay(10);
215return Task.CompletedTask;
221return Task.CompletedTask;
227return Task.CompletedTask;
249public async Task ExecuteAsync_WithPipelineStepFactoryAnnotation_ExecutesAnnotatedSteps()
261await Task.CompletedTask;
269await Task.CompletedTask;
281public async Task ExecuteAsync_WithMultiplePipelineStepAnnotations_ExecutesAllAnnotatedSteps()
295await Task.CompletedTask;
304await Task.CompletedTask;
324pipeline.AddStep("step1", async (context) => await Task.CompletedTask);
326var ex = Assert.Throws<InvalidOperationException>(() => pipeline.AddStep("step1", async (context) => await Task.CompletedTask));
332public async Task ExecuteAsync_WithUnknownDependency_ThrowsInvalidOperationException()
337pipeline.AddStep("step1", async (context) => await Task.CompletedTask, dependsOn: "unknown-step");
347public async Task ExecuteAsync_WithUnknownRequiredBy_ThrowsInvalidOperationException()
352pipeline.AddStep("step1", async (context) => await Task.CompletedTask, requiredBy: "unknown-step");
362public async Task ExecuteAsync_WithCircularDependency_ThrowsInvalidOperationException()
370Action = async (context) => await Task.CompletedTask
377Action = async (context) => await Task.CompletedTask
393public async Task ExecuteAsync_WhenStepThrows_WrapsExceptionWithStepName()
401await Task.CompletedTask;
415public async Task ExecuteAsync_WithComplexDependencyGraph_ExecutesInCorrectOrder()
425await Task.CompletedTask;
431await Task.CompletedTask;
437await Task.CompletedTask;
443await Task.CompletedTask;
449await Task.CompletedTask;
471public async Task ExecuteAsync_WithMultipleDependencies_ExecutesInCorrectOrder()
480await Task.CompletedTask;
486await Task.CompletedTask;
492await Task.CompletedTask;
507public async Task ExecuteAsync_WithMultipleRequiredBy_ExecutesInCorrectOrder()
516await Task.CompletedTask;
522await Task.CompletedTask;
528await Task.CompletedTask;
543public async Task ExecuteAsync_WithUnknownRequiredByStep_ThrowsInvalidOperationException()
550await Task.CompletedTask;
559public async Task ExecuteAsync_WithUnknownRequiredByStepInList_ThrowsInvalidOperationException()
566await Task.CompletedTask;
571await Task.CompletedTask;
585pipeline.AddStep("step1", async (context) => await Task.CompletedTask, dependsOn: 123));
596pipeline.AddStep("step1", async (context) => await Task.CompletedTask, requiredBy: 123));
606pipeline.AddStep("step1", async (context) => await Task.CompletedTask);
609pipeline.AddStep("step1", async (context) => await Task.CompletedTask));
615public async Task ExecuteAsync_WithDuplicateAnnotationStepNames_ThrowsInvalidOperationException()
623Action = async (ctx) => await Task.CompletedTask
630Action = async (ctx) => await Task.CompletedTask
645public async Task ExecuteAsync_WithFailingStep_PreservesOriginalStackTrace()
652await Task.CompletedTask;
670public async Task ExecuteAsync_WithDependencyFailure_ReportsFailedDependency()
680await Task.CompletedTask;
688await Task.CompletedTask;
704public async Task ExecuteAsync_WithCircularDependencyInComplex_ThrowsInvalidOperationException()
713Action = async (context) => await Task.CompletedTask
720Action = async (context) => await Task.CompletedTask
727Action = async (context) => await Task.CompletedTask
745public async Task ExecuteAsync_WithFailure_PreventsOtherStepsFromStarting()
756await Task.Delay(50);
764await Task.CompletedTask;
776public async Task ExecuteAsync_IndependentStepContinuesWhenSiblingFails()
807public async Task ExecuteAsync_IndependentStepIsNotCancelledWhenSiblingFails()
838public async Task ExecuteAsync_DependentStepSkippedButIndependentContinues()
858await Task.CompletedTask;
877public async Task ExecuteAsync_WhenStepThrows_ReportsFailureToActivityReporter()
886await Task.CompletedTask;
907public async Task ExecuteAsync_WhenStepThrowsProcessFailedException_RethrowsWithoutWrapping()
914pipeline.AddStep("failing-step", _ => Task.FromException(expected));
926public async Task ExecuteAsync_WithDiamondDependency_ExecutesCorrectly()
939await Task.Delay(10);
945await Task.Delay(10);
951await Task.Delay(10);
957await Task.CompletedTask;
992public async Task ExecuteAsync_WithPipelineStepFactoryAnnotation_FactoryReceivesPipelineContextAndResource()
1012await Task.CompletedTask;
1029public async Task WithPipelineStepFactory_SyncOverload_ExecutesStep()
1041await Task.CompletedTask;
1053public async Task WithPipelineStepFactory_AsyncOverload_ExecutesStep()
1061await Task.CompletedTask;
1068await Task.CompletedTask;
1081public async Task WithPipelineStepFactory_MultipleStepsSyncOverload_ExecutesAllSteps()
1095await Task.CompletedTask;
1104await Task.CompletedTask;
1118public async Task WithPipelineStepFactory_MultipleStepsAsyncOverload_ExecutesAllSteps()
1126await Task.CompletedTask;
1135await Task.CompletedTask;
1144await Task.CompletedTask;
1159public async Task ExecuteAsync_WithPipelineLoggerProvider_LogsToStepLogger()
1174return Task.CompletedTask;
1190public async Task ExecuteAsync_PipelineLoggerProvider_IsolatesLoggingBetweenSteps()
1208await Task.CompletedTask;
1220return Task.CompletedTask;
1247public async Task ExecuteAsync_WhenStepFails_PipelineLoggerIsCleanedUp()
1283public async Task ExecuteAsync_PipelineLoggerProvider_PreservesLoggerAfterStepCompletion()
1306return Task.CompletedTask;
1347public async Task ExecuteAsync_PipelineLoggerProvider_RespectsPipelineLogLevelConfiguration(
1379return Task.CompletedTask;
1403public async Task PipelineStep_WithTags_StoresTagsCorrectly()
1408Action = async (ctx) => await Task.CompletedTask,
1418public async Task ExecuteAsync_WithConfigurationCallback_ExecutesCallback()
1426pipeline.AddStep("step1", async (context) => await Task.CompletedTask);
1427pipeline.AddStep("step2", async (context) => await Task.CompletedTask);
1433return Task.CompletedTask;
1461public async Task ExecuteAsync_ConfigurationCallback_CanModifyDependencies()
1471await Task.CompletedTask;
1477await Task.CompletedTask;
1485return Task.CompletedTask;
1495public async Task PipelineConfigurationContext_GetStepsByTag_ReturnsCorrectSteps()
1505Action = async (ctx) => await Task.CompletedTask,
1512Action = async (ctx) => await Task.CompletedTask,
1519Action = async (ctx) => await Task.CompletedTask,
1526return Task.CompletedTask;
1539public async Task PipelineConfigurationContext_GetStepsByResource_ReturnsCorrectSteps()
1552Action = async (ctx) => await Task.CompletedTask
1557Action = async (ctx) => await Task.CompletedTask
1568Action = async (ctx) => await Task.CompletedTask
1589public async Task PipelineConfigurationContext_GetStepsByResourceAndTag_ReturnsCorrectSteps()
1601Action = async (ctx) => await Task.CompletedTask,
1607Action = async (ctx) => await Task.CompletedTask,
1629public async Task WithPipelineConfiguration_AsyncOverload_ExecutesCallback()
1638await Task.CompletedTask;
1650public async Task WithPipelineConfiguration_SyncOverload_ExecutesCallback()
1670public async Task ConfigurationCallback_CanAccessModel()
1691public async Task ConfigurationCallback_ExecutesAfterStepCollection()
1701Action = async (ctx) => await Task.CompletedTask
1711pipeline.AddStep("direct-step", async (context) => await Task.CompletedTask);
1728public async Task ConfigurationCallback_CanCreateComplexDependencyRelationships()
1741await Task.CompletedTask;
1752await Task.CompletedTask;
1763await Task.CompletedTask;
1774await Task.CompletedTask;
1801return Task.CompletedTask;
1818public async Task ExecuteAsync_WithNonExistentStepFilter_ThrowsInvalidOperationExceptionWithAvailableSteps()
1824pipeline.AddStep("step1", async (context) => await Task.CompletedTask);
1825pipeline.AddStep("step2", async (context) => await Task.CompletedTask);
1826pipeline.AddStep("step3", async (context) => await Task.CompletedTask);
1839public async Task ExecuteAsync_WithStepFilterAndComplexDependencies_ExecutesTransitiveClosure()
1850await Task.CompletedTask;
1856await Task.CompletedTask;
1862await Task.CompletedTask;
1868await Task.CompletedTask;
1874await Task.CompletedTask;
1880await Task.CompletedTask;
1907public async Task ExecuteAsync_WithStepFilterForIndependentStep_ExecutesOnlyThatStep()
1918await Task.CompletedTask;
1924await Task.CompletedTask;
1930await Task.CompletedTask;
1943public async Task FilterStepsForExecution_WithRequiredBy_IncludesTransitiveDependencies()
1964return Task.CompletedTask;
1973return Task.CompletedTask;
1982return Task.CompletedTask;
1991return Task.CompletedTask;
2008public async Task ProcessParametersStep_ValidatesBehavior()
2043return Task.CompletedTask;
2078public async Task ExecuteAsync_PassesStepHierarchyMetadataToActivityReporter()
2084pipeline.AddStep("root", _ => Task.CompletedTask);
2085pipeline.AddStep("child", _ => Task.CompletedTask, dependsOn: "root");
2086pipeline.AddStep("grandchild", _ => Task.CompletedTask, dependsOn: "child");
2098public async Task PushPrereq_SkipsRegistryCheckForNonDockerImageFormat()
2123public async Task PushPrereq_ThrowsForDockerImageFormatWithoutRegistry()
2150public async Task PushPrereq_ThrowsForDefaultImageFormatWithoutRegistry()
2171public async Task PushPrereq_ThrowsForArchiveDestinationWithoutOutputPath()
2199public async Task PushPrereq_SkipsExcludedFromManifestResources()
2234public async Task ResolveStepsAsync_ReturnsAllSteps()
2239pipeline.AddStep("custom-step", _ => Task.CompletedTask);
2251public async Task ResolveStepsAsync_NormalizesRequiredByToDependsOn()
2259Action = _ => Task.CompletedTask,
2273public async Task ResolveStepsAsync_PreservesTags()
2281Action = _ => Task.CompletedTask,
2294public async Task ResolveStepsAsync_DoesNotExecuteStepActions()
2303return Task.CompletedTask;
2317new() { Name = "deploy", Action = _ => Task.CompletedTask, DependsOnSteps = { "build" } },
2318new() { Name = "build", Action = _ => Task.CompletedTask, DependsOnSteps = { "init" } },
2319new() { Name = "init", Action = _ => Task.CompletedTask }
2337new() { Name = "c-step", Action = _ => Task.CompletedTask },
2338new() { Name = "a-step", Action = _ => Task.CompletedTask },
2339new() { Name = "b-step", Action = _ => Task.CompletedTask }
2377public async Task Clone_ResolveStepsOnClone_DoesNotMutateOriginalPipeline()
2392Action = _ => Task.CompletedTask,
ResourceCommandServiceTests.cs (91)
29public async Task ExecuteCommandAsync_NoMatchingResource_Failure()
48public async Task ExecuteCommandAsync_ResourceNameMultipleMatches_Failure()
71public async Task ExecuteCommandAsync_NoMatchingCommand_Failure()
90public async Task ExecuteCommandAsync_NoMatchingCommand_SingleInstance_MessageUsesDisplayName()
109public async Task ExecuteCommandAsync_NoMatchingCommand_HasReplicas_MessageUsesResourceId()
131public async Task ExecuteCommandAsync_ResourceNameMultipleMatches_Success()
168public async Task ExecuteCommandAsync_HasReplicas_Success_CalledPerReplica()
210public async Task ExecuteCommandAsync_HasReplicas_Failure_CalledPerReplica()
224return Task.FromResult(new ExecuteCommandResult { Success = false, Message = "Failure!" });
249public async Task ExecuteCommandAsync_Canceled_Success()
259return Task.FromResult(CommandResults.Canceled());
275public async Task ExecuteCommandAsync_HasReplicas_Canceled_CalledPerReplica()
289return Task.FromResult(CommandResults.Canceled());
305public async Task ExecuteCommandAsync_HasReplicas_MixedFailureAndCanceled_OnlyFailuresInErrorMessage()
322return Task.FromResult(count switch
360public async Task ExecuteCommandAsync_OperationCanceledException_Canceled()
386public async Task ExecuteCommandAsync_CommandException_Failure()
408public async Task ExecuteCommandAsync_LegacyCommandName_FallsBackToCurrentName()
416executeCommand: _ => Task.FromResult(new ExecuteCommandResult { Success = true }));
429public async Task ExecuteCommandAsync_LegacyCommandName_ById_FallsBackToCurrentName()
437executeCommand: _ => Task.FromResult(new ExecuteCommandResult { Success = true }));
452public async Task ExecuteCommandAsync_LegacyParameterCommandName_FallsBackToCurrentName(string currentCommandName, string legacyCommandName)
459executeCommand: _ => Task.FromResult(new ExecuteCommandResult { Success = true }));
470public async Task ExecuteCommandAsync_SuccessWithResult_ReturnsResultData()
477executeCommand: _ => Task.FromResult(CommandResults.Success("Generated token.", "{\"token\": \"abc123\"}", CommandResultFormat.Json)));
491public async Task ExecuteCommandAsync_SuccessWithoutResult_ReturnsNoResultData()
498executeCommand: _ => Task.FromResult(CommandResults.Success()));
510public async Task ExecuteCommandAsync_WithArgumentCollection_PassesArgumentsToCommand()
521return Task.FromResult(CommandResults.Success());
568public async Task ExecuteCommandAsync_WithArgumentValuesAndResource_PassesArgumentsToCommand()
579return Task.FromResult(CommandResults.Success());
609public async Task ExecuteCommandAsync_WithArgumentValuesAndResource_DoesNotRequirePublishedResourceState()
620return Task.FromResult(CommandResults.Success());
649public async Task ExecuteCommandAsync_SecretTextArgument_PreservesWhitespace()
660return Task.FromResult(CommandResults.Success());
696public async Task CreateCommandArguments_WithOrderedArgumentValues_MapsArgumentsByOrder()
703executeCommand: _ => Task.FromResult(CommandResults.Success()),
741public async Task CreateCommandArguments_TooManyOrderedArgumentValues_ReturnsError()
748executeCommand: _ => Task.FromResult(CommandResults.Success()),
772public async Task CreateCommandArguments_UnknownNamedArgumentValues_ReturnsError()
779executeCommand: _ => Task.FromResult(CommandResults.Success()),
803public async Task CreateCommandArguments_DisabledNamedArgumentValues_ReturnsError()
810executeCommand: _ => Task.FromResult(CommandResults.Success()),
835public async Task CreateCommandArguments_DynamicDisabledNamedArgumentValues_DoesNotReturnError()
842executeCommand: _ => Task.FromResult(CommandResults.Success()),
858return Task.CompletedTask;
876public async Task CreateCommandArguments_DisabledOrderedArgumentValues_ReturnsError()
883executeCommand: _ => Task.FromResult(CommandResults.Success()),
908public async Task ExecuteCommandAsync_NoArguments_PassesEmptyArgumentsToCommand()
919return Task.FromResult(CommandResults.Success());
933public async Task ExecuteCommandAsync_InvalidBuiltInArgumentValidation_DoesNotExecuteCommand()
944return Task.FromResult(CommandResults.Success());
975public async Task ExecuteCommandAsync_LoadsDependentChoiceOptionsBeforeBuiltInValidation()
987return Task.FromResult(CommandResults.Success());
1014return Task.CompletedTask;
1049public async Task ExecuteCommandAsync_SubmittedDynamicArgumentStillDisabledAfterLoading_ReturnsDisabledValidationError()
1060return Task.FromResult(CommandResults.Success());
1087return Task.CompletedTask;
1104return Task.CompletedTask;
1141public async Task ExecuteCommandAsync_LoadedDynamicArgumentStillDisabledWithDefaultValue_DoesNotReturnDisabledValidationError()
1152return Task.FromResult(CommandResults.Success());
1179return Task.CompletedTask;
1211public async Task ExecuteCommandAsync_UnknownNamedArgumentValues_DoesNotExecuteCommand()
1222return Task.FromResult(CommandResults.Success());
1258public async Task ExecuteCommandAsync_InteractiveWithoutArguments_PromptsForArguments()
1272return Task.FromResult(CommandResults.Success());
1314public async Task ExecuteCommandAsync_InteractiveDisabledDynamicArgumentWithDefaultValue_Succeeds()
1329return Task.FromResult(CommandResults.Success());
1354return Task.CompletedTask;
1386public async Task ExecuteCommandAsync_NonInteractiveWithoutArguments_DoesNotPrompt()
1400return Task.FromResult(CommandResults.Success());
1435public async Task ExecuteCommandAsync_NonInteractive_IsAvailableReturnsFalse()
1447return Task.FromResult(CommandResults.Success());
1465public async Task ExecuteCommandAsync_Interactive_IsAvailableNotAffectedByScope()
1477return Task.FromResult(CommandResults.Success());
1501public async Task ExecuteCommandAsync_PartialArgumentCollection_ValidatesMissingDeclaredArguments()
1512return Task.FromResult(CommandResults.Success());
1557public async Task ExecuteCommandAsync_InvalidCustomArgumentValidation_DoesNotExecuteCommand()
1568return Task.FromResult(CommandResults.Success());
1587return Task.CompletedTask;
1605public async Task ExecuteCommandAsync_HasReplicas_SuccessWithResult_ReturnsFirstResultData()
1620return Task.FromResult(CommandResults.Success("Generated token.", $"token-{count}", CommandResultFormat.Text));
1635public async Task ExecuteCommandAsync_RebuildCommand_ReturnsBuildOutput()
1725public async Task ExecuteCommandAsync_WithProgressOptions_CancelsCommandWhenProgressCanceled()
1739await Task.Delay(Timeout.Infinite, e.CancellationToken);
1770public async Task ExecuteCommandAsync_WithProgressOptions_ReturnsCanceledWhenCommandHandlesProgressCancellation()
1787await Task.Delay(Timeout.Infinite, e.CancellationToken);
1820public async Task ExecuteCommandAsync_WithProgressOptions_SkipsProgressWhenNotAvailable()
1835return Task.FromResult(CommandResults.Success("Done"));
1854public async Task ExecuteCommandAsync_WithProgressOptions_SuccessPathPropagatesResult()
1866return Task.FromResult(CommandResults.Success("Operation completed successfully."));
ResourceNotificationTests.cs (74)
60public async Task InitialSnapshotResourceTypeMatchesKnownResourceTypes(Type resourceType, string expectedResourceType)
78var watchTask = Task.Run(async () =>
96public async Task ResourceUpdatesAreQueued()
148public async Task PublishedHealthReportsUpdateHealthStatus()
173public async Task WatchingAllResourcesNotifiesOfAnyResourceChange()
233public async Task WaitingOnResourceReturnsWhenResourceReachesTargetState()
239var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState");
248public async Task WaitingOnResourceReturnsWhenResourceReachesTargetStateWithDifferentCasing()
255var waitTask = notificationService.WaitForResourceAsync("MYreSouRCe1", "sOmeSTAtE", cts.Token);
264public async Task WaitingOnResourceReturnsImmediatelyWhenResourceIsInTargetStateAlready()
273var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState");
279public async Task WaitingOnResourceReturnsWhenResourceReachesRunningStateIfNoTargetStateSupplied()
285var waitTask = notificationService.WaitForResourceAsync("myResource1", targetState: null);
294public async Task WaitingOnResourceReturnsCorrectStateWhenResourceReachesOneOfTargetStatesBeforeCancellation()
309public async Task WaitingOnResourceReturnsCorrectStateWhenResourceReachesOneOfTargetStates()
324public async Task WaitingOnResourceReturnsItReachesStateAfterApplicationStoppingCancellationTokenSignaled()
331var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState");
342public async Task WaitingOnResourceThrowsOperationCanceledExceptionIfResourceDoesntReachStateBeforeCancellationTokenSignaled()
347var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState", cts.Token);
358public async Task WaitForDependenciesPublishesAndUpdatesWaitingForDependencies()
369var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
404public async Task WaitForDependenciesPublishesAndUpdatesWaitingForHealthyDependencies()
417var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
431ResourceReadyEvent = new EventSnapshot(Task.CompletedTask)
449ResourceReadyEvent = new EventSnapshot(Task.CompletedTask)
462public async Task WaitForDependenciesPublishesAndUpdatesWaitingForCompletionDependencies()
473var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
510public async Task WaitForDependenciesTransitionsNotStartedResourceToWaiting()
527var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
552public async Task WaitForDependenciesDoesNotTransitionActiveOrTerminalResourceToWaiting(string state)
567var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
581public async Task WaitForDependenciesDoesNotTransitionNotStartedReplicaToWaiting()
607var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
629public async Task WaitForDependenciesDoesNotTransitionNotStartedExplicitStartResourceToWaiting()
645var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
659public async Task WaitForDependenciesTransitionsNotStartedExplicitStartResourceWithoutDcpInstancesToWaiting()
678var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
696public async Task WaitForDependenciesTransitionsNotStartedInstanceWithoutExplicitStartToWaiting()
717var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
735public async Task WaitForDependenciesPublishesResolvedWaitingForDependenciesForReplicas()
749var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
784public async Task PublishUpdateClearsWaitingForDependenciesWhenResourceLeavesWaiting()
808public async Task CancellationMessageIncludesWaitingForDependencies()
826var waitTask = notificationService.WaitForResourceAsync(resource.Name, KnownResourceStates.Running, cts.Token);
839public async Task WaitForDependenciesCancellationMessageIncludesWaitingForDependencies()
853var waitTask = notificationService.WaitForDependenciesAsync(resource, cts.Token);
874public async Task WaitingOnResourceThrowsOperationCanceledExceptionIfResourceDoesntReachStateBeforeServiceIsDisposed()
878var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState");
889public async Task WaitingOnResourceThrowsOperationCanceledExceptionIfResourceDoesntReachStateBeforeCancellationTokenSignalledWhenApplicationStoppingTokenExists()
895var waitTask = notificationService.WaitForResourceAsync("myResource1", "SomeState", cts.Token);
906public async Task PublishLogsStateTextChangesCorrectly()
974public async Task PublishLogsTraceStateDetailsCorrectly()
1028public async Task UpdateIcons_DoesNotOverwriteExistingIconValues()
1088public async Task UpdateIcons_UsesLastAnnotationWhenNoIconSet()
1125public async Task UpdateIcons_SetsIconValuesWhenNotAlreadySet()
1161public async Task WithHidden_AlwaysHidden()
1175public async Task WithHiddenOnCompletion_HidesOnSuccessfulCompletion()
1193public async Task WithHiddenOnCompletion_HidesOnSuccessfulCompletionWithCustomExitCodes()
1211public async Task WithHiddenOnCompletion_WithCustomExitCode_HidesOnMatchingCode()
1225public async Task WithHiddenOnCompletion_WithCustomExitCodes_HidesOnAnyMatchingCode()
1239public async Task WithHiddenOnCompletion_BecomesVisibleOnRestart()
1264public async Task WaitForResourceHealthyAsyncWaitsForResourceReadyEvent()
1310public async Task WaitForResourceHealthyAsyncWaitsForResourceReadyEventWithException()
1338public async Task WaitForResourceHealthyAsyncWorksWithoutResourceReadyEvent()
1359ResourceReadyEvent = new EventSnapshot(Task.CompletedTask)
1375public async Task WaitForResourceHealthyAsync_StopOnResourceUnavailable_ThrowsIfResourceNotInModel()
1393public async Task WaitForResourceHealthyAsync_WaitOnResourceUnavailable_DoesNotThrowForNonexistentResource()
1453public async Task PublishUpdateAsyncSkipsSnapshotsThatDidNotChange()
1475public async Task PublishUpdateAsyncSkipsUnchangedSnapshotsWithRebuiltCollections()
1547public async Task PublishUpdateAsyncIgnoresVersionOnlyChanges()
1567public async Task PublishUpdateAsyncPublishesEverySnapshotContentChange(string propertyName)
1589public async Task PublishUpdateAsyncPublishesEveryResourcePropertyContentChange(string propertyName)
1804if (type == typeof(Task))
1806return Task.CompletedTask;
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
tests\Shared\TestPipelineActivityReporter.cs (14)
133public Task CompletePublishAsync(PublishCompletionOptions? options = null, CancellationToken cancellationToken = default)
142return Task.CompletedTask;
147public Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, CancellationToken cancellationToken = default)
175return Task.FromResult<IReportingStep>(new TestReportingStep(this, title, _testOutputHelper));
193public Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
202return Task.CompletedTask;
213return Task.FromResult<IReportingTask>(new TestReportingTask(_reporter, statusText, _testOutputHelper));
250public Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
272public Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
280return Task.CompletedTask;
283public Task UpdateAsync(string statusText, CancellationToken cancellationToken = default)
291return Task.CompletedTask;
294public Task UpdateAsync(MarkdownString statusText, CancellationToken cancellationToken = default)
300public Task CompleteAsync(MarkdownString completionMessage, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
Aspire.Hosting.TestUtilities (69)
Publishing\FakeContainerRuntime.cs (17)
34public Func<string, string, ContainerImageBuildOptions?, Dictionary<string, string?>, Dictionary<string, BuildImageSecretValue>, string?, CancellationToken, Task>? BuildImageAsyncCallback { get; set; }
40return Task.FromResult(isRunning && !shouldFail);
43public Task TagImageAsync(string localImageName, string targetImageName, CancellationToken cancellationToken)
51return Task.CompletedTask;
54public Task RemoveImageAsync(string imageName, CancellationToken cancellationToken)
62return Task.CompletedTask;
65public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
73return Task.CompletedTask;
76public async Task BuildImageAsync(string contextPath, string dockerfilePath, ContainerImageBuildOptions? options, Dictionary<string, string?> buildArguments, Dictionary<string, BuildImageSecretValue> buildSecrets, string? stage, CancellationToken cancellationToken)
98public Task LoginToRegistryAsync(string registryServer, string username, string password, CancellationToken cancellationToken)
106return Task.CompletedTask;
109public Task ComposeUpAsync(ComposeOperationContext context, CancellationToken cancellationToken)
115return Task.CompletedTask;
118public Task ComposeDownAsync(ComposeOperationContext context, CancellationToken cancellationToken)
126return Task.CompletedTask;
131return Task.FromResult<IReadOnlyList<ComposeServiceInfo>?>(null);
136return Task.FromResult<IContainerRuntime>(this);
Utils\LoggerNotificationExtensions.cs (10)
23public static Task WaitForTextAsync(this DistributedApplication app, string logText, string? resourceName = null, CancellationToken cancellationToken = default)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
47public static Task WaitForTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
62public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, CancellationToken cancellationToken = default)
73public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, string? resourceName = null, CancellationToken cancellationToken = default)
84_ = Task.Run(() => WatchNotifications(app, resourceName, predicate, tcs, watchCts), watchCts.Token);
97public static async Task WaitForAllTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource)
128var logWatchTasks = new List<Task>();
160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
Aspire.Hosting.Valkey (1)
Aspire.Hosting.Valkey.Tests (29)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Hosting.Yarp (1)
Aspire.Hosting.Yarp.Tests (19)
Aspire.Managed.Tests (20)
Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration.Tests (3)
Aspire.Milvus.Client.Tests (2)
Aspire.MongoDB.Driver.Tests (2)
Aspire.MongoDB.Driver.v2.Tests (2)
Aspire.NATS.Net.Tests (2)
Aspire.OpenAI.Tests (6)
Aspire.Playground.Tests (45)
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (10)
23public static Task WaitForTextAsync(this DistributedApplication app, string logText, string? resourceName = null, CancellationToken cancellationToken = default)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
47public static Task WaitForTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
62public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, CancellationToken cancellationToken = default)
73public static Task WaitForTextAsync(this DistributedApplication app, Predicate<string> predicate, string? resourceName = null, CancellationToken cancellationToken = default)
84_ = Task.Run(() => WatchNotifications(app, resourceName, predicate, tcs, watchCts), watchCts.Token);
97public static async Task WaitForAllTextAsync(this DistributedApplication app, IEnumerable<string> logTexts, string? resourceName = null, CancellationToken cancellationToken = default)
122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource)
128var logWatchTasks = new List<Task>();
160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.Qdrant.Client.Tests (2)
Aspire.RabbitMQ.Client (1)
Aspire.RabbitMQ.Client.Tests (5)
Aspire.RabbitMQ.Client.v6.Tests (4)
Aspire.Seq.Tests (3)
Aspire.StackExchange.Redis.DistributedCaching (5)
Aspire.StackExchange.Redis.DistributedCaching.Tests (2)
Aspire.StackExchange.Redis.OutputCaching (4)
Aspire.StackExchange.Redis.Tests (5)
Aspire.Templates.Tests (60)
NewUpAndBuildSupportProjectTemplatesTests.cs (8)
11protected async Task CanNewAndBuildActual(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
68public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
78public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
88public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
98public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
108public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
118public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
128public Task CanNewAndBuild(string templateName, string extraTestCreationArgs, TestSdk sdk, TestTargetFramework tfm, string? error)
tests\Shared\TemplatesTesting\AspireProject.cs (19)
163public async Task StartAppHostAsync(string[]? extraArgs = default, Action<ProcessStartInfo>? configureProcess = null, bool noBuild = true, bool waitForDashboardUrl = true, CancellationToken token = default)
270var tasksToWaitFor = new List<Task> { appRunning.Task, projectsParsed.Task };
276var successfulStartupTask = Task.WhenAll(tasksToWaitFor);
277var startupTimeoutTask = Task.Delay(TimeSpan.FromSeconds(AppStartupWaitTimeoutSecs), token);
280var resultTask = await Task.WhenAny(successfulStartupTask, AppExited.Task, startupTimeoutTask).ConfigureAwait(false);
299var allOutputCompleteTask = Task.WhenAll(stdoutComplete.Task, stderrComplete.Task);
300var allOutputCompleteTimeoutTask = Task.Delay(TimeSpan.FromSeconds(5), token);
301var completedTask = await Task.WhenAny(allOutputCompleteTask, allOutputCompleteTimeoutTask).ConfigureAwait(false);
399public Task WaitForDashboardToBeAvailableAsync(CancellationToken cancellationToken = default)
409public static async Task WaitForDashboardToBeAvailableAsync(string dashboardUrl, ITestOutputHelper testOutput, CancellationToken token = default)
418public async Task StopAppHostAsync(CancellationToken token = default)
447public async Task DumpDockerInfoAsync(ITestOutputHelper? testOutputArg = null, CancellationToken cancellationToken = default)
464public async Task DumpComponentLogsAsync(string component, ITestOutputHelper? testOutputArg = null)
Aspire.TerminalHost (43)
Aspire.TerminalHost.Tests (47)
TerminalHostAppTests.cs (31)
47public async Task RunAsyncBindsControlListenerWhenStarted()
70public async Task ControlEndpointReturnsSessionInfo()
102public async Task ShutdownRequestCausesRunAsyncToReturn()
124public async Task ConcurrentControlConnectsAreRefusedDownToOne()
149var connectTasks = new Task[concurrency];
158await Task.WhenAll(connectTasks).WaitAsync(TimeSpan.FromSeconds(10));
164var results = await Task.WhenAll(rawSockets.Select(TryGetInfoAsync));
207public async Task SnapshotSessionReportsConfiguredPaths()
233public async Task RunAsyncWithBadArgsViaStaticEntryPointReturnsExUsage()
240public async Task HostStartsCleanlyWithStaleProducerAndConsumerSocketFiles()
293public async Task SessionRecyclesAfterProducerDisconnect()
376public async Task GracefulCancellationDeletesProducerAndConsumerSockets()
426public async Task SessionSnapshotIncludesNewFields()
457public async Task DownstreamPrimaryResizeIsForwardedUpstreamAsRawResizeFrame()
571public async Task SendHelloAsync(int width, int height, CancellationToken ct)
577public Task SendOutputAsync(byte[] payload, CancellationToken ct) =>
622private async Task ReadExactlyAsync(byte[] buffer, CancellationToken ct)
637private async Task SendFrameAsync(byte type, byte[] payload, CancellationToken ct)
684await Task.Delay(50).ConfigureAwait(false);
729await Task.Delay(50).ConfigureAwait(false);
736public async Task SendClientHelloAsync(string displayName, string defaultRole, CancellationToken ct)
744public async Task SendRequestPrimaryAsync(int cols, int rows, CancellationToken ct)
750private async Task SendFrameAsync(byte type, byte[] payload, CancellationToken ct)
778private static async Task WaitForAsync(Func<bool> predicate, TimeSpan timeout, string failureMessage)
787await Task.Delay(25).ConfigureAwait(false);
814public async Task ControlSocketIsRestrictedToOwningUser()
849public async Task ProducerAndConsumerSocketsAreRestrictedToOwningUser()
893private static async Task WaitForUnixFileModeAsync(string path, UnixFileMode expected, TimeSpan timeout)
922await Task.Delay(50);
929private static async Task WaitForFileAsync(string path, TimeSpan timeout)
938await Task.Delay(50);
tests\Shared\AsyncTestHelpers.cs (15)
83public static Task DefaultTimeout(this Task task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
93public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
98public static Task DefaultTimeout(this ValueTask task, int milliseconds = -1, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
108public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
176public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
215public static Task AssertIsTrueRetryAsync(Func<bool> assert, string message, ILogger? logger = null, int retries = 10)
217return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
220public static async Task AssertIsTrueRetryAsync(Func<Task<bool>> assert, string message, ILogger? logger = null, int retries = 10)
228await Task.Delay((i + 1) * (i + 1) * 10 * 5);
241public static Task WaitForCancellationAsync(CancellationToken token)
256public static Task WaitUntilCancelledAsync(this CancellationToken token)
260return Task.CompletedTask;
Aspire.TestTools (8)
AspireWithNode.AppHost (1)
AzureKusto.Worker (4)
AzureSearch.ApiService (6)
Program.cs (6)
44static async Task DeleteIfExistsAsync(ILogger logger, string indexName, SearchIndexClient searchIndexClient, CancellationToken cancellationToken)
60static async Task CreateIndexAsync(ILogger logger, string indexName, SearchIndexClient indexClient, CancellationToken cancellationToken)
70static async Task WriteDocumentsAsync(ILogger logger, SearchResults<Hotel> searchResults, CancellationToken cancellationToken)
78static async Task RunQueriesAsync(ILogger logger, SearchClient searchClient, CancellationToken cancellationToken)
145static async Task UploadDocumentsAsync(ILogger logger, SearchClient searchClient, CancellationToken cancellationToken)
172await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
AzureStorageEndToEnd.ApiService (1)
AzureVirtualNetworkEndToEnd.ApiService (1)
Binding.Http.IntegrationTests (5)
Binding.ReliableSession.IntegrationTests (26)
NetHttpBindingTests.cs (11)
23public static async Task EchoCall(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
62public static async Task OneWayCall(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
100public static async Task ResendFailedRequest(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
146return Task.FromResult(response);
184public static async Task RetryCountApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
242await Task.Delay((int)sw.ElapsedMilliseconds * 10);
266public static async Task MaxTransferWindowSizeApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
328await Task.Delay((int)sw.ElapsedMilliseconds * 6);
355public static async Task InactivityTimeoutApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
378return Task.FromResult<HttpResponseMessage>(null);
387await Task.Delay(keepAliveInterval * 1.1);
WSHttpBindingTests.cs (11)
23public static async Task EchoCall(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
62public static async Task OneWayCall(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
100public static async Task ResendFailedRequest(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
146return Task.FromResult(response);
184public static async Task RetryCountApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
242await Task.Delay((int)sw.ElapsedMilliseconds * 10);
266public static async Task MaxTransferWindowSizeApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
328await Task.Delay((int)sw.ElapsedMilliseconds * 6);
355public static async Task InactivityTimeoutApplied(ReliableMessagingVersion rmVersion, bool ordered, string endpointSuffix)
378return Task.FromResult<HttpResponseMessage>(null);
387await Task.Delay(keepAliveInterval * 1.1);
Binding.Tcp.IntegrationTests (15)
Binding.WS.TransportWithMessageCredentialSecurity.IntegrationTests (2)
blazor-gateway (1)
BlazorHosted.ClientServiceDefaults (2)
BlazorStandalone.ClientServiceDefaults (2)
CatalogDb (8)
Client.ChannelLayer.IntegrationTests (32)
DuplexChannelShapeTests.4.0.0.cs (14)
93Task.Factory.FromAsync(factory.BeginOpen, factory.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
97Task.Factory.FromAsync(channel.BeginOpen, channel.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
108Task.Factory.FromAsync((asyncCallback, o) => channel.BeginSend(requestMessage, asyncCallback, o),
111replyMessage = Task.Factory.FromAsync(channel.BeginReceive, channel.EndReceive, TaskCreationOptions.None).GetAwaiter().GetResult();
125Task.Factory.FromAsync(channel.BeginClose, channel.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
126Task.Factory.FromAsync(factory.BeginClose, factory.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
152Task task = channel.DoWorkAsync();
181Task task = channel.DoWorkAsync();
204public async Task CallWithWaitAsync(int delayTime)
207await Task.Delay(delayTime);
210await Task.Delay(100);
225public async Task CallWithWaitAsync(int delayTime)
228await Task.Delay(delayTime);
231await Task.Delay(100);
RequestReplyChannelShapeTests.4.0.0.cs (10)
143Task.Factory.FromAsync(factory.BeginOpen, factory.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
147Task.Factory.FromAsync(channel.BeginOpen, channel.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
157replyMessage = Task.Factory.FromAsync((asyncCallback, o) => channel.BeginRequest(requestMessage, asyncCallback, o),
171Task.Factory.FromAsync(channel.BeginClose, channel.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
172Task.Factory.FromAsync(factory.BeginClose, factory.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
199Task.Factory.FromAsync(factory.BeginOpen, factory.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
203Task.Factory.FromAsync(channel.BeginOpen, channel.EndOpen, TaskCreationOptions.None).GetAwaiter().GetResult();
213replyMessage = Task.Factory.FromAsync((asyncCallback, o) => channel.BeginRequest(requestMessage, asyncCallback, o),
228Task.Factory.FromAsync(channel.BeginClose, channel.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
229Task.Factory.FromAsync(factory.BeginClose, factory.EndClose, TaskCreationOptions.None).GetAwaiter().GetResult();
Client.ClientBase.IntegrationTests (1)
Client.ExpectedExceptions.IntegrationTests (6)
Client.TypedClient.IntegrationTests (14)
CodeStyleConfigFileGenerator (4)
Consumer (3)
Contract.Service.IntegrationTests (30)
ServiceContractTests.4.0.0.cs (16)
307Task t = Task.Factory.FromAsync(factory.BeginOpen, factory.EndOpen, TaskCreationOptions.None);
332bool success = Task.Run(() =>
336Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_Async_Open_ChannelFactory(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
361Task t = Task.Factory.FromAsync(proxyAsCommunicationObject.BeginOpen, proxyAsCommunicationObject.EndOpen, TaskCreationOptions.None);
385bool success = Task.Run(() =>
389Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_Async_Open_Proxy(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
416Task t = Task.Factory.FromAsync(factory.BeginClose, factory.EndClose, TaskCreationOptions.None);
436bool success = Task.Run(() =>
440Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_Async_Close_ChannelFactory(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
465Task t = Task.Factory.FromAsync(proxyAsCommunicationObject.BeginClose, proxyAsCommunicationObject.EndClose, TaskCreationOptions.None);
486bool success = Task.Run(() =>
490Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_Async_Close_Proxy(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
ServiceContractTests.4.1.0.cs (14)
206bool success = Task.Run(() =>
210Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_DefaultSettings_Echo_RoundTrips_String_Streamed(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
220bool success = Task.Run(() =>
224Task.Factory.StartNew(() => ServiceContractTests.BasicHttp_DefaultSettings_Echo_RoundTrips_String_Streamed_Async(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
260Task.Delay(sendTimeoutMs * 2).Wait();
269Task.Delay(sendTimeoutMs * 2).Wait();
320Task.Delay(sendTimeoutMs * 2).Wait();
326Task.Delay(sendTimeoutMs * 2).Wait();
610bool success = Task.Run(() =>
614Task.Factory.StartNew(() => ServiceContractTests.NetTcp_NoSecurity_Streamed_RoundTrips_String(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
624bool success = Task.Run(() =>
628Task.Factory.StartNew(() => ServiceContractTests.NetTcp_NoSecurity_Streamed_Async_RoundTrips_String(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
879Task factoryTask = Task.Factory.FromAsync(factory.BeginClose, factory.EndClose, TaskCreationOptions.None);
csc (13)
CustomResources.AppHost (7)
DatabaseMigration.MigrationService (3)
datacollector (2)
datacollector.arm64 (2)
dotnet (109)
dotnet-aot (32)
dotnet-format (10)
dotnet-openapi (8)
dotnet-sourcelink (4)
dotnet-suggest (4)
dotnet-svcutil-lib (327)
DebugLogger.cs (11)
63public Task WriteMessageAsync(string message, bool logToUI)
65return Task.Run(() => LogMessage(message, LogTag.LogMessage, logToUI));
68public Task WriteErrorAsync(string errorMessage, bool logToUI)
70return Task.Run(() => LogMessage(errorMessage, LogTag.Error, logToUI));
73public Task WriteWarningAsync(string warningMessage, bool logToUI)
75return Task.Run(() => LogMessage(warningMessage, LogTag.Warning, logToUI));
85public Task WriteEndOperationAsync(DateTime startTime, bool logToUI = false)
133Task NuGet.Common.ILogger.LogAsync(NuGet.Common.ILogMessage message)
135return Task.Run(() => LogMessage(message.Message, message.Level));
138Task NuGet.Common.ILogger.LogAsync(NuGet.Common.LogLevel level, string data)
140return Task.Run(() => LogMessage(data, level));
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (16)
15public static async Task AsyncWait<TException>(this Task task)
78public static Task ToApm(this Task task, AsyncCallback callback, object state)
144Task task = iar as Task;
153public static async Task<bool> AwaitWithTimeout(this Task task, TimeSpan timeout)
168var completedTask = await Task.WhenAny(task, Task.Delay(timeout, cts.Token));
183public static void WaitForCompletion(this Task task)
193public static bool WaitWithTimeSpan(this Task task, TimeSpan timeout)
206public static void Wait(this Task task, TimeSpan timeout, Action<Exception, TimeSpan, string> exceptionConverter, string operationType)
237public static Task CompletedTask()
239return Task.FromResult(true);
291Task.Run(continuation);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (8)
325public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
449private Action<Task, object> _onWrite;
451private Task _writeResult;
465_onWrite = new Action<Task, object>(OnWrite);
562Task localTask = _stream.WriteAsync(buffer, offset, size);
590Task localResult = _writeResult;
607private void OnWrite(Task antecedant, Object state)
814internal static async Task WriteAsync(this IConnection connection, byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (18)
103Task closeTask = CloseAsync();
122Task task = CloseOutputAsync(CancellationToken.None);
126protected override async Task CloseOutputSessionCoreAsync(TimeSpan timeout)
170protected internal override async Task OnCloseAsync(TimeSpan timeout)
202Task task = WebSocket.SendAsync(messageData, outgoingMessageType, true, helper.GetCancellationToken());
253Task task = CloseOutputAsync(helper.GetCancellationToken());
294Task task = WebSocket.SendAsync(messageData, outgoingMessageType, true, helper.GetCancellationToken());
357private Task CloseAsync()
374private Task CloseOutputAsync(CancellationToken cancellationToken)
396private async void HandleCloseOutputAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
412private async void HandleSendAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
561private async Task ReadBufferedMessageAsync()
1030return Task.FromResult(0);
1035return Task.FromResult(GetBytesFromInitialReadBuffer(buffer, offset, count));
1042return Task.FromResult(0);
1123public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1163private async Task WriteAsyncInternal(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1183Task task = _webSocket.SendAsync(new ArraySegment<byte>(Array.Empty<byte>(), 0, 0), _outgoingMessageType, true, timeoutHelper.GetCancellationToken());
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\MetadataExchangeClient.cs (3)
291return Task.Factory.FromAsync<MetadataRetriever, MetadataSet>(this.BeginGetMetadata, this.EndGetMetadata, retriever, /* state */ null);
301return Task.Factory.FromAsync<MetadataRetriever, MetadataSet>(this.BeginGetMetadata, this.EndGetMetadata, new MetadataReferenceRetriever(address, this), /* state */ null);
316return Task.Factory.FromAsync<MetadataRetriever, MetadataSet>(this.BeginGetMetadata, this.EndGetMetadata, new MetadataReferenceRetriever(address, via, this), /* state */ null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\OperationFormatter.cs (4)
50protected virtual Task SerializeBodyAsync(XmlDictionaryWriter writer, MessageVersion version, string action, MessageDescription messageDescription, object returnValue, object[] parameters, bool isRequest)
53return Task.CompletedTask;
353private async Task SerializeBodyContentsAsync(XmlDictionaryWriter writer, MessageVersion version, object[] parameters, object returnValue, bool isRequest)
726protected override Task OnWriteBodyContentsAsync(XmlDictionaryWriter writer)
Metadata\MetadataDocumentLoader.cs (7)
162public async Task LoadAsync(CancellationToken cancellationToken)
210private async Task LoadAsync(string uri, string baseUrl, string basePath, CancellationToken cancellationToken)
288internal async Task LoadFromStreamAsync(Stream stream, string uri, string basePath, CancellationToken cancellationToken)
317private async Task LoadAsXmlSchemaAsync(XmlNS.XmlReader reader, string uri, string basePath, CancellationToken cancellationToken)
330private async Task LoadAsXmlSchemaIncludesAsync(XmlNS.Schema.XmlSchema schema, string uri, string basePath, CancellationToken cancellationToken)
344private async Task LoadAsWsdlAsync(XmlNS.XmlReader reader, string uri, string basePath, CancellationToken cancellationToken)
427private async Task LoadAsEPRAsync(XmlNS.XmlReader reader, CancellationToken cancellationToken)
dotnet-svcutil-lib.Tests (17)
dotnet-watch (5)
DotNetInvocationHostedAgent (3)
DotnetTool.AppHost (2)
EventHubsConsumer (4)
Extensibility.WebSockets.IntegrationTests (3)
GenerateDocumentationAndConfigFiles (109)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
16public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
19public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
22public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
25public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
GetDocument.Insider (11)
HealthChecksSandbox.AppHost (6)
ILCompiler.DependencyAnalysisFramework (3)
ILCompiler.ReadyToRun (7)
ILLink.CodeFixProvider (16)
ILLink.RoslynAnalyzer (1)
Infrastructure.Tests (470)
installer.tasks (2)
Microsoft.Agents.AI.ProjectTemplates.Tests (5)
Microsoft.Analyzers.Extra (2)
Microsoft.Analyzers.Extra.Tests (65)
Microsoft.Analyzers.Local.Tests (18)
InternalReferencedInPublicDocAnalyzerTests.cs (12)
99public async Task ShouldIndicateWhenExternallyVisibleMemberReferencesTopLevelInternalType(string member, string type)
118public async Task ShouldNotIndicateWhenMemberReferencesTopLevelType(string member, string type)
143public async Task ShouldNotIndicateWhenInternalClassMemberReferencesTopLevelType(string member, string type)
162public async Task ShouldIndicateWhenExternallyVisibleTopLevelTypeReferencesItsInvisibleMember(string type, string member)
193public async Task ShouldNotIndicateWhenTopLevelTypeReferencesItsMember(string type, string member)
206public async Task ShouldSupportReferencesToEnumMembers(string enumAccess, bool shouldIndicate)
244public async Task ShouldSupportCommentsOnEnumMembers(string enumAccess, string typeAccess, bool shouldIndicate)
297public async Task ShouldSupportCrefPointingToNestedType(string enclosingTypeAccess, string nestedTypeAccess, bool shouldIndicate)
349public async Task ShouldSupportCrefOnNestedType(string enclosingTypeAccess, string nestedTypeAccess, bool shouldIndicate)
388public async Task ShouldNotIndicateWhenCrefIsInvalid(string cref)
409public async Task ShouldNotIndicateWhenCommentIsOrphan()
431public async Task ShouldNotIndicateWhenCRefDoesNotBelongToXmlDocumentation()
Microsoft.Arcade.Common (13)
Microsoft.AspNetCore (8)
Microsoft.AspNetCore.Antiforgery (5)
Microsoft.AspNetCore.App.Analyzers (8)
Microsoft.AspNetCore.App.CodeFixes (20)
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 (14)
Microsoft.AspNetCore.Authentication.DeviceBoundSessions (13)
Microsoft.AspNetCore.Authentication.JwtBearer (18)
Microsoft.AspNetCore.Authentication.Negotiate (18)
Microsoft.AspNetCore.Authentication.OAuth (9)
Microsoft.AspNetCore.Authentication.OpenIdConnect (38)
Events\OpenIdConnectEvents.cs (33)
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 Func<PushedAuthorizationContext, Task> OnPushAuthorization { get; set; } = context => Task.CompletedTask;
72public virtual Task AuthenticationFailed(AuthenticationFailedContext context) => OnAuthenticationFailed(context);
77public virtual Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext context) => OnAuthorizationCodeReceived(context);
82public virtual Task MessageReceived(MessageReceivedContext context) => OnMessageReceived(context);
89public virtual Task RedirectToIdentityProvider(RedirectContext context) => OnRedirectToIdentityProvider(context);
94public virtual Task RedirectToIdentityProviderForSignOut(RedirectContext context) => OnRedirectToIdentityProviderForSignOut(context);
99public virtual Task SignedOutCallbackRedirect(RemoteSignOutContext context) => OnSignedOutCallbackRedirect(context);
104public virtual Task RemoteSignOut(RemoteSignOutContext context) => OnRemoteSignOut(context);
109public virtual Task TokenResponseReceived(TokenResponseReceivedContext context) => OnTokenResponseReceived(context);
115public virtual Task TokenValidated(TokenValidatedContext context) => OnTokenValidated(context);
120public virtual Task UserInformationReceived(UserInformationReceivedContext context) => OnUserInformationReceived(context);
127public virtual Task PushAuthorization(PushedAuthorizationContext context) => OnPushAuthorization(context);
Microsoft.AspNetCore.Authentication.Twitter (10)
Microsoft.AspNetCore.Authentication.WsFederation (21)
Microsoft.AspNetCore.Authorization (22)
Microsoft.AspNetCore.Authorization.Policy (4)
Microsoft.AspNetCore.Components (267)
EventCallbackFactoryBinderExtensions.cs (36)
69Func<string?, Task> setter,
109Func<bool, Task> setter,
149Func<bool?, Task> setter,
189Func<int, Task> setter,
229Func<int?, Task> setter,
269Func<long, Task> setter,
309Func<short, Task> setter,
349Func<long?, Task> setter,
389Func<short?, Task> setter,
429Func<float, Task> setter,
469Func<float?, Task> setter,
509Func<double, Task> setter,
549Func<double?, Task> setter,
589Func<decimal, Task> setter,
629Func<decimal?, Task> setter,
669Func<DateTime, Task> setter,
712Func<DateTime, Task> setter,
753Func<DateTime?, Task> setter,
796Func<DateTime?, Task> setter,
837Func<DateTimeOffset, Task> setter,
880Func<DateTimeOffset, Task> setter,
921Func<DateTimeOffset?, Task> setter,
964Func<DateTimeOffset?, Task> setter,
1005Func<DateOnly, Task> setter,
1048Func<DateOnly, Task> setter,
1089Func<DateOnly?, Task> setter,
1132Func<DateOnly?, Task> setter,
1173Func<TimeOnly, Task> setter,
1216Func<TimeOnly, Task> setter,
1257Func<TimeOnly?, Task> setter,
1300Func<TimeOnly?, Task> setter,
1343Func<T, Task> setter,
1397Func<T, Task> setter,
1402Func<ChangeEventArgs, Task> callback = async e =>
1486Func<T, Task> setter,
1492Func<ChangeEventArgs, Task> callback = async e =>
RenderTree\Renderer.cs (58)
31internal static readonly Task CanceledRenderTask = Task.FromCanceled(new CancellationToken(canceled: true));
50private Task? _ongoingQuiescenceTask;
55private List<Task>? _pendingTasks;
56private Task? _disposeTask;
300protected Task RenderRootComponentAsync(int componentId)
311/// The returned <see cref="Task"/> waits for this component and all descendant components to
320protected internal async Task RenderRootComponentAsync(int componentId, ParameterView initialParameters)
384private async Task WaitForQuiescence()
405async Task ProcessAsynchronousWork()
412var pendingWork = Task.WhenAll(_pendingTasks);
456/// <returns>A <see cref="Task"/> to represent the UI update process.</returns>
457protected abstract Task UpdateDisplayAsync(in RenderBatch renderBatch);
466/// A <see cref="Task"/> which will complete once all asynchronous processing related to the event
469public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fieldInfo, EventArgs eventArgs)
482/// A <see cref="Task"/> which will complete once all asynchronous processing related to the event
485public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fieldInfo, EventArgs eventArgs, bool waitForQuiescence)
520return Task.CompletedTask;
541Task? task = null;
579return Task.CompletedTask;
592var errorHandledTask = GetErrorHandledTask(task, receiverComponentState);
672internal void AddToPendingTasksWithErrorHandling(Task task, ComponentState? owningComponentState)
694var handledErrorTask = GetErrorHandledTask(task, owningComponentState);
705/// <param name="task">The <see cref="Task"/>.</param>
706protected virtual void AddPendingTask(ComponentState? componentState, Task task)
846var updateDisplayTask = Task.CompletedTask;
913private Task InvokeRenderCompletedCalls(ArrayRange<RenderTreeDiff> updatedComponents, Task updateDisplayTask)
923return Task.CompletedTask;
930return Task.CompletedTask;
945List<Task> batch = null;
957Task.WhenAll(batch) :
958Task.CompletedTask;
961private async Task InvokeRenderCompletedCallsAfterUpdateDisplayTask(
962Task updateDisplayTask,
980List<Task> batch = null;
991var result = batch != null ?
992Task.WhenAll(batch) :
993Task.CompletedTask;
998private void NotifyRenderCompleted(ComponentState state, ref List<Task> batch)
1007var task = state.NotifyRenderCompletedAsync();
1027batch = batch ?? new List<Task>();
1068var result = disposalTask.AsTask();
1071async Task GetHandledAsynchronousDisposalErrorsTask(Task result)
1105private void RemoveEventHandlerIds(ArrayRange<ulong> eventHandlerIds, Task afterTaskIgnoreErrors)
1130async Task ContinueAfterTask(ArrayRange<ulong> eventHandlerIds, Task afterTaskIgnoreErrors)
1149RemoveEventHandlerIds(eventHandlerIdsClone, Task.CompletedTask);
1153private async Task GetErrorHandledTask(Task taskToHandle, ComponentState? owningComponentState)
1261var done = Dispatcher.InvokeAsync(() => Dispose(disposing));
1285List<Task> asyncDisposables = null;
1323async Task HandleAsyncExceptions(List<Task> tasks)
1326foreach (var task in tasks)
Microsoft.AspNetCore.Components.AI (20)
Microsoft.AspNetCore.Components.Analyzers (7)
Microsoft.AspNetCore.Components.Authorization (3)
Microsoft.AspNetCore.Components.Endpoints (92)
Microsoft.AspNetCore.Components.Forms (26)
Microsoft.AspNetCore.Components.Media (7)
Microsoft.AspNetCore.Components.QuickGrid (31)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
Microsoft.AspNetCore.Components.Server (145)
Circuits\CircuitHost.cs (34)
30private Func<Func<Task>, Task> _dispatchInboundActivity;
117public Task InitializeAsync(ProtectedPrerenderComponentApplicationStore store, ActivityContext httpActivityContext, CancellationToken cancellationToken)
150var pendingRenders = new Task[count];
158await Task.WhenAll(pendingRenders);
253private async Task OnCircuitOpenedAsync(CancellationToken cancellationToken)
283public async Task OnConnectionUpAsync(CancellationToken cancellationToken)
315public async Task OnConnectionDownAsync(CancellationToken cancellationToken)
351private async Task OnCircuitDownAsync(CancellationToken cancellationToken)
382public async Task OnRenderCompletedAsync(long renderId, string errorMessageOrNull)
403public async Task BeginInvokeDotNetFromJS(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, [StringSyntax(StringSyntaxAttribute.Json)] string argsJson)
429public async Task EndInvokeJSFromDotNet(long asyncCall, bool succeeded, string arguments)
463internal async Task ReceiveByteArray(int id, byte[] data)
563public async Task OnLocationChangedAsync(string uri, string state, bool intercepted)
605public async Task OnLocationChangingAsync(int callId, string uri, string? state, bool intercepted)
639authenticationStateProvider.SetAuthenticationState(Task.FromResult(authenticationState));
655internal Task HandleInboundActivityAsync(Func<Task> handler)
666private static Func<Func<Task>, Task> BuildInboundActivityDispatcher(IReadOnlyList<CircuitHandler> circuitHandlers, Circuit circuit)
718private async Task ReportUnhandledException(Exception exception)
741private async Task TryNotifyClientErrorAsync(IClientProxy client, string error, Exception exception = null)
764internal Task UpdateRootComponents(
778var postRemovalTask = Task.CompletedTask;
870private static async Task EnqueueRestore(
883Task postStateTask)
889? new Task[operations.Length]
902var task = webRootComponentManager.AddRootComponentAsync(
924return Task.CompletedTask;
929await Task.WhenAll(pendingTasks);
957return Task.FromResult(false);
963return Task.FromResult(false);
969return Task.FromResult(false);
Microsoft.AspNetCore.Components.Testing (41)
Microsoft.AspNetCore.Components.Web (44)
Microsoft.AspNetCore.Components.WebAssembly (59)
Microsoft.AspNetCore.Components.WebAssembly.Authentication (9)
Microsoft.AspNetCore.Components.WebAssembly.Server (8)
Microsoft.AspNetCore.Components.WebView (29)
Microsoft.AspNetCore.Components.WebView.Maui (12)
Microsoft.AspNetCore.Components.WebView.WindowsForms (17)
Microsoft.AspNetCore.Components.WebView.Wpf (11)
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.Cors (11)
Microsoft.AspNetCore.DataProtection (6)
Microsoft.AspNetCore.Diagnostics (33)
Microsoft.AspNetCore.Diagnostics.Abstractions (2)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (12)
Microsoft.AspNetCore.Diagnostics.HealthChecks (3)
Microsoft.AspNetCore.Diagnostics.Middleware (17)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (72)
Latency\RequestLatencyTelemetryMiddlewareTests.cs (24)
22public async Task RequestLatency_GivenContext_InvokesOperations()
31return Task.CompletedTask;
53public async Task RequestLatency_WithoutServiceMetadata_InvokesOperations()
61return Task.CompletedTask;
81public async Task RequestLatency_WithServerNameHeadersSet_ReturnsLastServerName()
90return Task.CompletedTask;
111public async Task RequestLatency_NoServiceData_DoesNotAddHeader()
119return Task.CompletedTask;
140public async Task RequestLatency_NoExporter()
148return Task.CompletedTask;
161public async Task RequestLatency_GivenTimeout_PassedToExport()
170return Task.CompletedTask;
188private Func<Task> _responseStartingAsync =
189static () => Task.CompletedTask;
191public override void OnStarting(Func<object, Task> callback, object state)
196public override void OnCompleted(Func<object, Task> callback, object state)
201private void ChainCallback(Func<object, Task> callback, object state)
211public async Task StartAsync() => await _responseStartingAsync();
219feature.Setup(m => m.OnCompleted(It.IsAny<Func<object, Task>>(), It.IsAny<object>()))
220.Callback<Func<object, Task>, object>((c, o) => c(o));
242public async Task ExportAsync(LatencyData latencyData, CancellationToken cancellationToken)
245await Task.CompletedTask;
260public async Task ExportAsync(LatencyData latencyData, CancellationToken cancellationToken)
264var e = await Record.ExceptionAsync(() => Task.Delay(_timeSpanToDelay, cancellationToken));
Logging\AcceptanceTests.cs (22)
143private static Task RunAsync(LogLevel level, Action<IServiceCollection> configure, Func<FakeLogCollector, HttpClient, Task> func)
146private static async Task RunAsync<TStartup>(
149Func<FakeLogCollector, HttpClient, IServiceProvider, Task> func)
179private static async Task WaitForLogRecordsAsync(FakeLogCollector logCollector, TimeSpan timeout, int expectedRecords = 1)
190await Task.Delay(spinTime);
202public async Task HttpLogging_WhenLogLevelInfo_LogResponseBody(string responseContentTypeToLog, bool shouldLog)
262public async Task HttpLogging_WhenLogLevelInfo_LogRequestBody(string requestContentType, bool shouldLog)
315public async Task HttpLogging_WhenIncludeUnmatchedRoutes_LogRequestPath()
357public async Task HttpLogging_WhenLogLevelInfo_LogRequestStart()
428public async Task HttpLogging_WhenLogLevelInfo_LogHeaders()
482public async Task HttpLogging_WhenEnricherAdded_LogAdditionalProps()
520public async Task HttpLogging_WhenRedactionModeNone_LogIncomingRequestPath(IncomingPathLoggingMode pathLoggingMode)
554public async Task HttpLogging_WhenLogRequestStart_SkipEnrichingFirstLogRecord()
591public async Task HttpLogging_WhenSecondLogRequestStart_DontLogDurationAndStatus()
648public async Task HttpLogging_WhenException_LogError(string requestPath, string expectedStatus)
679public async Task HttpLogging_WhenException_LogBody()
716public async Task HttpLogging_WhenException_DontLogResponseBody()
748public async Task HttpLogging_WhenLogLevelError_NoLogHttp()
776public async Task HttpLogging_LogRecordIsNotCreated_If_isFiltered_True(string httpPath, string excludedPath, bool isFiltered)
953public async Task HttpLogging_LogRecordIsNotCreated_If_Disabled()
973public async Task HttpLogging_EnricherThrows_Logged()
Microsoft.AspNetCore.Grpc.JsonTranscoding (24)
Microsoft.AspNetCore.HeaderPropagation (1)
Microsoft.AspNetCore.HostFiltering (3)
Microsoft.AspNetCore.Hosting (19)
Microsoft.AspNetCore.Hosting.Abstractions (4)
Microsoft.AspNetCore.Hosting.Server.Abstractions (3)
Microsoft.AspNetCore.Http (26)
Microsoft.AspNetCore.Http.Abstractions (39)
Extensions\UseMiddlewareExtensions.cs (6)
87if (!typeof(Task).IsAssignableFrom(invokeMethod.ReturnType))
89throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNonTaskReturnType(InvokeMethodName, InvokeAsyncMethodName, nameof(Task)));
200private static Func<T, HttpContext, IServiceProvider, Task> ReflectionFallback<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
235return (Task)methodInfo.Invoke(middleware, BindingFlags.DoNotWrapExceptions, binder: null, methodArguments, culture: null)!;
265private static Func<T, HttpContext, IServiceProvider, Task> CompileExpression<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
323var lambda = Expression.Lambda<Func<T, HttpContext, IServiceProvider, Task>>(body, instanceArg, httpContextArg, providerArg);
Microsoft.AspNetCore.Http.Connections (71)
Internal\HttpConnectionDispatcher.cs (19)
64public async Task ExecuteAsync(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionDelegate connectionDelegate)
105public async Task ExecuteNegotiateAsync(HttpContext context, HttpConnectionDispatcherOptions options)
124public async Task ExecuteRefreshAsync(HttpContext context, HttpConnectionDispatcherOptions options)
141private async Task ProcessRefresh(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
247private static async Task WriteRefreshErrorAsync(HttpContext context, int statusCode, string error)
271private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connectionDelegate, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
306if (connection.TryActivatePersistentConnection(connectionDelegate, sse, Task.CompletedTask, context, _logger))
361var reconnectTask = Task.CompletedTask;
378reconnectTask = connection.NotifyOnReconnect?.Invoke(connection.Transport.Output) ?? Task.CompletedTask;
406var resultTask = await Task.WhenAny(connection.ApplicationTask!, connection.TransportTask!);
419await ((Task)connection.TransportTask!).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
478private async Task DoPersistentConnection(HttpConnectionContext connection)
481await Task.WhenAny(connection.ApplicationTask!, connection.TransportTask!);
486private async Task ProcessNegotiate(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
616private async Task ProcessSend(HttpContext context)
714private async Task ProcessDeleteAsync(HttpContext context)
1080private async Task WriteUserChangedResponseAsync(ClaimsPrincipal? originalUser, ClaimsPrincipal newUser, HttpContext context)
Microsoft.AspNetCore.Http.Connections.Client (55)
Internal\ServerSentEventsTransport.cs (10)
31internal Task Running { get; private set; } = Task.CompletedTask;
46public async Task StartAsync(Uri url, TransferFormat transferFormat, CancellationToken cancellationToken = default)
88private async Task ProcessAsync(Uri url, HttpResponseMessage response)
93var receiving = ProcessEventStream(response, _transportCts.Token);
94var sending = SendUtils.SendMessages(url, _application, _httpClient, _logger, _inputCts.Token);
97var trigger = await Task.WhenAny(receiving, sending).ConfigureAwait(false);
126private async Task ProcessEventStream(HttpResponseMessage response, CancellationToken cancellationToken)
174public 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.Extensions (79)
HttpResponseJsonExtensions.cs (14)
36public static Task WriteAsJsonAsync<TValue>(
58public static Task WriteAsJsonAsync<TValue>(
80public static Task WriteAsJsonAsync<TValue>(
113public static Task WriteAsJsonAsync<TValue>(
132static async Task WriteAsJsonAsyncSlow(HttpResponse response, TValue value, JsonTypeInfo<TValue> jsonTypeInfo,
154public static Task WriteAsJsonAsync(
174static async Task WriteAsJsonAsyncSlow(HttpResponse response, object? value, JsonTypeInfo jsonTypeInfo,
187private static async Task WriteAsJsonAsyncSlow<TValue>(
211public static Task WriteAsJsonAsync(
234public static Task WriteAsJsonAsync(
257public static Task WriteAsJsonAsync(
284private static async Task WriteAsJsonAsyncSlow(
309public static Task WriteAsJsonAsync(
331static async Task WriteAsJsonAsyncSlow(PipeWriter body, object? value, Type type, JsonSerializerContext context,
RequestDelegateFactory.cs (44)
105private static readonly MemberExpression CompletedTaskExpr = Expression.Property(null, (PropertyInfo)GetMemberInfo<Func<Task>>(() => Task.CompletedTask));
314private static Func<object?, HttpContext, Task>? CreateTargetableRequestDelegate(
529if (returnType == typeof(Task))
1112if (returnType == typeof(Task))
1263private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegate(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1270var continuation = Expression.Lambda<Func<object?, HttpContext, object?[], Task>>(
1290return Expression.Lambda<Func<object?, HttpContext, Task>>(
1304private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForJson(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1318var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1355var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
1459private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForForm(
1475var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1509var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
2472private static Task ExecuteValueTaskOfObject(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2474static async Task ExecuteAwaited(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2487private static Task ExecuteTaskOfObject(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2489static async Task ExecuteAwaited(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2502private static Task ExecuteAwaitedReturn(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2507private static Task ExecuteTaskOfTFast<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2511static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2524private static Task ExecuteTaskOfT<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2528static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2541private static Task ExecuteTaskOfString(Task<string?> task, HttpContext httpContext)
2546static async Task ExecuteAwaited(Task<string> task, HttpContext httpContext)
2559private static Task ExecuteWriteStringResponseAsync(HttpContext httpContext, string text)
2565private static Task ExecuteValueTask(ValueTask task)
2567static async Task ExecuteAwaited(ValueTask task)
2575return Task.CompletedTask;
2581private static ValueTask<object?> ExecuteTaskWithEmptyResult(Task task)
2583static async ValueTask<object?> ExecuteAwaited(Task task)
2614private static Task ExecuteValueTaskOfTFast<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2616static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2629private static Task ExecuteValueTaskOfT<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2631static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2644private static Task ExecuteValueTaskOfString(ValueTask<string?> task, HttpContext httpContext)
2648static async Task ExecuteAwaited(ValueTask<string> task, HttpContext httpContext)
2661private static Task ExecuteValueTaskResult<T>(ValueTask<T?> task, HttpContext httpContext) where T : IResult
2663static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext)
2676private static async Task ExecuteTaskResult<T>(Task<T?> task, HttpContext httpContext) where T : IResult
2683private static async Task ExecuteResultWriteResponse(IResult? result, HttpContext httpContext)
2690private static Task WriteJsonResponseFast<T>(HttpResponse response, T value, JsonTypeInfo<T> jsonTypeInfo)
2693private static Task WriteJsonResponse<T>(HttpResponse response, T? value, JsonTypeInfo<T> jsonTypeInfo)
2888private 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.Features (9)
Microsoft.AspNetCore.Http.Results (81)
Microsoft.AspNetCore.HttpLogging (20)
Microsoft.AspNetCore.HttpOverrides (8)
Microsoft.AspNetCore.HttpsPolicy (3)
Microsoft.AspNetCore.Identity (65)
SignInManager.cs (14)
180public virtual async Task RefreshSignInAsync(TUser user)
242public virtual Task SignInAsync(TUser user, bool isPersistent, string? authenticationMethod = null)
253public virtual Task SignInAsync(TUser user, AuthenticationProperties authenticationProperties, string? authenticationMethod = null)
271public virtual Task SignInWithClaimsAsync(TUser user, bool isPersistent, IEnumerable<Claim> additionalClaims)
281public virtual async Task SignInWithClaimsAsync(TUser user, AuthenticationProperties? authenticationProperties, IEnumerable<Claim> additionalClaims)
311public virtual async Task SignOutAsync()
717private async Task StorePasskeyAuthenticationInfoAsync(string operation, string? state)
782public virtual async Task RememberTwoFactorClientAsync(TUser user)
803public virtual async Task ForgetTwoFactorClientAsync()
1145/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
1330return Task.FromResult(SignInResult.LockedOut);
1355/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
1356protected virtual async Task ResetLockout(TUser user)
1385var resetLockoutTask = ResetLockout(user);
Microsoft.AspNetCore.Identity.EntityFrameworkCore (89)
UserOnlyStore.cs (34)
180/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
181protected Task SaveChanges(CancellationToken cancellationToken)
183return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.CompletedTask;
191/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
207/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
233/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
258/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
274/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
348/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
349public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
358return Task.FromResult(false);
368/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
369public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
390/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
391public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
412/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
413public override Task AddLoginAsync(TUser user, UserLoginInfo login,
421return Task.FromResult(false);
431/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
432public override async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
451/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
470/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
507/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
540protected override Task AddUserTokenAsync(TUserToken token)
543return Task.CompletedTask;
551protected override Task RemoveUserTokenAsync(TUserToken token)
554return Task.CompletedTask;
617/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
618public virtual async Task AddOrUpdatePasskeyAsync(TUser user, UserPasskeyInfo passkey, CancellationToken cancellationToken)
645/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing a list of the user's passkeys.</returns>
668/// The <see cref="Task"/> that represents the asynchronous operation, containing the user, if any, associated with the specified passkey credential id.
689/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's passkey information.</returns>
707/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
708public virtual async Task RemovePasskeyAsync(TUser user, byte[] credentialId, CancellationToken cancellationToken)
UserStore.cs (39)
184/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
185protected Task SaveChanges(CancellationToken cancellationToken)
187return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.CompletedTask;
195/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
211/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
237/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
262/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
278/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="normalizedUserName"/> if it exists.
361/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
362public override async Task AddToRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken))
383/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
384public override async Task RemoveFromRoleAsync(TUser user, string normalizedRoleName, CancellationToken cancellationToken = default(CancellationToken))
465/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
466public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
475return Task.FromResult(false);
485/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
486public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
507/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
508public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
529/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
530public override Task AddLoginAsync(TUser user, UserLoginInfo login,
538return Task.FromResult(false);
548/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
549public override async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
568/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
587/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
624/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
647/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
685protected override Task AddUserTokenAsync(TUserToken token)
688return Task.CompletedTask;
696protected override Task RemoveUserTokenAsync(TUserToken token)
699return Task.CompletedTask;
762/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
763public virtual async Task AddOrUpdatePasskeyAsync(TUser user, UserPasskeyInfo passkey, CancellationToken cancellationToken)
790/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing a list of the user's passkeys.</returns>
813/// The <see cref="Task"/> that represents the asynchronous operation, containing the user, if any, associated with the specified passkey credential id.
834/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's passkey information.</returns>
852/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
853public virtual async Task RemovePasskeyAsync(TUser user, byte[] credentialId, CancellationToken cancellationToken)
Microsoft.AspNetCore.Identity.UI (104)
Microsoft.AspNetCore.InternalTesting (30)
src\aspnetcore\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.Localization (6)
Microsoft.AspNetCore.Localization.Routing (1)
Microsoft.AspNetCore.MiddlewareAnalysis (1)
Microsoft.AspNetCore.Mvc.Abstractions (31)
Microsoft.AspNetCore.Mvc.ApiExplorer (2)
Microsoft.AspNetCore.Mvc.Core (297)
Infrastructure\ControllerActionInvoker.cs (27)
61private Task Next(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
77var task = BindArgumentsAsync();
130var task = filter.OnActionExecutionAsync(actionExecutingContext, InvokeNextActionFilterAwaitedAsync);
210var task = InvokeNextActionFilterAsync();
248var task = InvokeActionMethodAsync();
271return Task.CompletedTask;
283return Task.CompletedTask;
291private Task InvokeNextActionFilterAsync()
301var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
317return Task.CompletedTask;
319static async Task Awaited(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
351var task = InvokeNextActionFilterAsync();
358return Task.FromResult<ActionExecutedContext>(_actionExecutedContext);
360static async Task<ActionExecutedContext> Awaited(ControllerActionInvoker invoker, Task task)
381private Task InvokeActionMethodAsync()
402return Task.CompletedTask;
404static async Task Awaited(ControllerActionInvoker invoker, ValueTask<IActionResult> actionResultValueTask)
409static async Task Logged(ControllerActionInvoker invoker)
456protected override Task InvokeInnerFilterAsync()
467var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
474return Task.CompletedTask;
480return Task.FromException(ex);
483static async Task Awaited(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
514private Task BindArgumentsAsync()
522return Task.CompletedTask;
Infrastructure\ResourceInvoker.cs (71)
61public virtual Task InvokeAsync()
71Task task;
78return Awaited(this, Task.FromException(exception), scope);
88static async Task Awaited(ResourceInvoker invoker, Task task, IDisposable? scope)
100static async Task Logged(ResourceInvoker invoker)
217private Task InvokeFilterPipelineAsync()
236var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
243return Task.CompletedTask;
249return Task.FromException(ex);
252static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
263protected abstract Task InvokeInnerFilterAsync();
265protected virtual Task InvokeResultAsync(IActionResult result)
274static async Task Logged(ResourceInvoker invoker, IActionResult result)
293private Task Next(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
351var task = filter.OnAuthorizationAsync(authorizationContext);
487var task = filter.OnResourceExecutionAsync(resourceExecutingContext, InvokeNextResourceFilterAwaitedAsync);
565var task = InvokeNextResourceFilter();
609var task = InvokeAlwaysRunResultFilters();
658var task = InvokeNextExceptionFilterAsync();
685var task = filter.OnExceptionAsync(exceptionContext);
725var task = InvokeNextExceptionFilterAsync();
796var task = InvokeAlwaysRunResultFilters();
813return Task.CompletedTask;
829var task = InvokeResultFilters();
840var task = InvokeInnerFilterAsync();
857return Task.CompletedTask;
861var task = InvokeResultFilters();
890return Task.CompletedTask;
902return Task.CompletedTask;
920var task = InvokeNextResourceFilter();
927return Task.FromResult<ResourceExecutedContext>(_resourceExecutedContext);
929static async Task<ResourceExecutedContext> Awaited(ResourceInvoker invoker, Task task)
949private Task InvokeNextResourceFilter()
960var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
976return Task.CompletedTask;
978static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1001private Task InvokeNextExceptionFilterAsync()
1012var lastTask = Next(ref next, ref scope, ref state, ref isCompleted);
1019return Task.CompletedTask;
1025return Task.FromException(ex);
1028static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1049private Task InvokeAlwaysRunResultFilters()
1060var lastTask = ResultNext<IAlwaysRunResultFilter, IAsyncAlwaysRunResultFilter>(ref next, ref scope, ref state, ref isCompleted);
1067return Task.CompletedTask;
1073return Task.FromException(ex);
1076static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1087private Task InvokeResultFilters()
1098var lastTask = ResultNext<IResultFilter, IAsyncResultFilter>(ref next, ref scope, ref state, ref isCompleted);
1105return Task.CompletedTask;
1111return Task.FromException(ex);
1114static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1125private Task ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object? state, ref bool isCompleted)
1184var task = filter.OnResultExecutionAsync(resultExecutingContext, InvokeNextResultFilterAwaitedAsync<TFilter, TFilterAsync>);
1266var task = InvokeNextResultFilterAsync<TFilter, TFilterAsync>();
1316var task = InvokeResultAsync(_result);
1338return Task.CompletedTask;
1342return Task.CompletedTask;
1350private Task InvokeNextResultFilterAsync<TFilter, TFilterAsync>()
1362var lastTask = ResultNext<TFilter, TFilterAsync>(ref next, ref scope, ref state, ref isCompleted);
1379return Task.CompletedTask;
1381static async Task Awaited(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object? state, bool isCompleted)
1416var task = InvokeNextResultFilterAsync<TFilter, TFilterAsync>();
1423return Task.FromResult<ResultExecutedContext>(_resultExecutedContext);
1425static async Task<ResultExecutedContext> Awaited(ResourceInvoker invoker, Task task)
Microsoft.AspNetCore.Mvc.Cors (3)
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.Razor (14)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (3)
Microsoft.AspNetCore.Mvc.RazorPages (74)
Microsoft.AspNetCore.Mvc.TagHelpers (15)
Microsoft.AspNetCore.Mvc.Testing (2)
Microsoft.AspNetCore.Mvc.ViewFeatures (103)
Microsoft.AspNetCore.OpenApi (50)
Microsoft.AspNetCore.OutputCaching (5)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
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.RateLimiting (3)
Microsoft.AspNetCore.Razor (12)
Microsoft.AspNetCore.Razor.Runtime (13)
Microsoft.AspNetCore.Razor.Utilities.Shared (13)
Microsoft.AspNetCore.RequestDecompression (2)
Microsoft.AspNetCore.ResponseCaching (9)
Microsoft.AspNetCore.ResponseCompression (9)
Microsoft.AspNetCore.Rewrite (2)
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.Server.HttpSys (79)
RequestProcessing\RequestContext.FeatureCollection.cs (19)
76private List<Tuple<Func<object, Task>, object>>? _onStartingActions = new List<Tuple<Func<object, Task>, object>>();
77private List<Tuple<Func<object, Task>, object>>? _onCompletedActions = new List<Tuple<Func<object, Task>, object>>();
350_clientCertTask = Task.FromResult(value);
369return _clientCertTask = Task.FromResult(clientCert);
490void IHttpResponseFeature.OnStarting(Func<object, Task> callback, object state)
498_onStartingActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
501void IHttpResponseFeature.OnCompleted(Func<object, Task> callback, object state)
509_onCompletedActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
524async Task IHttpResponseBodyFeature.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
530Task IHttpResponseBodyFeature.StartAsync(CancellationToken cancellation)
535Task IHttpResponseBodyFeature.CompleteAsync() => CompleteAsync();
543internal async Task CompleteAsync()
660internal async Task OnResponseStart()
673private async Task NotifiyOnStartingAsync()
754internal Task OnCompleted()
758return Task.CompletedTask;
764private async Task NotifyOnCompletedAsync()
RequestProcessing\ResponseBody.cs (13)
303public override Task FlushAsync(CancellationToken cancellationToken)
307return Task.CompletedTask;
313private unsafe Task FlushInternalAsync(ArraySegment<byte> data, CancellationToken cancellationToken)
317return Task.CompletedTask;
324return Task.CompletedTask;
330return Task.FromCanceled<int>(cancellationToken);
574public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
584return Task.CompletedTask;
597internal async Task SendFileAsync(string fileName, long offset, long? count, CancellationToken cancellationToken)
611internal unsafe Task SendFileAsyncCore(string fileName, long offset, long? count, CancellationToken cancellationToken)
615return Task.CompletedTask;
622return Task.CompletedTask;
628return Task.FromCanceled<int>(cancellationToken);
Microsoft.AspNetCore.Server.IIS (99)
Core\IISHttpContext.cs (21)
51protected Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
52protected Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
63protected Task? _readBodyTask;
64protected Task? _writeBodyTask;
490private async Task InitializeResponse(bool flushHeaders)
502private async Task ProduceStart(bool flushHeaders)
574protected Task ProduceEnd()
581return Task.CompletedTask;
602return Task.CompletedTask;
612private async Task ProduceEndAwaited()
726public void OnStarting(Func<object, Task> callback, object state)
737_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
739_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
743public void OnCompleted(Func<object, Task> callback, object state)
749_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
751_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
755protected async Task FireOnStarting()
757Stack<KeyValuePair<Func<object, Task>, object>>? onStarting = null;
779protected async Task FireOnCompleted()
781Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted = null;
925private async Task HandleRequest()
Microsoft.AspNetCore.Server.IISIntegration (19)
Microsoft.AspNetCore.Server.IntegrationTesting (5)
Microsoft.AspNetCore.Server.Kestrel.Core (257)
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)
170Task BindAsync(AddressBindContext context, CancellationToken cancellationToken);
175public async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
195public override Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
217public override Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
237public virtual async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
257public virtual async Task BindAsync(AddressBindContext context, CancellationToken cancellationToken)
Internal\Http\HttpProtocol.cs (43)
43private Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
44private Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
592public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> application) where TContext : notnull
646private async Task ProcessRequests<TContext>(IHttpApplication<TContext> application) where TContext : notnull
805public void OnStarting(Func<object, Task> callback, object state)
814_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
816_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
819public void OnCompleted(Func<object, Task> callback, object state)
823_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
825_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
828protected Task FireOnStarting()
836return Task.CompletedTask;
838static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
856protected Task FireOnCompleted()
864return Task.CompletedTask;
866static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
975public Task InitializeResponseAsync(int firstWriteByteCount)
977var startingTask = FireOnStarting();
987return Task.CompletedTask;
991public async Task InitializeResponseAwaited(Task startingTask, int firstWriteByteCount)
1038protected virtual Task TryProduceInvalidRequestResponse()
1048return Task.CompletedTask;
1051protected Task ProduceEnd()
1055return Task.CompletedTask;
1067return Task.CompletedTask;
1091private Task WriteSuffix()
1120return Task.CompletedTask;
1123private async Task WriteSuffixAwaited(ValueTask<FlushResult> writeTask)
1540var initializeTask = InitializeResponseAsync(0);
1555public Task CompleteAsync(Exception? exception = null)
1571var onStartingTask = FireOnStarting();
1593return Task.CompletedTask;
1596private async Task CompleteAsyncAwaited(Task onStartingTask)
1657var startingTask = FireOnStarting();
1666private async ValueTask<FlushResult> FirstWriteAsyncAwaited(Task initializeTask, ReadOnlyMemory<byte> data, CancellationToken cancellationToken)
1703public Task FlushAsync(CancellationToken cancellationToken = default)
1709private async ValueTask<FlushResult> FlushAsyncAwaited(Task initializeTask, CancellationToken cancellationToken)
1715public Task WriteAsync(ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
1720public 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.Transport.DirectTls (7)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (18)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (22)
src\aspnetcore\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.Sockets (4)
Microsoft.AspNetCore.Session (6)
Microsoft.AspNetCore.SignalR.Client.Core (140)
HubConnection.cs (83)
111/// The <see cref="Task"/> result does not block <see cref="HubConnection"/> operations.
131public event Func<Exception?, Task>? Closed;
139/// The <see cref="Task"/> result does not block <see cref="HubConnection"/> operations.
151public event Func<Exception?, Task>? Reconnecting;
159/// The <see cref="Task"/> result does not block <see cref="HubConnection"/> operations.
171public event Func<string?, Task>? Reconnected;
178/// The authentication refresh operation waits for each handler's returned <see cref="Task"/> to complete.
180public event Func<AuthenticationRefreshedContext, Task>? AuthenticationRefreshed;
187/// The authentication refresh operation waits for each handler's returned <see cref="Task"/> to complete.
189public event Func<AuthenticationRefreshFailedContext, Task>? AuthenticationRefreshFailed;
293/// <returns>A <see cref="Task"/> that represents the asynchronous start.</returns>
294public virtual async Task StartAsync(CancellationToken cancellationToken = default)
303private async Task StartAsyncInner(CancellationToken cancellationToken = default)
346/// <returns>A <see cref="Task"/> that represents the asynchronous stop.</returns>
347public virtual async Task StopAsync(CancellationToken cancellationToken = default)
418public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task> handler, object state)
501/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
505public virtual async Task SendCoreAsync(string methodName, object?[] args, CancellationToken cancellationToken = default)
513private async Task StartAsyncCore(CancellationToken cancellationToken)
664private static async Task InvokeEventHandlersAsync<T>(
665Func<T, Task> handlers,
670foreach (Func<T, Task> handler in handlers.GetInvocationList())
762private async Task OnAuthenticationRefreshTimerFired(AuthenticationRefreshTimerState timerState)
844private async Task StopAsyncCore(bool disposing)
858var reconnectTask = _state.ReconnectTask;
873var connectionStateStopTask = Task.CompletedTask;
893var writeTask = SendHubMessage(connectionState, CloseMessage.Empty);
1013var (irqLocal, tasks) = ((InvocationRequest, Task[]?))state!;
1084private Task[]? LaunchStreams(ConnectionState connectionState, Dictionary<string, object>? readers, CancellationToken cancellationToken)
1096var streamTasks = new Task[readers.Count];
1140private Task InvokeStreamMethod(MethodInfo methodInfo, Type[] genericTypes, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource)
1149return (Task)methodInfo
1162private Task ReflectionSendStreamItems(MethodInfo methodInfo, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource)
1164async Task ReadAsyncEnumeratorStream(IAsyncEnumerator<object?> enumerator)
1179Func<Task> createAndConsumeStream;
1198private Task SendStreamItems<T>(ConnectionState connectionState, string streamId, ChannelReader<T> reader, CancellationTokenSource tokenSource)
1200async Task ReadChannelStream()
1215private Task SendIAsyncEnumerableStreamItems<T>(ConnectionState connectionState, string streamId, IAsyncEnumerable<T> stream, CancellationTokenSource tokenSource)
1217async Task ReadAsyncEnumerableStream()
1228private async Task SendStreamItemAsync(ConnectionState connectionState, string streamId, object? item, CancellationTokenSource tokenSource)
1234private async Task CommonStreaming(ConnectionState connectionState, string streamId, Func<Task> createAndConsumeStream, CancellationTokenSource cts)
1364var (irqLocal, tasks) = ((InvocationRequest, Task[]?))state!;
1406private async Task CancelInvocationAsync(InvocationRequest irq, Task[]? streamTasks = null)
1411await Task.WhenAll(streamTasks).ConfigureAwait(false);
1443private async Task InvokeCore(ConnectionState connectionState, string methodName, InvocationRequest irq, object?[] args, string[]? streams, CancellationToken cancellationToken)
1472private async Task InvokeStreamCore(ConnectionState connectionState, string methodName, InvocationRequest irq, object?[] args, string[]? streams, CancellationToken cancellationToken)
1515private async Task SendHubMessage(ConnectionState connectionState, HubMessage hubMessage, CancellationToken cancellationToken = default)
1537private async Task SendCoreAsyncCore(string methodName, object?[] args, CancellationToken cancellationToken)
1577private async Task SendWithLock(ConnectionState expectedConnectionState, HubMessage message, CancellationToken cancellationToken, [CallerMemberName] string callerName = "")
1682private async Task DispatchInvocationAsync(InvocationMessage invocation, ConnectionState connectionState)
1716var task = handler.InvokeAsync(invocation.Arguments);
1766private async Task DispatchInvocationStreamItemAsync(StreamItemMessage streamItem, InvocationRequest irq)
1799private async Task HandshakeAsync(ConnectionState startingConnectionState, int protocolVersion, CancellationToken cancellationToken)
1904private async Task ReceiveLoop(ConnectionState connectionState)
1915var timerTask = connectionState.TimerLoop(timer);
1924async Task StartProcessingInvocationMessages(ChannelReader<InvocationMessage> invocationMessageChannelReader)
1930var invokeTask = DispatchInvocationAsync(invocationMessage, connectionState);
2028internal Task RunTimerActions()
2041private async Task HandleConnectionClose(ConnectionState connectionState)
2096async Task RunClosedEventAsync()
2113private async Task ReconnectAsync(Exception? closeException)
2152await Task.Delay(nextRetryDelay.Value, _state.StopCts.Token).ConfigureAwait(false);
2267async Task RunReconnectingEventAsync()
2287async Task RunReconnectedEventAsync()
2395private readonly Func<object?[], object, Task> _callback;
2398public InvocationHandler(Type[] parameterTypes, Func<object?[], object, Task> callback, object state)
2405public Task InvokeAsync(object?[] parameters)
2431public Task? ReceiveTask { get; set; }
2436public Task? InvocationMessageReceiveTask { get; set; }
2530public Task StopAsync()
2548private async Task StopAsyncCore()
2560await ((ReceiveTask ?? Task.CompletedTask).ConfigureAwait(false));
2573public async Task TimerLoop(TimerAwaitable timer)
2623public Task AckAsync(AckMessage ackMessage)
2630return Task.CompletedTask;
2647internal async Task RunTimerActions()
2749ReconnectTask = Task.CompletedTask;
2758public Task ReconnectTask { get; set; } = Task.CompletedTask;
2794public 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.Common (4)
Microsoft.AspNetCore.SignalR.Core (203)
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 (22)
32private readonly Func<HubLifetimeContext, Task>? _onConnectedMiddleware;
33private readonly Func<HubLifetimeContext, Exception?, Task>? _onDisconnectedMiddleware;
83public override async Task OnConnectedAsync(HubConnectionContext connection)
120public override async Task OnDisconnectedAsync(HubConnectionContext connection, Exception? exception)
156public override Task OnAuthenticationRefreshedAsync(HubConnectionContext connection)
199public override Task DispatchMessageAsync(HubConnectionContext connection, HubMessage hubMessage)
209return Task.CompletedTask;
287return Task.CompletedTask;
290private Task ProcessInvocationBindingFailure(HubConnectionContext connection, InvocationBindingFailureMessage bindingFailureMessage)
299private Task ProcessStreamBindingFailure(HubConnectionContext connection, StreamBindingFailureMessage bindingFailureMessage)
312return Task.CompletedTask;
315private Task ProcessStreamItem(HubConnectionContext connection, StreamItemMessage message)
317if (!connection.StreamTracker.TryProcessItem(message, out var processTask))
320return Task.CompletedTask;
327private Task ProcessInvocation(HubConnectionContext connection,
342return Task.CompletedTask;
407Task? invocation = null;
433static async Task ExecuteInvocation(DefaultHubDispatcher<THub> dispatcher,
588private async Task StreamAsync(string invocationId, HubConnectionContext connection, HubCallerContext hubCallerContext, object?[] arguments, AsyncServiceScope scope,
717if (methodExecutor.MethodReturnType == typeof(Task))
719await (Task)methodExecutor.Execute(hub, arguments)!;
733private 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.Protocols.MessagePack (4)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (4)
Microsoft.AspNetCore.SignalR.Specification.Tests (99)
src\aspnetcore\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, string userIdentifier)
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, string userIdentifier)
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.SpaProxy (10)
Microsoft.AspNetCore.SpaServices.Extensions (21)
Microsoft.AspNetCore.StaticAssets (11)
Microsoft.AspNetCore.StaticFiles (18)
Microsoft.AspNetCore.TestHost (45)
Microsoft.AspNetCore.Testing.Tests (11)
Microsoft.AspNetCore.Watch.BrowserRefresh (13)
Microsoft.AspNetCore.WebSockets (5)
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.Bcl.TimeProvider (13)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (13)
7/// Provides 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);
121/// 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.
124/// <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>
127/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
130public static Task WaitAsync(this Task task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
211/// 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.
214/// <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>
217/// <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 (74)
Microsoft.Build.Framework (4)
Microsoft.Build.NuGetSdkResolver (5)
Microsoft.Build.Tasks.CodeAnalysis (17)
Microsoft.Build.Tasks.Core (20)
Microsoft.CodeAnalysis (54)
DiagnosticAnalyzer\AnalyzerDriver.cs (30)
322private Task? _lazyInitializeTask;
332private Task? _lazyPrimaryTask;
412_lazyInitializeTask = Task.Run(async () =>
453_lazyInitializeTask = Task.FromCanceled(new CancellationToken(canceled: true));
456_lazyPrimaryTask = Task.FromCanceled(new CancellationToken(canceled: true));
645internal async Task AttachQueueAndProcessAllEventsAsync(AsyncQueue<CompilationEvent> eventQueue, AnalysisScope analysisScope, CancellationToken cancellationToken)
656_lazyPrimaryTask = Task.FromResult(true);
662_lazyPrimaryTask ??= Task.FromCanceled(new CancellationToken(canceled: true));
696_lazyPrimaryTask = Task.FromCanceled(new CancellationToken(canceled: true));
704private async Task ExecutePrimaryAnalysisTaskAsync(AnalysisScope analysisScope, bool usingPrePopulatedEventQueue, CancellationToken cancellationToken)
726private static void OnDriverException(Task faultedTask, AnalyzerExecutor analyzerExecutor, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken)
1109var tasks = ArrayBuilder<Task>.GetInstance();
1117var task = Task.Run(
1124Task.WaitAll(tasks.ToArray(), cancellationToken);
1439public Task WhenInitializedTask
1451public Task WhenCompletedTask
1523private async Task ProcessCompilationEventsAsync(AnalysisScope analysisScope, bool prePopulatedEventQueue, CancellationToken cancellationToken)
1540workerTasks[i] = Task.Run(async () => await ProcessCompilationEventsCoreAsync(analysisScope, prePopulatedEventQueue, cancellationToken).ConfigureAwait(false));
1546var syntaxTreeActionsTask = analysisScope.SyntaxTrees.Any()
1547? Task.Run(() => ExecuteSyntaxTreeActions(analysisScope, cancellationToken), cancellationToken)
1548: Task.CompletedTask;
1551var additionalFileActionsTask = analysisScope.AdditionalFiles.Any()
1552? Task.Run(() => ExecuteAdditionalFileActions(analysisScope, cancellationToken), cancellationToken)
1553: Task.CompletedTask;
1558await Task.WhenAll(workerTasks.Concat(syntaxTreeActionsTask).Concat(additionalFileActionsTask)).ConfigureAwait(false);
1649private async Task ProcessEventAsync(CompilationEvent e, AnalysisScope analysisScope, CancellationToken cancellationToken)
1671private async Task OnEventProcessedCoreAsync(CompilationEvent compilationEvent, ImmutableArray<DiagnosticAnalyzer> processedAnalyzers, AnalysisScope analysisScope, CancellationToken cancellationToken)
1700async Task onSymbolAndMembersProcessedAsync(ISymbol symbol, DiagnosticAnalyzer analyzer)
1718async Task processContainerOnMemberCompletedAsync(INamespaceOrTypeSymbol containerSymbol, ISymbol processedMemberSymbol, DiagnosticAnalyzer analyzer)
Microsoft.CodeAnalysis.Analyzers (148)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
30public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
33public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
36public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
39public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (21)
37public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
55public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
72public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
109private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
118return Task.FromCanceled(cancellationToken);
122Func<object, Task> taskBody = static async o =>
204return Task.FromException(e);
215public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
233public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
250public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
274private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
283return Task.FromCanceled(cancellationToken);
287Func<object, Task> taskBody = static async o =>
369return Task.FromException(e);
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
468System.Threading.Tasks.Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
478public Task AcquireLock()
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Microsoft.CodeAnalysis.AnalyzerUtilities (119)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
30public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
33public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
36public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
39public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (21)
37public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
55public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
72public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
109private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
118return Task.FromCanceled(cancellationToken);
122Func<object, Task> taskBody = static async o =>
204return Task.FromException(e);
215public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
233public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
250public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
274private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
283return Task.FromCanceled(cancellationToken);
287Func<object, Task> taskBody = static async o =>
369return Task.FromException(e);
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
468System.Threading.Tasks.Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
478public Task AcquireLock()
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Microsoft.CodeAnalysis.CodeStyle (118)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
30public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
33public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
36public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
39public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (21)
37public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
55public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
72public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
109private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
118return Task.FromCanceled(cancellationToken);
122Func<object, Task> taskBody = static async o =>
204return Task.FromException(e);
215public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
233public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
250public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
274private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
283return Task.FromCanceled(cancellationToken);
287Func<object, Task> taskBody = static async o =>
369return Task.FromException(e);
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
468System.Threading.Tasks.Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
478public Task AcquireLock()
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Microsoft.CodeAnalysis.CodeStyle.Fixes (130)
Microsoft.CodeAnalysis.CSharp (15)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (163)
Microsoft.CodeAnalysis.CSharp.Features (270)
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (20)
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
Microsoft.CodeAnalysis.Extensions.Package (6)
Microsoft.CodeAnalysis.ExternalAccess.Extensions (6)
Microsoft.CodeAnalysis.ExternalAccess.HotReload (6)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (3)
Microsoft.CodeAnalysis.Features (603)
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (11)
37private record struct TimestampedWorkItem(Func<Task> Work, DateTime TimestampAdded);
86var task = Task.Run(workItem.Work, cancellationToken);
119private void AddWork(Func<Task> work)
341private async Task EnqueueDocumentWorkItemAsync(Project project, DocumentId documentId, TextDocument? document, UnitTestingInvocationReasons invocationReasons, SyntaxNode? changedMember = null)
381private async Task EnqueueFullProjectWorkItemAsync(Project project, UnitTestingInvocationReasons invocationReasons, bool processSourceGeneratedDocuments)
401private async Task EnqueueWorkItemAsync(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReanalyzeScope scope)
411private async Task EnqueueWorkItemAsync(
423private async Task EnqueueWorkItemAsync(ProjectChanges projectChanges, bool processSourceGeneratedDocuments)
440private async Task EnqueueProjectConfigurationChangeWorkItemAsync(ProjectChanges projectChanges, bool processSourceGeneratedDocuments)
507private async Task EnqueueChangedDocumentWorkItemAsync(Document oldDocument, Document newDocument)
ExternalAccess\VSTypeScript\VSTypeScriptClassificationService.cs (5)
34public Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
35=> Task.CompletedTask;
37public Task AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
38=> Task.CompletedTask;
49public async Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (14)
26public async Task SearchDocumentAsync(
30Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
53public static async Task SearchDocumentAndRelatedDocumentsInCurrentProcessAsync(
57Func<ImmutableArray<RoslynNavigateToItem>, VoidResult, CancellationToken, Task> onItemsFound,
69await Task.WhenAll(
73Task SearchDocumentsInCurrentProcessAsync(ImmutableArray<(Document document, NormalizedTextSpanCollection? spans)> documentAndSpans)
96async Task SearchRelatedDocumentsInCurrentProcessAsync()
146public async Task SearchProjectsAsync(
153Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
154Func<Task> onProjectCompleted,
188public static async Task SearchProjectsInCurrentProcessAsync(
193Func<ImmutableArray<RoslynNavigateToItem>, VoidResult, CancellationToken, Task> onItemsFound,
194Func<Task> onProjectCompleted,
215async Task SearchSingleProjectAsync(
NavigateTo\INavigateToSearchService.cs (11)
18Task SearchDocumentAsync(
22Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
35Task SearchProjectsAsync(
42Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
43Func<Task> onProjectCompleted,
62Task SearchCachedDocumentsAsync(
69Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
70Func<Task> onProjectCompleted,
81Task SearchGeneratedDocumentsAsync(
87Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
88Func<Task> onProjectCompleted,
NavigateTo\NavigateToSearcher.cs (22)
115private async Task AddProgressItemsAsync(int count, CancellationToken cancellationToken)
124private async Task ProgressItemsCompletedAsync(int count, CancellationToken cancellationToken)
132public Task SearchAsync(NavigateToSearchScope searchScope, CancellationToken cancellationToken)
135public async Task SearchAsync(
184private async Task SearchCurrentDocumentAsync(CancellationToken cancellationToken)
199private Task SearchCurrentProjectAsync(
204return Task.CompletedTask;
220private async Task SearchAllProjectsAsync(
229private async Task SearchSpecificProjectsAsync(
346private async Task ProcessOrderedProjectsAsync(
350Func<INavigateToSearchService, ImmutableArray<Project>, Func<ImmutableArray<INavigateToSearchResult>, Task>, Func<Task>, Task> processProjectAsync,
413private Task SearchFullyLoadedProjectsAsync(
431private Task SearchCachedDocumentsAsync(
463private Task SearchGeneratedDocumentsAsync(
533public Task SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, CancellationToken cancellationToken)
534=> Task.CompletedTask;
536public async Task SearchProjectsAsync(Solution solution, ImmutableArray<Project> projects, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
ValueTracking\ValueTracker.OperationCollector.cs (17)
25public Task VisitAsync(IOperation operation, CancellationToken cancellationToken)
32IArgumentOperation argumentOperation => ShouldTrackArgument(argumentOperation) ? VisitAsync(argumentOperation.Value, cancellationToken) : Task.CompletedTask,
46private async Task VisitReturnDescendentsAsync(IOperation operation, bool allowImplicit, CancellationToken cancellationToken)
56private async Task VisitDefaultAsync(IOperation operation, CancellationToken cancellationToken)
99private Task VisitAssignmentOperationAsync(IAssignmentOperation assignmentOperation, CancellationToken cancellationToken)
102private Task VisitObjectCreationAsync(IObjectCreationOperation objectCreationOperation, CancellationToken cancellationToken)
105private async Task VisitInvocationAsync(IInvocationOperation invocationOperation, CancellationToken cancellationToken)
111private Task VisitReferenceAsync(IOperation operation, CancellationToken cancellationToken)
140return Task.CompletedTask;
142Task AddReferenceAsync(IOperation operation, CancellationToken cancellationToken)
149_ => Task.CompletedTask
153private Task VisitLiteralAsync(ILiteralOperation literalOperation, CancellationToken cancellationToken)
157return Task.CompletedTask;
163private Task VisitReturnAsync(IReturnOperation returnOperation, CancellationToken cancellationToken)
167return Task.CompletedTask;
173private async Task AddOperationAsync(IOperation operation, ISymbol symbol, CancellationToken cancellationToken)
182private async Task TrackArgumentsAsync(ImmutableArray<IArgumentOperation> argumentOperations, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features.ExternalAccess (17)
Copilot\Internal\Analyzer\AbstractCopilotCodeAnalysisService.cs (4)
44protected abstract Task StartRefinementSessionCoreAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken);
80public async Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken)
171return Task.FromResult(diagnostics.WhereAsArray(static (diagnostic, span) => diagnostic.Location.SourceSpan.IntersectsWith(span), span));
174public async Task StartRefinementSessionAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.NetAnalyzers (246)
SyntaxEditorFixAllProvider.cs (7)
99return Task.CompletedTask;
108Func<Document, Diagnostic, SyntaxEditor, CancellationToken, Task> applyFixAsync)
132Func<Document, Diagnostic, SyntaxEditor, TState, CancellationToken, Task> applyFixAsync,
151Func<Document, Diagnostic, SyntaxEditor, CancellationToken, Task> applyFixAsync,
167Func<Document, Diagnostic, SyntaxEditor, TState, CancellationToken, Task> applyFixAsync,
191private readonly Func<Document, Diagnostic, SyntaxEditor, TState, CancellationToken, Task> _applyFixAsync;
197Func<Document, Diagnostic, SyntaxEditor, TState, CancellationToken, Task> applyFixAsync,
Microsoft.CodeAnalysis.Razor.Compiler (9)
Microsoft.CodeAnalysis.ResxSourceGenerator (118)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
30public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
33public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
36public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
39public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (21)
37public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
55public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
72public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
109private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
118return Task.FromCanceled(cancellationToken);
122Func<object, Task> taskBody = static async o =>
204return Task.FromException(e);
215public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
233public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
250public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
274private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
283return Task.FromCanceled(cancellationToken);
287Func<object, Task> taskBody = static async o =>
369return Task.FromException(e);
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
468System.Threading.Tasks.Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
478public Task AcquireLock()
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Microsoft.CodeAnalysis.Scripting (14)
Script.cs (11)
235internal abstract Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken);
341private ImmutableArray<Func<object[], Task>> _lazyPrecedingExecutors;
374internal override Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken)
398private ImmutableArray<Func<object[], Task>> GetPrecedingExecutors(CancellationToken cancellationToken)
411private ImmutableArray<Func<object[], Task>> TryGetPrecedingExecutors(Script lastExecutedScriptInChainOpt, CancellationToken cancellationToken)
416return ImmutableArray<Func<object[], Task>>.Empty;
430return default(ImmutableArray<Func<object[], Task>>);
433var executors = ArrayBuilder<Func<object[], Task>>.GetInstance(scriptsReversed.Count);
560return Task.FromResult((ScriptState<T>)previousState);
577ImmutableArray<Func<object[], Task>> precedingExecutors,
578Func<object[], Task> currentExecutor,
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
Microsoft.CodeAnalysis.VisualBasic (17)
Microsoft.CodeAnalysis.Workspaces (349)
Classification\IClassificationService.cs (3)
46Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken);
63Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken);
74Task AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (12)
33public abstract Task DetermineDocumentsToSearchAsync<TData>(
83protected static async Task FindDocumentsAsync<T, TData>(
116protected static Task FindDocumentsAsync<TData>(
139protected static Task FindDocumentsWithGlobalSuppressMessageAttributeAsync<TData>(
146protected static async Task FindDocumentsAsync<TData>(
328protected static Task FindDocumentsWithPredicateAsync<T, TData>(
344protected static Task FindDocumentsWithPredicateAsync<TData>(
361protected static Task FindDocumentsWithForEachStatementsAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
364protected static Task FindDocumentsWithUsingStatementsAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
367protected static Task FindDocumentsWithCollectionExpressionsAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
697protected abstract Task DetermineDocumentsToSearchAsync<TData>(
721public sealed override async Task DetermineDocumentsToSearchAsync<TData>(
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (4)
67protected override async Task DetermineDocumentsToSearchAsync<TData>(
113private static Task FindDocumentsWithDeconstructionAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
116private static Task FindDocumentsWithAwaitExpressionAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
119private static Task FindDocumentsWithCollectionInitializersAsync<TData>(Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, CancellationToken cancellationToken)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
16public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
19public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
22public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
25public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (9)
51private readonly Func<bool, ImmutableArray<string>, Task> _onDocumentsAddedMaybeAsync;
81Func<bool, ImmutableArray<string>, Task> onDocumentsAddedMaybeAsync,
301public Task ApplyBatchChangeToWorkspaceAsync(Func<SolutionChangeAccumulator, ProjectUpdateState, ProjectUpdateState> mutation, Action<ProjectUpdateState>? onAfterUpdateAlways)
307public async Task ApplyBatchChangeToWorkspaceMaybeAsync(bool useAsync, Func<SolutionChangeAccumulator, ProjectUpdateState, ProjectUpdateState> mutation, Action<ProjectUpdateState>? onAfterUpdateAlways)
323public async Task ApplyBatchChangeToWorkspaceMaybe_NoLockAsync(bool useAsync, Func<SolutionChangeAccumulator, ProjectUpdateState, ProjectUpdateState> mutation, Action<ProjectUpdateState>? onAfterUpdateAlways)
841private Task StartRefreshingMetadataReferencesForFileAsync(string fullFilePath, CancellationToken cancellationToken)
861private Task StartRefreshingAnalyzerReferenceForFileAsync(string fullFilePath, CancellationToken cancellationToken)
909private async Task StartRefreshingReferencesForFileAsync<TReference>(
949internal Task RaiseOnDocumentsAddedMaybeAsync(bool useAsync, ImmutableArray<string> filePaths)
Microsoft.CodeAnalysis.Workspaces.MSBuild (16)
Rpc\RemoteProjectFile.cs (9)
36public Task AddDocumentAsync(string filePath, string? logicalPath, CancellationToken cancellationToken)
39public Task RemoveDocumentAsync(string filePath, CancellationToken cancellationToken)
42public Task AddMetadataReferenceAsync(string metadataReferenceIdentity, ImmutableArray<string> aliases, string? hintPath, CancellationToken cancellationToken)
45public Task RemoveMetadataReferenceAsync(string shortAssemblyName, string fullAssemblyName, string filePath, CancellationToken cancellationToken)
48public Task AddProjectReferenceAsync(string projectName, ProjectFileReference projectFileReference, CancellationToken cancellationToken)
51public Task RemoveProjectReferenceAsync(string projectName, string projectFilePath, CancellationToken cancellationToken)
54public Task AddAnalyzerReferenceAsync(string fullPath, CancellationToken cancellationToken)
57public Task RemoveAnalyzerReferenceAsync(string fullPath, CancellationToken cancellationToken)
60public Task SaveAsync(CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (12)
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (5)
Microsoft.Data.Analysis.Interactive (2)
Microsoft.Data.Analysis.Tests (2)
Microsoft.Deployment.DotNet.Releases (3)
Microsoft.Diagnostics.NETCore.Client (78)
DiagnosticsClient\DiagnosticsClient.cs (10)
58internal Task WaitForConnectionAsync(CancellationToken token)
197public Task WriteDumpAsync(DumpType dumpType, string dumpPath, bool logDumpGeneration, CancellationToken token)
209public async Task WriteDumpAsync(DumpType dumpType, string dumpPath, WriteDumpFlags flags, CancellationToken token)
248internal async Task AttachProfilerAsync(TimeSpan attachTimeout, Guid profilerGuid, string profilerPath, byte[] additionalData, CancellationToken token)
268internal async Task SetStartupProfilerAsync(Guid profilerGuid, string profilerPath, CancellationToken token)
285internal async Task ResumeRuntimeAsync(CancellationToken token)
304internal async Task SetEnvironmentVariableAsync(string name, string value, CancellationToken token)
358public async Task ApplyStartupHookAsync(string startupHookPath, CancellationToken token)
381internal async Task EnablePerfMapAsync(PerfMapType type, CancellationToken token)
398internal async Task DisablePerfMapAsync(CancellationToken token)
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (53)
46public virtual Task Start(CancellationToken token)
51public virtual Task Stop()
122protected async Task IsStreamConnectedAsync(Stream stream, CancellationToken token)
135await Task.Delay(IsStreamConnectedTimeoutMs, token).ConfigureAwait(false);
141protected static bool IsCompletedSuccessfully(Task t)
217public abstract Task Stop();
314public override async Task Stop()
372public override async Task Stop()
503await Task.Delay(TcpClientRetryTimeoutMs, token).ConfigureAwait(false);
514private async Task ConnectAsyncInternal(Socket clientSocket, EndPoint remoteEP, CancellationToken token)
523await Task.Factory.FromAsync(beginConnect, clientSocket.EndConnect, this).ConfigureAwait(false);
701await Task.Delay(IpcClientRetryTimeoutMs, token).ConfigureAwait(false);
761public override Task Start(CancellationToken token)
768return Task.CompletedTask;
771public override Task Stop()
800await Task.WhenAny(ipcServerStreamTask, netServerStreamTask).ConfigureAwait(false);
813using Task checkIpcStreamTask = IsStreamConnectedAsync(ipcServerStream, cancelRouter.Token);
816await Task.WhenAny(netServerStreamTask, checkIpcStreamTask).ConfigureAwait(false);
823await Task.WhenAll(netServerStreamTask, checkIpcStreamTask).ConfigureAwait(false);
850using Task checkTcpStreamTask = IsStreamConnectedAsync(tcpServerStream, cancelRouter.Token);
853await Task.WhenAny(ipcServerStreamTask, checkTcpStreamTask).ConfigureAwait(false);
860await Task.WhenAll(ipcServerStreamTask, checkTcpStreamTask).ConfigureAwait(false);
887await Task.WhenAll(ipcServerStreamTask, netServerStreamTask).ConfigureAwait(false);
960public override Task Start(CancellationToken token)
966return Task.CompletedTask;
969public override Task Stop()
974return Task.CompletedTask;
996using Task checkIpcStreamTask = IsStreamConnectedAsync(ipcServerStream, cancelRouter.Token);
999await Task.WhenAny(tcpClientStreamTask, checkIpcStreamTask).ConfigureAwait(false);
1006await Task.WhenAll(tcpClientStreamTask, checkIpcStreamTask).ConfigureAwait(false);
1086public override Task Start(CancellationToken token)
1097return Task.CompletedTask;
1100public override Task Stop()
1130using Task checkTcpStreamTask = IsStreamConnectedAsync(tcpServerStream, cancelRouter.Token);
1133await Task.WhenAny(ipcClientStreamTask, checkTcpStreamTask).ConfigureAwait(false);
1140await Task.WhenAll(ipcClientStreamTask, checkTcpStreamTask).ConfigureAwait(false);
1237public override Task Start(CancellationToken token)
1241return Task.CompletedTask;
1244public override Task Stop()
1248return Task.CompletedTask;
1275using Task checkTcpStreamTask = IsStreamConnectedAsync(tcpClientStream, cancelRouter.Token);
1278await Task.WhenAny(ipcClientStreamTask, checkTcpStreamTask).ConfigureAwait(false);
1285await Task.WhenAll(ipcClientStreamTask, checkTcpStreamTask).ConfigureAwait(false);
1355using Task checkTcpStreamTask = IsStreamConnectedAsync(tcpClientStream, cancelReadConnect.Token);
1358await Task.WhenAny(readTask, checkTcpStreamTask).ConfigureAwait(false);
1365await Task.WhenAll(readTask, checkTcpStreamTask).ConfigureAwait(false);
1395private async Task UpdateRuntimeInfo(CancellationToken token)
1445private Task _backendReadFrontendWriteTask;
1446private Task _frontendReadBackendWriteTask;
1494List<Task> runningTasks = new();
1506await Task.WhenAll(runningTasks.ToArray()).ConfigureAwait(false);
1549private async Task BackendReadFrontendWrite(CancellationToken token)
1592private async Task FrontendReadBackendWrite(CancellationToken token)
Microsoft.DotNet.Arcade.Sdk (1)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Build.Tasks.Packaging (4)
Microsoft.DotNet.Cli.Telemetry (6)
Microsoft.DotNet.Cli.Utils (20)
Microsoft.DotNet.HotReload.Utils.Generator (13)
Microsoft.DotNet.HotReload.Utils.Generator.Frontend (1)
Microsoft.DotNet.HotReload.Watch (90)
src\sdk\src\Dotnet.Watch\HotReloadClient\HotReloadClients.cs (11)
108await Task.WhenAll(clients.Select(c => c.WaitForConnectionEstablishedAsync(cancellationToken)));
125var results = await Task.WhenAll(clients.Select(c => c.GetUpdateCapabilitiesAsync(cancellationToken)));
133public async Task<Task> ApplyManagedCodeUpdatesAsync(ImmutableArray<HotReloadManagedCodeUpdate> updates, CancellationToken applyOperationCancellationToken, CancellationToken cancellationToken)
144var applyTasks = await Task.WhenAll(clients.Select(c => c.ApplyManagedCodeUpdatesAsync(updates, applyOperationCancellationToken, cancellationToken)));
148async Task CompleteApplyOperationAsync()
150var results = await Task.WhenAll(applyTasks);
170await Task.WhenAll(clients.Select(c => c.InitialUpdatesAppliedAsync(cancellationToken)));
175public async Task<Task> ApplyStaticAssetUpdatesAsync(IEnumerable<StaticWebAsset> assets, CancellationToken applyOperationCancellationToken, CancellationToken cancellationToken)
205public async ValueTask<Task> ApplyStaticAssetUpdatesAsync(ImmutableArray<HotReloadStaticAssetUpdate> updates, CancellationToken applyOperationCancellationToken, CancellationToken cancellationToken)
211var applyTasks = await Task.WhenAll(clients.Select(c => c.ApplyStaticAssetUpdatesAsync(updates, applyOperationCancellationToken, cancellationToken)));
213return Task.WhenAll(applyTasks);
Microsoft.DotNet.HotReload.WebAssembly.Browser (2)
Microsoft.Extensions.AI (21)
ChatCompletion\AnonymousDelegatingChatClient.cs (5)
32private readonly Func<IEnumerable<ChatMessage>, ChatOptions?, Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task>, CancellationToken, Task>? _sharedFunc;
51Func<IEnumerable<ChatMessage>, ChatOptions?, Func<IEnumerable<ChatMessage>, ChatOptions?, CancellationToken, Task>, CancellationToken, Task> sharedFunc)
137async Task ProcessAsync()
Microsoft.Extensions.AI.Abstractions (33)
Functions\AIFunctionFactory.cs (22)
119/// <see cref="void"/>, <see cref="Task"/>, or <see cref="ValueTask"/>, no return schema is produced (the property is <see langword="null"/>).
196/// For methods returning <see cref="void"/>, <see cref="Task"/>, or <see cref="ValueTask"/>, no return schema is produced.
288/// <see cref="void"/>, <see cref="Task"/>, or <see cref="ValueTask"/>, no return schema is produced (the property is <see langword="null"/>).
375/// For methods returning <see cref="void"/>, <see cref="Task"/>, or <see cref="ValueTask"/>, no return schema is produced.
480/// <see cref="void"/>, <see cref="Task"/>, or <see cref="ValueTask"/>, no return schema is produced (the property is <see langword="null"/>).
887if (t == typeof(Task) || t == typeof(ValueTask))
1049if (returnType == typeof(Task))
1056await ((Task)ThrowIfNullResult(result)).ConfigureAwait(true);
1063await ((Task)ThrowIfNullResult(result)).ConfigureAwait(true);
1101await ((Task)ThrowIfNullResult(taskObj)).ConfigureAwait(true);
1113await ((Task)ThrowIfNullResult(taskObj)).ConfigureAwait(true);
1122await ((Task)ThrowIfNullResult(taskObj)).ConfigureAwait(true);
1140var task = (Task)ReflectionInvoke(valueTaskAsTask, ThrowIfNullResult(taskObj), null)!;
1153var task = (Task)ReflectionInvoke(valueTaskAsTask, ThrowIfNullResult(taskObj), null)!;
1163var task = (Task)ReflectionInvoke(valueTaskAsTask, ThrowIfNullResult(taskObj), null)!;
1411public override Task FlushAsync(CancellationToken cancellationToken) =>
1412Task.CompletedTask;
1414public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
1428return new ValueTask(Task.FromCanceled(cancellationToken));
Microsoft.Extensions.AI.Abstractions.Tests (186)
Microsoft.Extensions.AI.Evaluation (2)
Microsoft.Extensions.AI.Evaluation.Console (4)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (35)
Microsoft.Extensions.AI.Evaluation.NLP (1)
Microsoft.Extensions.AI.Evaluation.NLP.Tests (17)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Evaluation.Reporting (7)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (4)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (17)
Microsoft.Extensions.AI.Evaluation.Safety (2)
Microsoft.Extensions.AI.Integration.Tests (74)
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (7)
Microsoft.Extensions.AI.OpenAI (11)
Microsoft.Extensions.AI.OpenAI.Tests (279)
Microsoft.Extensions.AI.Templates.Tests (7)
Microsoft.Extensions.AI.Tests (653)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (22)
20public async Task SuccessUsage_Default()
71return Task.FromResult(expectedResponse);
97public async Task SuccessUsage_NoJsonSchema()
132return Task.FromResult(expectedResponse);
158public async Task WrapsNonObjectValuesInDataProperty()
184return Task.FromResult(expectedResponse);
193public async Task OnlyUsesLastMessage()
228return Task.FromResult(expectedResponse);
237public async Task FailureUsage_InvalidJson()
242GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse),
256public async Task FailureUsage_NullJson()
261GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse),
275public async Task FailureUsage_NoJsonInResponse()
280GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse),
294public async Task CanUseNativeStructuredOutputWithSanitizedTypeName()
307return Task.FromResult(expectedResponse);
328public async Task CanUseNativeStructuredOutputWithArray()
336GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse)
356public async Task CanSpecifyCustomJsonSerializationOptions()
397return Task.FromResult(expectedResponse);
411public async Task HandlesBackendReturningMultipleObjects()
425return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, resultDuplicatedJson)));
ChatCompletion\FunctionInvokingChatClientTests.cs (102)
79public async Task SupportsSingleFunctionCallPerRequestAsync()
111public async Task SupportsToolsProvidedByAdditionalTools(bool provideOptions)
143public async Task PrefersToolsProvidedByChatOptions()
178public async Task SupportsMultipleFunctionCallsPerRequestAsync(bool concurrentInvocation)
226public async Task ParallelFunctionCallsMayBeInvokedConcurrentlyAsync()
274public async Task ConcurrentInvocationOfParallelCallsDisabledByDefaultAsync()
285await Task.Delay(100);
315public async Task FunctionInvokerDelegateOverridesHandlingAsync()
360public async Task FunctionReturningFunctionResultContentWithMatchingCallId_UsesItDirectly(bool streaming)
379return Task.FromResult(new ChatResponse(
384return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")));
441public async Task FunctionReturningFunctionResultContentWithMismatchedCallId_WrapsIt(bool streaming)
460return Task.FromResult(new ChatResponse(
465return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")));
522public async Task FunctionReturningDerivedFunctionResultContent_PropagatesInstanceToInnerClient(bool streaming)
541return Task.FromResult(new ChatResponse(
546return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "done")));
616public async Task ContinuesWithSuccessfulCallsUntilMaximumIterations()
657public async Task LastIteration_RemovesFunctionDeclarationTools_NonStreaming()
669return Task.FromResult(new ChatResponse(message));
701public async Task LastIteration_RemovesFunctionDeclarationTools_Streaming()
745public async Task LastIteration_PreservesNonFunctionDeclarationTools()
760return Task.FromResult(new ChatResponse(message));
765return Task.FromResult(new ChatResponse(message));
794public async Task LastIteration_DoesNotModifyOriginalOptions()
805return Task.FromResult(new ChatResponse(message));
832public async Task ContinuesWithFailingCallsUntilMaximumConsecutiveErrors(bool allowConcurrentInvocation)
913public async Task CanFailOnFirstException(bool allowConcurrentInvocation)
969public async Task KeepsFunctionCallingContent()
1008public async Task ExceptionDetailsOnlyReportedWhenRequestedAsync(bool detailedErrors)
1038public async Task FunctionInvocationsLogged(LogLevel level)
1060async Task InvokeAsync(Func<IServiceProvider, Task> work)
1093public async Task FunctionInvocationTrackedWithActivity(bool enableTelemetry, bool enableSensitiveData)
1117async Task InvokeAsync(Func<Task> work)
1168public async Task SupportsConsecutiveStreamingUpdatesWithFunctionCalls()
1226public async Task AllResponseMessagesReturned()
1242await Task.Yield();
1266public async Task CanAccesssFunctionInvocationContextFromFunctionCall()
1272await Task.Yield();
1316async Task InvokeAsync(Func<Task<List<ChatMessage>>> work)
1342public async Task HaltFunctionCallingAfterTermination()
1370return Task.FromResult(new ChatResponse(message));
1395public async Task PropagatesResponseConversationIdToOptions()
1431Task.FromResult(callback(chatContents, chatOptions, cancellationToken)),
1445public async Task FunctionInvocations_PassesServices()
1471public async Task FunctionInvocations_InvokedOnOriginalSynchronizationContext()
1495await Task.Delay(1, cancellationToken);
1504await Task.Delay(1, cancellationToken);
1517public async Task TerminateOnUnknownCalls_ControlsBehaviorForUnknownFunctions(bool terminateOnUnknown)
1571public async Task RequestsWithOnlyFunctionDeclarations_TerminatesRegardlessOfTerminateOnUnknownCalls(bool terminateOnUnknown)
1595public async Task MixedKnownFunctionAndDeclaration_TerminatesWithoutInvokingKnown()
1630public async Task ClonesChatOptionsAndResetContinuationTokenForBackgroundResponsesAsync()
1648return Task.FromResult(new ChatResponse { Messages = messages });
1674public async Task DoesNotCreateOrchestrateToolsSpanWhenInvokeAgentIsParent(string displayName)
1722public async Task StreamingPreservesTraceContextWhenInvokeAgentWithNameIsParent(string displayName)
1785public async Task CreatesOrchestrateToolsSpanWhenParentIsNotInvokeAgent(string displayName)
1827public async Task UsesAgentActivitySourceWhenInvokeAgentIsParent(string displayName)
1876public async Task SensitiveDataPropagatesFromAgentActivityWhenInvokeAgentIsParent(
1950public async Task CreatesOrchestrateToolsSpanWhenNoInvokeAgentParent(bool streaming)
1996public async Task InformationalOnly_SetToTrueAfterProcessing()
2024public async Task InformationalOnly_IgnoresFunctionCallsWithInformationalOnlyTrue(bool streaming)
2039await Task.Yield();
2070public async Task InformationalOnly_ProcessesMixedFunctionCalls(bool streaming)
2092await Task.Yield();
2140public async Task InformationalOnly_MultipleFunctionInvokingChatClientsOnlyProcessOnce()
2155await Task.Yield();
2219await Task.Yield();
2311await Task.Yield();
2351public async Task RespectsChatOptionsToolsModificationsByFunctionTool_AddTool(bool streaming)
2382await Task.Yield();
2448public async Task RespectsChatOptionsToolsModificationsByFunctionTool_RemoveTool(bool streaming)
2476await Task.Yield();
2550public async Task RespectsChatOptionsToolsModificationsByFunctionTool_ReplaceTool(bool streaming)
2584await Task.Yield();
2655public async Task RespectsChatOptionsToolsModificationsByFunctionTool_AddToolWithAdditionalTools(bool streaming)
2682await Task.Yield();
2758public async Task RespectsChatOptionsToolsModificationsByFunctionTool_AddToolOverridingAdditionalTool(bool streaming)
2786await Task.Yield();
2860public async Task ToolMapNotRefreshedWhenToolsUnchanged(bool streaming)
2883await Task.Yield();
2935public async Task RespectsChatOptionsToolsModificationsByFunctionTool_ClearAllTools(bool streaming)
2962await Task.Yield();
3035public async Task RespectsChatOptionsToolsModificationsByFunctionTool_AddApprovalRequiredTool(bool streaming)
3063await Task.Yield();
3138public async Task RespectsChatOptionsToolsModificationsByFunctionTool_ReplaceWithApprovalRequiredTool(bool streaming)
3169await Task.Yield();
3244public async Task LogsFunctionNotFound()
3273public async Task LogsNonInvocableFunction()
3305public async Task LogsFunctionRequestedTermination()
3338public async Task LogsFunctionRequiresApproval()
3376public async Task LogsProcessingApprovalResponse()
3386Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "world")))
3413public async Task LogsFunctionRejected()
3423Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "world")))
3457public async Task ServerHandledFunctionCalls_MarkedAsInformationalOnly(bool streaming)
3471await Task.Yield();
3510public async Task ServerHandledFunctionCalls_MixedWithLocalCalls(bool streaming)
3531await Task.Yield();
3588public async Task ServerHandledFunctionCalls_NoMatchingFRC_StillInvoked(bool streaming)
3603await Task.Yield();
ChatReduction\SummarizingChatReducerTests.cs (19)
43public async Task ReduceAsync_ThrowsOnNullMessages()
51public async Task ReduceAsync_HandlesEmptyMessages()
62public async Task ReduceAsync_PreservesSystemMessage()
76Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary of conversation")));
87public async Task ReduceAsync_PreservesCompleteToolCallSequence()
108return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Asked about time")));
131public async Task ReduceAsync_PreservesUserMessageWhenWithinThreshold()
156return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary of first exchange")));
177public async Task ReduceAsync_ExcludesToolCallsFromSummarizedPortion()
209return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "User asked about weather in Seattle and New York.")));
234public async Task ReduceAsync_RespectsTargetAndThresholdCounts(int targetCount, int thresholdCount, int messageCount, bool shouldSummarize)
249return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary")));
269public async Task ReduceAsync_CancellationTokenIsRespected()
287return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary")));
295public async Task ReduceAsync_OnlyFirstSystemMessageIsPreserved()
310Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary")));
323public async Task CanHaveSummarizedConversation()
350return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary)));
377return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary)));
ChatRouting\SemanticRoutingChatClientTests.cs (13)
74public async Task SemanticRouting_SelectsBestProfileAndCachesIndex()
93return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(
100GetResponseAsyncCallback = (_, _, _) => Task.FromResult(expected),
105Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "writing"))),
129public async Task SemanticRouting_AggregatesGlobalTopKByClient(
143Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(
149Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "code"))),
154Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "writing"))),
176public async Task SemanticRouting_UsesDefaultBelowThreshold()
186Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(
192Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "profiled"))),
197GetResponseAsyncCallback = (_, _, _) => Task.FromResult(expected),
245Task.FromResult(new ChatResponse());
Files\OpenTelemetryHostedFileClientTests.cs (25)
29public async Task UploadAsync_TracesExpectedData(bool enableSensitiveData)
41Task.FromResult(new HostedFileContent("file-abc") { Name = "test.txt", SizeInBytes = 1024 }),
82public async Task DownloadAsync_TracesExpectedData()
94Task.FromResult<HostedFileDownloadStream>(new TestDownloadStream(new byte[] { 1 })),
122public async Task GetFileInfoAsync_TracesExpectedData(bool enableSensitiveData)
134Task.FromResult<HostedFileContent?>(new HostedFileContent("file-info") { Name = "report.pdf", SizeInBytes = 2048 }),
170public async Task ListFilesAsync_TracesExpectedData()
187await Task.Yield();
219public async Task DeleteAsync_TracesExpectedData()
230DeleteAsyncCallback = (fileId, options, ct) => Task.FromResult(true),
256public async Task UploadAsync_OnError_SetsErrorStatus()
291public async Task ListFilesAsync_OnIterationError_SetsErrorStatus()
311await Task.Yield();
337public async Task GetService_ReturnsActivitySource()
353public async Task NoListeners_NoActivityCreated()
367Task.FromResult(new HostedFileContent("file-1")),
382public async Task DownloadAsync_OnError_SetsErrorStatus()
417public async Task DeleteAsync_OnError_SetsErrorStatus()
452public async Task GetFileInfoAsync_OnError_SetsErrorStatus()
487public async Task NoMetadata_ServerTagsAbsent()
499Task.FromResult(new HostedFileContent("file-1")),
525public async Task AdditionalProperties_TaggedWhenSensitiveDataEnabled()
537Task.FromResult(new HostedFileContent("file-1")),
562public async Task AdditionalProperties_NotTaggedWhenSensitiveDataDisabled()
574Task.FromResult(new HostedFileContent("file-1")),
Microsoft.Extensions.AmbientMetadata.Application.Tests (8)
Microsoft.Extensions.AsyncState.Tests (43)
Microsoft.Extensions.Caching.Abstractions (10)
DistributedCacheExtensions.cs (3)
42public static Task SetAsync(this IDistributedCache cache, string key, byte[] value, CancellationToken token = default(CancellationToken))
87public static Task SetStringAsync(this IDistributedCache cache, string key, string value, CancellationToken token = default(CancellationToken))
102public static Task SetStringAsync(this IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken))
Microsoft.Extensions.Caching.Hybrid (8)
Microsoft.Extensions.Caching.Hybrid.Tests (102)
SizeTests.cs (4)
28public async Task ValidateSizeLimit_Immutable(string? key, long? sizeLimit, bool expectFromL1, long? maximumPayloadBytes, int? maximumKeyLength,
97public async Task ValidateSizeLimit_Mutable(string? key, long? sizeLimit, bool expectFromL1, long? maximumPayloadBytes, int? maximumKeyLength,
151public async Task BrokenSerializer_Mutable(string value, bool same, int runCount, int serializeCount, int deserializeCount, bool expectKnownFailure, params int[] errorIds)
212public async Task BrokenSerializer_Immutable(string value, bool same, int runCount, int serializeCount, int deserializeCount, bool expectKnownFailure, bool withL2,
Microsoft.Extensions.Caching.Memory (10)
Microsoft.Extensions.Caching.SqlServer (10)
Microsoft.Extensions.Caching.StackExchangeRedis (7)
RedisCache.cs (7)
187var setFields = batch.HashSetAsync(prefixedKey, fields);
202public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)
208private async Task SetImplAsync(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options, CancellationToken token = default)
235await Task.WhenAll(
265public async Task RefreshAsync(string key, CancellationToken token = default)
485public async Task RemoveAsync(string key, CancellationToken token = default)
545private async Task RefreshAsync(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr, CancellationToken token)
Microsoft.Extensions.Configuration.FileExtensions (1)
Microsoft.Extensions.DataIngestion (2)
Microsoft.Extensions.DataIngestion.Abstractions (1)
Microsoft.Extensions.DataIngestion.Tests (79)
Microsoft.Extensions.DependencyInjection (2)
Microsoft.Extensions.DependencyInjection.AutoActivation (4)
Microsoft.Extensions.DependencyInjection.AutoActivation.Tests (40)
Microsoft.Extensions.Diagnostics.ExceptionSummarization.Tests (6)
Microsoft.Extensions.Diagnostics.HealthChecks (16)
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (2)
Microsoft.Extensions.Diagnostics.HealthChecks.Common (7)
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (6)
Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization (3)
Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.Tests (13)
Microsoft.Extensions.Diagnostics.Probes (5)
Microsoft.Extensions.Diagnostics.Probes.Tests (4)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes.Tests (4)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (13)
Microsoft.Extensions.Diagnostics.Testing (5)
Microsoft.Extensions.Diagnostics.Testing.Tests (17)
Microsoft.Extensions.DotNetDeltaApplier (6)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Hosting (30)
Microsoft.Extensions.Hosting.Abstractions (39)
Microsoft.Extensions.Hosting.Systemd (4)
Microsoft.Extensions.Hosting.Testing (8)
Microsoft.Extensions.Hosting.Testing.Tests (30)
Microsoft.Extensions.Hosting.WindowsServices (3)
Microsoft.Extensions.Http.Diagnostics (10)
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (3)
Microsoft.Extensions.Http.Diagnostics.Tests (85)
Logging\HttpRequestBodyReaderTest.cs (9)
31public async Task Reader_SimpleContent_ReadsContent()
52public async Task Reader_EmptyContent_ErrorMessage()
73public async Task Reader_UnreadableContent_ErrorMessage(
96public async Task Reader_OperationCanceled_ThrowsTaskCanceledException()
122public async Task Reader_BigContent_TrimsAtTheEnd([CombinatorialValues(32, 256, 4095, 4096, 4097, 65536, 131072)] int limit)
146public async Task Reader_SmallContentBigLimit_ReadsCorrectly([CombinatorialValues(32, 256, 4095, 4096, 4097, 65536, 131072)] int limit)
169public async Task Reader_ReadingTakesTooLong_Timesout()
202public async Task Reader_NullContent_ReturnsEmpty()
223public async Task Reader_MethodIsGet_ReturnsEmpty()
Microsoft.Extensions.Http.Resilience.PerformanceTests (1)
Microsoft.Extensions.Http.Resilience.Tests (62)
Microsoft.Extensions.Identity.Core (180)
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 (70)
460return id == null ? Task.FromResult<TUser?>(null) : FindByIdAsync(id);
468/// The <see cref="Task"/> that represents the asynchronous operation, containing the security
473return Task.FromResult(Guid.NewGuid().ToString());
482/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
526/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
552/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
581/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
594/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userName"/> if it exists.
632/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
696/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
697public virtual async Task UpdateNormalizedUserNameAsync(TUser user)
708/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
721/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
745/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
758/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing true if
809/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a password
828/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
875/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
918/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
947/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="PasswordVerificationResult"/>
966/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
986/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1016/// <returns>The <see cref="Task"/> that represents the asynchronous operation,
1032/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1065/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
1084/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1115/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1156/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
1172/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1186/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1216/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1246/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1260/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1304/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1344/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1388/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1435/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1477/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing a list of role names.</returns>
1492/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified <paramref name="user"/> is
1522/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1590public virtual async Task UpdateNormalizedEmailAsync(TUser user)
1605/// The <see cref="Task"/> that represents the asynchronous operation, an email confirmation token.
1619/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1675/// The <see cref="Task"/> that represents the asynchronous operation, an email change token.
1690/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1728/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's telephone number, if any.</returns>
1743/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1775/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
1816/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a confirmed
1833/// The <see cref="Task"/> that represents the asynchronous operation, containing the telephone change number token.
1848/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the <paramref name="token"/>
1869/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the <paramref name="token"/>
1908/// The <see cref="Task"/> that represents result of the asynchronous operation, a token for
1952/// The <see cref="Task"/> that represents result of the asynchronous operation, a list of two
1977/// The <see cref="Task"/> that represents result of the asynchronous operation, true if the token is valid,
2014/// The <see cref="Task"/> that represents result of the asynchronous operation, a two factor authentication token
2044/// The <see cref="Task"/> that represents the asynchronous operation, true if the specified <paramref name="user "/>
2062/// The <see cref="Task"/> that represents the asynchronous operation, the <see cref="IdentityResult"/> of the operation
2090/// The <see cref="Task"/> that represents the asynchronous operation, true if the specified <paramref name="user "/>
2113/// The <see cref="Task"/> that represents the asynchronous operation, the <see cref="IdentityResult"/> of the operation
2139/// The <see cref="Task"/> that represents the asynchronous operation, true if a user can be locked out, otherwise false.
2170/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
2208/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
2241/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
2276/// <returns>The <see cref="Task"/> that contains the result the asynchronous operation, the current failed access count
2656/// The <see cref="Task"/> that represents the asynchronous operation, containing a list of the user's passkeys.
2673/// The <see cref="Task"/> that represents the asynchronous operation, containing the passkey if found; otherwise <see langword="null"/>.
2690/// The <see cref="Task"/> that represents the asynchronous operation, containing the user if found, otherwise <see langword="null"/>.
2707/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
2818private 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.ML (2)
Microsoft.Extensions.ML.Tests (2)
Microsoft.Extensions.Options (6)
Microsoft.Extensions.Options.Contextual.Tests (15)
Microsoft.Extensions.Options.DataAnnotations (1)
Microsoft.Extensions.Primitives (10)
ChangeToken.cs (10)
56/// <param name="changeTokenConsumer">Function called when the token changes. The token is only re-registered once the returned <see cref="Task"/> completes.</param>
63public static IDisposable OnChange(Func<IChangeToken?> changeTokenProducer, Func<Task> changeTokenConsumer)
68return new AsyncChangeTokenRegistration<Func<Task>>(changeTokenProducer, static callback => callback(), changeTokenConsumer);
75/// <param name="changeTokenConsumer">Function called when the token changes. The token is only re-registered once the returned <see cref="Task"/> completes.</param>
83public static IDisposable OnChange<TState>(Func<IChangeToken?> changeTokenProducer, Func<TState, Task> changeTokenConsumer, TState state)
210private readonly Func<TState, Task> _changeTokenConsumer;
212public AsyncChangeTokenRegistration(Func<IChangeToken?> changeTokenProducer, Func<TState, Task> changeTokenConsumer, TState state)
229Task consumerTask;
262private async Task AwaitConsumerAndRegisterCallback(Task consumerTask, IChangeToken? token)
Microsoft.Extensions.ServiceDiscovery (20)
Microsoft.Extensions.ServiceDiscovery.Abstractions (3)
Microsoft.Extensions.ServiceDiscovery.Dns (6)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (87)
Resolver\LoopbackDnsServer.cs (9)
32private static async Task<int> ProcessRequestCore(IPEndPoint remoteEndPoint, ArraySegment<byte> message, Func<LoopbackDnsResponseBuilder, IPEndPoint, Task> action, Memory<byte> responseBuffer)
52public async Task ProcessUdpRequest(Func<LoopbackDnsResponseBuilder, IPEndPoint, Task> action)
70public Task ProcessUdpRequest(Func<LoopbackDnsResponseBuilder, Task> action)
75public async Task ProcessTcpRequest(Func<LoopbackDnsResponseBuilder, IPEndPoint, Task> action)
113public Task ProcessTcpRequest(Func<LoopbackDnsResponseBuilder, Task> action)
Microsoft.Extensions.ServiceDiscovery.Tests (18)
Microsoft.Extensions.ServiceDiscovery.Yarp (1)
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (7)
Microsoft.Extensions.Telemetry (1)
Microsoft.Extensions.Telemetry.Abstractions (2)
Microsoft.Extensions.Telemetry.Tests (6)
Microsoft.Extensions.TimeProvider.Testing.Tests (18)
Microsoft.Extensions.Validation (6)
Microsoft.Extensions.VectorData.Abstractions (13)
Microsoft.Extensions.VectorData.ConformanceTests (225)
Microsoft.Gen.BuildMetadata.Unit.Tests (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (4)
Microsoft.Gen.ContextualOptions.Unit.Tests (10)
Microsoft.Gen.Logging.Unit.Tests (102)
Microsoft.Gen.MetadataExtractor.Unit.Tests (4)
Microsoft.Gen.Metrics.Unit.Tests (88)
Microsoft.Gen.MetricsReports.Unit.Tests (4)
Microsoft.Interop.ComInterfaceGenerator (10)
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
33protected abstract Func<SolutionEditor, DocumentId, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
106private static async Task<Solution> ApplyActionAndEnableUnsafe(Solution solution, DocumentId documentId, Func<SolutionEditor, DocumentId, CancellationToken, Task> solutionBasedFix, CancellationToken ct)
116public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
161protected record struct ConvertToSourceGeneratedInteropFix(Func<SolutionEditor, DocumentId, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
Microsoft.Interop.LibraryImportGenerator (12)
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
33protected abstract Func<SolutionEditor, DocumentId, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions);
106private static async Task<Solution> ApplyActionAndEnableUnsafe(Solution solution, DocumentId documentId, Func<SolutionEditor, DocumentId, CancellationToken, Task> solutionBasedFix, CancellationToken ct)
116public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
161protected record struct ConvertToSourceGeneratedInteropFix(Func<SolutionEditor, DocumentId, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions);
Microsoft.JSInterop (15)
Microsoft.Maui (24)
Microsoft.Maui.Controls (162)
Shell\Shell.cs (17)
802 Task IShellController.OnFlyoutItemSelectedAsync(Element element) =>
805 Task OnFlyoutItemSelectedAsync(Element element, bool platformInitiated)
834 return Task.CompletedTask;
891 return Task.CompletedTask;
1008 public Task GoToAsync(ShellNavigationState state)
1014 public Task GoToAsync(ShellNavigationState state, bool animate)
1021 public Task GoToAsync(ShellNavigationState state, IDictionary<string, object> parameters)
1029 public Task GoToAsync(ShellNavigationState state, bool animate, IDictionary<string, object> parameters)
1036 /// This method navigates to a <see cref="ShellNavigationState" /> and returns a <see cref="Task" /> that will complete once the navigation animation.
1041 public Task GoToAsync(ShellNavigationState state, ShellNavigationQueryParameters shellNavigationQueryParameters)
1047 /// This method navigates to a <see cref="ShellNavigationState" /> and returns a <see cref="Task" />.
1053 public Task GoToAsync(ShellNavigationState state, bool animate, ShellNavigationQueryParameters shellNavigationQueryParameters)
1216 async Task SetCurrentItem()
2092 protected override Task OnPopToRootAsync(bool animated) => SectionProxy.PopToRootAsync(animated);
2094 protected override Task OnPushAsync(Page page, bool animated) => SectionProxy.PushAsync(page, animated);
2115 protected override async Task OnPushModal(Page modal, bool animated)
2152 protected override Task OnPushModal(Page modal, bool animated) => _shellProxy.PushModalAsync(modal, animated);
Shell\ShellSection.cs (17)
114 async void IShellSectionController.SendPopping(Task poppingCompleted)
131 async void IShellSectionController.SendPoppingToRoot(Task finishedPopping)
320 async Task PrepareCurrentStackForBeingReplaced(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, bool? animate, List<string> globalRoutes, bool isRelativePopping)
510 internal async Task GoToAsync(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, bool? animate, bool isRelativePopping)
594 Task PopModalAsync(bool isAnimated)
602 Task PushModalAsync(Page page, bool isAnimated)
610 async Task PushStackOfPages(List<Page> pages, bool? animate)
812 protected virtual async Task OnPopToRootAsync(bool animated)
854 protected virtual Task OnPushAsync(Page page, bool animated)
868 return Task.FromResult(true);
883 Task.CompletedTask;
886 internal async Task PopModalStackToPage(Page page, bool? animated)
1085 protected override Task OnPopToRootAsync(bool animated)
1111 protected override Task OnPushAsync(Page page, bool animated)
1127 internal Task PushModalInnerAsync(Page modal, bool animated)
1139 protected override async Task OnPushModal(Page modal, bool animated)
1240 internal Task? PendingNavigationTask => _handlerBasedNavigationCompletionSource?.Task;
Microsoft.Maui.Controls.Foldable (2)
Microsoft.Maui.Essentials (138)
Map\Map.shared.cs (24)
19 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
20 Task OpenAsync(double latitude, double longitude, MapLaunchOptions options);
27 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
28 Task OpenAsync(Placemark placemark, MapLaunchOptions options);
59 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
60 public static Task OpenAsync(Location location) =>
68 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
69 public static Task OpenAsync(Location location, MapLaunchOptions options) =>
77 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
78 public static Task OpenAsync(double latitude, double longitude) =>
87 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
88 public static Task OpenAsync(double latitude, double longitude, MapLaunchOptions options) =>
95 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
96 public static Task OpenAsync(Placemark placemark) =>
104 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
105 public static Task OpenAsync(Placemark placemark, MapLaunchOptions options) =>
191 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
192 public static Task OpenAsync(this IMap map, Location location) =>
201 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
203 public static Task OpenAsync(this IMap map, Location location, MapLaunchOptions options)
251 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
252 public static Task OpenAsync(this IMap map, double latitude, double longitude) =>
260 /// <returns>A <see cref="Task"/> object with the current status of the asynchronous operation.</returns>
261 public static Task OpenAsync(this IMap map, Placemark placemark) =>
Microsoft.Maui.Graphics (5)
Microsoft.Maui.Graphics.Skia (1)
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (3)
Microsoft.Maui.Maps (3)
Microsoft.Maui.Resizetizer (9)
Microsoft.ML.AutoML (6)
Microsoft.ML.AutoML.Interactive (5)
Microsoft.ML.AutoML.Samples (2)
Microsoft.ML.AutoML.Tests (24)
Microsoft.ML.CodeAnalyzer.Tests (23)
Microsoft.ML.CodeGenerator.Tests (2)
Microsoft.ML.Core (12)
Microsoft.ML.Core.Tests (1)
Microsoft.ML.Data (26)
Microsoft.ML.Fairlearn (1)
Microsoft.ML.FastTree (8)
Microsoft.ML.GenAI.Core (1)
Microsoft.ML.GenAI.LLaMA (2)
Microsoft.ML.GenAI.Mistral (2)
Microsoft.ML.GenAI.Phi (2)
Microsoft.ML.GenAI.Phi.Tests (3)
Microsoft.ML.GenAI.Samples (10)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.ML.Maml (2)
Microsoft.ML.PerformanceTests (1)
Microsoft.ML.Samples (6)
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (2)
331var task = Task.Run(() =>
Microsoft.ML.Samples.GPU (6)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (2)
287var task = Task.Run(() =>
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (2)
308var task = Task.Run(() =>
Microsoft.ML.Sweeper (3)
Microsoft.ML.Sweeper.Tests (7)
Microsoft.ML.TestFramework (1)
Microsoft.ML.TestFrameworkCommon (3)
Microsoft.ML.Tokenizers.Data.Tests (5)
Microsoft.ML.Tokenizers.Tests (9)
Microsoft.NET.Build.Containers (85)
LocalDaemons\ArchiveFileRegistry.cs (5)
20internal async Task LoadAsync<T>(T image, SourceImageReference sourceReference,
22Func<T, SourceImageReference, DestinationImageReference, Stream, CancellationToken, Task> writeStreamFunc)
55public async Task LoadAsync(BuiltImage image, SourceImageReference sourceReference,
62public async Task LoadAsync(MultiArchImage multiArchImage, SourceImageReference sourceReference,
69public Task<bool> IsAvailableAsync(CancellationToken cancellationToken) => Task.FromResult(true);
LocalDaemons\ContainerRuntimeOperations.cs (5)
33public async Task LoadFromStandardInputAsync<T>(
39Func<T, SourceImageReference, DestinationImageReference, Stream, CancellationToken, Task> writeStreamFunc,
75await ((Task)loadTask).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
86public async Task LoadFromFileAsync<T>(
92Func<T, SourceImageReference, DestinationImageReference, Stream, CancellationToken, Task> writeStreamFunc,
LocalDaemons\DockerCli.cs (17)
87private async Task LoadAsync<T>(
91Func<T, SourceImageReference, DestinationImageReference, Stream, CancellationToken, Task> writeStreamFunc,
133public async Task LoadAsync(BuiltImage image, SourceImageReference sourceReference, DestinationImageReference destinationReference, CancellationToken cancellationToken)
137public async Task LoadAsync(MultiArchImage multiArchImage, SourceImageReference sourceReference, DestinationImageReference destinationReference, CancellationToken cancellationToken)
288public static async Task WriteImageToStreamAsync(BuiltImage image, SourceImageReference sourceReference, DestinationImageReference destinationReference, Stream imageStream, CancellationToken cancellationToken)
304private static async Task WriteDockerImageToStreamAsync(
328private static async Task WriteImageLayers(
361private static async Task WriteImageConfig(
378private static async Task WriteManifestForDockerImage(
410private static async Task WriteOciImageToStreamAsync(
431private static async Task WriteOciLayout(TarWriter writer, CancellationToken cancellationToken)
447private static async Task WriteManifestForOciImage(
465private static async Task WriteIndexJsonForOciImage(
490private static async Task WriteOciImageToBlobs(
506public static async Task WriteMultiArchOciImageToStreamAsync(
530private static async Task WriteIndexJsonForMultiArchOciImage(
586await Task.WhenAll(
Registry\Registry.cs (9)
472await Task.Delay(_retryDelayProvider(), cancellationToken).ConfigureAwait(false);
481internal async Task PushLayerAsync(Layer layer, string repository, CancellationToken cancellationToken)
555private async Task UploadBlobAsync(string repository, string digest, Stream contents, CancellationToken cancellationToken)
582public async Task PushManifestListAsync(
597public Task PushAsync(BuiltImage builtImage, SourceImageReference source, DestinationImageReference destination, CancellationToken cancellationToken)
600public Task PushAsync(BuiltImage builtImage, SourceImageReference source, DestinationImageReference destination, bool noCache, CancellationToken cancellationToken)
603private async Task PushAsync(BuiltImage builtImage, SourceImageReference source, DestinationImageReference destination, bool pushTags, bool noCache, CancellationToken cancellationToken)
616Func<Descriptor, Task> uploadLayerFunc = async (descriptor) =>
652await Task.WhenAll(builtImage.LayerDescriptors.Select(descriptor => uploadLayerFunc(descriptor))).ConfigureAwait(false);
Microsoft.NET.Build.Tasks (6)
Microsoft.NET.Sdk.Publish.Tasks (20)
Microsoft.NET.Sdk.Razor.Tasks (8)
Microsoft.Svcutil.NamedPipeMetadataImporter (1)
Microsoft.TemplateEngine.Cli (25)
Microsoft.TemplateEngine.Edge (48)
Microsoft.TemplateEngine.IDE (4)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (15)
Microsoft.TemplateEngine.Utils (3)
Microsoft.TemplateSearch.Common (1)
Microsoft.TestPlatform.CommunicationUtilities (25)
Microsoft.TestPlatform.CoreUtilities (1)
Microsoft.TestPlatform.CrossPlatEngine (19)
Microsoft.TestPlatform.Extensions.BlameDataCollector (6)
Microsoft.TestPlatform.TestHostRuntimeProvider (6)
Microsoft.TestPlatform.VsTestConsole.TranslationLayer (64)
Microsoft.VisualStudio.TestPlatform.Client (3)
Microsoft.VisualStudio.TestPlatform.Common (9)
Microsoft.VisualStudio.TestPlatform.ObjectModel (2)
Mongo.AppHost (1)
MSBuild (1)
MSBuild.Coordinator (9)
mscorlib (1)
MyFrontend (2)
Nats.Backend (5)
netstandard (1)
NuGet.Build.Tasks (2)
NuGet.Build.Tasks.Pack (2)
NuGet.CommandLine.XPlat (52)
Commands\Package\Update\PackageUpdateIO.cs (6)
174public async Task CommitAsync(IPackageUpdateIO.RestoreResult restorePreviewResult, CancellationToken none)
237lookups[source] = Task.Run(() => FindHighestPackageVersionAsync(sourceRepository, packageId, includePrerelease, logger, cancellationToken));
240await Task.WhenAll(lookups);
269tasks.Add(Task.Run(async () =>
316lookups[source] = Task.Run(() => FindLowestNonVulnerablePackageVersionAsync(sourceRepository, packageId, minVersion, knownVulnerabilities, logger, cancellationToken));
319await Task.WhenAll(lookups);
NuGet.Commands (59)
NuGet.Common (30)
NuGet.Credentials (7)
NuGet.DependencyResolver.Core (12)
NuGet.PackageManagement (121)
NuGetPackageManager.cs (25)
216public Task InstallPackageAsync(
253public Task InstallPackageAsync(
279public async Task InstallPackageAsync(NuGetProject nuGetProject, string packageId, ResolutionContext resolutionContext,
312public async Task InstallPackageAsync(
354public Task InstallPackageAsync(
377public Task InstallPackageAsync(
402public async Task InstallPackageAsync(
439public async Task InstallPackageAsync(
468public async Task UninstallPackageAsync(NuGetProject nuGetProject, string packageId, UninstallationContext uninstallationContext,
734tasks.Add(Task.Run(async ()
746var allActions = await Task.WhenAll(tasks);
815var doneTask = await Task.WhenAny(updateTasks);
2068var task = Task.Run(() => metadataResource.Exists(packageIdentity, sourceCacheContext, logger, tokenSource.Token), tokenSource.Token);
2409public async Task ExecuteNuGetProjectActionsAsync(IEnumerable<NuGetProject> nuGetProjects,
2470public async Task ExecuteNuGetProjectActionsAsync(NuGetProject nuGetProject,
2498public async Task ExecuteNuGetProjectActionsAsync(NuGetProject nuGetProject,
3258public async Task ExecuteBuildIntegratedProjectActionsAsync(
3520private async Task RollbackAsync(
3563private Task OpenReadmeFile(NuGetProject nuGetProject, INuGetProjectContext nuGetProjectContext, CancellationToken token)
3664private async Task ExecuteInstallAsync(
3680private async Task ExecuteUninstallAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, HashSet<PackageIdentity> packageWithDirectoriesToBeDeleted,
3838tasks.Add(Task.Run(async ()
3842var resolvedPackages = await Task.WhenAll(tasks);
3859tasks.Add(Task.Run(async ()
3863var resolvedPackages = await Task.WhenAll(tasks);
NuGet.Packaging (57)
PackageExtractor.cs (6)
23/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
153/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
260/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
380Func<Stream, Task> copyToAsync,
1029private static async Task VerifyPackageSignatureAsync(
1149private static async Task LogPackageSignatureVerificationAsync(
NuGet.Protocol (141)
OrderProcessor (5)
Pipelines.Library (1)
PresentationBuildTasks (1)
PresentationFramework (1)
Producer (3)
Publishers.AppHost (4)
Roslyn.Diagnostics.Analyzers (147)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.cs (4)
30public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
33public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
36public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
39public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (21)
37public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
55public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
72public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
109private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
118return Task.FromCanceled(cancellationToken);
122Func<object, Task> taskBody = static async o =>
204return Task.FromException(e);
215public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
233public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
250public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
274private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
283return Task.FromCanceled(cancellationToken);
287Func<object, Task> taskBody = static async o =>
369return Task.FromException(e);
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
468System.Threading.Tasks.Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
478public Task AcquireLock()
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\roslyn\src\Dependencies\Threading\ProducerConsumer.cs (35)
25Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
46public static Task RunAsync<TArgs>(
48Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
49Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
64public static Task RunAsync<TArgs>(
66Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
67Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
87public static Task RunParallelAsync<TSource, TArgs>(
89Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
90Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
101public static Task RunParallelAsync<TSource, TArgs>(
103Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
104Func<IAsyncEnumerable<TItem>, TArgs, CancellationToken, Task> consumeItems,
124public static Task RunParallelAsync<TSource, TArgs>(
126Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
127Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
138public static Task RunParallelAsync<TSource, TArgs>(
140Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
141Func<ImmutableArray<TItem>, TArgs, CancellationToken, Task> consumeItems,
159Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
173Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
193Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
206Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
225Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
249Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
283/// Equivalent to <see cref="RunParallelAsync{TSource, TArgs}(IEnumerable{TSource}, Func{TSource, Action{TItem}, TArgs, CancellationToken, Task}, TArgs, CancellationToken)"/>,
290Func<TSource, Action<TItem>, TArgs, CancellationToken, Task> produceItems,
321Func<Action<TItem>, TArgs, CancellationToken, Task> produceItems,
342var writeTask = ProduceItemsAndWriteToChannelAsync();
344await Task.WhenAll(writeTask, readTask).ConfigureAwait(false);
350await Task.Yield().ConfigureAwait(false);
354Task ProduceItemsAndWriteToChannelAsync()
359await Task.Yield().ConfigureAwait(false);
375private static async Task PerformActionAndCloseWriterAsync<TArgs>(
376Func<TArgs, CancellationToken, Task> action,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
22Task AnalyzeAsync(
Roslyn.Diagnostics.CSharp.Analyzers (9)
rzc (31)
ScenarioTests.Common.Tests (18)
Security.TransportSecurity.IntegrationTests (6)
ServiceBusWorker (10)
Shared (3)
ServerSentEvents\SseFormatter.cs (3)
30public static Task WriteAsync(IAsyncEnumerable<SseItem<string>> source, Stream destination, CancellationToken cancellationToken = default)
54public static Task WriteAsync<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken = default)
74private static async Task WriteAsyncCore<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken)
Shared.Tests (8)
SignalRServerlessWeb (2)
SignalRWeb (1)
SimplePipelines.AppHost (3)
Stress.ApiService (36)
Stress.AppHost (62)
CommandResources.cs (30)
31return Task.FromResult(CommandResults.Success());
42return Task.FromResult(CommandResults.Success());
55return Task.FromResult(CommandResults.Success());
66return Task.FromResult(CommandResults.Success());
78return Task.FromResult(CommandResults.Success());
90return Task.FromResult(CommandResults.Success());
98return Task.FromResult(CommandResults.Success());
114return Task.FromResult(CommandResults.Failure("The message and count arguments are required."));
124return Task.FromResult(CreateJsonSuccess("Echoed command arguments.", response));
164return Task.FromResult(CommandResults.Failure("The message argument is required."));
168return Task.FromResult(CommandResults.Failure("The repeat argument must be between 1 and 10."));
182return Task.FromResult(CreateJsonSuccess("Echoed command arguments.", payload, displayImmediately: true));
249return Task.FromResult(CommandResults.Failure("The target argument is required."));
253return Task.FromResult(CommandResults.Failure("The timeoutSeconds argument must be positive."));
266? Task.FromResult(CreateJsonFailure("Argument validation failed.", payload))
267: Task.FromResult(CreateJsonSuccess("Argument validation passed.", payload));
281return Task.CompletedTask;
345return Task.FromResult(CreateJsonSuccess("Summarized command arguments.", payload, displayImmediately: true));
368return Task.FromResult(CreateJsonSuccess("Dependent arguments received.", payload, displayImmediately: true));
405await Task.Delay(1000, context.CancellationToken);
456await Task.Delay(500, context.CancellationToken);
926return Task.FromResult(CommandResults.Success());
969return Task.FromResult(CommandResults.Success("Generated token.", resultData));
989return Task.FromResult(CommandResults.Success(message, new CommandResultData { Value = connectionString, DisplayImmediately = true }));
999return Task.FromResult(CommandResults.Failure("Validation failed", json, CommandResultFormat.Json));
1007return Task.FromResult(CommandResults.Failure("Health check failed", "Connection refused: ECONNREFUSED 127.0.0.1:5432\nRetries exhausted after 3 attempts", CommandResultFormat.Text));
1033return Task.FromResult(CommandResults.Success("Database migrated.", new CommandResultData { Value = markdown, Format = CommandResultFormat.Markdown }));
1186private static async Task ExecuteCommandForAllResourcesAsync(IServiceProvider serviceProvider, string commandName, CancellationToken cancellationToken)
1196var commandTasks = new List<Task>();
1201await Task.WhenAll(commandTasks).ConfigureAwait(false);
InteractionCommands.cs (26)
23await Task.WhenAll(resultTask1, resultTask2);
35await Task.Yield();
122return Task.CompletedTask;
258return Task.CompletedTask;
305await Task.Delay(5000, context.CancellationToken);
324await Task.Delay(5000, context.CancellationToken);
374await Task.Delay(5000, context.CancellationToken);
397return Task.CompletedTask;
444await Task.Delay(1000, context.CancellationToken);
461await Task.Delay(1000, context.CancellationToken);
497return Task.CompletedTask;
562return Task.FromResult(CommandResults.Success());
616await Task.Delay(1500, context.CancellationToken);
640await Task.Delay(2000, context.CancellationToken);
678await Task.Delay(1000, context.CancellationToken);
713await Task.Delay(6000, context.CancellationToken);
728await Task.Delay(3000, context.CancellationToken);
770return Task.CompletedTask;
807await Task.Delay(10000, ctx.CancellationToken);
834await Task.Delay(10000, ctx.CancellationToken);
863await Task.Delay(10000, commandContext.CancellationToken);
886await Task.Delay(10000, ctx.CancellationToken);
909await Task.Delay(10000, ctx.CancellationToken);
934await Task.Delay(10000, ctx.CancellationToken);
975await Task.Delay(10000, commandContext.CancellationToken);
1093private static void RunInteractionWithDismissValues(string title, Func<bool?, string, Task> action)
Stress.TelemetryService (8)
SuperFileCheck (2)
System.CommandLine (4)
System.ComponentModel.Annotations (10)
System.ComponentModel.EventBasedAsync (1)
System.Console (6)
System.Data.Common (76)
System.Data.Odbc (4)
System.Data.OleDb (1)
System.Diagnostics.Process (17)
System.DirectoryServices.Protocols (2)
System.Formats.Tar (61)
System.IO.Compression (66)
System\IO\Compression\ZipBlocks.Async.cs (4)
14public async Task WriteBlockAsync(Stream stream, CancellationToken cancellationToken)
24public static async Task WriteAllBlocksAsync(List<ZipGenericExtraField>? fields, ReadOnlyMemory<byte> trailingExtraFieldData, Stream stream, CancellationToken cancellationToken)
42public static async Task WriteAllBlocksExcludingTagAsync(List<ZipGenericExtraField>? fields, ReadOnlyMemory<byte> trailingExtraFieldData, Stream stream, ushort excludeTag, CancellationToken cancellationToken)
245public static async Task WriteBlockAsync(Stream stream, long numberOfEntries, long startOfCentralDirectory, long sizeOfCentralDirectory, byte[] archiveComment, CancellationToken cancellationToken)
System.IO.Compression.Brotli (10)
System.IO.Compression.ZipFile (32)
System\IO\Compression\ZipFile.Create.Async.cs (11)
219public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, CancellationToken cancellationToken = default) =>
268public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel compressionLevel, bool includeBaseDirectory, CancellationToken cancellationToken = default) =>
340public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName,
368public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, CancellationToken cancellationToken = default) =>
398public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, CompressionLevel compressionLevel, bool includeBaseDirectory, CancellationToken cancellationToken = default) =>
429public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination,
442public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, ZipFileCreationOptions options, CancellationToken cancellationToken = default)
469public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, ZipFileCreationOptions options, CancellationToken cancellationToken = default)
487private static async Task DoCreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName,
506private static async Task DoCreateFromDirectoryAsync(string sourceDirectoryName, Stream destination,
520private static async Task CreateZipArchiveFromDirectoryAsync(string sourceDirectoryName, ZipArchive archive,
System\IO\Compression\ZipFile.Extract.Async.cs (12)
44public static Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, CancellationToken cancellationToken = default) =>
80public static Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles, CancellationToken cancellationToken = default) =>
137public static Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, Encoding? entryNameEncoding, CancellationToken cancellationToken = default) =>
195public static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, Encoding? entryNameEncoding, bool overwriteFiles, CancellationToken cancellationToken = default)
264private static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, Encoding? entryNameEncoding, bool overwriteFiles, ReadOnlyMemory<char> password, CancellationToken cancellationToken = default)
309public static Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, CancellationToken cancellationToken = default) =>
341public static Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, bool overwriteFiles, CancellationToken cancellationToken = default) =>
381public static Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, Encoding? entryNameEncoding, CancellationToken cancellationToken = default) =>
422public static async Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, Encoding? entryNameEncoding, bool overwriteFiles, CancellationToken cancellationToken = default)
478private static async Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, Encoding? entryNameEncoding, bool overwriteFiles, ReadOnlyMemory<char> password, CancellationToken cancellationToken = default)
507public static Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, ZipExtractionOptions options, CancellationToken cancellationToken = default)
522public static Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, ZipExtractionOptions options, CancellationToken cancellationToken = default)
System\IO\Compression\ZipFileExtensions.ZipArchiveEntry.Extract.Async.cs (6)
38public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destinationFileName, CancellationToken cancellationToken = default) =>
70public static async Task ExtractToFileAsync(this ZipArchiveEntry source, string destinationFileName, bool overwrite, CancellationToken cancellationToken = default)
81public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destinationFileName, ZipExtractionOptions options, CancellationToken cancellationToken = default)
88private static async Task ExtractToFileAsync(ZipArchiveEntry source, string destinationFileName, bool overwrite, ReadOnlyMemory<char> password, CancellationToken cancellationToken = default)
99private static async Task ExtractToFileCoreAsync(ZipArchiveEntry source, string destinationFileName, bool overwrite, FileStreamOptions fileStreamOptions, ReadOnlyMemory<char> password, bool usePassword, CancellationToken cancellationToken)
146internal static async Task ExtractRelativeToDirectoryAsync(this ZipArchiveEntry source, string destinationDirectoryName, bool overwrite, ReadOnlyMemory<char> password = default, CancellationToken cancellationToken = default)
System.IO.FileSystem.Watcher (1)
System.IO.Hashing (5)
System.IO.IsolatedStorage (2)
System.IO.Pipelines (23)
System.IO.Pipes (20)
System.IO.Ports (5)
System.Linq.AsyncEnumerable (2)
System.Linq.Expressions (1)
System.Linq.Parallel (15)
System.Memory (10)
System.Net.Http (198)
System\Net\Http\HttpContent.cs (30)
253Task.FromResult<Stream>(CreateMemoryStreamFromBufferedContent()) :
265Task<Stream> ts = Task.FromResult((Stream)_contentReadStream);
299protected abstract Task SerializeToStreamAsync(Stream stream, TransportContext? context);
309protected virtual Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) =>
341public Task CopyToAsync(Stream stream) =>
344public Task CopyToAsync(Stream stream, CancellationToken cancellationToken) =>
347public Task CopyToAsync(Stream stream, TransportContext? context) =>
350public Task CopyToAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken)
360return Task.FromException(GetStreamCopyException(e));
363static async Task WaitAsync(ValueTask copyTask)
383Task task = SerializeToStreamAsync(stream, context, cancellationToken);
441public Task LoadIntoBufferAsync() =>
447public Task LoadIntoBufferAsync(long maxBufferSize) =>
456/// This operation will not block. The returned <see cref="Task"/> object will complete after all of the content has been serialized to the memory buffer.
461public Task LoadIntoBufferAsync(CancellationToken cancellationToken) =>
471/// This operation will not block. The returned <see cref="Task"/> object will complete after all of the content has been serialized to the memory buffer.
476public Task LoadIntoBufferAsync(long maxBufferSize, CancellationToken cancellationToken)
483return Task.CompletedTask;
489return Task.FromException(error!);
495Task task = SerializeToStreamAsync(tempBuffer, null, cancellationToken);
506return Task.FromException(GetStreamCopyException(e));
514private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, LimitArrayPoolWriteStream tempBuffer)
676private void CheckTaskNotNull(Task task)
772private static async Task<TResult> WaitAndReturnAsync<TState, TResult>(Task waitTask, TState state, Func<TState, TResult> returnFunc)
1116public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1120return Task.FromCanceled(cancellationToken);
1124return Task.CompletedTask;
1148public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (16)
368return Task.FromResult(false);
373return Task.FromResult(true);
396private async Task FlushOutgoingBytesAsync()
492private async Task ProcessIncomingFramesAsync()
1158internal Task FlushAsync(CancellationToken cancellationToken) =>
1206private Task PerformWriteAsync<T>(int writeBytes, T state, Func<T, Memory<byte>, bool> writeAction, CancellationToken cancellationToken = default)
1214return Task.FromException(GetRequestAbortedException(_abortException));
1221return Task.FromException(ExceptionDispatchInfo.SetCurrentStackTrace(new ObjectDisposedException(nameof(Http2Connection))));
1227private async Task ProcessOutgoingFramesAsync()
1352private Task SendRstStreamAsync(int streamId, Http2ProtocolErrorCode errorCode) =>
1769private async Task SendStreamDataAsync(int streamId, ReadOnlyMemory<byte> buffer, bool finalFlush, CancellationToken cancellationToken)
1816private Task SendEndStreamAsync(int streamId) =>
1826private Task SendWindowUpdateAsync(int streamId, int amount)
2100Task requestBodyTask = http2Stream.SendRequestBodyAsync(requestBodyCancellationToken);
2103Task responseHeadersTask = http2Stream.ReadResponseHeadersAsync(cancellationToken);
2116await Task.WhenAny(requestBodyTask, responseHeadersTask).ConfigureAwait(false) == requestBodyTask ||
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (7)
545Task? sendRequestContentTask = null;
768Task sendTask = sendRequestContentTask;
999private async Task SendRequestContentWithExpect100ContinueAsync(
1905private Task CopyToUntilEofAsync(Stream destination, bool async, int bufferSize, CancellationToken cancellationToken)
1920return Task.CompletedTask;
1923private async Task CopyToUntilEofWithExistingBufferedDataAsync(Stream destination, bool async, int bufferSize, CancellationToken cancellationToken)
1941private async Task CopyToContentLengthAsync(Stream destination, bool async, ulong length, int bufferSize, CancellationToken cancellationToken)
System.Net.Http.Json (5)
System.Net.Http.WinHttpHandler (25)
System.Net.HttpListener (14)
System.Net.Mail (46)
System\Net\Mail\SmtpCommands.cs (6)
82internal static async Task SendAsync<TIOAdapter>(SmtpConnection conn, CancellationToken cancellationToken = default)
125internal static async Task SendAsync<TIOAdapter>(SmtpConnection conn, CancellationToken cancellationToken = default)
216internal static async Task SendAsync<TIOAdapter>(SmtpConnection conn, string domain, CancellationToken cancellationToken = default)
259internal static async Task SendAsync<TIOAdapter>(SmtpConnection conn, CancellationToken cancellationToken = default)
303internal static Task SendAsync<TIOAdapter>(SmtpConnection conn, ReadOnlySpan<byte> command, MailAddress from, bool allowUnicode, CancellationToken cancellationToken = default)
412internal static async Task SendAsync<TIOAdapter>(SmtpConnection conn, CancellationToken cancellationToken = default)
System.Net.NameResolution (32)
System\Net\Dns.cs (28)
670private static Task GetHostEntryOrAddressesCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny, bool justAddresses, AddressFamily family, CancellationToken cancellationToken)
676return justAddresses ? (Task)
677Task.FromCanceled<IPAddress[]>(cancellationToken) :
678Task.FromCanceled<IPHostEntry>(cancellationToken);
683return justAddresses ? (Task)
684Task.FromResult((IPAddress[])resultOnFailure) :
685Task.FromResult((IPHostEntry)resultOnFailure);
701return justAddresses ? (Task)
702Task.FromResult(family == AddressFamily.Unspecified || ipAddress.AddressFamily == family ? new[] { ipAddress } : Array.Empty<IPAddress>()) :
703Task.FromResult(CreateHostEntryForAddress(ipAddress));
718return justAddresses ? (Task)
719Task.FromException<IPAddress[]>(invalidDomainException!) :
720Task.FromException<IPHostEntry>(invalidDomainException!);
738Task? t;
789Task? task = NameResolutionPal.GetAddrInfoAsync(hostName, justAddresses, addressFamily, cancellationToken);
801static async Task<T> CompleteAsync(Task task, string hostName, bool justAddresses, AddressFamily addressFamily, bool shouldFallbackToLocalhost, long startingTimeStamp, CancellationToken cancellationToken)
863return await ((Task<T>)(Task)Dns.GetHostAddressesAsync(Localhost, family, cancellationToken)).ConfigureAwait(false);
868return await ((Task<T>)(Task)Dns.GetHostAddressesAsync(IPv6Localhost, family, cancellationToken)).ConfigureAwait(false);
876return await ((Task<T>)(Task)Dns.GetHostEntryAsync(Localhost, family, cancellationToken)).ConfigureAwait(false);
881return await ((Task<T>)(Task)Dns.GetHostEntryAsync(IPv6Localhost, family, cancellationToken)).ConfigureAwait(false);
921private static readonly Dictionary<object, Task> s_tasks = new Dictionary<object, Task>();
950s_tasks.TryGetValue(key, out Task? prevTask);
951prevTask ??= Task.CompletedTask;
970((ICollection<KeyValuePair<object, Task>>)s_tasks).Remove(new KeyValuePair<object, Task>(key!, task!));
983((ICollection<KeyValuePair<object, Task>>)s_tasks).Remove(new KeyValuePair<object, Task>(key!, task));
System.Net.NetworkInformation (3)
System.Net.Quic (19)
System.Net.Requests (22)
System.Net.Security (61)
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(
293public override Task FlushAsync(CancellationToken cancellationToken) =>
482/// <returns>A <see cref="Task"/> that represents the asynchronous read operation.</returns>
483public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
508private async Task WriteAsync<TIOAdapter>(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken)
727private async Task AuthenticateAsync<TIOAdapter>(CancellationToken cancellationToken)
756private async Task SendBlobAsync<TIOAdapter>(byte[]? message, CancellationToken cancellationToken)
865private async Task ReceiveBlobAsync<TIOAdapter>(CancellationToken cancellationToken)
925private async Task SendAuthResetSignalAndThrowAsync<TIOAdapter>(byte[] message, Exception exception, CancellationToken cancellationToken)
System\Net\Security\SslStream.cs (14)
381public virtual Task AuthenticateAsClientAsync(string targetHost) => AuthenticateAsClientAsync(targetHost, null, false);
383public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, bool checkCertificateRevocation) => AuthenticateAsClientAsync(targetHost, clientCertificates, SslProtocols.None, checkCertificateRevocation);
385public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
399public Task AuthenticateAsClientAsync(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken = default)
408public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate) =>
411public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
424public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
438public Task AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken = default)
445public Task AuthenticateAsServerAsync(ServerOptionsSelectionCallback optionsCallback, object? state, CancellationToken cancellationToken = default)
452public virtual Task ShutdownAsync()
463return Task.CompletedTask;
693public override Task FlushAsync(CancellationToken cancellationToken) => InnerStream.FlushAsync(cancellationToken);
698public virtual Task NegotiateClientCertificateAsync(CancellationToken cancellationToken = default)
878public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
System.Net.ServerSentEvents (3)
System\Net\ServerSentEvents\SseFormatter.cs (3)
28public static Task WriteAsync(IAsyncEnumerable<SseItem<string>> source, Stream destination, CancellationToken cancellationToken = default)
53public static Task WriteAsync<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken = default)
73private static async Task WriteAsyncCore<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken)
System.Net.Sockets (23)
System\Net\Sockets\Socket.Tasks.cs (6)
78public Task ConnectAsync(EndPoint remoteEP) => ConnectAsync(remoteEP, default).AsTask();
113public Task ConnectAsync(IPAddress address, int port) => ConnectAsync(new IPEndPoint(address, port));
130public Task ConnectAsync(IPAddress[] addresses, int port) => ConnectAsync(addresses, port, CancellationToken.None).AsTask();
207public Task ConnectAsync(string host, int port) => ConnectAsync(host, port, default).AsTask();
857t = Task.FromResult(fromNetworkStream & !isReceive ? 0 : saea.BytesTransferred);
861t = Task.FromException<int>(GetException(saea.SocketError, wrapExceptionsInIOExceptions: fromNetworkStream));
System.Net.WebClient (12)
System.Net.WebSockets (26)
System\Net\WebSockets\ManagedWebSocket.cs (14)
263Task lockTask = mutex.EnterAsync(CancellationToken.None);
297public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
366return Task.FromException<WebSocketReceiveResult>(exc);
387public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
400return Task.FromException(exc);
406public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
414private async Task CloseOutputAsyncCore(WebSocketCloseStatus closeStatus, string? statusDescription, bool enterReceiveMutex, CancellationToken cancellationToken)
486Task lockTask = _sendMutex.EnterAsync(cancellationToken);
519Task flushTask = _stream.FlushAsync();
600private async ValueTask SendFrameFallbackAsync(MessageOpcode opcode, bool endOfMessage, bool disableCompression, ReadOnlyMemory<byte> payloadBuffer, Task lockTask, CancellationToken cancellationToken)
1136Task? task = null;
1440private async Task CloseAsyncPrivate(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
1888private void LogExceptions(Task t)
1907static void LogFaulted(Task task, object? thisObj)
System.Net.WebSockets.Client (35)
System\Net\WebSockets\BrowserWebSockets\BrowserWebSocket.cs (14)
136internal Task ConnectAsync(Uri uri, List<string>? requestedSubProtocols, CancellationToken cancellationToken)
154public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
183public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
193public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
316private async Task ConnectAsyncCore(CancellationToken cancellationToken)
318Task openTask;
369private async Task SendAsyncCore(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
372Task? sendTask;
423Task? receiveTask;
509private async Task CloseAsyncCore(WebSocketCloseStatus closeStatus, string? statusDescription, bool fullClose, CancellationToken cancellationToken)
511Task? closeTask;
553private async Task CancellationHelper(Task promise, CancellationToken cancellationToken, WebSocketState previousState)
571CancelablePromise.CancelPromise((Task)s!);
System\Net\WebSockets\ClientWebSocket.cs (6)
78public Task ConnectAsync(Uri uri, CancellationToken cancellationToken)
90public Task ConnectAsync(Uri uri, HttpMessageInvoker? invoker, CancellationToken cancellationToken)
120private async Task ConnectAsyncCore(Uri uri, HttpMessageInvoker? invoker, CancellationToken cancellationToken)
141public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) =>
156public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) =>
159public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) =>
System.Private.CoreLib (1637)
src\runtime\src\coreclr\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncHelpers.CoreCLR.cs (27)
171public Task? CurrentTask;
368private static unsafe void Suspend(Task task, ConfigureAwaitOptions options)
458if (obj is Task t)
632private static unsafe void TransparentSuspend(Task task)
693private static void TransparentAwait(Task task)
899Task.ThrowAsync(ex, targetContext: null);
1246Task.ThrowAsync(ex, targetContext: null);
1329private static Task CreateRuntimeAsyncTask(ref RuntimeAsyncAwaitState state)
1359private static Task TaskFromException(Exception ex)
1361Task task = new();
1584taskCont.Initialize(Task.CompletedTask);
1781public static void ResumeRuntimeAsyncContext(Task task, ref AsyncDispatcherInfo info, AsyncInstrumentation.Flags flags)
1948public static void CreateAsyncContext(Task task)
1950Task.AddToActiveTasks(task);
1954public static void ResumeAsyncContext(Task task)
1961Task.ReplaceOrAddRuntimeAsyncContinuationTimestamp(curContinuation, newContinuation);
1970public static void CompleteAsyncContext(Task? task)
1974Task.RemoveRuntimeAsyncTask(task);
1980public static void AsyncMethodUnhandledException(Task? task, Exception ex, Continuation curContinuation)
1984Task.RemoveRuntimeAsyncTask(task, curContinuation);
1992Task.RemoveRuntimeAsyncContinuationChainTimestamps(curContinuation, unwindedFrames);
1999Task.UpdateRuntimeAsyncTaskTimestamp(info.CurrentTask, curContinuation);
2005Task.RemoveRuntimeAsyncContinuationTimestamp(curContinuation);
2012Task.TryAddRuntimeAsyncContinuationChainTimestamps(nextContinuation);
2016public static void HandleSuspendedFailed(Task task, Continuation? nextContinuation)
2020Task.RemoveRuntimeAsyncTask(task, nextContinuation);
2024Task.RemoveRuntimeAsyncTask(task);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.Threads.cs (3)
17Task? previousDispatchTask = m_dispatchTask;
18m_dispatchTask = Task.Factory.StartNew(() => DispatchEventsToEventListeners(sessionID, syncTimeUtc, syncTimeQPC, timeQPCFrequency, previousDispatchTask, m_dispatchTaskCancellationSource.Token), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
21private void DispatchEventsToEventListeners(ulong sessionID, DateTime syncTimeUtc, long syncTimeQPC, long timeQPCFrequency, Task? previousDispatchTask, CancellationToken token)
src\runtime\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)
1274public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
1281Task.FromCanceled<int>(cancellationToken) :
1285private async Task CopyToAsyncCore(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (31)
857public static Task AppendAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken = default)
875public static Task AppendAllBytesAsync(string path, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)
880? Task.FromCanceled(cancellationToken)
883static async Task Core(string path, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken)
1119? Task.FromCanceled<string>(cancellationToken)
1156public static Task WriteAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default)
1168public static Task WriteAllTextAsync(string path, ReadOnlyMemory<char> contents, CancellationToken cancellationToken = default)
1171public static Task WriteAllTextAsync(string path, string? contents, Encoding encoding, CancellationToken cancellationToken = default)
1184public static Task WriteAllTextAsync(string path, ReadOnlyMemory<char> contents, Encoding encoding, CancellationToken cancellationToken = default)
1190return Task.FromCanceled(cancellationToken);
1200return Task.FromCanceled<byte[]>(cancellationToken);
1211return Task.FromException<byte[]>(ExceptionDispatchInfo.SetCurrentStackTrace(new IOException(SR.IO_FileTooLong2GB)));
1289public static Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken = default)
1306public static Task WriteAllBytesAsync(string path, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)
1311? Task.FromCanceled(cancellationToken)
1314static async Task Core(string path, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken)
1329? Task.FromCanceled<string[]>(cancellationToken)
1353public static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken = default)
1356public static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken = default) =>
1359private static Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, bool append, CancellationToken cancellationToken)
1365return Task.FromCanceled(cancellationToken);
1377return Task.FromException(e);
1383private static async Task InternalWriteAllLinesAsync(StreamWriter writer, IEnumerable<string> contents, CancellationToken cancellationToken)
1399public static Task AppendAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default)
1410public static Task AppendAllTextAsync(string path, ReadOnlyMemory<char> contents, CancellationToken cancellationToken = default)
1413public static Task AppendAllTextAsync(string path, string? contents, Encoding encoding, CancellationToken cancellationToken = default)
1425public static Task AppendAllTextAsync(string path, ReadOnlyMemory<char> contents, Encoding encoding, CancellationToken cancellationToken = default)
1431return Task.FromCanceled(cancellationToken);
1437public static Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken = default)
1440public static Task AppendAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken = default) =>
1613private static async Task WriteToFileAsync(string path, FileMode mode, ReadOnlyMemory<char> contents, Encoding encoding, CancellationToken cancellationToken)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\FileStream.cs (9)
250public override Task FlushAsync(CancellationToken cancellationToken)
254return Task.FromCanceled(cancellationToken);
279return Task.FromCanceled<int>(cancellationToken);
322public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
328return Task.FromCanceled(cancellationToken);
526public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
599internal Task BaseFlushAsync(CancellationToken cancellationToken)
612internal Task BaseWriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
621internal Task BaseCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (11)
311Task semaphoreLockTask = semaphore.WaitAsync(cancellationToken);
392private async ValueTask<int> ReadAsyncSlowPath(Task semaphoreLockTask, Memory<byte> buffer, CancellationToken cancellationToken)
583public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
612Task semaphoreLockTask = semaphore.WaitAsync(cancellationToken);
676private async ValueTask WriteAsyncSlowPath(Task semaphoreLockTask, ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
785public override Task FlushAsync(CancellationToken cancellationToken)
789return Task.FromCanceled<int>(cancellationToken);
797private async Task FlushAsyncInternal(CancellationToken cancellationToken)
834public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
840Task.FromCanceled<int>(cancellationToken) :
844private async Task CopyToAsyncCore(Stream destination, int bufferSize, CancellationToken cancellationToken)
src\runtime\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;
238var thisTask = Task.InternalCurrent as ReadWriteTask;
306Task.FromCanceled<int>(cancellationToken) :
478internal Task BeginWriteInternal(
494Task? semaphoreTask = null;
514var thisTask = Task.InternalCurrent as ReadWriteTask;
551private static void RunReadWriteTaskWhenReady(Task asyncWaiter, ReadWriteTask readWriteTask)
698void ITaskCompletionAction.Invoke(Task completingTask)
724public Task WriteAsync(byte[] buffer, int offset, int count) => WriteAsync(buffer, offset, count, CancellationToken.None);
726public virtual Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
730Task.FromCanceled(cancellationToken) :
745private static async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
757private Task BeginEndWriteAsync(byte[] buffer, int offset, int count)
1019public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) =>
1021Task.FromCanceled(cancellationToken) :
1022Task.CompletedTask;
1031public override Task FlushAsync(CancellationToken cancellationToken) =>
1033Task.FromCanceled(cancellationToken) :
1034Task.CompletedTask;
1043TaskToAsyncResult.Begin(Task.CompletedTask, callback, state);
1054Task.FromCanceled<int>(cancellationToken) :
1055Task.FromResult(0);
1068public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
1070Task.FromCanceled(cancellationToken) :
1071Task.CompletedTask;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (51)
55private Task _asyncWriteTask = Task.CompletedTask;
679public override Task WriteAsync(char value)
696private async Task WriteAsyncInternal(char value, bool appendNewLine)
726public override Task WriteAsync(string? value)
746return Task.CompletedTask;
750public override Task WriteAsync(char[] buffer, int index, int count)
776public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
789return Task.FromCanceled(cancellationToken);
795private async Task WriteAsyncInternal(ReadOnlyMemory<char> source, bool appendNewLine, CancellationToken cancellationToken)
834public override Task WriteLineAsync()
851public override Task WriteLineAsync(char value)
868public override Task WriteLineAsync(string? value)
890public override Task WriteLineAsync(char[] buffer, int index, int count)
916public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
928return Task.FromCanceled(cancellationToken);
934public override Task FlushAsync()
954/// <returns>A <see cref="Task"/> that represents the asynchronous flush operation.</returns>
955public override Task FlushAsync(CancellationToken cancellationToken)
961return Task.FromCanceled(cancellationToken);
978private async Task FlushAsyncInternalWithGuard(bool flushStream, bool flushEncoder, CancellationToken cancellationToken)
984private Task FlushAsyncInternal(bool flushStream, bool flushEncoder, CancellationToken cancellationToken = default)
988return Task.FromCanceled(cancellationToken);
994return Task.CompletedTask;
999async Task Core(bool flushStream, bool flushEncoder, CancellationToken cancellationToken)
1053public override Task FlushAsync() => Task.CompletedTask;
1054public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
1074public override Task WriteAsync(char value) => Task.CompletedTask;
1075public override Task WriteAsync(string? value) => Task.CompletedTask;
1076public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
1077public override Task WriteAsync(char[] buffer, int index, int count) => Task.CompletedTask;
1078public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
1099public override Task WriteLineAsync(char value) => Task.CompletedTask;
1100public override Task WriteLineAsync(string? value) => Task.CompletedTask;
1101public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
1102public override Task WriteLineAsync(char[] buffer, int index, int count) => Task.CompletedTask;
1103public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
1104public override Task WriteLineAsync() => Task.CompletedTask;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (106)
588public virtual Task WriteAsync(char value) =>
589Task.Factory.StartNew(static state =>
600public virtual unsafe Task WriteAsync(Rune value)
606return Task.Factory.StartNew(static state =>
617public virtual Task WriteAsync(string? value) =>
618Task.Factory.StartNew(static state =>
630public Task WriteAsync(string? value, CancellationToken cancellationToken) =>
639public virtual Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default)
642cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
643value == null ? Task.CompletedTask :
646async Task WriteAsyncCore(StringBuilder sb, CancellationToken ct)
655public Task WriteAsync(char[]? buffer)
659return Task.CompletedTask;
665public virtual Task WriteAsync(char[] buffer, int index, int count) =>
666Task.Factory.StartNew(static state =>
672public virtual Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) =>
673cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
676Task.Factory.StartNew(static state =>
682public virtual Task WriteLineAsync(char value) =>
683Task.Factory.StartNew(static state =>
694public virtual unsafe Task WriteLineAsync(Rune value)
700return Task.Factory.StartNew(static state =>
711public virtual Task WriteLineAsync(string? value) =>
712Task.Factory.StartNew(static state =>
724public Task WriteLineAsync(string? value, CancellationToken cancellationToken) =>
733public virtual Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default)
736cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
740async Task WriteLineAsyncCore(StringBuilder sb, CancellationToken ct)
750public Task WriteLineAsync(char[]? buffer)
760public virtual Task WriteLineAsync(char[] buffer, int index, int count) =>
761Task.Factory.StartNew(static state =>
767public virtual Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) =>
768cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
771Task.Factory.StartNew(static state =>
777public virtual Task WriteLineAsync()
787public Task WriteLineAsync(CancellationToken cancellationToken) =>
790public virtual Task FlushAsync()
792return Task.Factory.StartNew(static state => ((TextWriter)state!).Flush(), this,
801/// <returns>A <see cref="Task"/> that represents the asynchronous flush operation.</returns>
804public virtual Task FlushAsync(CancellationToken cancellationToken) =>
805cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
821public override Task FlushAsync() => Task.CompletedTask;
822public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
845public override Task WriteAsync(char value) => Task.CompletedTask;
846public override Task WriteAsync(Rune value) => Task.CompletedTask;
847public override Task WriteAsync(string? value) => Task.CompletedTask;
848public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
849public override Task WriteAsync(char[] buffer, int index, int count) => Task.CompletedTask;
850public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
873public override Task WriteLineAsync(char value) => Task.CompletedTask;
874public override Task WriteLineAsync(Rune value) => Task.CompletedTask;
875public override Task WriteLineAsync(string? value) => Task.CompletedTask;
876public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default) => Task.CompletedTask;
877public override Task WriteLineAsync(char[] buffer, int index, int count) => Task.CompletedTask;
878public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) => Task.CompletedTask;
879public override Task WriteLineAsync() => Task.CompletedTask;
1068public override Task WriteAsync(char value)
1071return Task.CompletedTask;
1075public override Task WriteAsync(Rune value)
1078return Task.CompletedTask;
1082public override Task WriteAsync(string? value)
1085return Task.CompletedTask;
1089public override Task WriteAsync(StringBuilder? value, CancellationToken cancellationToken = default)
1093return Task.FromCanceled(cancellationToken);
1097return Task.CompletedTask;
1101public override Task WriteAsync(char[] buffer, int index, int count)
1104return Task.CompletedTask;
1108public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
1112return Task.FromCanceled(cancellationToken);
1116return Task.CompletedTask;
1120public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default)
1124return Task.FromCanceled(cancellationToken);
1128return Task.CompletedTask;
1132public override Task WriteLineAsync(char value)
1135return Task.CompletedTask;
1139public override Task WriteLineAsync(Rune value)
1142return Task.CompletedTask;
1146public override Task WriteLineAsync()
1149return Task.CompletedTask;
1153public override Task WriteLineAsync(string? value)
1156return Task.CompletedTask;
1160public override Task WriteLineAsync(StringBuilder? value, CancellationToken cancellationToken = default)
1164return Task.FromCanceled(cancellationToken);
1168return Task.CompletedTask;
1172public override Task WriteLineAsync(char[] buffer, int index, int count)
1175return Task.CompletedTask;
1179public override Task FlushAsync()
1182return Task.CompletedTask;
1186public override Task FlushAsync(CancellationToken cancellationToken)
1190return Task.FromCanceled(cancellationToken);
1194return Task.CompletedTask;
src\runtime\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
154private readonly Action<Action, Task> _invokeAction; // This wrapper is an action that wraps another action, this is that Action.
156internal readonly Task _innerTask; // If the continuation is logically going to invoke a task, this is that task (may be null)
158internal ContinuationWrapper(Action continuation, Action<Action, Task> invokeAction, Task innerTask)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\TaskAwaiter.cs (37)
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)
192/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
196internal static void UnsafeOnCompletedInternal(Task task, IAsyncStateMachineBox stateMachineBox, bool continueOnCapturedContext)
243private static Action OutputWaitEtwEvents(Task task, Action continuation)
248if (Task.s_asyncDebuggingEnabled)
250Task.AddToActiveTasks(task);
258Task? currentTaskAtBegin = Task.InternalCurrent;
261Task? continuationTask = AsyncMethodBuilderCore.TryGetContinuationTask(continuation);
276if (Task.s_asyncDebuggingEnabled)
278Task.RemoveFromActiveTasks(innerTask);
288Task? currentTaskAtEnd = Task.InternalCurrent;
335/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
345/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
382/// <summary>Provides an awaitable object that allows for configured awaits on <see cref="Task"/>.</summary>
390/// <param name="task">The awaitable <see cref="Task"/>.</param>
392internal ConfiguredTaskAwaitable(Task task, ConfigureAwaitOptions options)
413internal readonly Task m_task;
418/// <param name="task">The <see cref="Task"/> to await.</param>
420internal ConfiguredTaskAwaiter(Task task, ConfigureAwaitOptions options)
433/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
443/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
453/// <summary>Ends the await on the completed <see cref="Task"/>.</summary>
515/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
525/// <summary>Schedules the continuation onto the <see cref="Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task_T.cs (45)
48/// <see cref="Task.Start()">Start</see>
53/// <see cref="Task.Dispose()">Dispose</see>, are thread-safe
284internal Task(Func<TResult> valueSelector, Task? parent, CancellationToken cancellationToken,
300internal Task(Delegate valueSelector, object? state, Task? parent, CancellationToken cancellationToken,
308internal static Task<TResult> StartNew(Task? parent, Func<TResult> function, CancellationToken cancellationToken,
328internal static Task<TResult> StartNew(Task? parent, Func<object?, TResult> function, object? state, CancellationToken cancellationToken,
518/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
549/// <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>
557/// <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>
567/// <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>
576/// <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>
618/// <returns>A new continuation <see cref="Task"/>.</returns>
620/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
627public Task ContinueWith(Action<Task<TResult>> continuationAction)
641/// <returns>A new continuation <see cref="Task"/>.</returns>
643/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
650public Task ContinueWith(Action<Task<TResult>> continuationAction, CancellationToken cancellationToken)
666/// <returns>A new continuation <see cref="Task"/>.</returns>
668/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
678public Task ContinueWith(Action<Task<TResult>> continuationAction, TaskScheduler scheduler)
697/// <returns>A new continuation <see cref="Task"/>.</returns>
699/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
711public Task ContinueWith(Action<Task<TResult>> continuationAction, TaskContinuationOptions continuationOptions)
735/// <returns>A new continuation <see cref="Task"/>.</returns>
737/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
751public Task ContinueWith(Action<Task<TResult>> continuationAction, CancellationToken cancellationToken,
758internal Task ContinueWith(Action<Task<TResult>> continuationAction, TaskScheduler scheduler, CancellationToken cancellationToken,
776Task continuationTask = new ContinuationTaskFromResultTask<TResult>(
799/// <returns>A new continuation <see cref="Task"/>.</returns>
801/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
808public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state)
823/// <returns>A new continuation <see cref="Task"/>.</returns>
825/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
832public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, CancellationToken cancellationToken)
849/// <returns>A new continuation <see cref="Task"/>.</returns>
851/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
861public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskScheduler scheduler)
881/// <returns>A new continuation <see cref="Task"/>.</returns>
883/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
895public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskContinuationOptions continuationOptions)
920/// <returns>A new continuation <see cref="Task"/>.</returns>
922/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
936public Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, CancellationToken cancellationToken,
943internal Task ContinueWith(Action<Task<TResult>, object?> continuationAction, object? state, TaskScheduler scheduler, CancellationToken cancellationToken,
961Task continuationTask = new ContinuationTaskFromResultTask<TResult>(
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (441)
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.
131private Task? ParentForDebugger => m_contingentProperties?.m_parent; // Private property used by a debugger to access this Task's parent
182private static Dictionary<int, Task>? s_currentActiveTasks;
193internal static bool AddToActiveTasks(Task task)
197Dictionary<int, Task> activeTasks =
199Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ??
211internal static void RemoveFromActiveTasks(Task task)
213Dictionary<int, Task>? activeTasks = s_currentActiveTasks;
300internal static void UpdateRuntimeAsyncTaskTimestamp(Task task, Continuation timestampSource)
324internal static void RemoveRuntimeAsyncTask(Task task)
338internal static void RemoveRuntimeAsyncTask(Task task, Continuation continuationChain)
388internal volatile List<Task>? m_exceptionalChildren;
390internal Task? m_parent;
485Task? parent = InternalCurrent;
496/// Initializes a new <see cref="Task"/> with the specified action.
506/// Initializes a new <see cref="Task"/> with the specified action and <see cref="Threading.CancellationToken">CancellationToken</see>.
521/// Initializes a new <see cref="Task"/> with the specified action and creation options.
541/// Initializes a new <see cref="Task"/> with the specified action and creation options.
565/// Initializes a new <see cref="Task"/> with the specified action and state.
578/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
595/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
616/// Initializes a new <see cref="Task"/> with the specified action, state, and options.
650internal Task(Delegate action, object? state, Task? parent, CancellationToken cancellationToken,
730Task? parent = props.m_parent;
753private void AssignCancellationToken(CancellationToken cancellationToken, Task? antecedent, TaskContinuation? continuation)
781ctr = cancellationToken.UnsafeRegister(static t => ((Task)t!).InternalCancel(), this);
792var tuple = (TupleSlim<Task, Task, TaskContinuation>)t!;
794Task targetTask = tuple.Item1;
795Task antecedentTask = tuple.Item2;
799}, new TupleSlim<Task, Task, TaskContinuation>(this, antecedent, continuation));
810Task? parent = m_contingentProperties?.m_parent;
922internal static bool AnyTaskRequiresNotifyDebuggerOfWaitCompletion(Task?[] tasks)
925foreach (Task? task in tasks)
1003Task? currentTask = InternalCurrent;
1004Task? parentTask = m_contingentProperties?.m_parent;
1050/// Starts the <see cref="Task"/>, scheduling it for execution to the current <see
1058/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1068/// Starts the <see cref="Task"/>, scheduling it for execution to the specified <see
1083/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1124/// Runs the <see cref="Task"/> synchronously on the current <see
1143/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1153/// Runs the <see cref="Task"/> synchronously on the <see
1168/// The <see cref="Task"/> is not in a valid state to be started. It may have already been started,
1289internal static Task InternalStartNew(
1290Task? creatingTask, Delegate action, object? state, CancellationToken cancellationToken, TaskScheduler scheduler,
1301Task t = new Task(action, state, creatingTask, cancellationToken, options, internalOptions | InternalTaskOptions.QueuedByRuntime, scheduler);
1308/// Gets a unique ID for a <see cref="Task">Task</see> or task continuation instance.
1332/// Gets a unique ID for this <see cref="Task">Task</see> instance.
1353/// Returns the unique ID of the currently executing <see cref="Task">Task</see>.
1359Task? currentTask = InternalCurrent;
1368/// Gets the <see cref="Task">Task</see> instance currently executing, or
1371internal static Task? InternalCurrent => t_currentTask;
1379internal static Task? InternalCurrentIfAttached(TaskCreationOptions creationOptions)
1386/// cref="Task">Task</see> to end prematurely. If the <see
1387/// cref="Task">Task</see> completed successfully or has not yet thrown any
1442/// Gets whether this <see cref="Task">Task</see> instance has completed
1446/// A <see cref="Task">Task</see> will complete in Canceled state either if its <see cref="CancellationToken">CancellationToken</see>
1510/// Gets whether this <see cref="Task"/> threw an OperationCanceledException while its CancellationToken was signaled.
1515/// Gets whether this <see cref="Task">Task</see> has completed.
1569/// The <see cref="Task"/> has been disposed.
1587/// Gets the state object supplied when the <see cref="Task">Task</see> was created,
1604/// Provides access to factory methods for creating <see cref="Task"/> and <see cref="Task{TResult}"/> instances.
1618public static Task CompletedTask
1667/// Gets whether the <see cref="Task"/> completed due to an unhandled exception.
1716/// Disposes the <see cref="Task"/>, releasing all of its unmanaged resources.
1719/// Unlike most of the members of <see cref="Task"/>, this method is not thread-safe.
1720/// Also, <see cref="Dispose()"/> may only be called on a <see cref="Task"/> that is in one of
1726/// The exception that is thrown if the <see cref="Task"/> is not in
1738/// Disposes the <see cref="Task"/>, releasing all of its unmanaged resources.
1745/// Unlike most of the members of <see cref="Task"/>, this method is not thread-safe.
2097Task? parent = m_contingentProperties?.m_parent;
2180List<Task>? exceptionalChildren = props.m_exceptionalChildren;
2292Task? parent = m_contingentProperties?.m_parent;
2304internal void ProcessChildCompletion(Task childTask)
2319Interlocked.CompareExchange(ref props.m_exceptionalChildren, new List<Task>(), null);
2326List<Task>? tmp = props.m_exceptionalChildren;
2357List<Task>? exceptionalChildren = props.m_exceptionalChildren;
2365foreach (Task task in exceptionalChildren)
2455private void ExecuteWithThreadLocal(ref Task? currentTaskSlot, Thread? threadPoolThread = null)
2458Task? previousTask = currentTaskSlot;
2536Debug.Assert(obj is Task);
2538Unsafe.As<Task>(obj).InnerInvoke();
2592/// <summary>Gets an awaiter used to await this <see cref="Task"/>.</summary>
2599/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
2610/// <summary>Configures an awaiter used to await this <see cref="Task"/>.</summary>
2628/// Sets a continuation onto the <see cref="Task"/>.
2632/// <param name="continuationAction">The action to invoke when the <see cref="Task"/> has completed.</param>
2701/// Sets a continuation onto the <see cref="Task"/>.
2705/// <param name="stateMachineBox">The action to invoke when the <see cref="Task"/> has completed.</param>
2771/// Waits for the <see cref="Task"/> to complete execution.
2774/// The <see cref="Task"/> was canceled -or- an exception was thrown during
2775/// the execution of the <see cref="Task"/>.
2790/// Waits for the <see cref="Task"/> to complete execution.
2797/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2800/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2801/// cref="Task"/>.
2811/// Waits for the <see cref="Task"/> to complete execution.
2818/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2821/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2822/// cref="Task"/>.
2845/// Waits for the <see cref="Task"/> to complete execution.
2854/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2855/// cref="Task"/>.
2863/// Waits for the <see cref="Task"/> to complete execution.
2868/// <returns>true if the <see cref="Task"/> completed execution within the allotted time; otherwise,
2876/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2877/// cref="Task"/>.
2885/// Waits for the <see cref="Task"/> to complete execution.
2895/// true if the <see cref="Task"/> completed execution within the allotted time; otherwise, false.
2898/// The <see cref="Task"/> was canceled -or- an exception was thrown during the execution of the <see
2899/// cref="Task"/>.
2946/// <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>
2948/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2949public Task WaitAsync(CancellationToken cancellationToken) => WaitAsync(Timeout.UnsignedInfinite, TimeProvider.System, cancellationToken);
2951/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes or when the specified timeout expires.</summary>
2952/// <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>
2953/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2954public Task WaitAsync(TimeSpan timeout) => WaitAsync(ValidateTimeout(timeout, ExceptionArgument.timeout), TimeProvider.System, default);
2956/// <summary>Gets a <see cref="Task"/> that will complete when this <see cref="Task"/> completes or when the specified timeout expires.</summary>
2957/// <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>
2959/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2961public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider)
2967/// <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>
2968/// <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>
2970/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2971public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) =>
2974/// <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>
2975/// <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>
2978/// <returns>The <see cref="Task"/> representing the asynchronous wait. It may or may not be the same instance as the current instance.</returns>
2980public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken)
2986private Task WaitAsync(uint millisecondsTimeout, TimeProvider timeProvider, CancellationToken cancellationToken)
3010private readonly Task _task;
3016internal CancellationPromise(Task source, uint millisecondsDelay, TimeProvider timeProvider, CancellationToken token)
3071void ITaskCompletionAction.Invoke(Task completingTask)
3137Task? currentTask = InternalCurrent;
3170Task? currentTask = InternalCurrent;
3199public void Invoke(Task completingTask) { Set(); }
3324/// Cancels the <see cref="Task"/>.
3810/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3813/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3816/// <returns>A new continuation <see cref="Task"/>.</returns>
3818/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3825public Task ContinueWith(Action<Task> continuationAction)
3831/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3834/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3838/// <returns>A new continuation <see cref="Task"/>.</returns>
3840/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3847public Task ContinueWith(Action<Task> continuationAction, CancellationToken cancellationToken)
3853/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3856/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3862/// <returns>A new continuation <see cref="Task"/>.</returns>
3864/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3874public Task ContinueWith(Action<Task> continuationAction, TaskScheduler scheduler)
3880/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3883/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3893/// <returns>A new continuation <see cref="Task"/>.</returns>
3895/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3907public Task ContinueWith(Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
3913/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3916/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3931/// <returns>A new continuation <see cref="Task"/>.</returns>
3933/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
3947public Task ContinueWith(Action<Task> continuationAction, CancellationToken cancellationToken,
3954private Task ContinueWith(Action<Task> continuationAction, TaskScheduler scheduler,
3971Task continuationTask = new ContinuationTaskFromTask(
3987/// Creates a continuation that executes when the target <see cref="Task"/> completes.
3990/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
3994/// <returns>A new continuation <see cref="Task"/>.</returns>
3996/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
4003public Task ContinueWith(Action<Task, object?> continuationAction, object? state)
4009/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4012/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
4017/// <returns>A new continuation <see cref="Task"/>.</returns>
4019/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
4026public Task ContinueWith(Action<Task, object?> continuationAction, object? state, CancellationToken cancellationToken)
4032/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4035/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
4042/// <returns>A new continuation <see cref="Task"/>.</returns>
4044/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
4054public Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskScheduler scheduler)
4060/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4063/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
4074/// <returns>A new continuation <see cref="Task"/>.</returns>
4076/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
4088public Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskContinuationOptions continuationOptions)
4094/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4097/// An action to run when the <see cref="Task"/> completes. When run, the delegate will be
4113/// <returns>A new continuation <see cref="Task"/>.</returns>
4115/// The returned <see cref="Task"/> will not be scheduled for execution until the current task has
4129public Task ContinueWith(Action<Task, object?> continuationAction, object? state, CancellationToken cancellationToken,
4136private Task ContinueWith(Action<Task, object?> continuationAction, object? state, TaskScheduler scheduler,
4153Task continuationTask = new ContinuationTaskFromTask(
4170/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4176/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4188public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction)
4195/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4201/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4217public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
4223/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4229/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4247public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler)
4253/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4259/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4283public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
4289/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4295/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4329public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
4336private Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler,
4369/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4375/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4388public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state)
4395/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4401/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4418public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, CancellationToken cancellationToken)
4424/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4430/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4449public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskScheduler scheduler)
4455/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4461/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4486public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskContinuationOptions continuationOptions)
4492/// Creates a continuation that executes when the target <see cref="Task"/> completes.
4498/// A function to run when the <see cref="Task"/> completes. When run, the delegate will be
4533public Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, CancellationToken cancellationToken,
4540private Task<TResult> ContinueWith<TResult>(Func<Task, object?, TResult> continuationFunction, object? state, TaskScheduler scheduler,
4633internal void ContinueWithCore(Task continuationTask,
4873/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4876/// An array of <see cref="Task"/> instances on which to wait.
4885/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4886/// the execution of at least one of the <see cref="Task"/> instances.
4890public static void WaitAll(params Task[] tasks)
4902/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4905/// An array of <see cref="Task"/> instances on which to wait.
4911/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4912/// the execution of at least one of the <see cref="Task"/> instances.
4915public static void WaitAll(params ReadOnlySpan<Task> tasks)
4922/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4925/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
4929/// An array of <see cref="Task"/> instances on which to wait.
4942/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4943/// the execution of at least one of the <see cref="Task"/> instances.
4952public static bool WaitAll(Task[] tasks, TimeSpan timeout)
4969/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
4972/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
4978/// <param name="tasks">An array of <see cref="Task"/> instances on which to wait.
4987/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
4988/// the execution of at least one of the <see cref="Task"/> instances.
4996public static bool WaitAll(Task[] tasks, int millisecondsTimeout)
5007/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
5010/// An array of <see cref="Task"/> instances on which to wait.
5022/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
5023/// the execution of at least one of the <see cref="Task"/> instances.
5030public static void WaitAll(Task[] tasks, CancellationToken cancellationToken)
5041/// Waits for all of the provided <see cref="Task"/> objects to complete execution.
5044/// true if all of the <see cref="Task"/> instances completed execution within the allotted time;
5048/// An array of <see cref="Task"/> instances on which to wait.
5064/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
5065/// the execution of at least one of the <see cref="Task"/> instances.
5076public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5086/// <summary>Waits for all of the provided <see cref="Task"/> objects to complete execution unless the wait is cancelled.</summary>
5091/// <exception cref="ObjectDisposedException">One or more of the <see cref="Task"/> objects in tasks has been disposed.</exception>
5094/// At least one of the <see cref="Task"/> instances was canceled. If a task was canceled, the <see cref="AggregateException"/>
5098public static void WaitAll(IEnumerable<Task> tasks, CancellationToken cancellationToken = default)
5105ReadOnlySpan<Task> span =
5106tasks is List<Task> list ? CollectionsMarshal.AsSpan(list) :
5107tasks is Task[] array ? array :
5108CollectionsMarshal.AsSpan(new List<Task>(tasks));
5116private static bool WaitAllCore(ReadOnlySpan<Task> tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5132List<Task>? waitedOnTaskList = null;
5133List<Task>? notificationTasks = null;
5143Task task = tasks[i];
5189foreach (Task task in waitedOnTaskList)
5206foreach (Task task in notificationTasks)
5223foreach (Task task in tasks) AddExceptionsForCompletedTask(ref exceptions, task);
5248private static bool WaitAllBlockingCore(List<Task> tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5259foreach (Task task in tasks)
5269foreach (Task task in tasks)
5303public void Invoke(Task completingTask)
5317internal static void AddExceptionsForCompletedTask(ref List<Exception>? exceptions, Task t)
5333/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5336/// An array of <see cref="Task"/> instances on which to wait.
5346public static int WaitAny(params Task[] tasks)
5354/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5357/// An array of <see cref="Task"/> instances on which to wait.
5379public static int WaitAny(Task[] tasks, TimeSpan timeout)
5391/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5394/// An array of <see cref="Task"/> instances on which to wait.
5412public static int WaitAny(Task[] tasks, CancellationToken cancellationToken)
5418/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5421/// An array of <see cref="Task"/> instances on which to wait.
5442public static int WaitAny(Task[] tasks, int millisecondsTimeout)
5448/// Waits for any of the provided <see cref="Task"/> objects to complete execution.
5451/// An array of <see cref="Task"/> instances on which to wait.
5478public static int WaitAny(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) =>
5483private static int WaitAnyCore(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
5503Task task = tasks[taskIndex];
5522Task<Task> firstCompleted = TaskFactory.CommonCWAnyLogic(tasks, isSyncBlocking: true);
5608public static Task FromException(Exception exception)
5612var task = new Task();
5632/// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified token.</summary>
5635public static Task FromCanceled(CancellationToken cancellationToken)
5653/// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified exception.</summary>
5656internal static Task FromCanceled(OperationCanceledException exception)
5660var task = new Task();
5692public static Task Run(Action action)
5710public static Task Run(Action action, CancellationToken cancellationToken)
5757public static Task Run(Func<Task?> function)
5775public static Task Run(Func<Task?> function, CancellationToken cancellationToken)
5784Task<Task?> task1 = Task<Task?>.Factory.StartNew(function, cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
5852public static Task Delay(TimeSpan delay) => Delay(delay, TimeProvider.System, default);
5861public static Task Delay(TimeSpan delay, TimeProvider timeProvider) => Delay(delay, timeProvider, default);
5881public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) =>
5892public static Task Delay(TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken)
5909public static Task Delay(int millisecondsDelay) => Delay(millisecondsDelay, default);
5929public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken)
5940private static Task Delay(uint millisecondsDelay, TimeProvider timeProvider, CancellationToken cancellationToken) =>
6096public static Task WhenAll(IEnumerable<Task> tasks)
6104if (tasks is ICollection<Task> taskCollection)
6106if (tasks is Task[] taskArray)
6108return WhenAll((ReadOnlySpan<Task>)taskArray);
6111if (tasks is List<Task> taskList)
6121ValueListBuilder<Task> builder = count is > 8 ?
6122new ValueListBuilder<Task>(count.Value) :
6123new ValueListBuilder<Task>([null, null, null, null, null, null, null, null]);
6124foreach (Task task in tasks)
6129Task t = WhenAll(builder.AsSpan());
6162public static Task WhenAll(params Task[] tasks)
6169return WhenAll((ReadOnlySpan<Task>)tasks);
6194 public static Task WhenAll(params ReadOnlySpan<Task> tasks)
6202Task t = tasks[0];
6220internal WhenAllPromise(ReadOnlySpan<Task> tasks)
6231foreach (Task task in tasks)
6251foreach (Task task in tasks)
6264public void Invoke(Task? completedTask)
6288if (failedOrCanceled is List<Task> list)
6298Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
6299Task first = (Task)failedOrCanceled;
6300failedOrCanceled = Interlocked.CompareExchange(ref m_stateObject, new List<Task> { first, completedTask }, first);
6307Debug.Assert(failedOrCanceled is List<Task>);
6336Task? canceledTask = null;
6338void HandleTask(Task task)
6353if (failedOrCanceled is List<Task> list)
6355foreach (Task task in list)
6362Debug.Assert(failedOrCanceled is Task);
6363HandleTask((Task)failedOrCanceled);
6595public void Invoke(Task ignored)
6606Task? canceledTask = null;
6692public static Task<Task> WhenAny(params Task[] tasks)
6696return WhenAnyCore((ReadOnlySpan<Task>)tasks);
6711public static Task<Task> WhenAny(params ReadOnlySpan<Task> tasks) =>
6726private static Task<TTask> WhenAnyCore<TTask>(ReadOnlySpan<TTask> tasks) where TTask : Task
6764public static Task<Task> WhenAny(Task task1, Task task2) =>
6765WhenAny<Task>(task1, task2);
6778private static Task<TTask> WhenAny<TTask>(TTask task1, TTask task2) where TTask : Task
6795private sealed class TwoTaskWhenAnyPromise<TTask> : Task<TTask>, ITaskCompletionAction where TTask : Task
6830public void Invoke(Task completingTask)
6832Task? task1;
6835Task? task2 = _task2;
6884public static Task<Task> WhenAny(IEnumerable<Task> tasks) =>
6885WhenAny<Task>(tasks);
6900private static Task<TTask> WhenAny<TTask>(IEnumerable<TTask> tasks) where TTask : Task
7046public static IAsyncEnumerable<Task> WhenEach(params Task[] tasks)
7049return WhenEach((ReadOnlySpan<Task>)tasks);
7052/// <inheritdoc cref="WhenEach(Task[])"/>
7054public static IAsyncEnumerable<Task> WhenEach(params ReadOnlySpan<Task> tasks) =>
7055WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));
7057/// <inheritdoc cref="WhenEach(Task[])"/>
7059public static IAsyncEnumerable<Task> WhenEach(IEnumerable<Task> tasks) =>
7060WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));
7062/// <inheritdoc cref="WhenEach(Task[])"/>
7071/// <inheritdoc cref="WhenEach(Task[])"/>
7075WhenEachState.Iterate<Task<TResult>>(WhenEachState.Create(ReadOnlySpan<Task>.CastUp(tasks)));
7077/// <inheritdoc cref="WhenEach(Task[])"/>
7084private sealed class WhenEachState : Queue<Task>, IValueTaskSource, ITaskCompletionAction
7100void ITaskCompletionAction.Invoke(Task completingTask)
7124public static WhenEachState? Create(ReadOnlySpan<Task> tasks)
7131foreach (Task task in tasks)
7146/// <inheritdoc cref="Create(ReadOnlySpan{Task})"/>
7147public static WhenEachState? Create(IEnumerable<Task> tasks)
7153IEnumerator<Task> e = tasks.GetEnumerator();
7159Task task = e.Current;
7175public static async IAsyncEnumerable<T> Iterate<T>(WhenEachState? waiter, [EnumeratorCancellation] CancellationToken cancellationToken = default) where T : Task
7192Task? next;
7229internal static Task<TResult> CreateUnwrapPromise<TResult>(Task outerTask, bool lookForOce)
7261if (continuationObject is Task continuationTask)
7272return [new Action<Task>(singleCompletionAction.Invoke)];
7299private static Task? GetActiveTaskFromId(int taskId)
7301Task? task = null;
7310private readonly Task m_completingTask;
7312internal CompletionActionInvoker(ITaskCompletionAction action, Task completingTask)
7327private readonly Task m_task;
7329public SystemThreadingTasks_TaskDebugView(Task task)
7543void Invoke(Task completingTask);
7573public UnwrapPromise(Task outerTask, bool lookForOce)
7599public void Invoke(Task completingTask)
7619private void InvokeCore(Task completingTask)
7639private void InvokeCoreAsync(Task completingTask)
7648var tuple = (TupleSlim<UnwrapPromise<TResult>, Task>)state!;
7650}, new TupleSlim<UnwrapPromise<TResult>, Task>(this, completingTask));
7655private void ProcessCompletedOuterTask(Task task)
7676taskOfTaskOfTResult.Result : ((Task<Task>)task).Result);
7685private bool TrySetFromTask(Task task, bool lookForOce)
7732private void ProcessInnerTask(Task? task)
src\runtime\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)
507Task task = CreateTask(static state =>
515Task.ThrowAsync(exception, targetContext: null);
561protected static Task CreateTask(Action<object?> action, object? state, TaskScheduler scheduler, ExecutionContext? capturedContext)
577internal override void Run(Task task, bool canInlineContinuationTask)
586RunCallback(GetInvokeActionCallback(), m_action, ref Task.t_currentTask); // any exceptions from m_action will be handled by s_callbackRunAction
593m_continuationId = Task.NewId();
695protected void RunCallback(ContextCallback callback, object? state, ref Task? currentTask)
698Debug.Assert(currentTask == Task.t_currentTask);
702Task? prevCurrentTask = currentTask;
721Task.ThrowAsync(exception, targetContext: null);
743ref Task? currentTask = ref Task.t_currentTask;
744Task? prevCurrentTask = currentTask;
761Task.ThrowAsync(exception, targetContext: null);
779ref Task? currentTask = ref Task.t_currentTask;
780Task? prevCurrentTask = currentTask;
820Task.ThrowAsync(exception, targetContext: null);
831internal static void UnsafeScheduleAction(Action action, Task? task)
838atc.m_continuationId = Task.NewId();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskFactory_T.cs (82)
42private TaskScheduler GetDefaultScheduler(Task? currTask)
253/// <see cref="Task.Start()">Start</see> to schedule it for execution.
259Task? currTask = Task.InternalCurrent;
280/// <see cref="Task.Start()">Start</see> to schedule it for execution.
286Task? currTask = Task.InternalCurrent;
309/// <see cref="Task.Start()">Start</see> to schedule it for execution.
315Task? currTask = Task.InternalCurrent;
349/// <see cref="Task.Start()">Start</see> to schedule it for execution.
356Task.InternalCurrentIfAttached(creationOptions), function, cancellationToken,
374/// <see cref="Task.Start()">Start</see> to schedule it for execution.
380Task? currTask = Task.InternalCurrent;
403/// <see cref="Task.Start()">Start</see> to schedule it for execution.
409Task? currTask = Task.InternalCurrent;
434/// <see cref="Task.Start()">Start</see> to schedule it for execution.
440Task? currTask = Task.InternalCurrent;
476/// <see cref="Task.Start()">Start</see> to schedule it for execution.
482return Task<TResult>.StartNew(Task.InternalCurrentIfAttached(creationOptions), function, state, cancellationToken,
532if (Task.s_asyncDebuggingEnabled)
533Task.RemoveFromActiveTasks(promise);
654if (Task.s_asyncDebuggingEnabled)
655Task.AddToActiveTasks(promise);
660Task t = new Task(new Action<object>(delegate
670if (Task.s_asyncDebuggingEnabled)
671Task.AddToActiveTasks(t);
773if (Task.s_asyncDebuggingEnabled)
774Task.AddToActiveTasks(promise);
795if (Task.s_asyncDebuggingEnabled)
796Task.RemoveFromActiveTasks(promise);
890if (Task.s_asyncDebuggingEnabled)
891Task.AddToActiveTasks(promise);
912if (Task.s_asyncDebuggingEnabled)
913Task.RemoveFromActiveTasks(promise);
1015if (Task.s_asyncDebuggingEnabled)
1016Task.AddToActiveTasks(promise);
1037if (Task.s_asyncDebuggingEnabled)
1038Task.RemoveFromActiveTasks(promise);
1148if (Task.s_asyncDebuggingEnabled)
1149Task.AddToActiveTasks(promise);
1170if (Task.s_asyncDebuggingEnabled)
1171Task.RemoveFromActiveTasks(promise);
1327Task.CreationOptionsFromContinuationOptions(continuationOptions, out TaskCreationOptions tco, out _);
1351public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction)
1379public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
1413public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1434/// cref="Task">Task</see>.</param>
1457public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction,
1651internal static Task<TResult> ContinueWhenAllImpl(Task[] tasks,
1652Func<Task[], TResult>? continuationFunction, Action<Task[]>? continuationAction,
1662Task[] tasksCopy = TaskFactory.CheckMultiContinuationTasksAndCopy(tasks);
1673Task<Task[]> starter = TaskFactory.CommonCWAllLogic(tasksCopy);
1682Debug.Assert(state is Func<Task[], TResult>);
1683return ((Func<Task[], TResult>)state)(completedTasks.Result);
1694Debug.Assert(state is Action<Task[]>);
1695((Action<Task[]>)state)(completedTasks.Result); return default!;
1721public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction)
1749public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
1783public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1804/// cref="Task">Task</see>.</param>
1827public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction,
1973internal static Task<TResult> ContinueWhenAnyImpl(Task[] tasks,
1974Func<Task, TResult>? continuationFunction, Action<Task>? continuationAction,
1986Task<Task> starter = TaskFactory.CommonCWAnyLogic(tasks);
2002Debug.Assert(state is Func<Task, TResult>);
2003return ((Func<Task, TResult>)state)(completedTask.Result);
2013Debug.Assert(state is Action<Task>);
2014((Action<Task>)state)(completedTask.Result);
src\runtime\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] ?? throw new ArgumentException(SR.Task_MultiTaskContinuation_NullTask, nameof(tasks));
2391internal static void CommonCWAnyLogicCleanup(Task<Task> continuation)
2395((CompleteOnInvokePromise<Task>)continuation).Invoke(null!);
2399/// Creates a continuation <see cref="Task">Task</see>
2405/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2414public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction)
2422/// Creates a continuation <see cref="Task">Task</see>
2430/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2442public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken)
2450/// Creates a continuation <see cref="Task">Task</see>
2458/// the created continuation <see cref="Task">Task</see>.</param>
2459/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2476public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
2484/// Creates a continuation <see cref="Task">Task</see>
2494/// the created continuation <see cref="Task">Task</see>.</param>
2497/// cref="Task">Task</see>.</param>
2498/// <returns>The new continuation <see cref="Task">Task</see>.</returns>
2520public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken,
2549public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction)
2581public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
2619public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
2667public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
2829/// Creates a continuation <see cref="Task">Task</see>
2836/// <returns>The new continuation <see cref="Task"/>.</returns>
2845public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction)
2853/// Creates a continuation <see cref="Task">Task</see>
2862/// <returns>The new continuation <see cref="Task"/>.</returns>
2874public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2883/// Creates a continuation <see cref="Task">Task</see>
2892/// the created continuation <see cref="Task">Task</see>.</param>
2893/// <returns>The new continuation <see cref="Task"/>.</returns>
2910public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2919/// Creates a continuation <see cref="Task">Task</see>
2930/// the created continuation <see cref="Task">Task</see>.</param>
2934/// <returns>The new continuation <see cref="Task"/>.</returns>
2956public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
2966internal static Task[] CheckMultiContinuationTasksAndCopy(Task[] tasks)
2973Task[] 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)
702private Task FlushEncoderAsync()
716return Task.CompletedTask;
872protected async Task WriteAttributeTextBlockAsync(char[] chars, int index, int count)
889protected Task WriteAttributeTextBlockAsync(string text)
903return Task.CompletedTask;
906private async Task _WriteAttributeTextBlockAsync(string text, int curIndex, int leftCount)
1083protected async Task WriteElementTextBlockAsync(char[] chars, int index, int count)
1108protected Task WriteElementTextBlockAsync(string text)
1127return Task.CompletedTask;
1130private async Task _WriteElementTextBlockAsync(bool newLine, string text, int curIndex, int leftCount)
1246protected Task RawTextAsync(string text)
1251Task.CompletedTask;
1254protected Task RawTextAsync(string text1, string? text2 = null, string? text3 = null, string? text4 = null)
1307return Task.CompletedTask;
1310private async Task _RawTextAsync(
1482protected async Task WriteRawWithCharCheckingAsync(char[] chars, int index, int count)
1506protected async Task WriteRawWithCharCheckingAsync(string text)
1684protected async Task WriteCommentOrPiAsync(string text, int stopChar)
1868protected async Task WriteCDataSectionAsync(string text)
1905public override async Task WriteDocTypeAsync(string name, string? pubid, string? sysid, string? subset)
1916public override async Task WriteStartElementAsync(string? prefix, string localName, string? ns)
1932internal override async Task WriteEndElementAsync(string prefix, string localName, string ns)
1950internal override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
1969protected internal override async Task WriteStartAttributeAsync(string? prefix, string localName, string? ns)
1982internal override async Task WriteStartNamespaceDeclarationAsync(string prefix)
1994public override Task WriteCDataAsync(string? text)
2001public override async Task WriteCommentAsync(string? text)
2012public override async Task WriteProcessingInstructionAsync(string target, string? text)
2023public override Task WriteEntityRefAsync(string name)
2030public override Task WriteCharEntityAsync(char ch)
2037public override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
2044public override Task WriteWhitespaceAsync(string? ws)
2051public override Task WriteStringAsync(string? text)
2058public override Task WriteCharsAsync(char[] buffer, int index, int count)
2065public override Task WriteRawAsync(char[] buffer, int index, int count)
2072public override Task WriteRawAsync(string data)
2079public override Task WriteBase64Async(byte[] buffer, int index, int count)
2087private 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 (26)
System.Security.Cryptography (11)
System.Security.Cryptography.Cose (4)
System.Security.Principal.Windows (3)
System.ServiceModel.Federation (27)
System\ServiceModel\Federation\WSTrustChannelSecurityTokenProvider.cs (7)
243await Task.Factory.FromAsync(channel.BeginOpen, channel.EndOpen, null, TaskCreationOptions.None);
247Message reply = await Task.Factory.FromAsync(channel.BeginRequest, channel.EndRequest, requestMessage, null, TaskCreationOptions.None);
254await Task.Factory.FromAsync(channel.BeginClose, channel.EndClose, null, TaskCreationOptions.None);
448async Task ISecurityCommunicationObject.OnCloseAsync(TimeSpan timeout)
452await Task.Factory.FromAsync(ChannelFactory.BeginClose, ChannelFactory.EndClose, timeout, null, TaskCreationOptions.None);
457async Task ISecurityCommunicationObject.OnOpenAsync(TimeSpan timeout)
469await Task.Factory.FromAsync(channelFactory.BeginOpen, channelFactory.EndOpen, null, TaskCreationOptions.None);
System.ServiceModel.Http (48)
System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (19)
82Task closeTask = CloseAsync();
101Task task = CloseOutputAsync(CancellationToken.None);
105protected override async Task CloseOutputSessionCoreAsync(TimeSpan timeout)
149protected internal override async Task OnCloseAsync(TimeSpan timeout)
181Task task = WebSocket.SendAsync(messageData, outgoingMessageType, true, helper.GetCancellationToken());
232Task task = CloseOutputAsync(helper.GetCancellationToken());
273Task task = WebSocket.SendAsync(messageData, outgoingMessageType, true, helper.GetCancellationToken());
336private Task CloseAsync()
342return Task.CompletedTask; // Nothing to do here.
358private Task CloseOutputAsync(CancellationToken cancellationToken)
380private async void HandleCloseOutputAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
396private async void HandleSendAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
533private async Task ReadBufferedMessageAsync()
1002return Task.FromResult(0);
1007return Task.FromResult(GetBytesFromInitialReadBuffer(buffer, offset, count));
1014return Task.FromResult(0);
1095public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1135private async Task WriteAsyncInternal(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
1155Task task = _webSocket.SendAsync(new ArraySegment<byte>(Array.Empty<byte>(), 0, 0), _outgoingMessageType, true, timeoutHelper.GetCancellationToken());
System.ServiceModel.NetFramingBase (45)
System\ServiceModel\Security\SecurityUtilsEx.cs (10)
38internal static Task CloseTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
43internal static Task OpenTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
53internal static Task CloseTokenAuthenticatorIfRequiredAsync(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
58internal static Task OpenTokenAuthenticatorIfRequiredAsync(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
85private static Task CloseCommunicationObjectAsync(object obj, TimeSpan timeout)
92return Task.Factory.FromAsync(co.BeginClose, co.EndClose, timeout, null, TaskCreationOptions.None);
100return Task.CompletedTask;
103private static Task OpenCommunicationObjectAsync(ICommunicationObject obj, TimeSpan timeout)
107return Task.Factory.FromAsync(obj.BeginOpen, obj.EndOpen, timeout, null);
110return Task.CompletedTask;
System.ServiceModel.NetNamedPipe (2)
System.ServiceModel.NetTcp (2)
System.ServiceModel.Primitives (428)
Internals\System\Runtime\ActionItem.cs (13)
34public static void Schedule(Func<object, Task> callback, object state)
50protected abstract Task InvokeAsync();
80private static void ScheduleCallback(Func<object, Task> callback, object state)
86Task<Task>.Factory.StartNew(callback, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, IOThreadScheduler.IOTaskScheduler);
94private void ScheduleCallback(Func<object, Task> callback)
102private static Func<object, Task> s_invokeAsyncCallback;
122public static Func<object, Task> InvokeAsyncCallbackFunc
128s_invokeAsyncCallback = new Func<object, Task>(InvokeAsyncCallback);
134private static async Task InvokeAsyncCallback(object state)
149private Func<object, Task> _asyncCallback;
171public DefaultActionItem(Func<object, Task> callback, object state)
204protected override Task InvokeAsync()
261private async Task TraceAndInvokeAsync()
Internals\System\Runtime\TaskHelpers.cs (23)
16public static async Task AsyncWait<TException>(this Task task)
88public static Task ToApm(this Task task, AsyncCallback callback, object state)
154Task task = iar as Task;
191public static Task CloseHelperAsync(this ICommunicationObject communicationObject, TimeSpan timeout)
199return Task.Factory.FromAsync(communicationObject.BeginClose, communicationObject.EndClose, timeout, null);
203public static Task OpenHelperAsync(this ICommunicationObject communicationObject, TimeSpan timeout)
211return Task.Factory.FromAsync(communicationObject.BeginOpen, communicationObject.EndOpen, timeout, null);
219public static async Task<bool> AwaitWithTimeout(this Task task, TimeSpan timeout)
234var completedTask = await Task.WhenAny(task, Task.Delay(timeout, cts.Token));
250public static void WaitForCompletion(this Task task)
262public static void WaitForCompletionNoSpin(this Task task)
297public static bool WaitForCompletionNoSpin(this Task task, TimeSpan timeout)
325public static void Wait(this Task task, TimeSpan timeout, Action<Exception, TimeSpan, string> exceptionConverter, string operationType)
349public static Task CompletedTask()
351return Task.FromResult(true);
383public static async Task CallActionAsync<TArg>(Action<TArg> action, TArg argument)
392await Task.Yield();
452Task.Run(continuation);
System\ServiceModel\Channels\ClientReliableChannelBinder.cs (10)
120protected override Task OnCloseAsync(TimeSpan timeout)
122return Task.CompletedTask;
125protected override Task OnOpenAsync(TimeSpan timeout)
127return Task.CompletedTask;
220return Task.FromResult(true);
272protected override Task OnSendAsync(TDuplexChannel channel, Message message,
281return Task.Factory.FromAsync(channel.BeginSend, channel.EndSend, message, timeout, null);
364protected override Task CloseChannelAsync(IDuplexSessionChannel channel, TimeSpan timeout)
458return Task.Factory.FromAsync(channel.BeginRequest, channel.EndRequest, message, timeout, null);
462protected override async Task OnSendAsync(TRequestChannel channel, Message message,
System\ServiceModel\Channels\ClientReliableDuplexSessionChannel.cs (26)
26protected static Func<object, Task> s_startReceivingAsyncStatic = new Func<object, Task>(StartReceivingAsyncStatic);
33_acknowledgementTimer = new IOThreadTimer(new Func<object, Task>(OnAcknowledgementTimeoutElapsedAsync), null, true);
82private Task CloseSequenceAsync(TimeSpan timeout)
192private async Task InternalCloseOutputSessionAsync(TimeSpan timeout)
237protected async Task ProcessDuplexMessageAsync(WsrmMessageInfo info)
620protected abstract Task ProcessMessageAsync(WsrmMessageInfo info);
647private async Task OnAcknowledgementTimeoutElapsedAsync(object state)
715protected internal override async Task OnCloseAsync(TimeSpan timeout)
750protected async Task OnCloseOutputSessionAsync(TimeSpan timeout)
824protected override async Task OnSendAsync(Message message, TimeSpan timeout)
830private async Task OnSendAsyncHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException)
876private async Task OnSendAckRequestedAsyncHandler(TimeSpan timeout)
923private static Task StartReceivingAsyncStatic(object state)
929protected async Task StartReceivingAsync()
981private async Task TerminateSequenceAsync(TimeSpan timeout)
1078private static Func<object, Task> s_onReconnectTimerElapsed = new Func<object, Task>(OnReconnectTimerElapsed);
1114protected internal override Task OnCloseAsync(TimeSpan timeout)
1149protected internal override async Task OnOpenAsync(TimeSpan timeout)
1181private static async Task OnReconnectTimerElapsed(object state)
1203private async Task PollingAsyncCallback()
1212protected override Task ProcessMessageAsync(WsrmMessageInfo info)
1215return Task.CompletedTask;
1218return Task.CompletedTask;
1223private async Task ReconnectAsync()
System\ServiceModel\Channels\CommunicationObject.cs (16)
223private async Task CloseAsyncInternal(TimeSpan timeout)
229async Task IAsyncCommunicationObject.CloseAsync(TimeSpan timeout)
306private async Task OnCloseAsyncInternal(TimeSpan timeout)
327await Task.Factory.FromAsync(OnBeginClose, OnEndClose, timeout, TaskCreationOptions.RunContinuationsAsynchronously);
501private Task OpenAsyncInternal(TimeSpan timeout)
506async Task IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
556private async Task OnOpenAsyncInternal(TimeSpan timeout)
576await Task.Factory.FromAsync(OnBeginOpen, OnEndOpen, timeout, TaskCreationOptions.RunContinuationsAsynchronously);
997internal protected virtual Task OnCloseAsync(TimeSpan timeout)
1006internal protected virtual Task OnOpenAsync(TimeSpan timeout)
1017internal Task OpenOtherAsync(ICommunicationObject other, TimeSpan timeout)
1041return Task.Factory.FromAsync(other.BeginOpen, other.EndOpen, timeout, null);
1047internal Task CloseOtherAsync(ICommunicationObject other, TimeSpan timeout)
1071return Task.Factory.FromAsync(other.BeginClose, other.EndClose, timeout, null);
1171public static async Task OnCloseAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
1177public static async Task OnOpenAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
System\ServiceModel\Channels\DelegatingStream.cs (3)
75public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => BaseStream.CopyToAsync(destination, bufferSize, cancellationToken);
77public override Task FlushAsync(CancellationToken cancellationToken) => BaseStream.FlushAsync(cancellationToken);
104public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => BaseStream.WriteAsync(buffer, offset, count, cancellationToken);
System\ServiceModel\Channels\LayeredChannelFactory.cs (14)
57protected internal override async Task OnCloseAsync(TimeSpan timeout)
71protected internal override Task OnOpenAsync(TimeSpan timeout)
100private Task InternalOnReceiveAsync(Message message)
107return Task.CompletedTask;
110protected virtual Task OnReceiveAsync(Message message)
112return Task.CompletedTask;
129message = await Task.Factory.FromAsync(InnerChannel.BeginReceive, InnerChannel.EndReceive, timeout, null);
145message = await Task.Factory.FromAsync(InnerChannel.BeginReceive, InnerChannel.EndReceive, null);
216return Task.Factory.FromAsync(InnerChannel.BeginWaitForMessage, InnerChannel.EndWaitForMessage, timeout, null);
282protected internal override async Task OnCloseAsync(TimeSpan timeout)
295protected internal override async Task OnOpenAsync(TimeSpan timeout)
309public Task SendAsync(Message message)
314public Task SendAsync(Message message, TimeSpan timeout)
322return Task.Factory.FromAsync(_innerOutputChannel.BeginSend, _innerOutputChannel.EndSend, message, timeout, null);
System\ServiceModel\Channels\ReliableChannelBinder.cs (17)
236public Task CloseAsync(TimeSpan timeout)
241public async Task CloseAsync(TimeSpan timeout, MaskingMode maskingMode)
314protected virtual Task CloseChannelAsync(TChannel channel, TimeSpan timeout)
453protected abstract Task OnCloseAsync(TimeSpan timeout);
489protected abstract Task OnOpenAsync(TimeSpan timeout);
544protected virtual Task OnSendAsync(TChannel channel, Message message, TimeSpan timeout)
554public async Task OpenAsync(TimeSpan timeout)
601public Task SendAsync(Message message, TimeSpan timeout)
606public async Task SendAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
823internal Task WaitForPendingOperationsAsync(TimeSpan timeout)
1449public async Task StartSynchronizingAsync()
1665public async Task WaitForPendingOperationsAsync(TimeSpan timeout)
1895return Task.CompletedTask.ToApm(callback, state);
1967private async Task OnReplyAsync(Message message, TimeSpan timeout)
1976await Task.Factory.FromAsync(_innerContext.BeginReply, _innerContext.EndReply, message, timeout, null);
2004internal static async Task CloseDuplexSessionChannelAsync(
2085internal static async Task CloseReplySessionChannelAsync(
System\ServiceModel\Channels\ReliableMessagingHelpers.cs (19)
16internal delegate Task OperationWithTimeoutAsyncCallback(TimeSpan timeout);
38public async Task CloseAsync(TimeSpan timeout)
109public delegate Task AsyncWaitCallback(object state);
115private static Func<object, Task> s_onTimerElapsedAsync = new Func<object, Task>(OnTimerElapsedAsync);
201private Task OnTimerElapsedAsync()
206return Task.CompletedTask;
220private static Task OnTimerElapsedAsync(object state)
471public abstract Task CloseAsync(TimeSpan timeout);
472public abstract Task SendFaultAsync(IReliableChannelBinder binder, RequestContext requestContext, Message faultMessage);
529private async Task AsyncCloseBinder(IReliableChannelBinder binder)
573public override async Task CloseAsync(TimeSpan timeout)
582protected abstract Task SendFaultAsync(IReliableChannelBinder binder, TState state, TimeSpan timeout);
607protected async Task SendFaultAsync(IReliableChannelBinder binder, TState state)
627public override async Task SendFaultAsync(IReliableChannelBinder binder, RequestContext requestContext, Message faultMessage)
694protected override async Task SendFaultAsync(IReliableChannelBinder binder, FaultState faultState, TimeSpan timeout)
697await Task.Factory.FromAsync(context.BeginReply, context.EndReply, faultState.FaultMessage, timeout, null);
724protected override async Task SendFaultAsync(IReliableChannelBinder binder, Message message, TimeSpan timeout)
857return Task.FromResult(true);
System\ServiceModel\Channels\ReliableOutputSessionChannel.cs (18)
97private async Task CloseSequenceAsync(TimeSpan timeout)
244protected internal override async Task OnCloseAsync(TimeSpan timeout)
265protected abstract Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException);
267private async Task OnConnectionSendAckRequestedAsyncHandler(TimeSpan timeout)
277private async Task OnConnectionSendAsyncHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException)
299protected abstract Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode);
333protected internal override async Task OnOpenAsync(TimeSpan timeout)
353protected override async Task OnSendAsync(Message message, TimeSpan timeout)
376private async Task PollingAsyncCallback()
428protected async Task ProcessMessageAsync(Message message)
574private async Task TerminateSequenceAsync(TimeSpan timeout)
655protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout,
694protected override async Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
734protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException)
766protected override Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
791ActionItem.Schedule(new Func<object, Task>(StartReceivingAsync), this);
810private async Task StartReceivingAsync()
851private static Task StartReceivingAsync(object state)
System\ServiceModel\Channels\SecurityChannelFactory.cs (11)
78private Task CloseProtocolFactoryAsync(bool aborted, TimeSpan timeout)
87return Task.CompletedTask;
124protected internal override async Task OnCloseAsync(TimeSpan timeout)
173protected internal override async Task OnOpenAsync(TimeSpan timeout)
223private Task OnOpenCoreAsync(TimeSpan timeout)
279protected internal override async Task OnOpenAsync(TimeSpan timeout)
357public Task SendAsync(Message message)
362public async Task SendAsync(Message message, TimeSpan timeout)
374await Task.Factory.FromAsync(InnerChannel.BeginSend, InnerChannel.EndSend, message, timeoutHelper.RemainingTime(), null);
471Message reply = await Task.Factory.FromAsync(InnerChannel.BeginRequest, InnerChannel.EndRequest, message, timeoutHelper.RemainingTime(), null);
649return Task.Factory.FromAsync(InnerDuplexChannel.BeginWaitForMessage, InnerDuplexChannel.EndWaitForMessage, timeout, null);
System\ServiceModel\Dispatcher\OperationFormatter.cs (4)
53protected virtual Task SerializeBodyAsync(XmlDictionaryWriter writer, MessageVersion version, string action, MessageDescription messageDescription, object returnValue, object[] parameters, bool isRequest)
56return Task.CompletedTask;
373private async Task SerializeBodyContentsAsync(XmlDictionaryWriter writer, MessageVersion version, object[] parameters, object returnValue, bool isRequest)
777protected override Task OnWriteBodyContentsAsync(XmlDictionaryWriter writer)
System\ServiceModel\Security\SecurityUtils.cs (10)
506internal static Task OpenTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
516return Task.Factory.FromAsync(communicationObject.BeginOpen, communicationObject.EndOpen, timeout, null, TaskCreationOptions.None);
519return Task.CompletedTask;
527internal static Task CloseTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
537return Task.Factory.FromAsync(communicationObject.BeginClose, communicationObject.EndClose, timeout, null, TaskCreationOptions.None);
540return Task.CompletedTask;
563private static Task OpenCommunicationObjectAsync(IAsyncCommunicationObject obj, TimeSpan timeout)
570return Task.CompletedTask;
573private static Task CloseCommunicationObjectAsync(IAsyncCommunicationObject obj, bool aborted, TimeSpan timeout)
593return Task.CompletedTask;
System.ServiceModel.Primitives.Tests (29)
ServiceModel\ThrowingOnCloseBindingElement.cs (7)
79return ToApm(Task.Factory.FromAsync(_innerFactory.BeginOpen, _innerFactory.EndOpen, timeout, null), callback, state);
114private async Task OnCloseAsyncImpl(TimeSpan timeout)
121await Task.Factory.FromAsync(base.OnBeginClose, base.OnEndClose, timeout, null);
122await Task.Factory.FromAsync(_innerFactory.BeginClose, _innerFactory.EndClose, timeout, null);
160private static Task ToApm(Task task, AsyncCallback callback, object state)
181((Task)iar).GetAwaiter().GetResult();
System.ServiceModel.UnixDomainSocket (9)
System.Text.Json (28)
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\runtime\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 (47)
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)
223ParallelEtwProvider.Log.ParallelInvokeBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
329Task[] tasks = new Task[actionsCopy.Length];
337tasks[i] = Task.Factory.StartNew(actionsCopy[i], parallelOptions.CancellationToken, TaskCreationOptions.None,
348Task.WaitAll(tasks);
362ParallelEtwProvider.Log.ParallelInvokeEnd(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
968ParallelEtwProvider.Log.ParallelLoopBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
1005ParallelEtwProvider.Log.ParallelFork(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
1105ParallelEtwProvider.Log.ParallelJoin(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
1150ParallelEtwProvider.Log.ParallelLoopEnd(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID, long.CreateTruncating(nTotalIterations));
2535ParallelEtwProvider.Log.ParallelLoopBegin(TaskScheduler.Current.Id, Task.CurrentId ?? 0,
2596ParallelEtwProvider.Log.ParallelFork(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
2741ParallelEtwProvider.Log.ParallelJoin(TaskScheduler.Current.Id, Task.CurrentId ?? 0, forkJoinContextID);
2789ParallelEtwProvider.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;
96Func<object, Task> taskBody = static async o =>
187return Task.FromException(e);
198public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
214public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
229public static Task ForEachAsync<TSource>(IEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
247private static Task ForEachAsync<TSource>(IEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
256return Task.FromCanceled(cancellationToken);
260Func<object, Task> taskBody = static async o =>
342return Task.FromException(e);
353public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask> body)
369public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
384public static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, ParallelOptions parallelOptions, Func<TSource, CancellationToken, ValueTask> body)
402private static Task ForEachAsync<TSource>(IAsyncEnumerable<TSource> source, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
411return Task.FromCanceled(cancellationToken);
415Func<object, Task> taskBody = static async o =>
497return Task.FromException(e);
519private readonly Func<object, Task> _taskBody;
540protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
581Task.Factory.StartNew(_taskBody!, this, default(CancellationToken), TaskCreationOptions.DenyChildAttach, _scheduler);
591public Task AcquireLock()
691IEnumerable<TSource> source, Func<object, Task> taskBody,
713IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
736T fromExclusive, T toExclusive, Func<object, Task> taskBody,
System.Windows.Extensions (2)
System.Windows.Forms (13)
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System.Windows.Forms.Primitives (2)
System.Windows.Presentation (3)
testhost (5)
testhost.arm64 (5)
testhost.x86 (5)
Testing.Tests (18)
TestingAppHost1.AppHost (4)
TestProject.AppHost (5)
TestProject.WorkerA (2)
TestShop.AppHost (1)
UnitTests.Common (4)
vbc (13)
VBCSCompiler (38)
vstest.console (5)
vstest.console.arm64 (5)
WebPubSubWeb (2)
WithDockerfile.AppHost (2)