5 types derived from CancellationTokenSource
Microsoft.AspNetCore.Http (1)
src\aspnetcore\src\Shared\CancellationTokenSourcePool.cs (1)
41public sealed class PooledCancellationTokenSource : CancellationTokenSource
Microsoft.AspNetCore.Server.Kestrel.Core (1)
src\aspnetcore\src\Shared\CancellationTokenSourcePool.cs (1)
41public sealed class PooledCancellationTokenSource : CancellationTokenSource
System.Private.CoreLib (3)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (3)
889private sealed class Linked1CancellationTokenSource : CancellationTokenSource 910private sealed class Linked2CancellationTokenSource : CancellationTokenSource 934private sealed class LinkedNCancellationTokenSource : CancellationTokenSource
1047 instantiations of CancellationTokenSource
aspire (15)
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
239using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Backchannel\ResourceSnapshotWatcher.cs (1)
16private readonly CancellationTokenSource _cts = new();
Commands\BaseCommand.cs (1)
286using var flushCancellationTokenSource = new CancellationTokenSource(s_extensionInteractionFlushTimeout);
Commands\DashboardRunCommand.cs (1)
441using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
ConsoleCancellationManager.cs (2)
66private readonly CancellationTokenSource _cts = new(); 67private readonly CancellationTokenSource _gracefulCts = new();
DotNet\ProcessExecution.cs (2)
347using var killDrain = new CancellationTokenSource(TimeSpan.FromSeconds(1)); 376using var drainCts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Interaction\ExtensionInteractionService.cs (1)
34private readonly CancellationTokenSource _cts = new();
Profiling\ProfileCaptureService.cs (2)
273using var timeoutCts = new CancellationTokenSource(timeout, _timeProvider); 390using var timeoutCts = new CancellationTokenSource(_profileDataTimeout, _timeProvider);
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
Telemetry\InternalMicrosoftDetector.cs (1)
618using var timeoutSource = new CancellationTokenSource(_gitHubCandidateTimeout);
Utils\EnvironmentChecker\DcpConnectionChecker.cs (1)
358using var exitCts = new CancellationTokenSource(s_processExitTimeout);
Utils\ProcessCaptureRunner.cs (1)
191using var cts = new CancellationTokenSource(bound);
aspire-managed (3)
Program.cs (2)
47using var shutdownCts = new CancellationTokenSource(); 73using var operationCts = new CancellationTokenSource();
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
Aspire.Acquisition.Tests (2)
Scripts\Common\ScriptHostFixture.cs (1)
57_cts = new CancellationTokenSource();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Azure.Messaging.WebPubSub.Tests (1)
AspireWebPubSubExtensionsTests.cs (1)
295using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Azure.Search.Documents.Tests (1)
AspireAzureSearchExtensionsTests.cs (1)
135using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Cli.Tests (82)
Acquisition\PeerInstallProbeTests.cs (1)
396using var cts = new CancellationTokenSource();
Agents\AgentEnvironmentApplicatorTests.cs (1)
31using var cts = new CancellationTokenSource();
Agents\AspireSkillsInstallerTests.cs (3)
921using var cancellationTokenSource = new CancellationTokenSource(); 1157using var cancellationTokenSource = new CancellationTokenSource(); 1539using var cancellationTokenSource = new CancellationTokenSource();
Agents\TelemetryHookScriptTests.cs (1)
525using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
38using var watchCancellation = new CancellationTokenSource();
Backchannel\AppHostCliBackchannelTests.cs (1)
75using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
Backchannel\ExtensionBackchannelTests.cs (1)
104using var firstConnectorCts = new CancellationTokenSource();
Certificates\CertificateServiceTests.cs (1)
306using var cancellationTokenSource = new CancellationTokenSource();
Certificates\UnixCertificateManagerTests.cs (1)
28using var cancellationTokenSource = new CancellationTokenSource();
Commands\AgentMcpCommandTests.cs (2)
31var cts = new CancellationTokenSource(); 444using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(200));
Commands\AppHostLauncherTests.cs (3)
705using var cts = new CancellationTokenSource(); 771using var cts = new CancellationTokenSource(); 811using var cts = new CancellationTokenSource();
Commands\BaseCommandTests.cs (2)
458using var cts = new CancellationTokenSource(); 497using var cts = new CancellationTokenSource();
Commands\DashboardRunCommandTests.cs (1)
462using var cts = new CancellationTokenSource();
Commands\DescribeCommandTests.cs (1)
409using var cts = new CancellationTokenSource();
Commands\LogsCommandTests.cs (1)
962using var cts = new CancellationTokenSource();
Commands\LsCommandTests.cs (2)
463using var cancellationTokenSource = new CancellationTokenSource(); 670using var cancellationTokenSource = new CancellationTokenSource();
Commands\PsCommandTests.cs (1)
582using var cancellationTokenSource = new CancellationTokenSource();
Commands\RunCommandTests.cs (20)
368using var cts = new CancellationTokenSource(); 625using var cts = new CancellationTokenSource(); 1536using var cts = new CancellationTokenSource(); 1597using var cts = new CancellationTokenSource(); 1598using var unrelatedCts = new CancellationTokenSource(); 2052using var cts = new CancellationTokenSource(); 2124using var cts = new CancellationTokenSource(); 2375using var cts = new CancellationTokenSource(); 2486using var cts = new CancellationTokenSource(); 2592using var cts = new CancellationTokenSource(); 2662using var cts = new CancellationTokenSource(); 2731using var cts = new CancellationTokenSource(); 2922using var cts = new CancellationTokenSource(); 2981using var cts = new CancellationTokenSource(); 3093using var cts = new CancellationTokenSource(); 3152using var cts = new CancellationTokenSource(); 3559using var cts = new CancellationTokenSource(); 3640using var cts = new CancellationTokenSource(); 4098using var cts = new CancellationTokenSource(); 4171using var cts = new CancellationTokenSource();
DotNet\ProcessExecutionDetachedTests.cs (1)
157using var cts = new CancellationTokenSource();
DotNet\ProcessExecutionTests.cs (4)
170using var cts = new CancellationTokenSource(); 198using var cts = new CancellationTokenSource(); 229using var cts = new CancellationTokenSource(); 259using var cts = new CancellationTokenSource();
DotNetSdkInstallerTests.cs (1)
59using var cancellationTokenSource = new CancellationTokenSource();
Mcp\Docs\DocsFetcherTests.cs (1)
214using var cts = new CancellationTokenSource();
Mcp\Docs\DocsIndexServiceTests.cs (1)
826using var cts = new CancellationTokenSource();
Mcp\Docs\LlmsTxtParserTests.cs (1)
512var cts = new CancellationTokenSource();
NuGet\NuGetPackagePrefetcherTests.cs (1)
112using var stoppingCts = new CancellationTokenSource();
Processes\LauncherLivenessMonitorTests.cs (4)
20using var runCts = new CancellationTokenSource(); 33using var runCts = new CancellationTokenSource(); 60using var runCts = new CancellationTokenSource(); 79using var runCts = new CancellationTokenSource();
Projects\AppHostCandidateFinderTests.cs (2)
494using var cancellationTokenSource = new CancellationTokenSource(); 507using var cancellationTokenSource = new CancellationTokenSource();
Projects\AppHostInfoResolverTests.cs (1)
156using var cancellationTokenSource = new CancellationTokenSource();
Projects\AppHostServerSessionTests.cs (5)
189using var stopCts = new CancellationTokenSource(); 218using var stopCts = new CancellationTokenSource(); 267using var stopCts = new CancellationTokenSource(); 313using var stopCts = new CancellationTokenSource(); 349using var stopCts = new CancellationTokenSource();
Projects\GuestAppHostProjectTests.cs (1)
1116using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Projects\GuestRuntimeTests.cs (2)
854using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 908using var cts = new CancellationTokenSource();
Projects\PrebuiltAppHostServerTests.cs (1)
1452using var cancellation = new CancellationTokenSource();
Projects\ProcessGuestLauncherTests.cs (5)
63using var cts = new CancellationTokenSource(); 99using var cts = new CancellationTokenSource(); 151using var cts = new CancellationTokenSource(); 210using var cts = new CancellationTokenSource(); 276using var cts = new CancellationTokenSource();
Projects\RunningInstanceManagerTests.cs (1)
66private readonly CancellationTokenSource _cts = new();
Telemetry\InternalMicrosoftDetectorTests.cs (1)
541using var safetyTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
TestServices\TestGracefulShutdownWindow.cs (1)
16private readonly CancellationTokenSource _cts = new();
Utils\DcpConnectionHealthCheckTests.cs (1)
90using var cancellation = new CancellationTokenSource();
Utils\DevCertsCheckTests.cs (1)
600using var cancellationTokenSource = new CancellationTokenSource();
Utils\EnvironmentCheckerTests.cs (1)
102using var cancellationTokenSource = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (25)
Components\Controls\ApplicationName.razor.cs (1)
36_disposalCts = new CancellationTokenSource();
Components\Controls\Chart\ChartBase.cs (1)
22private readonly CancellationTokenSource _cts = new();
Components\Controls\Chart\ChartContainer.razor.cs (1)
23private readonly CancellationTokenSource _disposeCts = new();
Components\Controls\SpanDetails.razor.cs (1)
86private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
36private readonly CancellationTokenSource _cts = new();
Components\Dialogs\FilterDialog.razor.cs (1)
20private readonly CancellationTokenSource _disposeCts = new();
Components\Dialogs\GenAIVisualizerDialog.razor.cs (1)
28private readonly CancellationTokenSource _cts = new();
Components\Dialogs\InteractionsInputDialog.razor.cs (1)
37private readonly CancellationTokenSource _disposalCts = new();
Components\Dialogs\ManageDataDialog.razor.cs (1)
68private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (4)
37private readonly CancellationTokenSource _cts = new(); 52_cts = new(); 139private readonly CancellationTokenSource _resourceSubscriptionCts = new(); 934_showNoLogsMessageCts = new();
Components\Pages\Resources.razor.cs (1)
107private readonly CancellationTokenSource _cts = new();
Components\Pages\StructuredLogs.razor.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\TraceDetail.razor.cs (1)
34private readonly CancellationTokenSource _cts = new();
Components\Pages\Traces.razor.cs (1)
32private readonly CancellationTokenSource _cts = new();
Model\DashboardCommandExecutor.cs (2)
103using var executeCommandCts = new CancellationTokenSource(); 148var closeToastCts = new CancellationTokenSource();
Model\ResourceOutgoingPeerResolver.cs (1)
42_watchContainersTokenSource = new();
Model\TraceLinkHelpers.cs (1)
48using var cts = new CancellationTokenSource();
ServiceClient\DashboardClient.cs (1)
57private readonly CancellationTokenSource _cts = new();
Utils\CallbackThrottler.cs (1)
24_cts = new CancellationTokenSource();
Utils\CancellationSeries.cs (1)
33var nextCts = new CancellationTokenSource();
Aspire.Dashboard.Components.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Dashboard.Tests (32)
ChannelExtensionsTests.cs (5)
35var cts = new CancellationTokenSource(); 57var cts = new CancellationTokenSource(); 81var cts = new CancellationTokenSource(); 105var cts = new CancellationTokenSource(); 149var cts = new CancellationTokenSource();
Integration\StartupTests.cs (1)
109using var cts = new CancellationTokenSource();
Integration\TelemetryApiTests.cs (2)
354using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 385using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Model\DashboardClientTests.cs (3)
40var cts = new CancellationTokenSource(); 126var cts = new CancellationTokenSource(); 184var cts = new CancellationTokenSource();
Model\SqliteResourceRepositoryTests.cs (2)
48using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 72using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Shared\TestHostApplicationLifetime.cs (3)
10private readonly CancellationTokenSource _started = new(); 11private readonly CancellationTokenSource _stopping = new(); 12private readonly CancellationTokenSource _stopped = new();
TelemetryRepositoryTests\SqliteTelemetryPersistenceTests.cs (1)
34using var cancellationSource = new CancellationTokenSource();
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (14)
387using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 446using var cts = new CancellationTokenSource(); 505using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 563using var cts = new CancellationTokenSource(); 658using var doneCts = new CancellationTokenSource(); 736using var doneCts = new CancellationTokenSource(); 806using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 881using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 912using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 971using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1062using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1145using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1248using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1345using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Deployment.EndToEnd.Tests (56)
AcaCompactNamingDeploymentTests.cs (2)
27using var cts = new CancellationTokenSource(s_testTimeout); 41using var cts = new CancellationTokenSource(s_testTimeout);
AcaCompactNamingUpgradeDeploymentTests.cs (1)
27using var cts = new CancellationTokenSource(s_testTimeout);
AcaCustomRegistryDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AcaDeploymentErrorOutputTests.cs (1)
30using var cts = new CancellationTokenSource(s_testTimeout);
AcaExistingRegistryDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AcaManagedRedisDeploymentTests.cs (1)
24using var cts = new CancellationTokenSource(s_testTimeout);
AcaStarterDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AcrPurgeTaskDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksAzureKubernetesEnvironmentCertManagerDeploymentTests.cs (1)
34using var cts = new CancellationTokenSource(s_testTimeout);
AksAzureKubernetesEnvironmentCertManagerTypeScriptDeploymentTests.cs (1)
37using var cts = new CancellationTokenSource(s_testTimeout);
AksAzureKubernetesEnvironmentGatewayDeploymentTests.cs (1)
28using var cts = new CancellationTokenSource(s_testTimeout);
AksBlazorRedisDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksMultipleNodePoolsDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksPersistentVolumeDeploymentTests.cs (1)
19using var cts = new CancellationTokenSource(s_testTimeout);
AksStarterDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
AksStarterWithRedisHelmDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksVnetInfraDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AksVnetWithAzureResourcesDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksWithAzureResourcesDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksWithHelmChartDeploymentTests.cs (1)
29using var cts = new CancellationTokenSource(s_testTimeout);
AppServicePythonDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AppServiceReactDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AppServiceStoragePrivateEndpointDeploymentTests.cs (1)
20using var cts = new CancellationTokenSource(s_testTimeout);
AzureAppConfigDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureContainerRegistryDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureEventHubsDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureKeyVaultDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureLogAnalyticsDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureResourceScopeDeploymentTests.cs (1)
20using var cts = new CancellationTokenSource(s_testTimeout);
AzureRoleAssignmentRunModeTests.cs (1)
33using var cts = new CancellationTokenSource(s_testTimeout);
AzureServiceBusDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AzureStorageDeploymentTests.cs (2)
22using var cts = new CancellationTokenSource(s_testTimeout); 33using var cts = new CancellationTokenSource(s_testTimeout);
AzureStorageRunModeTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
FoundryHostedAgentDeploymentTests.cs (1)
24using var cts = new CancellationTokenSource(s_testTimeout);
FrontDoorDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
Helpers\DeploymentE2ETestHelpers.cs (1)
162using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
KubernetesGatewayTlsDeploymentTests.cs (1)
28using var cts = new CancellationTokenSource(s_testTimeout);
KubernetesHelmChartDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
NspStorageKeyVaultDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
PythonFastApiDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
RadiusAzureResourcesDeploymentTests.cs (1)
39using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(8));
RadiusStarterDeploymentTests.cs (3)
36using var cts = new CancellationTokenSource(s_testTimeout); 650using var waitCts = new CancellationTokenSource(TimeSpan.FromMinutes(2)); 666using var killCts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
TypeScriptAzureContainerAppJobDeploymentTests.cs (1)
20using var cts = new CancellationTokenSource(s_testTimeout);
TypeScriptExpressDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
TypeScriptJavaScriptHostingDeploymentTests.cs (1)
20using var cts = new CancellationTokenSource(s_testTimeout);
TypeScriptVnetSqlServerInfraDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
VnetKeyVaultConnectivityDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
VnetKeyVaultInfraDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
VnetSqlServerConnectivityDeploymentTests.cs (1)
26using var cts = new CancellationTokenSource(s_testTimeout);
VnetSqlServerInfraDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
VnetStorageBlobConnectivityDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
VnetStorageBlobInfraDeploymentTests.cs (1)
21using var cts = new CancellationTokenSource(s_testTimeout);
Aspire.EndToEnd.Tests (2)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
367CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Hosting (18)
ApplicationModel\ResourceLoggerService.cs (2)
23private readonly CancellationTokenSource _disposing = new(); 379private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (1)
30private readonly CancellationTokenSource _disposing = new();
Backchannel\AppHostRpcTarget.cs (1)
28private readonly CancellationTokenSource _shutdownCts = new();
Backchannel\AuxiliaryBackchannelRpcTarget.cs (2)
646using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(request.TimeoutSeconds)); 1883using var timeoutCts = new CancellationTokenSource(s_mcpDiscoveryTimeout);
Dashboard\DashboardServiceData.cs (1)
17private readonly CancellationTokenSource _cts = new();
Dcp\DcpExecutor.cs (2)
71private readonly CancellationTokenSource _shutdownCancellation = new(); 325var disposeCts = new CancellationTokenSource();
Dcp\DcpHost.cs (1)
39private readonly CancellationTokenSource _shutdownCts = new();
Dcp\DcpResourceWatcher.cs (2)
267using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 1018private readonly CancellationTokenSource _cancellation = new();
Dcp\ResourceLogSource.cs (1)
44ownedCts = new CancellationTokenSource();
Devcontainers\DevcontainerSettingsWriter.cs (1)
34private readonly CancellationTokenSource _processingCancellation = new();
ExternalServiceBuilderExtensions.cs (1)
349using var timeoutSource = new CancellationTokenSource(s_defaultHttpTimeout);
Orchestrator\ApplicationOrchestrator.cs (1)
37private readonly CancellationTokenSource _shutdownCancellation = new();
Orchestrator\ParameterProcessor.cs (1)
83var cts = new CancellationTokenSource();
Pipelines\PipelineActivityReporter.cs (1)
23private readonly CancellationTokenSource _cancellationTokenSource = new();
Aspire.Hosting.Azure (2)
Provisioning\Internal\DefaultArmClientProvider.cs (2)
271using var timeoutCts = new CancellationTokenSource(s_keyVaultDeleteTimeout, timeProvider); 302using var timeoutCts = new CancellationTokenSource(s_keyVaultPurgeTimeout, timeProvider);
Aspire.Hosting.Azure.Kusto.Tests (6)
KustoFunctionalTests.cs (5)
46using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 97using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 175using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 203using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 236using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Azure.Tests (31)
AzureBicepProvisionerTests.cs (2)
62var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 1750using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
28var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 69var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 141var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 275var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureDeployerTests.cs (1)
1901using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureEnvironmentResourceExtensionsTests.cs (4)
2335using var cts = new CancellationTokenSource(); 4282using var cts = new CancellationTokenSource(); 5126using var watchdog = new CancellationTokenSource(s_testSynchronizationTimeout); 5155using var watchdog = new CancellationTokenSource(s_testSynchronizationTimeout);
AzureEventHubsExtensionsTests.cs (3)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 120var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureServiceBusExtensionsTests.cs (3)
76var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 119var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 811var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureSignalREmulatorFunctionalTest.cs (2)
42var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 78var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureStorageEmulatorFunctionalTests.cs (6)
23var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 115var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 158var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 214var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 254var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultAzurePrincipalProviderTests.cs (1)
116using var cts = new CancellationTokenSource();
FoundryExtensionsTests.cs (5)
74var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 332using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 361using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 402using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 443using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Hosting.Blazor (2)
BrowserDebuggerHelper.cs (2)
81var watcherCts = new CancellationTokenSource(); 168watcherCts = new CancellationTokenSource();
Aspire.Hosting.Blazor.Tests (3)
BrowserDebuggerHelperTests.cs (2)
101using var watcherCts = new CancellationTokenSource(); 126using var watcherCts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Browsers (6)
BrowserLogsCdpConnection.cs (2)
48private readonly CancellationTokenSource _disposeCts = new(); 484using var closeCts = new CancellationTokenSource(_closeTimeout);
BrowserLogsRunningSession.cs (1)
92private readonly CancellationTokenSource _stopCts = new();
BrowserPageSession.cs (2)
39private readonly CancellationTokenSource _stopCts = new(); 200using var closeTargetCts = new CancellationTokenSource(s_closeTargetTimeout);
IBrowserHost.cs (1)
106using var releaseCts = new CancellationTokenSource(s_releaseTimeout);
Aspire.Hosting.Browsers.Tests (7)
src\Aspire.Hosting.Browsers\BrowserLogsCdpConnection.cs (2)
48private readonly CancellationTokenSource _disposeCts = new(); 484using var closeCts = new CancellationTokenSource(_closeTimeout);
src\Aspire.Hosting.Browsers\BrowserLogsRunningSession.cs (1)
92private readonly CancellationTokenSource _stopCts = new();
src\Aspire.Hosting.Browsers\BrowserPageSession.cs (2)
39private readonly CancellationTokenSource _stopCts = new(); 200using var closeTargetCts = new CancellationTokenSource(s_closeTargetTimeout);
src\Aspire.Hosting.Browsers\IBrowserHost.cs (1)
106using var releaseCts = new CancellationTokenSource(s_releaseTimeout);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.CodeGeneration.TypeScript.Tests (1)
AtsTypeScriptCodeGeneratorTests.cs (1)
2514using var cancellation = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (2)
DockerSocketBindMountTests.cs (1)
39using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.DevTunnels.Tests (2)
DevTunnelResourceBuilderExtensionsTests.cs (1)
594using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Dotnet.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.DotnetTool.Tests (3)
DotnetToolFunctionalTests.cs.cs (2)
14var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2)); 35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.EntityFrameworkCore.Tests (7)
EFCoreOperationExecutorTests.cs (7)
24using var cts = new CancellationTokenSource(); 41using var cts = new CancellationTokenSource(); 58using var cts = new CancellationTokenSource(); 73using var cts = new CancellationTokenSource(); 93using var cts = new CancellationTokenSource(); 110using var cts = new CancellationTokenSource(); 128using var cts = new CancellationTokenSource();
Aspire.Hosting.Foundry (2)
FoundryLocalService.cs (2)
100using var stopCancellation = new CancellationTokenSource(stopTimeout); 165using var startCancellation = new CancellationTokenSource(s_serviceStartTimeout);
Aspire.Hosting.Foundry.Tests (2)
PromptAgentTests.cs (1)
95using var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
23var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 61var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 106var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.GitHub.Models.Tests (2)
GitHubModelsFunctionalTests.cs (1)
19using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.JavaScript.Tests (8)
BunAppFixture.cs (2)
46using var startCts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 49using var readinessCts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
BunFunctionalTests.cs (2)
23using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 33using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
NodeAppFixture.cs (1)
41using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
23using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 33using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Kafka.Tests (3)
KafkaFunctionalTests.cs (2)
64var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 122var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Maui (1)
Lifecycle\MauiBuildQueueEventSubscriber.cs (1)
399using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Hosting.Maui.Tests (5)
MauiBuildQueueTests.cs (5)
42var cts = new CancellationTokenSource(); 123using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 157using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 239using var cts = new CancellationTokenSource(); 788using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Aspire.Hosting.MongoDB.Tests (5)
MongoDbFunctionalTests.cs (5)
35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 111var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 258var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 365var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (12)
MySqlFunctionalTests.cs (11)
32using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 70using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 125using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 306using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 401using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 483using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 557using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 628var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 710var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 786var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 837var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Nats.Tests (3)
NatsFunctionalTests.cs (3)
70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 113var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 330var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.OpenAI.Tests (3)
OpenAIFunctionalTests.cs (2)
20using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 62using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Oracle.Tests (5)
OracleFunctionalTests.cs (5)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 83var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 355var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 448var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (10)
PostgresFunctionalTests.cs (9)
101var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 197var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 366var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 462var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 544var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 603var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 656var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 702var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 780var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Qdrant.Tests (3)
QdrantFunctionalTests.cs (3)
29var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 94var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 259var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (2)
RabbitMQFunctionalTests.cs (1)
100var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Radius.Tests (3)
Deployment\RadCliDetectionTests.cs (1)
35using var cts = new CancellationTokenSource();
Secrets\SealedSecretApplyStepTests.cs (2)
542using var cts = new CancellationTokenSource(); 820using var cts = new CancellationTokenSource();
Aspire.Hosting.Redis.Tests (6)
RedisFunctionalTests.cs (6)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 139var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 174var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 226var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 484var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 663var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.RemoteHost (2)
CancellationTokenRegistry.cs (2)
30var cts = new CancellationTokenSource(); 137var cts = new CancellationTokenSource();
Aspire.Hosting.RemoteHost.Tests (7)
AtsMarshallerTests.cs (2)
205using var cts = new CancellationTokenSource(); 221using var cts = new CancellationTokenSource();
CallbackProxyTests.cs (2)
192using var cts = new CancellationTokenSource(); 213using var cts = new CancellationTokenSource();
CancellationTokenRegistryTests.cs (1)
38using var cts = new CancellationTokenSource();
CapabilityDispatcherTests.cs (1)
315using var cts = new CancellationTokenSource();
JsonRpcAuthenticationTests.cs (1)
187using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Hosting.Rust.Tests (2)
RustPublicApiTests.cs (2)
215using var cts = new CancellationTokenSource(); 513using var cts = new CancellationTokenSource();
Aspire.Hosting.Sdk.Tests (2)
AppHostSdkTargetsTests.cs (2)
1828using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 1887using var cts = new CancellationTokenSource(timeout);
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 67var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 133var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 343var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 417var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 471var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 548var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (3)
DistributedApplicationFactory.cs (3)
28private readonly CancellationTokenSource _disposingCts = new(); 408using var cts = new CancellationTokenSource(GetConfiguredTimeout()); 502using var shutdownTimeoutCts = new CancellationTokenSource(_shutdownTimeout);
Aspire.Hosting.Testing.Tests (16)
DashboardUrlTests.cs (8)
27using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 72using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 98using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 169using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 203using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 259using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 312using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 330using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceLoggerForwarderServiceTests.cs (3)
156private readonly CancellationTokenSource _startedCts = new(); 157private readonly CancellationTokenSource _stoppingCts = new(); 158private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
458using var cts = new CancellationTokenSource(timeout); 503using var cts = new CancellationTokenSource(timeout); 524using var cts = new CancellationTokenSource(timeout);
TestingFactoryCrashTests.cs (1)
21using var cts = new CancellationTokenSource(timeout);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Tests (122)
ApplicationModel\McpServerEndpointAnnotationTests.cs (1)
171using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
ApplicationModel\ResourceAnnotationCollectionTests.cs (1)
183using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Backchannel\AppHostRpcTargetCancellationTests.cs (6)
30using var cts = new CancellationTokenSource(); 50using var cts = new CancellationTokenSource(); 105using var cts = new CancellationTokenSource(); 124using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 195using var cts = new CancellationTokenSource();
Backchannel\AppHostRpcTargetUploadTests.cs (1)
147using var cancellationTokenSource = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (5)
979using var cts = new CancellationTokenSource(); 1091using var cts = new CancellationTokenSource(); 1507using var cancellationTokenSource = new CancellationTokenSource(); 1542using var cancellationTokenSource = new CancellationTokenSource(); 2112using var cts = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelTests.cs (1)
422using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
Backchannel\GetTerminalInfoAsyncTests.cs (1)
398_cts = new CancellationTokenSource();
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 65var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceDataTerminalTests.cs (3)
216public CancellationToken ApplicationStarted { get; } = new CancellationTokenSource().Token; 217public CancellationToken ApplicationStopped { get; } = new CancellationTokenSource().Token; 218public CancellationToken ApplicationStopping { get; } = new CancellationTokenSource().Token;
Dashboard\DashboardServiceTests.cs (6)
216var cts = new CancellationTokenSource(); 478var cts = new CancellationTokenSource(); 549var cts = new CancellationTokenSource(); 597var cts = new CancellationTokenSource(); 657var cts = new CancellationTokenSource(); 695var cts = new CancellationTokenSource();
Dashboard\ResourcePublisherTests.cs (5)
35CancellationTokenSource cts = new(); 88CancellationTokenSource cts = new(); 135CancellationTokenSource cts = new(); 156CancellationTokenSource cts = new(); 177CancellationTokenSource cts = new();
Dcp\DcpExecutorTests.cs (3)
1512var watchCts = new CancellationTokenSource(); 4635using var cts = new CancellationTokenSource(); 8348using var restartCancellation = new CancellationTokenSource();
Dcp\DcpHostNotificationTests.cs (14)
110using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 154using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 208using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 267using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 325using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 380using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 402using (var testTimeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(5))) 451using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 785using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 835using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 894using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 946using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 1004using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 1068using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Dcp\KubernetesServiceTests.cs (7)
27using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 50using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 73using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 96using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 118using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 139using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 176using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
DebugSupportExtensionsTests.cs (4)
77using var cts = new CancellationTokenSource(); 196using var cts = new CancellationTokenSource(); 215using var cts = new CancellationTokenSource(); 256using var cts = new CancellationTokenSource();
DistributedApplicationTests.cs (4)
77var cts = new CancellationTokenSource(); 122var cts = new CancellationTokenSource(); 442using var cts = new CancellationTokenSource(); 482using var cts = new CancellationTokenSource();
EndpointReferenceTests.cs (1)
173using var cts = new CancellationTokenSource();
ExecutionConfigurationGathererTests.cs (1)
659using var cts = new CancellationTokenSource();
Health\FriendlyHealthCheckErrorMessagesTests.cs (3)
36var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 76var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 202var cts = new CancellationTokenSource();
InteractionServiceTests.cs (5)
51var cts = new CancellationTokenSource(); 1222using var cts = new CancellationTokenSource(); 1256var cts = new CancellationTokenSource(); 1297var cts = new CancellationTokenSource(); 1404using var cancellationTokenSource = new CancellationTokenSource();
Lifecycle\TerminalHostFailureDiagnosticServiceTests.cs (3)
244var stopCts = new CancellationTokenSource(); 274using var cts = timeoutMs is { } ms ? new CancellationTokenSource(ms) : null; 297using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(150));
Publishing\ContainerRuntimeResolverTests.cs (1)
68using var cts = new CancellationTokenSource();
Publishing\PipelineActivityReporterTests.cs (1)
691using var cancellationTokenSource = new CancellationTokenSource();
Publishing\ResourceContainerImageManagerTests.cs (30)
37using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 102using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 139using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 173using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 203using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 241using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 285using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 322using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 354using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 383using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 434using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 463using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 487using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 522using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 555using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 588using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 626using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 665using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 703using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 748using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 822using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 918using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 971using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1346using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1394using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1429using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1472using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1505using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1541using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceNotificationTests.cs (6)
346using var cts = new CancellationTokenSource(); 825using var cts = new CancellationTokenSource(); 852using var cts = new CancellationTokenSource(); 894using var cts = new CancellationTokenSource(); 1397using var cts = new CancellationTokenSource(); 1430private readonly CancellationTokenSource _stoppingCts = new();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Utils\PeriodicRestartAsyncEnumerableTests.cs (2)
15using var cts = new CancellationTokenSource(); 39using var cts = new CancellationTokenSource();
ValueSnapshotTests.cs (2)
180using var cts = new CancellationTokenSource(); 192using var cts = new CancellationTokenSource();
WithHttpCommandTests.cs (1)
468using var cts = new CancellationTokenSource();
WithProcessCommandTests.cs (1)
1471using var cts = new CancellationTokenSource();
Aspire.Hosting.TestUtilities (2)
Utils\DockerUtils.cs (1)
49using var cts = new CancellationTokenSource(s_runtimeDetectionTimeout);
Utils\PersistentContainerTestHelpers.cs (1)
61using var cts = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(10));
Aspire.Hosting.Valkey.Tests (2)
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
208var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Managed.Tests (2)
ParentProcessWatchdogTests.cs (2)
44using var operationCts = new CancellationTokenSource(); 61using var operationCts = new CancellationTokenSource();
Aspire.Milvus.Client.Tests (1)
MilvusHealthCheckTests.cs (1)
43using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
112using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v2.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
112using var source = new CancellationTokenSource(10);
Aspire.MongoDB.EntityFrameworkCore.Tests (1)
ConformanceTests.cs (1)
89using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.NATS.Net.Tests (1)
AspireNatsClientExtensionsTests.cs (1)
199using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Playground.Tests (2)
ProjectSpecificTests.cs (1)
157CancellationTokenSource cts = new();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Qdrant.Client.Tests (1)
QdrantHealthCheckTests.cs (1)
40using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Seq.Tests (2)
SeqEndpointCanBeConfigured.cs (2)
81using var serverCts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 94using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Templates.Tests (3)
TemplateTestsBase.cs (1)
186var cts = new CancellationTokenSource();
tests\Shared\TemplatesTesting\AspireProject.cs (1)
367CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.TerminalHost (6)
DcpUpstreamAdapter.cs (1)
66private readonly CancellationTokenSource _disposeCts = new();
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
TerminalHostApp.cs (2)
33private readonly CancellationTokenSource _shutdownCts = new(); 403using var stopCts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
TerminalHostControlListener.cs (1)
22private readonly CancellationTokenSource _disposeCts = new();
TerminalHostProcessRunner.cs (1)
22using var forceExitCts = new CancellationTokenSource();
Aspire.TerminalHost.Tests (15)
TerminalHostAppTests.cs (14)
53using var hostCts = new CancellationTokenSource(); 76using var hostCts = new CancellationTokenSource(); 108using var hostCts = new CancellationTokenSource(); 136using var hostCts = new CancellationTokenSource(); 195using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 213using var hostCts = new CancellationTokenSource(); 266using var hostCts = new CancellationTokenSource(); 304using var hostCts = new CancellationTokenSource(); 390using var hostCts = new CancellationTokenSource(); 435using var hostCts = new CancellationTokenSource(); 472using var hostCts = new CancellationTokenSource(); 590using var cts = new CancellationTokenSource(timeout); 827using var hostCts = new CancellationTokenSource(); 864using var hostCts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
CustomResources.AppHost (1)
TestResource.cs (1)
37private readonly CancellationTokenSource _tokenSource = new();
dotnet (7)
Commands\Test\MTP\CtrlCCancellationManager.cs (1)
31private readonly CancellationTokenSource _cancellationTokenSource = new();
Commands\Test\MTP\Terminal\TestProgressStateAwareTerminal.cs (1)
14private readonly CancellationTokenSource _cts = new();
Commands\Test\MTP\TestApplication.cs (1)
58private readonly CancellationTokenSource _pipeCancellationTokenSource = new();
Commands\Test\MTP\TestRunPolicy.cs (1)
26private readonly CancellationTokenSource _cancellationTokenSource = new();
NugetPackageDownloader\NuGetPackageDownloader.cs (2)
1011var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1030var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout);
NugetSearch\NugetToolSearchApiRequest.cs (1)
29using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10));
dotnet-aot (4)
src\sdk\src\Cli\dotnet\NugetPackageDownloader\NuGetPackageDownloader.cs (2)
1011var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1030var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout);
src\sdk\src\Cli\dotnet\NugetSearch\NugetToolSearchApiRequest.cs (2)
29using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 98using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10));
dotnet-svcutil-lib (8)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (1)
166using (CancellationTokenSource cts = new CancellationTokenSource())
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (2)
309var tokenSource = new CancellationTokenSource((int)(targetTime - currentTime)); 326tokenTask = Task.FromResult(new CancellationTokenSource(millisecondsTimeout).Token);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
892_httpSendCts = new CancellationTokenSource();
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SslStreamSecurityUpgradeProvider.cs (3)
280using (CancellationTokenSource cts = new CancellationTokenSource(timeout)) 525using (CancellationTokenSource cts = new CancellationTokenSource(timeoutHelper.RemainingTime())) 539using (CancellationTokenSource cts = new CancellationTokenSource(timeoutHelper.RemainingTime()))
Tool.cs (1)
70var cancellationSource = new CancellationTokenSource();
dotnet-watch (1)
Watch\DotNetWatcher.cs (1)
92using var currentRunCancellationSource = new CancellationTokenSource();
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Infrastructure.Tests (19)
CreateFailingTestIssue\CreateFailingTestIssueFixture.cs (1)
48using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(3));
CreateFailingTestIssue\CreateFailingTestIssueToolTests.cs (1)
653using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
DownloadFailingJobLogs\DownloadFailingJobLogsToolTests.cs (1)
109using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
ExtractTestPartitions\ExtractTestPartitionsFixture.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
ExtractTestPartitions\ExtractTestPartitionsTests.cs (1)
339using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
GenerateTestSummary\GenerateTestSummaryFixture.cs (1)
41using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(3));
GenerateTestSummary\GenerateTestSummaryToolTests.cs (1)
270using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
Pipelines\NixCliPackageTests.cs (1)
243using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
PowerShellScripts\DownloadNativeArchivesTests.cs (1)
536_cts = new CancellationTokenSource();
PowerShellScripts\PowerShellCommand.cs (1)
58using CancellationTokenSource cts = new();
WorkflowScripts\ExtensionChangelogFinalizedWorkflowTests.cs (2)
338using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 502using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WorkflowScripts\ExtensionReleaseWorkflowTests.cs (5)
613using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 665using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 744using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 781using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 847using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1));
WorkflowScripts\NodeCommand.cs (1)
52using CancellationTokenSource cts = new();
WorkflowScripts\PrDocsCheckWorkflowTests.cs (1)
195using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
Microsoft.Agents.AI.ProjectTemplates.Tests (1)
TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components (2)
NavigationManager.cs (1)
426var cts = new CancellationTokenSource();
Routing\Router.cs (1)
360_onNavigateCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Endpoints (4)
Builder\RazorComponentEndpointDataSource.cs (2)
59_cancellationTokenSource = new CancellationTokenSource(); 173_cancellationTokenSource = new CancellationTokenSource();
DependencyInjection\HotReloadService.cs (2)
19private CancellationTokenSource _tokenSource = new(); 39var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Components.Forms (1)
EditContext.cs (1)
372var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Media (1)
MediaComponentBase.cs (1)
285_loadCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components.QuickGrid (1)
QuickGrid.razor.cs (1)
527var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Server (5)
Circuits\CircuitRegistry.cs (1)
148var cancellationTokenSource = new CancellationTokenSource(_options.DisconnectedCircuitRetentionPeriod);
Circuits\DefaultInMemoryCircuitPersistenceProvider.cs (1)
58var cancellationTokenSource = new CancellationTokenSource(_options.PersistedCircuitInMemoryRetentionPeriod);
Circuits\RemoteJSRuntime.cs (1)
192CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(10));
Circuits\RevalidatingServerAuthenticationStateProvider.cs (2)
19private CancellationTokenSource _loopCancellationTokenSource = new CancellationTokenSource(); 42_loopCancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Web (1)
Virtualization\Virtualize.cs (1)
955: new CancellationTokenSource();
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
DebugProxyLauncher.cs (1)
75using var cts = new CancellationTokenSource(DebugProxyLaunchTimeout);
TargetPickerUi.cs (1)
136var source = new CancellationTokenSource();
Microsoft.AspNetCore.Connections.Abstractions (1)
DefaultConnectionContext.cs (1)
27private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
487Interlocked.Exchange(ref _cacheExpirationTokenSource, new CancellationTokenSource())?.Cancel();
Microsoft.AspNetCore.Diagnostics.Middleware.PerformanceTests (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.AspNetCore.Hosting (5)
Internal\ApplicationLifetime.cs (3)
20private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 21private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 22private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
WebHostExtensions.cs (2)
28using var cts = new CancellationTokenSource(timeout); 91using (var cts = new CancellationTokenSource())
Microsoft.AspNetCore.Http.Connections (8)
Internal\HttpConnectionContext.cs (5)
122_connectionClosedTokenSource = new CancellationTokenSource(); 125_connectionCloseRequested = new CancellationTokenSource(); 851Cancellation = new CancellationTokenSource(); 853var timeoutSource = new CancellationTokenSource(); 1020_sendCts = new CancellationTokenSource();
Internal\HttpConnectionDispatcher.cs (1)
327connection.Cancellation ??= new CancellationTokenSource();
Internal\Transports\WebSocketsServerTransport.cs (2)
81using (var delayCts = new CancellationTokenSource()) 109using (var delayCts = new CancellationTokenSource())
Microsoft.AspNetCore.Http.Connections.Client (4)
Internal\LongPollingTransport.cs (1)
28private readonly CancellationTokenSource _transportCts = new CancellationTokenSource();
Internal\ServerSentEventsTransport.cs (2)
26private readonly CancellationTokenSource _transportCts = new CancellationTokenSource(); 27private readonly CancellationTokenSource _inputCts = new CancellationTokenSource();
Internal\WebSocketsTransport.cs (1)
315_stopCts = new CancellationTokenSource();
Microsoft.AspNetCore.HttpLogging (1)
FileLoggerProcessor.cs (1)
102_cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc (2)
HotReloadService.cs (2)
21private CancellationTokenSource _tokenSource = new(); 78var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Mvc.Core (2)
Infrastructure\DefaultActionDescriptorCollectionProvider.cs (1)
164_cancellationTokenSource = new CancellationTokenSource();
Routing\ActionEndpointDataSourceBase.cs (1)
134_cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.TagHelpers (1)
CacheTagHelper.cs (1)
92var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
31private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.AspNetCore.Routing (1)
CompositeEndpointDataSource.cs (1)
245var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.HttpSys (1)
NativeInterop\DisconnectListener.cs (1)
59var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpContext.IHttpRequestLifetimeFeature.cs (1)
35_abortedCts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Deployers\SelfHostDeployer.cs (1)
164var hostExitTokenSource = new CancellationTokenSource();
src\aspnetcore\src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Microsoft.AspNetCore.Server.Kestrel.Core (5)
Internal\Http\HttpProtocol.cs (1)
318_abortedCts = new CancellationTokenSource();
Internal\Http3\Http3Connection.cs (2)
52private CancellationTokenSource _acceptStreamsCts = new(); 374_acceptStreamsCts = new CancellationTokenSource();
Internal\Infrastructure\KestrelConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosingCts = new CancellationTokenSource();
Internal\KestrelServerImpl.cs (1)
31private readonly CancellationTokenSource _stopCts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Transport.DirectTls (2)
Connection\DirectTlsConnection.cs (1)
36private readonly CancellationTokenSource _connectionClosedTokenSource = new();
Connection\DirectTlsConnectionListener.cs (1)
203using var stopCts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Internal\NamedPipeConnection.cs (1)
23private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Internal\NamedPipeConnectionListener.cs (1)
24private readonly CancellationTokenSource _listeningTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Internal\QuicConnectionContext.cs (1)
29private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Internal\QuicStreamContext.cs (1)
126_streamClosedTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\SocketConnection.cs (1)
24private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.Core (10)
HubConnection.cs (9)
331_state.StopCts = new CancellationTokenSource(); 916_state.StopCts = new CancellationTokenSource(); 960var cts = cancellationToken.CanBeCanceled ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : new CancellationTokenSource(); 1819using var handshakeCts = new CancellationTokenSource(HandshakeTimeout); 1917using var uploadStreamSource = new CancellationTokenSource(); 2088_state.StopCts = new CancellationTokenSource(); 2600cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 2748StopCts = new CancellationTokenSource(); 2756public CancellationTokenSource StopCts { get; set; } = new CancellationTokenSource();
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (1)
140using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5), _timeProvider);
Microsoft.AspNetCore.SignalR.Core (3)
HubConnectionContext.cs (2)
30private readonly CancellationTokenSource _connectionAbortedTokenSource = new CancellationTokenSource(); 614using (var cts = new CancellationTokenSource())
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (1)
140using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5), _timeProvider);
Microsoft.AspNetCore.SignalR.Specification.Tests (4)
HubLifetimeManagerTestBase.cs (1)
357var cts = new CancellationTokenSource();
Internal\TaskExtensions.cs (2)
24var cts = new CancellationTokenSource(); 48var cts = new CancellationTokenSource();
src\aspnetcore\src\SignalR\common\testassets\Tests.Utils\TestClient.cs (1)
65_cts = new CancellationTokenSource();
Microsoft.AspNetCore.SpaServices.Extensions (1)
AngularCli\AngularCliMiddleware.cs (1)
112using var cancellationTokenSource = new CancellationTokenSource(timeoutMilliseconds);
Microsoft.AspNetCore.StaticAssets (2)
StaticAssetEndpointDataSource.cs (2)
38_cancellationTokenSource = new CancellationTokenSource(); 114_cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.TestHost (1)
RequestLifetimeFeature.cs (1)
10private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.Bcl.TimeProvider (1)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (1)
250return new CancellationTokenSource(delay, timeProvider);
Microsoft.Build (5)
BackEnd\BuildManager\BuildManager.cs (1)
611_executionCancellationTokenSource = new CancellationTokenSource();
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (1)
1083_packetQueueDrainDelayCancellation = new CancellationTokenSource();
BackEnd\Components\Logging\LoggingService.cs (1)
1478_loggingEventProcessingCancellation = new CancellationTokenSource();
BackEnd\Components\RequestBuilder\RequestBuilder.cs (1)
645_cancellationTokenSource = new CancellationTokenSource();
Logging\TerminalLogger\TerminalLogger.cs (1)
97private readonly CancellationTokenSource _cts = new();
Microsoft.Build.Tasks.CodeAnalysis (1)
src\roslyn\src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
541_sharedCompileCts = new CancellationTokenSource();
Microsoft.Build.Tasks.Core (7)
Copy.cs (1)
107private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
DownloadFile.cs (1)
24private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\GetFileHash.cs (1)
126private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\VerifyFileHash.cs (1)
80private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
TarDirectory.cs (1)
30private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Untar.cs (1)
33private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Unzip.cs (1)
33private readonly CancellationTokenSource _cancellationToken = new CancellationTokenSource();
Microsoft.CodeAnalysis.Analyzers (5)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.AnalyzerUtilities (5)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CodeStyle (5)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp (1)
CommandLine\CSharpCommandLineParser.cs (1)
298using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.Features (3)
EditAndContinue\DebuggingSession.cs (1)
35private readonly CancellationTokenSource _cancellationSource = new();
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (1)
30private readonly CancellationTokenSource _shutdownNotificationSource = new();
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs (1)
234var source = new CancellationTokenSource();
Microsoft.CodeAnalysis.ResxSourceGenerator (5)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces (7)
Remote\IRemoteKeepAliveService.cs (1)
52private CancellationTokenSource KeepAliveTokenSource { get; } = new();
Shared\TestHooks\AsynchronousOperationListener.cs (2)
34_expeditedDelayCancellationTokenSource = new CancellationTokenSource(); 132var oldSource = Interlocked.Exchange(ref _expeditedDelayCancellationTokenSource, new CancellationTokenSource());
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
Rpc\RpcClient.cs (1)
39private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Rpc\RpcServer.cs (1)
44private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.Diagnostics.NETCore.Client (11)
DiagnosticsIpc\IpcServerTransport.cs (2)
99private readonly CancellationTokenSource _cancellation = new(); 166private readonly CancellationTokenSource _cancellation = new();
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (6)
228using CancellationTokenSource acceptTimeoutTokenSource = new(); 253using CancellationTokenSource connectTimeoutTokenSource = new(); 459using CancellationTokenSource connectTimeoutTokenSource = new(); 582using CancellationTokenSource connectTimeoutTokenSource = new(); 672using CancellationTokenSource connectTimeoutTokenSource = new(); 1462_cancelRouterTokenSource = new CancellationTokenSource();
HandleableCollection.cs (1)
141using CancellationTokenSource cancellation = new(timeout);
ReversedServer\ReversedDiagnosticsServer.cs (2)
26private readonly CancellationTokenSource _disposalSource = new(); 273using CancellationTokenSource parseCancellationSource = new();
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
41private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ExecWithRetries.cs (1)
52private CancellationTokenSource _cancelTokenSource = new CancellationTokenSource();
Microsoft.DotNet.Cli.Telemetry (2)
PersistentStorageLogExporter.cs (1)
102_drainCts = new CancellationTokenSource();
PersistentStorageTraceExporter.cs (1)
110_drainCts = new CancellationTokenSource();
Microsoft.DotNet.HotReload.Watch (8)
HotReload\HotReloadDotNetWatcher.cs (1)
85Interlocked.Exchange(ref forceRestartCancellationSource, new CancellationTokenSource())?.Dispose();
HotReload\RunningProjectsManager.cs (2)
60var processExitedSource = new CancellationTokenSource(); 61var processTerminationSource = new CancellationTokenSource();
Process\ProcessRunner.cs (2)
266using var cancellationSource = new CancellationTokenSource(); 304using var cancellationSource = new CancellationTokenSource();
src\sdk\src\Dotnet.Watch\AspireService\AspireServerService.cs (1)
49private readonly CancellationTokenSource _shutdownCancellationSource = new();
src\sdk\src\Dotnet.Watch\HotReloadClient\Web\AbstractBrowserRefreshServer.cs (1)
154using var progressCancellationSource = new CancellationTokenSource();
UI\ShutdownHandler.cs (1)
10private readonly CancellationTokenSource _cancellationSource = new();
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatClientExtensionsTests.cs (4)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 216using var cts = new CancellationTokenSource();
ChatRouting\RoutingChatClientTests.cs (1)
25using var cancellationSource = new CancellationTokenSource();
Contents\DataContentTests.cs (3)
776using CancellationTokenSource cts = new(); 798using CancellationTokenSource cts = new(); 825using CancellationTokenSource cts = new();
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
25using var cts = new CancellationTokenSource();
Image\ImageGeneratorTests.cs (1)
49using var cts = new CancellationTokenSource();
SpeechToText\SpeechToTextClientExtensionsTests.cs (1)
57using var cts = new CancellationTokenSource();
SpeechToText\SpeechToTextClientTests.cs (2)
19using var cts = new CancellationTokenSource(); 47using var cts = new CancellationTokenSource();
TextToSpeech\TextToSpeechClientTests.cs (2)
18using var cts = new CancellationTokenSource(); 42using var cts = new CancellationTokenSource();
Microsoft.Extensions.AI.OpenAI.Tests (7)
OpenAIRealtimeClientSessionTests.cs (2)
68using var cts = new CancellationTokenSource(); 88using var cts = new CancellationTokenSource();
OpenAIRealtimeClientTests.cs (1)
55using var cts = new CancellationTokenSource();
OpenAISpeechToTextClientTests.cs (2)
111using var cancellationTokenSource = new CancellationTokenSource(); 125using var cancellationTokenSource = new CancellationTokenSource();
OpenAITextToSpeechClientTests.cs (2)
224using var cancellationTokenSource = new CancellationTokenSource(); 237using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (37)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
1470using CancellationTokenSource cts = new(); 1546using CancellationTokenSource cts = new(); 1961using CancellationTokenSource cts = new(); 2049using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
2209using CancellationTokenSource cts = new(); 2279using CancellationTokenSource cts = new();
ChatCompletion\UseDelegateChatClientTests.cs (4)
30using CancellationTokenSource expectedCts = new(); 80using CancellationTokenSource expectedCts = new(); 122using CancellationTokenSource expectedCts = new(); 173using CancellationTokenSource expectedCts = new();
ChatReduction\SummarizingChatReducerTests.cs (1)
281using var cts = new CancellationTokenSource();
ChatRouting\FailoverChatClientTests.cs (7)
73using var cancellationSource = new CancellationTokenSource(); 513using var cancellationSource = new CancellationTokenSource(); 538using var cancellationSource = new CancellationTokenSource(); 566using var cancellationSource = new CancellationTokenSource(); 661using var cancellationSource = new CancellationTokenSource(); 707using var cancellationSource = new CancellationTokenSource(); 929using var cancellationSource = new CancellationTokenSource();
ChatRouting\OrderedFailoverChatClientTests.cs (1)
296using var cancellationSource = new CancellationTokenSource();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
196using var cts = new CancellationTokenSource(); 975using CancellationTokenSource cts = new(); 998using CancellationTokenSource cts = new(); 1021using CancellationTokenSource cts = new(); 1044using CancellationTokenSource cts = new(); 1067using CancellationTokenSource cts = new(); 1090using CancellationTokenSource cts = new(); 1113using CancellationTokenSource cts = new(); 1136using CancellationTokenSource cts = new();
Image\ConfigureOptionsImageGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Realtime\LoggingRealtimeClientTests.cs (3)
211using var cts = new CancellationTokenSource(); 272using var cts = new CancellationTokenSource(); 375using var cts = new CancellationTokenSource();
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (1)
40using CancellationTokenSource cts = new();
TextToSpeech\ConfigureOptionsTextToSpeechClientTests.cs (1)
39using CancellationTokenSource cts = new();
Microsoft.Extensions.AsyncState (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Caching.Hybrid (2)
Internal\DefaultHybridCache.L2.cs (1)
143using var cts = new CancellationTokenSource(millisecondsDelay: READ_TIMEOUT);
Internal\DefaultHybridCache.StampedeState.cs (1)
49_sharedCancellation = new();
Microsoft.Extensions.Caching.Hybrid.Tests (6)
StampedeTests.cs (6)
91using var cts = canBeCanceled ? new CancellationTokenSource() : null; 187cancels[i] = new CancellationTokenSource(); 268cancels[i] = new CancellationTokenSource(); 339using CancellationTokenSource? cts = withCancelation ? new() : null; 379using var cts = withCancelation ? new CancellationTokenSource() : null; 423using CancellationTokenSource? cts = withCancelation ? new() : null;
Microsoft.Extensions.Compliance.Abstractions (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Configuration (1)
ConfigurationReloadToken.cs (1)
16private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Microsoft.Extensions.DataIngestion.Tests (2)
Readers\DocumentReaderConformanceTests.cs (2)
38using CancellationTokenSource cts = new(); 56using CancellationTokenSource cts = new();
Microsoft.Extensions.Diagnostics.ExceptionSummarization.Tests (2)
ExceptionSummarizerTests.cs (1)
212using var tokenSource = new CancellationTokenSource(TimeSpan.Zero);
HttpExceptionSummaryProviderTests.cs (1)
120using var tokenSource = new CancellationTokenSource(TimeSpan.Zero);
Microsoft.Extensions.Diagnostics.HealthChecks (1)
HealthCheckPublisherHostedService.cs (1)
50_stopping = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.HealthChecks.Common (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (3)
MockHostApplicationLifetime.cs (3)
12private readonly CancellationTokenSource _started = new(); 13private readonly CancellationTokenSource _stopping = new(); 14private readonly CancellationTokenSource _stopped = new();
Microsoft.Extensions.Diagnostics.Probes.Tests (2)
TcpEndpointProbesServiceTests.cs (2)
23using var cts = new CancellationTokenSource(); 89using var cts = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogCollector.LogEnumeration.cs (1)
93: new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.Testing.Tests (2)
Logging\FakeLogCollectorTests.LogEnumeration.cs (1)
32using var cts = new CancellationTokenSource();
Metrics\MetricCollectorTests.cs (1)
283using var cts = new CancellationTokenSource();
Microsoft.Extensions.FileProviders.Physical (5)
PhysicalFilesWatcher.cs (5)
211var cancellationTokenSource = new CancellationTokenSource(); 236pollingChangeToken.CancellationTokenSource = new CancellationTokenSource(); 255var cancellationTokenSource = new CancellationTokenSource(); 279pollingChangeToken.CancellationTokenSource = new CancellationTokenSource(); 906private readonly CancellationTokenSource _cts = new();
Microsoft.Extensions.Hosting (3)
Internal\ApplicationLifetime.cs (3)
21private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 22private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 23private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
Microsoft.Extensions.Hosting.Abstractions (1)
HostingAbstractionsHostExtensions.cs (1)
34using CancellationTokenSource cts = new CancellationTokenSource(timeout);
Microsoft.Extensions.Hosting.Testing.Tests (3)
FakeHostTests.cs (2)
81using var tokenSource = new CancellationTokenSource(); 140using var tokenSource = new CancellationTokenSource();
HostingFakesExtensionsTests.cs (1)
28using var tokenSource = new CancellationTokenSource();
Microsoft.Extensions.Http.Diagnostics.Tests (2)
Logging\HttpClientLoggerTest.cs (1)
117using var cancellationTokenSource = new CancellationTokenSource();
Logging\HttpResponseBodyReaderTest.cs (1)
186using var cts = new CancellationTokenSource();
Microsoft.Extensions.Http.Resilience (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Http.Resilience.PerformanceTests (2)
RetryBenchmark.cs (1)
30_cancellationToken = new CancellationTokenSource().Token;
StandardResilienceBenchmark.cs (1)
30_cancellationToken = new CancellationTokenSource().Token;
Microsoft.Extensions.Http.Resilience.Tests (2)
Hedging\HedgingTests.cs (1)
43_cancellationTokenSource = new CancellationTokenSource();
Resilience\ResilienceHandlerTest.cs (1)
128using var source = new CancellationTokenSource();
Microsoft.Extensions.Logging.AzureAppServices (1)
BatchingLoggerProvider.cs (1)
161_cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.Logging.EventSource (1)
LoggingEventSource.cs (1)
401CancellationTokenSource cts = LazyInitializer.EnsureInitialized(ref _cancellationTokenSource, () => new CancellationTokenSource());
Microsoft.Extensions.ML (2)
ModelLoaders\UriModelLoader.cs (1)
41_stopping = new CancellationTokenSource();
ModelReloadToken.cs (1)
20_cts = new CancellationTokenSource();
Microsoft.Extensions.Primitives (1)
CompositeChangeToken.cs (1)
112_cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.ServiceDiscovery (1)
ServiceEndpointWatcher.cs (1)
30private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.Extensions.ServiceDiscovery.Dns (4)
DnsServiceEndpointProviderBase.cs (3)
16private readonly CancellationTokenSource _disposeCancellation = new(); 42var cancellation = _lastCollectionCancellation = new CancellationTokenSource(); 129var cancellation = _lastCollectionCancellation = new CancellationTokenSource(validityPeriod, _timeProvider);
Resolver\DnsResolver.cs (1)
25private readonly CancellationTokenSource _pendingRequestsCts = new();
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (2)
Resolver\CancellationTests.cs (2)
18CancellationTokenSource cts = new CancellationTokenSource(); 29CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.Extensions.ServiceDiscovery.Tests (8)
ServiceEndpointResolverTests.cs (8)
88var cts = new[] { new CancellationTokenSource() }; 97cts[0] = new(); 140var cts = new[] { new CancellationTokenSource() }; 149cts[0] = new(); 176var cts = new[] { new CancellationTokenSource() }; 185cts[0] = new(); 214var cts = new[] { new CancellationTokenSource() }; 223cts[0] = new();
Microsoft.Extensions.Telemetry (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Telemetry.Abstractions (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.TimeProvider.Testing.Tests (3)
FakeTimeProviderTests.cs (3)
317using var cs = new CancellationTokenSource(); 332using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000)); 431using var cts = new CancellationTokenSource();
Microsoft.JSInterop (11)
JSObjectReferenceExtensions.cs (5)
97using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 115using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 165using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 183using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 202using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout);
JSRuntime.cs (1)
126using var cts = new CancellationTokenSource(DefaultAsyncTimeout.Value);
JSRuntimeExtensions.cs (5)
97using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 115using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 165using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 183using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 202using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout);
Microsoft.Maui (1)
ImageSources\ImageSourceServiceResultManager.cs (1)
41 _sourceCancellation = new CancellationTokenSource();
Microsoft.Maui.Controls (1)
ImageSource.cs (1)
149 CancellationTokenSource = new CancellationTokenSource();
Microsoft.Maui.Resizetizer (1)
AsyncTask.cs (1)
18 readonly CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.ML.AutoML (2)
AutoMLExperiment\AutoMLExperiment.cs (1)
252var trialCancellationTokenSource = new CancellationTokenSource();
AutoMLExperiment\IStopTrainingManager.cs (1)
66_cts = new CancellationTokenSource();
Microsoft.ML.AutoML.Tests (5)
AutoMLExperimentTests.cs (3)
47var cts = new CancellationTokenSource(); 134var cts = new CancellationTokenSource(); 173var cts = new CancellationTokenSource();
StopTrainingManagerTests.cs (2)
28var cts = new CancellationTokenSource(); 72var cts = new CancellationTokenSource();
Microsoft.ML.Core (2)
Utilities\ResourceManagerUtils.cs (1)
158using (var downloadCancel = new CancellationTokenSource())
Utilities\ThreadUtils.cs (1)
196_ctSource = new CancellationTokenSource();
Microsoft.ML.Maml (1)
MAML.cs (1)
63using (var progressCancel = new CancellationTokenSource())
Microsoft.ML.Sweeper (1)
AsyncSweeper.cs (1)
206_cts = new CancellationTokenSource();
Microsoft.ML.TestFrameworkCommon (1)
TestDownloadUtils.cs (1)
30using (var cancellationSource = new CancellationTokenSource(timeout))
Microsoft.NET.Build.Containers (2)
Tasks\CreateImageIndex.cs (1)
17private readonly CancellationTokenSource _cancellationTokenSource = new();
Tasks\CreateNewImage.cs (1)
15private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.NET.Build.Tasks (1)
GenerateBundle.cs (1)
15private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.NET.Sdk.Publish.Tasks (2)
Tasks\OneDeploy\OneDeployStatusService.cs (1)
40var maxWaitForResultTokenSource = new CancellationTokenSource(s_maximumWaitForResult);
Tasks\ZipDeploy\ZipDeploymentStatus.cs (1)
34var tokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(MaxMinutesToWait));
Microsoft.NET.Sdk.Razor.Tasks (1)
DotnetToolTask.cs (1)
148using (_razorServerCts = new CancellationTokenSource())
Microsoft.TemplateEngine.Cli (3)
Commands\create\InstantiateCommand.TabCompletion.cs (2)
143CancellationTokenSource cancellationTokenSource = new(); 173CancellationTokenSource cancellationTokenSource = new();
Commands\create\TemplateCommand.cs (1)
171CancellationTokenSource cancellationTokenSource = new();
Microsoft.TemplateEngine.Edge (2)
BuiltInManagedProvider\GlobalSettings.cs (1)
205CancellationTokenSource cts = new();
TemplateConstraintManager.cs (1)
16private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.TestPlatform.CommunicationUtilities (3)
DataCollectionRequestHandler.cs (1)
100_cancellationTokenSource = new CancellationTokenSource();
SocketClient.cs (1)
39_cancellation = new CancellationTokenSource();
SocketServer.cs (1)
58_cancellation = new CancellationTokenSource();
Microsoft.TestPlatform.CrossPlatEngine (2)
Client\ProxyOperationManager.cs (1)
102CancellationTokenSource = new CancellationTokenSource();
Discovery\DiscoveryManager.cs (1)
38private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.TestPlatform.Extensions.BlameDataCollector (1)
NetClientHangDumper.cs (1)
59var timeout = new CancellationTokenSource();
Microsoft.TestPlatform.PlatformAbstractions (1)
common\System\ProcessHelper.cs (1)
144var cts = new CancellationTokenSource(timeout);
Microsoft.TestPlatform.VsTestConsole.TranslationLayer (3)
VsTestConsoleRequestSender.cs (3)
86_processExitCancellationTokenSource = new CancellationTokenSource(); 127_processExitCancellationTokenSource = new CancellationTokenSource(); 134var timeoutSource = new CancellationTokenSource(clientConnectionTimeout);
Microsoft.VisualBasic.Forms (2)
Microsoft\VisualBasic\ApplicationServices\WindowsFormsApplicationBase.vb (2)
1097Dim tokenSource As New CancellationTokenSource() 1110Dim tokenSource As New CancellationTokenSource()
Microsoft.VisualStudio.TestPlatform.Common (1)
DataCollection\DataCollectionAttachmentManager.cs (1)
81_cancellationTokenSource = new CancellationTokenSource();
MSBuild (1)
XMake.cs (1)
144private static readonly CancellationTokenSource s_buildCancellationSource = new CancellationTokenSource();
MSBuild.Coordinator (2)
CoordinatorServer.cs (1)
30private readonly CancellationTokenSource _cts = new();
Program.cs (1)
30using CancellationTokenSource cts = new();
Nats.Backend (1)
Program.cs (1)
18private readonly CancellationTokenSource _cts = new();
NuGet.Build.Tasks (2)
RestoreTask.cs (1)
33private readonly CancellationTokenSource _cts = new CancellationTokenSource();
StaticGraphRestoreTaskBase.cs (1)
27internal readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
NuGet.PackageManagement (1)
NuGetPackageManager.cs (1)
2058using var tokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NuGet.Protocol (6)
Plugins\PluginFactory.cs (1)
454using (var cancellationTokenSource = new CancellationTokenSource(PluginConstants.CloseTimeout))
Plugins\RequestHandlers\SymmetricHandshake.cs (1)
76_timeoutCancellationTokenSource = new CancellationTokenSource(handshakeTimeout);
Plugins\StandardInputReceiver.cs (1)
45_receiveCancellationTokenSource = new CancellationTokenSource();
Resources\PackageUpdateResource.cs (1)
98using var tokenSource = new CancellationTokenSource();
Utility\TimeoutUtility.cs (2)
35using (var timeoutTcs = new CancellationTokenSource()) 36using (var taskTcs = new CancellationTokenSource())
Roslyn.Diagnostics.Analyzers (5)
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
122_entireQueueCancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
89_entireQueueCancellationTokenSource = new CancellationTokenSource();
rzc (2)
DefaultRequestDispatcher.cs (1)
166_listenCancellationTokenSource = new CancellationTokenSource();
Program.cs (1)
27var cancel = new CancellationTokenSource();
Shared (1)
Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Stress.AppHost (1)
TestResource.cs (1)
152private readonly CancellationTokenSource _tokenSource = new();
System.Collections.Concurrent (2)
System\Collections\Concurrent\BlockingCollection.cs (2)
217_consumersCancellationTokenSource = new CancellationTokenSource(); 218_producersCancellationTokenSource = new CancellationTokenSource();
System.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionFactory.cs (1)
48CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
System.Data.OleDb (1)
System\Data\ProviderBase\DbConnectionFactory.cs (1)
157CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\AggregationManager.cs (1)
29private readonly CancellationTokenSource _cts = new();
System.Diagnostics.Process (2)
System\Diagnostics\AsyncStreamReader.cs (1)
63_cts = new CancellationTokenSource();
System\Diagnostics\ProcessWaitState.Unix.cs (1)
481(cts = new CancellationTokenSource(remainingTimeout)).Token;
System.IO.Pipelines (2)
System\IO\Pipelines\StreamPipeReader.cs (1)
79return _internalTokenSource ??= new CancellationTokenSource();
System\IO\Pipelines\StreamPipeWriter.cs (1)
41return _internalTokenSource ??= new CancellationTokenSource();
System.IO.Pipes (1)
System\IO\Pipes\NamedPipeServerStream.Unix.cs (1)
22private readonly CancellationTokenSource _internalTokenSource = new CancellationTokenSource();
System.IO.Ports (1)
System\IO\Ports\SerialStream.Unix.cs (1)
1069new CancellationTokenSource(Math.Max(timeoutMs, TimeoutResolution));
System.Linq.Parallel (4)
System\Linq\Parallel\QueryOperators\QueryOpeningEnumerator.cs (1)
45private readonly CancellationTokenSource _topLevelCancellationTokenSource = new CancellationTokenSource();
System\Linq\Parallel\QueryOperators\QuerySettings.cs (1)
137return WithPerExecutionSettings(new CancellationTokenSource(), new Shared<bool>(false));
System\Linq\Parallel\QueryOperators\Unary\ForAllOperator.cs (1)
53CancellationTokenSource dummyInternalCancellationTokenSource = new CancellationTokenSource();
System\Linq\ParallelEnumerable.cs (1)
4386.WithPerExecutionSettings(new CancellationTokenSource(), new System.Linq.Parallel.Shared<bool>(false));
System.Net.Http (10)
System\Net\Http\HttpClient.cs (2)
155_pendingRequestsCts = new CancellationTokenSource(); 702CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingRequestsCts, new CancellationTokenSource());
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (1)
511cts = new CancellationTokenSource((int)drainTime.TotalMilliseconds);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (1)
850var cts = new CancellationTokenSource(Settings._connectTimeout);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
829_altSvcBlocklistTimerCancellation = new CancellationTokenSource();
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (1)
223cts = new CancellationTokenSource((int)drainTime.TotalMilliseconds);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (2)
115_requestBodyCancellationSource = new CancellationTokenSource(); 127_requestBodyCancellationSource = new CancellationTokenSource();
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
81_requestBodyCancellationSource = new CancellationTokenSource();
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (1)
102_connectionDisposalCts = new CancellationTokenSource();
System.Net.Mail (2)
System\Net\Mail\SmtpClient.cs (2)
93_pendingSendCts = new CancellationTokenSource(); 631CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingSendCts, new CancellationTokenSource());
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.cs (1)
87_timeoutOrCancellationSource ??= new();
System.Net.Quic (4)
System\Net\Quic\QuicConnection.cs (1)
145private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
System\Net\Quic\QuicListener.cs (1)
91private readonly CancellationTokenSource _disposeCts = new CancellationTokenSource();
System\Net\Quic\QuicStream.Stream.cs (2)
124cts = new CancellationTokenSource(_readTimeout); 183cts = new CancellationTokenSource(_writeTimeout);
System.Net.Requests (1)
System\Net\HttpWebRequest.cs (1)
1202_sendRequestCts = new CancellationTokenSource();
System.Net.Security (1)
src\runtime\src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (1)
61CancellationTokenSource? cts = totalMillis > int.MaxValue ? null : new CancellationTokenSource((int)totalMillis);
System.Net.Sockets (1)
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
608_multipleConnectCancellation = saeaMultiConnectCancelable ? new CancellationTokenSource() : null;
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketStream.cs (1)
268cts = new CancellationTokenSource(timeout);
System.Private.CoreLib (4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.Threads.cs (1)
16m_dispatchTaskCancellationSource = new CancellationTokenSource();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (3)
29internal static readonly CancellationTokenSource s_canceledSource = new CancellationTokenSource() { _state = States.NotifyingCompleteState }; 31internal static readonly CancellationTokenSource s_neverCanceledSource = new CancellationTokenSource(); 854token.CanBeCanceled ? new Linked1CancellationTokenSource(token) : new CancellationTokenSource();
System.Security.Cryptography (1)
src\runtime\src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (1)
61CancellationTokenSource? cts = totalMillis > int.MaxValue ? null : new CancellationTokenSource((int)totalMillis);
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
990_httpSendCts = new CancellationTokenSource();
System.ServiceModel.Primitives (3)
Internals\System\Runtime\TaskHelpers.cs (1)
232using (CancellationTokenSource cts = new CancellationTokenSource())
Internals\System\Runtime\TimeoutHelper.cs (2)
320var tokenSource = new CancellationTokenSource((int)(targetTime - currentTime)); 337tokenTask = Task.FromResult(new CancellationTokenSource(millisecondsTimeout).Token);
System.Threading.Tasks.Dataflow (2)
Base\DataflowBlock.cs (2)
1125internal readonly CancellationTokenSource _cts = new CancellationTokenSource(); 2358internal readonly CancellationTokenSource Canceler = new CancellationTokenSource();
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\Parallel.ForEachAsync.cs (1)
537public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
System.Windows.Extensions (1)
System\Media\SoundPlayer.cs (1)
326var cts = new CancellationTokenSource();
System.Windows.Forms.Primitives (1)
System\Windows\Forms\Animation\HighPrecisionTimer.cs (1)
697CancellationSource = new CancellationTokenSource();
VBCSCompiler (3)
src\roslyn\src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
36var cancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Compilers\Server\VBCSCompiler\NamedPipeClientConnection.cs (1)
20private CancellationTokenSource DisconnectCancellationTokenSource { get; } = new CancellationTokenSource();
src\roslyn\src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (1)
59_cancellationTokenSource = new CancellationTokenSource();
vstest.console (1)
TestPlatformHelpers\TestRequestManager.cs (1)
456_currentAttachmentsProcessingCancellationTokenSource = new CancellationTokenSource();
vstest.console.arm64 (1)
src\vstest\src\vstest.console\TestPlatformHelpers\TestRequestManager.cs (1)
456_currentAttachmentsProcessingCancellationTokenSource = new CancellationTokenSource();
2215 references to CancellationTokenSource
aspire (88)
Backchannel\AuxiliaryBackchannelMonitor.cs (3)
239using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1)); 240using var combined = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken, timeout.Token);
Backchannel\ResourceSnapshotWatcher.cs (1)
16private readonly CancellationTokenSource _cts = new();
Commands\AppHostLauncher.cs (4)
583using var readinessCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 757using var probeCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\BaseCommand.cs (1)
286using var flushCancellationTokenSource = new CancellationTokenSource(s_extensionInteractionFlushTimeout);
Commands\DashboardRunCommand.cs (3)
441using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 442using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
Commands\InstallationInfoOutput.cs (2)
32using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\LsCommand.cs (2)
199using var statusCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\PsCommand.cs (2)
184using var followCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\RenderCommand.cs (2)
411using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\RunCommand.cs (9)
247CancellationTokenSource? runCts = null; 346runCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 406using var logCaptureCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 783CancellationTokenSource logCaptureCancellationSource, 790using var startupCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 871CancellationTokenSource logCaptureCancellationSource, 1246private async Task CancelAppHostStartupAsync(CancellationTokenSource runCancellationTokenSource, Task<int> pendingRun, CancellationToken cancellationToken)
ConsoleCancellationManager.cs (3)
13/// shared <see cref="CancellationTokenSource"/>, and owns the command-level graceful-shutdown policy: 66private readonly CancellationTokenSource _cts = new(); 67private readonly CancellationTokenSource _gracefulCts = new();
DotNet\ProcessExecution.cs (2)
347using var killDrain = new CancellationTokenSource(TimeSpan.FromSeconds(1)); 376using var drainCts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Interaction\ExtensionInteractionService.cs (1)
34private readonly CancellationTokenSource _cts = new();
Processes\LauncherLivenessMonitor.cs (1)
39CancellationTokenSource cancelOnLauncherExit,
Profiling\ProfileCaptureService.cs (6)
273using var timeoutCts = new CancellationTokenSource(timeout, _timeProvider); 274using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 390using var timeoutCts = new CancellationTokenSource(_profileDataTimeout, _timeProvider); 391using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
Projects\AppHostServerSession.cs (4)
38private readonly CancellationTokenSource _stopCts; 90_stopCts = CancellationTokenSource.CreateLinkedTokenSource(stopRequested); 312using var connectCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Projects\GuestAppHostProject.cs (6)
485using var serverStopCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 552using var appHostSystemCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 1098using var serverStopCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Projects\ProjectLocator.cs (4)
199using var discoveryCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 314using var validationCancellationTokenSource = stopAfterMultipleBuildableAppHosts 315? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken)
src\Shared\ContainerRuntimeDetector.cs (6)
166using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 268using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 345using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
Telemetry\InternalMicrosoftDetector.cs (7)
229using var stageCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 618using var timeoutSource = new CancellationTokenSource(_gitHubCandidateTimeout); 619using var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutSource.Token); 766using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Tui\TerminalViewerApp.cs (4)
87private CancellationTokenSource? _embeddedCts; 92private CancellationTokenSource? _outerCts; 207_embeddedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 226_outerCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\CliDownloader.cs (2)
196using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\EnvironmentChecker\DcpConnectionChecker.cs (3)
35using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 358using var exitCts = new CancellationTokenSource(s_processExitTimeout);
Utils\EnvironmentChecker\DeprecatedWorkloadCheck.cs (2)
54using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\EnvironmentChecker\EnvironmentChecker.cs (4)
45using var totalTimeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 54using var checkTimeoutCts = CancellationTokenSource.CreateLinkedTokenSource(totalTimeoutCts.Token);
Utils\ProcessCaptureRunner.cs (3)
72using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 191using var cts = new CancellationTokenSource(bound);
aspire-managed (6)
Program.cs (2)
47using var shutdownCts = new CancellationTokenSource(); 73using var operationCts = new CancellationTokenSource();
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
src\Shared\ParentProcessWatchdog.cs (3)
31public static IAsyncDisposable? Start(CancellationTokenSource operationCts) 42CancellationTokenSource operationCts, 94CancellationTokenSource operationCts,
Aspire.Acquisition.Tests (2)
Scripts\Common\ScriptHostFixture.cs (1)
18private CancellationTokenSource? _cts;
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Azure.Messaging.WebPubSub.Tests (1)
AspireWebPubSubExtensionsTests.cs (1)
295using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Azure.Search.Documents.Tests (1)
AspireAzureSearchExtensionsTests.cs (1)
135using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Cli.Tests (86)
Acquisition\PeerInstallProbeTests.cs (1)
396using var cts = new CancellationTokenSource();
Agents\AgentEnvironmentApplicatorTests.cs (1)
31using var cts = new CancellationTokenSource();
Agents\AspireSkillsInstallerTests.cs (3)
921using var cancellationTokenSource = new CancellationTokenSource(); 1157using var cancellationTokenSource = new CancellationTokenSource(); 1539using var cancellationTokenSource = new CancellationTokenSource();
Agents\TelemetryHookScriptTests.cs (1)
525using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
38using var watchCancellation = new CancellationTokenSource();
Backchannel\AppHostCliBackchannelTests.cs (1)
75using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
Backchannel\ExtensionBackchannelTests.cs (1)
104using var firstConnectorCts = new CancellationTokenSource();
Certificates\CertificateServiceTests.cs (1)
306using var cancellationTokenSource = new CancellationTokenSource();
Certificates\UnixCertificateManagerTests.cs (1)
28using var cancellationTokenSource = new CancellationTokenSource();
Commands\AgentMcpCommandTests.cs (4)
31var cts = new CancellationTokenSource(); 444using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(200)); 599CancellationTokenSource cts, 607public CancellationTokenSource Cts => cts;
Commands\AppHostLauncherTests.cs (3)
705using var cts = new CancellationTokenSource(); 771using var cts = new CancellationTokenSource(); 811using var cts = new CancellationTokenSource();
Commands\BaseCommandTests.cs (2)
458using var cts = new CancellationTokenSource(); 497using var cts = new CancellationTokenSource();
Commands\DashboardRunCommandTests.cs (1)
462using var cts = new CancellationTokenSource();
Commands\DescribeCommandTests.cs (1)
409using var cts = new CancellationTokenSource();
Commands\LogsCommandTests.cs (1)
962using var cts = new CancellationTokenSource();
Commands\LsCommandTests.cs (2)
463using var cancellationTokenSource = new CancellationTokenSource(); 670using var cancellationTokenSource = new CancellationTokenSource();
Commands\PsCommandTests.cs (1)
582using var cancellationTokenSource = new CancellationTokenSource();
Commands\RunCommandTests.cs (20)
368using var cts = new CancellationTokenSource(); 625using var cts = new CancellationTokenSource(); 1536using var cts = new CancellationTokenSource(); 1597using var cts = new CancellationTokenSource(); 1598using var unrelatedCts = new CancellationTokenSource(); 2052using var cts = new CancellationTokenSource(); 2124using var cts = new CancellationTokenSource(); 2375using var cts = new CancellationTokenSource(); 2486using var cts = new CancellationTokenSource(); 2592using var cts = new CancellationTokenSource(); 2662using var cts = new CancellationTokenSource(); 2731using var cts = new CancellationTokenSource(); 2922using var cts = new CancellationTokenSource(); 2981using var cts = new CancellationTokenSource(); 3093using var cts = new CancellationTokenSource(); 3152using var cts = new CancellationTokenSource(); 3559using var cts = new CancellationTokenSource(); 3640using var cts = new CancellationTokenSource(); 4098using var cts = new CancellationTokenSource(); 4171using var cts = new CancellationTokenSource();
DotNet\ProcessExecutionDetachedTests.cs (1)
157using var cts = new CancellationTokenSource();
DotNet\ProcessExecutionTests.cs (4)
170using var cts = new CancellationTokenSource(); 198using var cts = new CancellationTokenSource(); 229using var cts = new CancellationTokenSource(); 259using var cts = new CancellationTokenSource();
DotNetSdkInstallerTests.cs (1)
59using var cancellationTokenSource = new CancellationTokenSource();
Mcp\Docs\DocsFetcherTests.cs (1)
214using var cts = new CancellationTokenSource();
Mcp\Docs\DocsIndexServiceTests.cs (1)
826using var cts = new CancellationTokenSource();
Mcp\Docs\LlmsTxtParserTests.cs (1)
512var cts = new CancellationTokenSource();
Npm\AspireJsLauncherTests.cs (1)
381using var timeout = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
NuGet\NuGetPackagePrefetcherTests.cs (1)
112using var stoppingCts = new CancellationTokenSource();
Processes\LauncherLivenessMonitorTests.cs (4)
20using var runCts = new CancellationTokenSource(); 33using var runCts = new CancellationTokenSource(); 60using var runCts = new CancellationTokenSource(); 79using var runCts = new CancellationTokenSource();
Projects\AppHostCandidateFinderTests.cs (2)
494using var cancellationTokenSource = new CancellationTokenSource(); 507using var cancellationTokenSource = new CancellationTokenSource();
Projects\AppHostInfoResolverTests.cs (1)
156using var cancellationTokenSource = new CancellationTokenSource();
Projects\AppHostServerSessionTests.cs (5)
189using var stopCts = new CancellationTokenSource(); 218using var stopCts = new CancellationTokenSource(); 267using var stopCts = new CancellationTokenSource(); 313using var stopCts = new CancellationTokenSource(); 349using var stopCts = new CancellationTokenSource();
Projects\GuestAppHostProjectTests.cs (1)
1116using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Projects\GuestRuntimeTests.cs (2)
854using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 908using var cts = new CancellationTokenSource();
Projects\PrebuiltAppHostServerTests.cs (1)
1452using var cancellation = new CancellationTokenSource();
Projects\ProcessGuestLauncherTests.cs (5)
63using var cts = new CancellationTokenSource(); 99using var cts = new CancellationTokenSource(); 151using var cts = new CancellationTokenSource(); 210using var cts = new CancellationTokenSource(); 276using var cts = new CancellationTokenSource();
Projects\RunningInstanceManagerTests.cs (1)
66private readonly CancellationTokenSource _cts = new();
Telemetry\InternalMicrosoftDetectorTests.cs (1)
541using var safetyTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
TestServices\TestGracefulShutdownWindow.cs (1)
16private readonly CancellationTokenSource _cts = new();
Utils\DcpConnectionHealthCheckTests.cs (1)
90using var cancellation = new CancellationTokenSource();
Utils\DevCertsCheckTests.cs (1)
600using var cancellationTokenSource = new CancellationTokenSource();
Utils\EnvironmentCheckerTests.cs (1)
102using var cancellationTokenSource = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (50)
Components\Controls\ApplicationName.razor.cs (3)
12private CancellationTokenSource? _disposalCts; 37using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(_disposalCts.Token);
Components\Controls\Chart\ChartBase.cs (1)
22private readonly CancellationTokenSource _cts = new();
Components\Controls\Chart\ChartContainer.razor.cs (1)
23private readonly CancellationTokenSource _disposeCts = new();
Components\Controls\SpanDetails.razor.cs (1)
86private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
36private readonly CancellationTokenSource _cts = new();
Components\Dialogs\FilterDialog.razor.cs (1)
20private readonly CancellationTokenSource _disposeCts = new();
Components\Dialogs\GenAIVisualizerDialog.razor.cs (1)
28private readonly CancellationTokenSource _cts = new();
Components\Dialogs\InteractionsInputDialog.razor.cs (1)
37private readonly CancellationTokenSource _disposalCts = new();
Components\Dialogs\ManageDataDialog.razor.cs (1)
68private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (3)
37private readonly CancellationTokenSource _cts = new(); 139private readonly CancellationTokenSource _resourceSubscriptionCts = new(); 154private CancellationTokenSource? _showNoLogsMessageCts;
Components\Pages\Resources.razor.cs (1)
107private readonly CancellationTokenSource _cts = new();
Components\Pages\StructuredLogs.razor.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\TraceDetail.razor.cs (1)
34private readonly CancellationTokenSource _cts = new();
Components\Pages\Traces.razor.cs (1)
32private readonly CancellationTokenSource _cts = new();
Model\DashboardCommandExecutor.cs (2)
103using var executeCommandCts = new CancellationTokenSource(); 148var closeToastCts = new CancellationTokenSource();
Model\ResourceOutgoingPeerResolver.cs (1)
29private readonly CancellationTokenSource _watchContainersTokenSource;
Model\TraceLinkHelpers.cs (1)
48using var cts = new CancellationTokenSource();
ServiceClient\DashboardClient.cs (20)
57private readonly CancellationTokenSource _cts = new(); 81private CancellationTokenSource? _reconnectDelayCts; 395CancellationTokenSource delayCts; 398delayCts = _reconnectDelayCts ??= CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 486CancellationTokenSource delayCts; 489delayCts = _reconnectDelayCts ??= CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 696var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 847var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 895var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 943using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 986using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 1053using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 1108using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken);
Terminal\TerminalWebSocketProxy.cs (2)
264using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(ct);
Utils\CallbackThrottler.cs (1)
34private readonly CancellationTokenSource _cts;
Utils\CancellationSeries.cs (4)
19private CancellationTokenSource? _cts; 33var nextCts = new CancellationTokenSource(); 58private async Task Next(CancellationTokenSource? next) 60using var priorCts = Interlocked.Exchange(ref _cts, next);
Aspire.Dashboard.Components.Tests (2)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Dashboard.Tests (39)
ChannelExtensionsTests.cs (5)
35var cts = new CancellationTokenSource(); 57var cts = new CancellationTokenSource(); 81var cts = new CancellationTokenSource(); 105var cts = new CancellationTokenSource(); 149var cts = new CancellationTokenSource();
Integration\StartupTests.cs (1)
109using var cts = new CancellationTokenSource();
Integration\TelemetryApiTests.cs (2)
354using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 385using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Model\DashboardClientTests.cs (3)
40var cts = new CancellationTokenSource(); 126var cts = new CancellationTokenSource(); 184var cts = new CancellationTokenSource();
Model\SqliteResourceRepositoryTests.cs (2)
48using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 72using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Shared\TestHostApplicationLifetime.cs (3)
10private readonly CancellationTokenSource _started = new(); 11private readonly CancellationTokenSource _stopping = new(); 12private readonly CancellationTokenSource _stopped = new();
TelemetryRepositoryTests\SqliteTelemetryPersistenceTests.cs (1)
34using var cancellationSource = new CancellationTokenSource();
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (20)
387using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 446using var cts = new CancellationTokenSource(); 505using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 563using var cts = new CancellationTokenSource(); 657using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 658using var doneCts = new CancellationTokenSource(); 659using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cts.Token, doneCts.Token); 735using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 736using var doneCts = new CancellationTokenSource(); 737using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cts.Token, doneCts.Token); 806using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 881using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 912using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 971using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1062using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1145using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1248using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 1345using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Deployment.EndToEnd.Tests (162)
AcaCompactNamingDeploymentTests.cs (6)
27using var cts = new CancellationTokenSource(s_testTimeout); 28using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource( 41using var cts = new CancellationTokenSource(s_testTimeout); 42using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaCompactNamingUpgradeDeploymentTests.cs (3)
27using var cts = new CancellationTokenSource(s_testTimeout); 28using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaCustomRegistryDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaDeploymentErrorOutputTests.cs (3)
30using var cts = new CancellationTokenSource(s_testTimeout); 31using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaExistingRegistryDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaManagedRedisDeploymentTests.cs (3)
24using var cts = new CancellationTokenSource(s_testTimeout); 25using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaStarterDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcrPurgeTaskDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksAzureKubernetesEnvironmentCertManagerDeploymentTests.cs (3)
34using var cts = new CancellationTokenSource(s_testTimeout); 35using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksAzureKubernetesEnvironmentCertManagerTypeScriptDeploymentTests.cs (3)
37using var cts = new CancellationTokenSource(s_testTimeout); 38using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksAzureKubernetesEnvironmentGatewayDeploymentTests.cs (3)
28using var cts = new CancellationTokenSource(s_testTimeout); 29using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksBlazorRedisDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksMultipleNodePoolsDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksPersistentVolumeDeploymentTests.cs (3)
19using var cts = new CancellationTokenSource(s_testTimeout); 20using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksStarterDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksStarterWithRedisHelmDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksVnetInfraDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksVnetWithAzureResourcesDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksWithAzureResourcesDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksWithHelmChartDeploymentTests.cs (3)
29using var cts = new CancellationTokenSource(s_testTimeout); 30using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AppServicePythonDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AppServiceReactDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AppServiceStoragePrivateEndpointDeploymentTests.cs (3)
20using var cts = new CancellationTokenSource(s_testTimeout); 21using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureAppConfigDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureContainerRegistryDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureEventHubsDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureKeyVaultDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureLogAnalyticsDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureResourceScopeDeploymentTests.cs (3)
20using var cts = new CancellationTokenSource(s_testTimeout); 21using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureRoleAssignmentRunModeTests.cs (3)
33using var cts = new CancellationTokenSource(s_testTimeout); 34using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureServiceBusDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureStorageDeploymentTests.cs (6)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource( 33using var cts = new CancellationTokenSource(s_testTimeout); 34using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureStorageRunModeTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
FoundryHostedAgentDeploymentTests.cs (3)
24using var cts = new CancellationTokenSource(s_testTimeout); 25using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
FrontDoorDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
Helpers\DeploymentE2ETestHelpers.cs (1)
162using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
KubernetesGatewayTlsDeploymentTests.cs (3)
28using var cts = new CancellationTokenSource(s_testTimeout); 29using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
KubernetesHelmChartDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
NspStorageKeyVaultDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
PythonFastApiDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
RadiusAzureResourcesDeploymentTests.cs (3)
39using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(8)); 40using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
RadiusStarterDeploymentTests.cs (5)
36using var cts = new CancellationTokenSource(s_testTimeout); 37using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource( 650using var waitCts = new CancellationTokenSource(TimeSpan.FromMinutes(2)); 666using var killCts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
TypeScriptAzureContainerAppJobDeploymentTests.cs (3)
20using var cts = new CancellationTokenSource(s_testTimeout); 21using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
TypeScriptExpressDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
TypeScriptJavaScriptHostingDeploymentTests.cs (3)
20using var cts = new CancellationTokenSource(s_testTimeout); 21using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
TypeScriptVnetSqlServerInfraDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetKeyVaultConnectivityDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetKeyVaultInfraDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetSqlServerConnectivityDeploymentTests.cs (3)
26using var cts = new CancellationTokenSource(s_testTimeout); 27using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetSqlServerInfraDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetStorageBlobConnectivityDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetStorageBlobInfraDeploymentTests.cs (3)
21using var cts = new CancellationTokenSource(s_testTimeout); 22using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
Aspire.EndToEnd.Tests (2)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
367CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Hosting (96)
ApplicationModel\CommandsConfigurationExtensions.cs (5)
249using var logCts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken); 273using var buildTimeoutCts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken); 406private static async Task StopLogForwardingAsync(CancellationTokenSource logCts, Task logForwardTask)
ApplicationModel\ResourceCommandService.cs (2)
439using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(progress.CancellationToken, cancellationToken);
ApplicationModel\ResourceLoggerService.cs (4)
23private readonly CancellationTokenSource _disposing = new(); 232using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken); 379private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (3)
30private readonly CancellationTokenSource _disposing = new(); 670using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken);
Backchannel\AppHostRpcTarget.cs (7)
28private readonly CancellationTokenSource _shutdownCts = new(); 39using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token); 81using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token); 118using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token);
Backchannel\AuxiliaryBackchannelRpcTarget.cs (8)
646using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(request.TimeoutSeconds)); 647using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 1577using var logStreamCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 1883using var timeoutCts = new CancellationTokenSource(s_mcpDiscoveryTimeout); 1884using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
Backchannel\TerminalHostControlClient.cs (2)
43using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Dashboard\DashboardEventHandlers.cs (2)
58private CancellationTokenSource? _dashboardLogsCts; 81_dashboardLogsCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping);
Dashboard\DashboardService.cs (4)
77var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 479using var cts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, serverCallContext.CancellationToken);
Dashboard\DashboardServiceData.cs (5)
17private readonly CancellationTokenSource _cts = new(); 172using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token); 189using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token);
Dashboard\ResourcePublisher.cs (2)
60using var linked = CancellationTokenSource.CreateLinkedTokenSource(enumeratorCancellationToken, cancellationToken);
Dcp\DcpExecutor.cs (2)
71private readonly CancellationTokenSource _shutdownCancellation = new(); 325var disposeCts = new CancellationTokenSource();
Dcp\DcpHost.cs (5)
39private readonly CancellationTokenSource _shutdownCts = new(); 106using var timeoutCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 585var notificationCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token);
Dcp\DcpKubernetesClient.cs (6)
52using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 92using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 118using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Dcp\DcpResourceWatcher.cs (4)
267using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 436using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 1018private readonly CancellationTokenSource _cancellation = new();
Dcp\ResourceLogSource.cs (1)
35CancellationTokenSource? ownedCts = null;
Devcontainers\DevcontainerSettingsWriter.cs (1)
34private readonly CancellationTokenSource _processingCancellation = new();
ExternalServiceBuilderExtensions.cs (3)
349using var timeoutSource = new CancellationTokenSource(s_defaultHttpTimeout); 350using var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, cancellationToken);
Health\ResourceHealthCheckService.cs (2)
324private readonly CancellationTokenSource _cts; 332_cts = CancellationTokenSource.CreateLinkedTokenSource(serviceStoppingToken);
IInteractionService.cs (2)
141private CancellationTokenSource? _currentCts; 189_currentCts = CancellationTokenSource.CreateLinkedTokenSource(options.CancellationToken);
InteractionService.cs (8)
114using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 189using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 268using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 296using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Orchestrator\ApplicationOrchestrator.cs (3)
37private readonly CancellationTokenSource _shutdownCancellation = new(); 128using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Orchestrator\ParameterProcessor.cs (2)
34private CancellationTokenSource? _allParametersResolvedCts; 83var cts = new CancellationTokenSource();
Pipelines\DistributedApplicationPipeline.cs (2)
193using var waitCts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken);
Pipelines\PipelineActivityReporter.cs (1)
23private readonly CancellationTokenSource _cancellationTokenSource = new();
src\Shared\ContainerRuntimeDetector.cs (6)
166using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 268using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 345using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\PeriodicRestartAsyncEnumerable.cs (4)
26using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Azure (11)
AzureProvisioningController.cs (3)
4224private readonly CancellationTokenSource _cancellationTokenSource; 4229private ActiveAzureOperation(AzureIntent intent, AzureOperationState operation, DateTimeOffset startedAt, CancellationTokenSource cancellationTokenSource) 4252=> new(intent, operation, startedAt, CancellationTokenSource.CreateLinkedTokenSource(cancellationToken));
Provisioning\Internal\DefaultArmClientProvider.cs (6)
271using var timeoutCts = new CancellationTokenSource(s_keyVaultDeleteTimeout, timeProvider); 272using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 302using var timeoutCts = new CancellationTokenSource(s_keyVaultPurgeTimeout, timeProvider); 303using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
Provisioning\Provisioners\BicepProvisioner.cs (2)
699using var deploymentOperationTrackingCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Azure.Kusto.Tests (17)
KustoFunctionalTests.cs (15)
46using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 47using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 97using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 98using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 175using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 176using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 203using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 204using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 236using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 237using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Azure.Tests (33)
AzureBicepProvisionerTests.cs (2)
62var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 1750using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
28var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 69var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 141var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 275var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureDeployerTests.cs (1)
1901using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureEnvironmentResourceExtensionsTests.cs (4)
2335using var cts = new CancellationTokenSource(); 4282using var cts = new CancellationTokenSource(); 5126using var watchdog = new CancellationTokenSource(s_testSynchronizationTimeout); 5155using var watchdog = new CancellationTokenSource(s_testSynchronizationTimeout);
AzureEventHubsExtensionsTests.cs (3)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 120var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureServiceBusExtensionsTests.cs (3)
76var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 119var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 811var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureSignalREmulatorFunctionalTest.cs (2)
42var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 78var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureStorageEmulatorFunctionalTests.cs (6)
23var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 115var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 158var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 214var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 254var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultAzurePrincipalProviderTests.cs (1)
116using var cts = new CancellationTokenSource();
FoundryExtensionsTests.cs (5)
74var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 332using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 361using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 402using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 443using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
tests\Shared\TestInteractionService.cs (2)
82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Blazor (1)
BrowserDebuggerHelper.cs (1)
81var watcherCts = new CancellationTokenSource();
Aspire.Hosting.Blazor.Tests (4)
BrowserDebuggerHelperTests.cs (2)
101using var watcherCts = new CancellationTokenSource(); 126using var watcherCts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Browsers (12)
BrowserEndpointDiscovery.cs (2)
210using var probeCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
BrowserLogsCdpConnection.cs (4)
48private readonly CancellationTokenSource _disposeCts = new(); 239using var sendCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposeCts.Token); 484using var closeCts = new CancellationTokenSource(_closeTimeout);
BrowserLogsRunningSession.cs (1)
92private readonly CancellationTokenSource _stopCts = new();
BrowserPageSession.cs (4)
39private readonly CancellationTokenSource _stopCts = new(); 90using var captureCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _stopCts.Token); 200using var closeTargetCts = new CancellationTokenSource(s_closeTargetTimeout);
IBrowserHost.cs (1)
106using var releaseCts = new CancellationTokenSource(s_releaseTimeout);
Aspire.Hosting.Browsers.Tests (16)
src\Aspire.Hosting.Browsers\BrowserEndpointDiscovery.cs (2)
210using var probeCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\Aspire.Hosting.Browsers\BrowserLogsCdpConnection.cs (4)
48private readonly CancellationTokenSource _disposeCts = new(); 239using var sendCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposeCts.Token); 484using var closeCts = new CancellationTokenSource(_closeTimeout);
src\Aspire.Hosting.Browsers\BrowserLogsRunningSession.cs (1)
92private readonly CancellationTokenSource _stopCts = new();
src\Aspire.Hosting.Browsers\BrowserPageSession.cs (4)
39private readonly CancellationTokenSource _stopCts = new(); 90using var captureCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _stopCts.Token); 200using var closeTargetCts = new CancellationTokenSource(s_closeTargetTimeout);
src\Aspire.Hosting.Browsers\IBrowserHost.cs (1)
106using var releaseCts = new CancellationTokenSource(s_releaseTimeout);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
tests\Shared\TestInteractionService.cs (2)
82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.CodeGeneration.TypeScript.Tests (1)
AtsTypeScriptCodeGeneratorTests.cs (1)
2514using var cancellation = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (7)
DockerSocketBindMountTests.cs (1)
39using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
ResourceFailureLoggingTests.cs (4)
22using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 45using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 69using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 93using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.DevTunnels (2)
src\Shared\CoalescingAsyncOperation.cs (2)
16private CancellationTokenSource? _cts; 44_cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.DevTunnels.Tests (5)
DevTunnelResourceBuilderExtensionsTests.cs (1)
594using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
tests\Shared\TestInteractionService.cs (2)
82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Dotnet.Tests (4)
DotnetProjectResourceTests.cs (2)
916using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.DotnetTool.Tests (4)
DotnetToolFunctionalTests.cs.cs (2)
14var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2)); 35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.EntityFrameworkCore (2)
EFCoreOperationExecutor.cs (2)
295using var logCancellation = CancellationTokenSource.CreateLinkedTokenSource(_cancellationToken);
Aspire.Hosting.EntityFrameworkCore.Tests (7)
EFCoreOperationExecutorTests.cs (7)
24using var cts = new CancellationTokenSource(); 41using var cts = new CancellationTokenSource(); 58using var cts = new CancellationTokenSource(); 73using var cts = new CancellationTokenSource(); 93using var cts = new CancellationTokenSource(); 110using var cts = new CancellationTokenSource(); 128using var cts = new CancellationTokenSource();
Aspire.Hosting.Foundry (6)
FoundryLocalService.cs (4)
100using var stopCancellation = new CancellationTokenSource(stopTimeout); 165using var startCancellation = new CancellationTokenSource(s_serviceStartTimeout); 166using var linkedCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, startCancellation.Token);
PromptAgent\AzurePromptAgentResource.cs (2)
306var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, lifetime.ApplicationStopping);
Aspire.Hosting.Foundry.Tests (3)
PromptAgentTests.cs (1)
95using var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
23var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 61var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 106var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.GitHub.Models.Tests (3)
GitHubModelsFunctionalTests.cs (1)
19using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.JavaScript.Tests (9)
BunAppFixture.cs (2)
46using var startCts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 49using var readinessCts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
BunFunctionalTests.cs (2)
23using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 33using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
NodeAppFixture.cs (1)
41using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
23using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 33using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Kafka.Tests (4)
KafkaFunctionalTests.cs (2)
64var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 122var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Maui (9)
Annotations\MauiBuildQueueAnnotation.cs (2)
24public ConcurrentDictionary<string, CancellationTokenSource> ResourceCancellations { get; } = new(); 32if (ResourceCancellations.TryRemove(resourceName, out var cts))
Lifecycle\MauiBuildQueueEventSubscriber.cs (7)
71using var resourceCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 180using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 288using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 399using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Hosting.Maui.Tests (5)
MauiBuildQueueTests.cs (5)
42var cts = new CancellationTokenSource(); 123using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 157using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 239using var cts = new CancellationTokenSource(); 788using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Aspire.Hosting.MongoDB.Tests (5)
MongoDbFunctionalTests.cs (5)
35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 111var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 258var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 365var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (13)
MySqlFunctionalTests.cs (11)
32using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 70using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 125using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 306using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 401using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 483using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 557using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 628var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 710var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 786var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 837var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Nats.Tests (3)
NatsFunctionalTests.cs (3)
70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 113var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 330var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.OpenAI (2)
OpenAIHealthCheck.cs (2)
63using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.OpenAI.Tests (4)
OpenAIFunctionalTests.cs (2)
20using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 62using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Oracle.Tests (5)
OracleFunctionalTests.cs (5)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 83var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 355var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 448var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (11)
PostgresFunctionalTests.cs (9)
101var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 197var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 366var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 462var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 544var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 603var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 656var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 702var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 780var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Qdrant.Tests (3)
QdrantFunctionalTests.cs (3)
29var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 94var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 259var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (3)
RabbitMQFunctionalTests.cs (1)
100var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Radius (2)
Publishing\SealedSecretApplyStep.cs (2)
328using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Radius.Tests (3)
Deployment\RadCliDetectionTests.cs (1)
35using var cts = new CancellationTokenSource();
Secrets\SealedSecretApplyStepTests.cs (2)
542using var cts = new CancellationTokenSource(); 820using var cts = new CancellationTokenSource();
Aspire.Hosting.Redis.Tests (6)
RedisFunctionalTests.cs (6)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 139var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 174var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 226var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 484var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 663var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.RemoteHost (12)
CancellationTokenRegistry.cs (10)
16private readonly ConcurrentDictionary<string, CancellationTokenSource> _sources = new(); 30var cts = new CancellationTokenSource(); 52var cts = CancellationTokenSource.CreateLinkedTokenSource(linkedToken); 70if (_sources.TryGetValue(tokenId, out var cts)) 94if (_sources.TryRemove(tokenId, out var cts)) 110if (_sources.TryGetValue(tokenId, out var cts)) 131if (_sources.TryGetValue(tokenId, out var existing)) 137var cts = new CancellationTokenSource(); 140var added = _sources.GetOrAdd(tokenId, cts);
JsonRpcCallbackInvoker.cs (2)
38using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.RemoteHost.Tests (11)
AtsMarshallerTests.cs (2)
205using var cts = new CancellationTokenSource(); 221using var cts = new CancellationTokenSource();
CallbackProxyTests.cs (2)
192using var cts = new CancellationTokenSource(); 213using var cts = new CancellationTokenSource();
CancellationTokenRegistryTests.cs (1)
38using var cts = new CancellationTokenSource();
CapabilityDispatcherTests.cs (1)
315using var cts = new CancellationTokenSource();
JsonRpcAuthenticationTests.cs (3)
187using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 188using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
tests\Shared\TestInteractionService.cs (2)
82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Rust (2)
CargoMetadataReader.cs (2)
101using var timeoutSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Rust.Tests (2)
RustPublicApiTests.cs (2)
215using var cts = new CancellationTokenSource(); 513using var cts = new CancellationTokenSource();
Aspire.Hosting.Sdk.Tests (2)
AppHostSdkTargetsTests.cs (2)
1828using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 1887using var cts = new CancellationTokenSource(timeout);
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 67var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 133var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 343var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 417var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 471var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 548var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (11)
DistributedApplicationFactory.cs (11)
28private readonly CancellationTokenSource _disposingCts = new(); 48using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 58using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 71using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 408using var cts = new CancellationTokenSource(GetConfiguredTimeout()); 502using var shutdownTimeoutCts = new CancellationTokenSource(_shutdownTimeout); 597using var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, appFactory._disposingCts.Token);
Aspire.Hosting.Testing.Tests (21)
DashboardUrlTests.cs (8)
27using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 72using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 98using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 169using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 203using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 259using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 312using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 330using var cancellationTokenSource = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceLoggerForwarderServiceTests.cs (3)
156private readonly CancellationTokenSource _startedCts = new(); 157private readonly CancellationTokenSource _stoppingCts = new(); 158private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
458using var cts = new CancellationTokenSource(timeout); 503using var cts = new CancellationTokenSource(timeout); 524using var cts = new CancellationTokenSource(timeout);
TestingFactoryCrashTests.cs (1)
21using var cts = new CancellationTokenSource(timeout);
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (4)
80var watchCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, cancellationToken); 122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource) 160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Tests (209)
ApplicationModel\McpServerEndpointAnnotationTests.cs (1)
171using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
ApplicationModel\ResourceAnnotationCollectionTests.cs (1)
183using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Backchannel\AppHostRpcTargetCancellationTests.cs (6)
30using var cts = new CancellationTokenSource(); 50using var cts = new CancellationTokenSource(); 105using var cts = new CancellationTokenSource(); 124using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 195using var cts = new CancellationTokenSource();
Backchannel\AppHostRpcTargetUploadTests.cs (1)
147using var cancellationTokenSource = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (5)
979using var cts = new CancellationTokenSource(); 1091using var cts = new CancellationTokenSource(); 1507using var cancellationTokenSource = new CancellationTokenSource(); 1542using var cancellationTokenSource = new CancellationTokenSource(); 2112using var cts = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelTests.cs (1)
422using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
Backchannel\GetTerminalInfoAsyncTests.cs (1)
379private CancellationTokenSource? _cts;
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 65var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceTests.cs (7)
216var cts = new CancellationTokenSource(); 478var cts = new CancellationTokenSource(); 549var cts = new CancellationTokenSource(); 597var cts = new CancellationTokenSource(); 657var cts = new CancellationTokenSource(); 695var cts = new CancellationTokenSource(); 1325private static async Task CancelTokenAndAwaitTask(CancellationTokenSource cts, Task task)
Dashboard\ResourcePublisherTests.cs (5)
35CancellationTokenSource cts = new(); 88CancellationTokenSource cts = new(); 135CancellationTokenSource cts = new(); 156CancellationTokenSource cts = new(); 177CancellationTokenSource cts = new();
Dcp\DcpExecutorTests.cs (3)
1512var watchCts = new CancellationTokenSource(); 4635using var cts = new CancellationTokenSource(); 8348using var restartCancellation = new CancellationTokenSource();
Dcp\DcpHostNotificationTests.cs (16)
110using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 154using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 208using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 267using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 325using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 380using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 402using (var testTimeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(5))) 403using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(interaction.CancellationToken, testTimeoutCts.Token)) 451using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 785using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 835using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 894using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 946using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 1004using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 1068using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Dcp\KubernetesServiceTests.cs (9)
27using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 50using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 73using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 96using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 118using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 139using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20)); 140using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(cts.Token); 176using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
DebugSupportExtensionsTests.cs (4)
77using var cts = new CancellationTokenSource(); 196using var cts = new CancellationTokenSource(); 215using var cts = new CancellationTokenSource(); 256using var cts = new CancellationTokenSource();
DistributedApplicationTests.cs (21)
77var cts = new CancellationTokenSource(); 122var cts = new CancellationTokenSource(); 204using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 249using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 339using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout); 383using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout); 442using var cts = new CancellationTokenSource(); 482using var cts = new CancellationTokenSource(); 538using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 625using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.ExtraLongTimeoutDuration); 790var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 1221using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1259using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1768using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 2041using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 2080using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.ExtraLongTimeoutDuration); 2228using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 2243using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout)) 2252using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout)) 2266using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout)) 2299using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.ExtraLongTimeoutDuration);
EndpointReferenceTests.cs (1)
173using var cts = new CancellationTokenSource();
ExecutionConfigurationGathererTests.cs (1)
659using var cts = new CancellationTokenSource();
Health\FriendlyHealthCheckErrorMessagesTests.cs (3)
36var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 76var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 202var cts = new CancellationTokenSource();
Health\ResourceHealthCheckServiceTests.cs (3)
225var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 266var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 309var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
InteractionServiceTests.cs (5)
51var cts = new CancellationTokenSource(); 1222using var cts = new CancellationTokenSource(); 1256var cts = new CancellationTokenSource(); 1297var cts = new CancellationTokenSource(); 1404using var cancellationTokenSource = new CancellationTokenSource();
Lifecycle\TerminalHostFailureDiagnosticServiceTests.cs (4)
219private static (ResourceNotificationService Notifications, ResourceLoggerService Loggers, TerminalHostResource Host, TerminalHostFailureDiagnosticService Service, CancellationTokenSource StopCts) CreateHarness( 244var stopCts = new CancellationTokenSource(); 274using var cts = timeoutMs is { } ms ? new CancellationTokenSource(ms) : null; 297using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(150));
Publishing\ContainerRuntimeResolverTests.cs (1)
68using var cts = new CancellationTokenSource();
Publishing\PipelineActivityReporterTests.cs (1)
691using var cancellationTokenSource = new CancellationTokenSource();
Publishing\ResourceContainerImageManagerTests.cs (30)
37using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 102using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 139using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 173using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 203using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 241using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 285using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 322using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 354using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 383using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 434using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 463using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 487using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 522using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 555using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 588using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 626using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 665using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 703using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 748using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 822using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 918using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 971using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1346using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1394using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1429using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1472using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1505using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1541using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceCommandServiceTests.cs (1)
1649using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
ResourceFailureLoggingTests.cs (2)
21using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 48using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout);
ResourceNotificationTests.cs (23)
76using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 119using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 197using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 254using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 346using var cts = new CancellationTokenSource(); 368using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 416using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 472using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 526using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 566using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 606using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 644using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 677using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 716using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 748using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 825using var cts = new CancellationTokenSource(); 852using var cts = new CancellationTokenSource(); 894using var cts = new CancellationTokenSource(); 1055using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 1107using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 1143using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 1397using var cts = new CancellationTokenSource(); 1430private readonly CancellationTokenSource _stoppingCts = new();
SlimTestProgramTests.cs (3)
27using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 52using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 71using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
TestProgramFixture.cs (1)
32using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
tests\Shared\TestInteractionService.cs (2)
82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\PeriodicRestartAsyncEnumerableTests.cs (2)
15using var cts = new CancellationTokenSource(); 39using var cts = new CancellationTokenSource();
ValueSnapshotTests.cs (2)
180using var cts = new CancellationTokenSource(); 192using var cts = new CancellationTokenSource();
WaitForTests.cs (36)
29var abortCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 104using var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 107using var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 135using var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 138using var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 168var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 174var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 212var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 215var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 323var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 326var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 357var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 360var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 404var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 407var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 446var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 452var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 468var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 493var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 499var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 515var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 548var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 554var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 571var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 602var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 608var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 623var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 653var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 659var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 706var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 712var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 755var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 761var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 870var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 874var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 884var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
WithHttpCommandTests.cs (2)
468using var cts = new CancellationTokenSource(); 588private sealed class CancelingHttpMessageHandler(CancellationTokenSource cancellationTokenSource) : HttpMessageHandler
WithProcessCommandTests.cs (1)
1471using var cts = new CancellationTokenSource();
Aspire.Hosting.TestUtilities (6)
Utils\DockerUtils.cs (1)
49using var cts = new CancellationTokenSource(s_runtimeDetectionTimeout);
Utils\LoggerNotificationExtensions.cs (4)
80var watchCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, cancellationToken); 122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource) 160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
Utils\PersistentContainerTestHelpers.cs (1)
61using var cts = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(10));
Aspire.Hosting.Valkey.Tests (3)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
208var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
35var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Managed.Tests (2)
ParentProcessWatchdogTests.cs (2)
44using var operationCts = new CancellationTokenSource(); 61using var operationCts = new CancellationTokenSource();
Aspire.Milvus.Client.Tests (1)
MilvusHealthCheckTests.cs (1)
43using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
112using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v2.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
112using var source = new CancellationTokenSource(10);
Aspire.MongoDB.EntityFrameworkCore.Tests (1)
ConformanceTests.cs (1)
89using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.NATS.Net.Tests (1)
AspireNatsClientExtensionsTests.cs (1)
199using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Playground.Tests (7)
ProjectSpecificTests.cs (1)
157CancellationTokenSource cts = new();
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (4)
80var watchCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, cancellationToken); 122private static async Task WatchNotifications(DistributedApplication app, string? resourceName, Predicate<string> predicate, TaskCompletionSource tcs, CancellationTokenSource cancellationTokenSource) 160private static async Task WatchResourceLogs(TaskCompletionSource tcs, string resourceId, Predicate<string> predicate, ResourceLoggerService resourceLoggerService, CancellationTokenSource cancellationTokenSource)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Qdrant.Client.Tests (1)
QdrantHealthCheckTests.cs (1)
40using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Seq.Tests (2)
SeqEndpointCanBeConfigured.cs (2)
81using var serverCts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 94using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Templates.Tests (3)
TemplateTestsBase.cs (1)
186var cts = new CancellationTokenSource();
tests\Shared\TemplatesTesting\AspireProject.cs (1)
367CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.TerminalHost (15)
DcpUpstreamAdapter.cs (1)
66private readonly CancellationTokenSource _disposeCts = new();
src\Shared\ParentProcessLivenessMonitor.cs (1)
15private readonly CancellationTokenSource _stopCts = new();
src\Shared\ParentProcessWatchdog.cs (3)
31public static IAsyncDisposable? Start(CancellationTokenSource operationCts) 42CancellationTokenSource operationCts, 94CancellationTokenSource operationCts,
TerminalHostApp.cs (4)
33private readonly CancellationTokenSource _shutdownCts = new(); 106using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource( 403using var stopCts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
TerminalHostControlListener.cs (1)
22private readonly CancellationTokenSource _disposeCts = new();
TerminalHostProcessRunner.cs (3)
21using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 22using var forceExitCts = new CancellationTokenSource();
TerminalReplica.cs (2)
51private readonly CancellationTokenSource _stopCts; 182_stopCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.TerminalHost.Tests (16)
TerminalHostAppTests.cs (14)
53using var hostCts = new CancellationTokenSource(); 76using var hostCts = new CancellationTokenSource(); 108using var hostCts = new CancellationTokenSource(); 136using var hostCts = new CancellationTokenSource(); 195using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); 213using var hostCts = new CancellationTokenSource(); 266using var hostCts = new CancellationTokenSource(); 304using var hostCts = new CancellationTokenSource(); 390using var hostCts = new CancellationTokenSource(); 435using var hostCts = new CancellationTokenSource(); 472using var hostCts = new CancellationTokenSource(); 590using var cts = new CancellationTokenSource(timeout); 827using var hostCts = new CancellationTokenSource(); 864using var hostCts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.TestTools (4)
GitHubCli.cs (4)
245using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 295using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CodeStyleConfigFileGenerator (2)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
csc (2)
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (2)
310var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CustomResources.AppHost (1)
TestResource.cs (1)
37private readonly CancellationTokenSource _tokenSource = new();
dotnet (17)
Commands\Test\MTP\CtrlCCancellationManager.cs (1)
31private readonly CancellationTokenSource _cancellationTokenSource = new();
Commands\Test\MTP\MicrosoftTestingPlatformTestCommand.cs (2)
175using var queueCancellation = CancellationTokenSource.CreateLinkedTokenSource(ctrlC.Token, testRunPolicy.Token);
Commands\Test\MTP\Terminal\TestProgressStateAwareTerminal.cs (1)
14private readonly CancellationTokenSource _cts = new();
Commands\Test\MTP\TestApplication.cs (1)
58private readonly CancellationTokenSource _pipeCancellationTokenSource = new();
Commands\Test\MTP\TestRunPolicy.cs (1)
26private readonly CancellationTokenSource _cancellationTokenSource = new();
NugetPackageDownloader\NuGetPackageDownloader.cs (8)
836using CancellationTokenSource linkedCts = 837CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 1011var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1012var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 1030var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1031var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
NugetSearch\NugetToolSearchApiRequest.cs (1)
29using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10));
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.12.0-1.26426.103\contentFiles\cs\net11.0\BuildServerConnection.cs (2)
310var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
dotnet-aot (10)
src\sdk\src\Cli\dotnet\NugetPackageDownloader\NuGetPackageDownloader.cs (8)
836using CancellationTokenSource linkedCts = 837CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 1011var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1012var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 1030var timeoutCts = new CancellationTokenSource(CliCompletionsTimeout); 1031var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
src\sdk\src\Cli\dotnet\NugetSearch\NugetToolSearchApiRequest.cs (2)
29using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 98using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10));
dotnet-svcutil-lib (9)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (1)
166using (CancellationTokenSource cts = new CancellationTokenSource())
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (2)
252var args = (Tuple<long, CancellationTokenSource>)state; 309var tokenSource = new CancellationTokenSource((int)(targetTime - currentTime));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (2)
866((CancellationTokenSource)state).Cancel(); 884private readonly CancellationTokenSource _httpSendCts;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SslStreamSecurityUpgradeProvider.cs (3)
280using (CancellationTokenSource cts = new CancellationTokenSource(timeout)) 525using (CancellationTokenSource cts = new CancellationTokenSource(timeoutHelper.RemainingTime())) 539using (CancellationTokenSource cts = new CancellationTokenSource(timeoutHelper.RemainingTime()))
Tool.cs (1)
70var cancellationSource = new CancellationTokenSource();
dotnet-watch (3)
Watch\DotNetWatcher.cs (3)
92using var currentRunCancellationSource = new CancellationTokenSource(); 93using var combinedCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(shutdownCancellationToken, currentRunCancellationSource.Token);
GenerateDocumentationAndConfigFiles (15)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Infrastructure.Common (1)
xunit\WcfTestCase.cs (1)
49ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Infrastructure.Tests (19)
CreateFailingTestIssue\CreateFailingTestIssueFixture.cs (1)
48using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(3));
CreateFailingTestIssue\CreateFailingTestIssueToolTests.cs (1)
653using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
DownloadFailingJobLogs\DownloadFailingJobLogsToolTests.cs (1)
109using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
ExtractTestPartitions\ExtractTestPartitionsFixture.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
ExtractTestPartitions\ExtractTestPartitionsTests.cs (1)
339using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
GenerateTestSummary\GenerateTestSummaryFixture.cs (1)
41using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(3));
GenerateTestSummary\GenerateTestSummaryToolTests.cs (1)
270using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2));
Pipelines\NixCliPackageTests.cs (1)
243using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
PowerShellScripts\DownloadNativeArchivesTests.cs (1)
448private CancellationTokenSource? _cts;
PowerShellScripts\PowerShellCommand.cs (1)
58using CancellationTokenSource cts = new();
WorkflowScripts\ExtensionChangelogFinalizedWorkflowTests.cs (2)
338using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 502using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WorkflowScripts\ExtensionReleaseWorkflowTests.cs (5)
613using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 665using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 744using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 781using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1)); 847using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(1));
WorkflowScripts\NodeCommand.cs (1)
52using CancellationTokenSource cts = new();
WorkflowScripts\PrDocsCheckWorkflowTests.cs (1)
195using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
Microsoft.Agents.AI.ProjectTemplates.Tests (1)
TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components (3)
NavigationManager.cs (2)
36private CancellationTokenSource? _locationChangingCts; 426var cts = new CancellationTokenSource();
Routing\Router.cs (1)
37private CancellationTokenSource _onNavigateCts;
Microsoft.AspNetCore.Components.AI (3)
Engine\AgentContext.cs (3)
27private CancellationTokenSource? _streamingCts; 90_streamingCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 112_streamingCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.AspNetCore.Components.Endpoints (5)
Builder\RazorComponentEndpointDataSource.cs (3)
31private CancellationTokenSource _cancellationTokenSource; 38internal CancellationTokenSource ChangeTokenSource => _cancellationTokenSource; 171var oldCancellationTokenSource = _cancellationTokenSource;
DependencyInjection\HotReloadService.cs (2)
19private CancellationTokenSource _tokenSource = new(); 39var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Components.Forms (4)
EditContext.cs (3)
352/// <see cref="CancellationTokenSource.CreateLinkedTokenSource(CancellationToken)"/>. Write 372var cts = new CancellationTokenSource(); 521private async Task ObserveFieldValidationTask(FieldState state, Task task, CancellationTokenSource cts)
FieldState.cs (1)
24internal CancellationTokenSource? PendingValidationCts { get; set; }
Microsoft.AspNetCore.Components.Media (3)
MediaComponentBase.cs (3)
44private CancellationTokenSource? _loadCts; 265/// Cancels any in-flight media load operation, if one is active, by signalling its <see cref="CancellationTokenSource"/>. 281/// Creates a new <see cref="CancellationTokenSource"/> for an upcoming load operation and returns its token.
Microsoft.AspNetCore.Components.QuickGrid (2)
QuickGrid.razor.cs (2)
216private CancellationTokenSource? _pendingDataLoadCancellationTokenSource; 527var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Server (13)
Circuits\CircuitRegistry.cs (3)
148var cancellationTokenSource = new CancellationTokenSource(_options.DisconnectedCircuitRetentionPeriod); 425public DisconnectedCircuitEntry(CircuitHost circuitHost, CancellationTokenSource tokenSource) 432public CancellationTokenSource TokenSource { get; }
Circuits\DefaultInMemoryCircuitPersistenceProvider.cs (2)
58var cancellationTokenSource = new CancellationTokenSource(_options.PersistedCircuitInMemoryRetentionPeriod); 145public CancellationTokenSource TokenSource { get; set; }
Circuits\RemoteJSDataStream.cs (4)
238private readonly CancellationTokenSource? _linkedCts; 258var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2); 262private ValueLinkedCancellationTokenSource(CancellationTokenSource? linkedCts, CancellationToken token)
Circuits\RemoteJSRuntime.cs (2)
192CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(10)); 242public CancellationTokenSource? CancellationTokenSource { get; set; }
Circuits\RevalidatingServerAuthenticationStateProvider.cs (2)
19private CancellationTokenSource _loopCancellationTokenSource = new CancellationTokenSource(); 35var oldCancellationTokenSource = _loopCancellationTokenSource;
Microsoft.AspNetCore.Components.Web (10)
Forms\InputFile\BrowserFileStream.cs (4)
15private readonly CancellationTokenSource _openReadStreamCts; 20private CancellationTokenSource? _copyFileDataCts; 33_openReadStreamCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 104_copyFileDataCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Virtualization\Virtualize.cs (6)
55private CancellationTokenSource? _refreshCts; 57private CancellationTokenSource? _currentScrollCts; 264var ourCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 940CancellationTokenSource? refreshCts = null; 954? CancellationTokenSource.CreateLinkedTokenSource(ownerCancellationToken)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
DebugProxyLauncher.cs (1)
75using var cts = new CancellationTokenSource(DebugProxyLaunchTimeout);
TargetPickerUi.cs (1)
136var source = new CancellationTokenSource();
Microsoft.AspNetCore.Connections.Abstractions (2)
DefaultConnectionContext.cs (2)
27private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource(); 101ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource);
Microsoft.AspNetCore.DataProtection (2)
KeyManagement\XmlKeyManager.cs (2)
63private CancellationTokenSource? _cacheExpirationTokenSource; 285return Interlocked.CompareExchange<CancellationTokenSource?>(ref _cacheExpirationTokenSource, null, null).Token;
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\RequestLatencyTelemetryMiddleware.cs (2)
28private static readonly ObjectPool<CancellationTokenSource> _cancellationTokenSourcePool = PoolFactory.CreateCancellationTokenSourcePool(); 87var tokenSource = _cancellationTokenSourcePool.Get();
Microsoft.AspNetCore.Diagnostics.Middleware.PerformanceTests (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.AspNetCore.Hosting (11)
Internal\ApplicationLifetime.cs (3)
20private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 21private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 22private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
Internal\WebHost.cs (2)
290using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Internal\WebHostLifetime.cs (2)
10private readonly CancellationTokenSource _cts; 20public WebHostLifetime(CancellationTokenSource cts, ManualResetEventSlim resetEvent, string shutdownMessage)
WebHostExtensions.cs (4)
28using var cts = new CancellationTokenSource(timeout); 50using (var cts = CancellationTokenSource.CreateLinkedTokenSource(token)) 91using (var cts = new CancellationTokenSource())
Microsoft.AspNetCore.Http (9)
src\aspnetcore\src\Shared\CancellationTokenSourcePool.cs (1)
38/// A <see cref="CancellationTokenSource"/> with a back pointer to the pool it came from.
Timeouts\CancellationTokenLinker.cs (4)
12public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan) 17var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(originalToken, timeoutCts.Token);
Timeouts\HttpRequestTimeoutFeature.cs (2)
8private readonly CancellationTokenSource _timeoutCancellationTokenSource; 10public HttpRequestTimeoutFeature(CancellationTokenSource timeoutCancellationTokenSource)
Timeouts\ICancellationTokenLinker.cs (2)
8(CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan);
Microsoft.AspNetCore.Http.Connections (14)
Internal\HttpConnectionContext.cs (12)
53private readonly CancellationTokenSource _connectionClosedTokenSource; 54private readonly CancellationTokenSource _connectionCloseRequested; 56private CancellationTokenSource? _sendCts; 133public CancellationTokenSource? Cancellation { get; set; } 229ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 730ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 740ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 853var timeoutSource = new CancellationTokenSource(); 854var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(Cancellation.Token, nonClonedContext.RequestAborted, timeoutSource.Token); 904CancellationTokenSource? cts; 1064ThreadPool.UnsafeQueueUserWorkItem(static cts => ((CancellationTokenSource)cts!).Cancel(), _connectionCloseRequested);
Internal\Transports\WebSocketsServerTransport.cs (2)
81using (var delayCts = new CancellationTokenSource()) 109using (var delayCts = new CancellationTokenSource())
Microsoft.AspNetCore.Http.Connections.Client (4)
Internal\LongPollingTransport.cs (1)
28private readonly CancellationTokenSource _transportCts = new CancellationTokenSource();
Internal\ServerSentEventsTransport.cs (2)
26private readonly CancellationTokenSource _transportCts = new CancellationTokenSource(); 27private readonly CancellationTokenSource _inputCts = new CancellationTokenSource();
Internal\WebSocketsTransport.cs (1)
40private CancellationTokenSource _stopCts = default!;
Microsoft.AspNetCore.HttpLogging (1)
FileLoggerProcessor.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource;
Microsoft.AspNetCore.InternalTesting (10)
xunit\AspNetTestAssemblyRunner.cs (1)
105CancellationTokenSource cancellationTokenSource)
xunit\AspNetTestCaseRunner.cs (2)
23CancellationTokenSource cancellationTokenSource) 28protected override XunitTestRunner CreateTestRunner(ITest test, IMessageBus messageBus, Type testClass, object[] constructorArguments, MethodInfo testMethod, object[] testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
xunit\AspNetTestClassRunner.cs (1)
23CancellationTokenSource cancellationTokenSource,
xunit\AspNetTestCollectionRunner.cs (1)
26CancellationTokenSource cancellationTokenSource)
xunit\AspNetTestInvoker.cs (1)
28CancellationTokenSource cancellationTokenSource,
xunit\AspNetTestMethodRunner.cs (1)
26CancellationTokenSource cancellationTokenSource,
xunit\AspNetTestRunner.cs (1)
29CancellationTokenSource cancellationTokenSource)
xunit\AspNetTheoryTestCaseRunner.cs (2)
23CancellationTokenSource cancellationTokenSource) 28protected override XunitTestRunner CreateTestRunner(ITest test, IMessageBus messageBus, Type testClass, object[] constructorArguments, MethodInfo testMethod, object[] testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Microsoft.AspNetCore.Mvc (2)
HotReloadService.cs (2)
21private CancellationTokenSource _tokenSource = new(); 78var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Mvc.Core (4)
Infrastructure\DefaultActionDescriptorCollectionProvider.cs (2)
25private CancellationTokenSource? _cancellationTokenSource; 156var oldCancellationTokenSource = _cancellationTokenSource;
Routing\ActionEndpointDataSourceBase.cs (2)
29private CancellationTokenSource? _cancellationTokenSource; 128var oldCancellationTokenSource = _cancellationTokenSource;
Microsoft.AspNetCore.Mvc.TagHelpers (1)
CacheTagHelper.cs (1)
92var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
31private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.AspNetCore.Routing (3)
CompositeEndpointDataSource.cs (3)
24private CancellationTokenSource? _cts; 192CancellationTokenSource? oldTokenSource = null; 245var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.HttpSys (3)
NativeInterop\DisconnectListener.cs (1)
59var cts = new CancellationTokenSource();
RequestProcessing\RequestContext.cs (2)
19private CancellationTokenSource? _requestAbortSource; 60_requestAbortSource = CancellationTokenSource.CreateLinkedTokenSource(connectionDisconnectToken);
Microsoft.AspNetCore.Server.IIS (3)
Core\IISHttpContext.cs (1)
871CancellationTokenSource? localAbortCts = null;
Core\IISHttpContext.IHttpRequestLifetimeFeature.cs (1)
11private CancellationTokenSource? _abortedCts;
Core\IISHttpContext.IO.cs (1)
266CancellationTokenSource? localAbortCts = null;
Microsoft.AspNetCore.Server.IntegrationTesting (4)
Deployers\ApplicationDeployer.cs (1)
164protected void TriggerHostShutdown(CancellationTokenSource hostShutdownSource)
Deployers\SelfHostDeployer.cs (1)
164var hostExitTokenSource = new CancellationTokenSource();
src\aspnetcore\src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Microsoft.AspNetCore.Server.Kestrel.Core (8)
Internal\Http\HttpProtocol.cs (2)
49private CancellationTokenSource? _abortedCts; 488CancellationTokenSource? localAbortCts = null;
Internal\Http3\Http3Connection.cs (1)
52private CancellationTokenSource _acceptStreamsCts = new();
Internal\Infrastructure\KestrelConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosingCts = new CancellationTokenSource();
Internal\KestrelServerImpl.cs (3)
31private readonly CancellationTokenSource _stopCts = new CancellationTokenSource(); 361using var cts = CancellationTokenSource.CreateLinkedTokenSource(_stopCts.Token);
src\aspnetcore\src\Shared\CancellationTokenSourcePool.cs (1)
38/// A <see cref="CancellationTokenSource"/> with a back pointer to the pool it came from.
Microsoft.AspNetCore.Server.Kestrel.Transport.DirectTls (2)
Connection\DirectTlsConnection.cs (1)
36private readonly CancellationTokenSource _connectionClosedTokenSource = new();
Connection\DirectTlsConnectionListener.cs (1)
203using var stopCts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Internal\NamedPipeConnection.cs (1)
23private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Internal\NamedPipeConnectionListener.cs (1)
24private readonly CancellationTokenSource _listeningTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Internal\QuicConnectionContext.cs (1)
29private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Internal\QuicStreamContext.cs (1)
33private CancellationTokenSource? _streamClosedTokenSource;
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\SocketConnection.cs (1)
24private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Session (4)
DistributedSession.cs (4)
216using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken)) 246using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
Microsoft.AspNetCore.SignalR.Client.Core (24)
HubConnection.cs (17)
960var cts = cancellationToken.CanBeCanceled ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : new CancellationTokenSource(); 966private async IAsyncEnumerable<T> CastIAsyncEnumerable<T>(string methodName, object?[] args, CancellationTokenSource cts) 1094var cts = CancellationTokenSource.CreateLinkedTokenSource(connectionState.UploadStreamToken, cancellationToken); 1140private Task InvokeStreamMethod(MethodInfo methodInfo, Type[] genericTypes, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource) 1162private Task ReflectionSendStreamItems(MethodInfo methodInfo, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource) 1198private Task SendStreamItems<T>(ConnectionState connectionState, string streamId, ChannelReader<T> reader, CancellationTokenSource tokenSource) 1215private Task SendIAsyncEnumerableStreamItems<T>(ConnectionState connectionState, string streamId, IAsyncEnumerable<T> stream, CancellationTokenSource tokenSource) 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) 1237using var _ = cts; 1819using var handshakeCts = new CancellationTokenSource(HandshakeTimeout); 1917using var uploadStreamSource = new CancellationTokenSource(); 2593CancellationTokenSource? cts = null; 2604using var __ = cts; 2756public CancellationTokenSource StopCts { get; set; } = new CancellationTokenSource();
src\aspnetcore\src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (4)
22public static IAsyncEnumerable<T> MakeCancelableTypedAsyncEnumerable<T>(IAsyncEnumerable<T> asyncEnumerable, CancellationTokenSource cts) 74private readonly CancellationTokenSource _cts; 76public CancelableTypedAsyncEnumerable(IAsyncEnumerable<TResult> asyncEnumerable, CancellationTokenSource cts) 89((CancellationTokenSource)ctsState!).Cancel();
src\aspnetcore\src\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (1)
140using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5), _timeProvider);
Microsoft.AspNetCore.SignalR.Core (18)
HubConnectionContext.cs (4)
30private readonly CancellationTokenSource _connectionAbortedTokenSource = new CancellationTokenSource(); 249internal ConcurrentDictionary<string, CancellationTokenSource> ActiveRequestCancellationSources { get; } = new ConcurrentDictionary<string, CancellationTokenSource>(StringComparer.Ordinal); 614using (var cts = new CancellationTokenSource())
Internal\DefaultHubDispatcher.cs (7)
231if (connection.ActiveRequestCancellationSources.TryGetValue(cancelInvocationMessage.InvocationId!, out var cts)) 410CancellationTokenSource? cts = null; 443CancellationTokenSource? cts, 589IHubActivator<THub> hubActivator, THub hub, CancellationTokenSource? streamCts, HubMethodInvocationMessage hubMethodInvocationMessage, 594streamCts ??= CancellationTokenSource.CreateLinkedTokenSource(connection.ConnectionAborted); 824ref long? streamOwner, out CancellationTokenSource? cts) 844cts = CancellationTokenSource.CreateLinkedTokenSource(connection.ConnectionAborted);
src\aspnetcore\src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (4)
22public static IAsyncEnumerable<T> MakeCancelableTypedAsyncEnumerable<T>(IAsyncEnumerable<T> asyncEnumerable, CancellationTokenSource cts) 74private readonly CancellationTokenSource _cts; 76public CancelableTypedAsyncEnumerable(IAsyncEnumerable<TResult> asyncEnumerable, CancellationTokenSource cts) 89((CancellationTokenSource)ctsState!).Cancel();
src\aspnetcore\src\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (1)
140using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5), _timeProvider);
Microsoft.AspNetCore.SignalR.Specification.Tests (4)
HubLifetimeManagerTestBase.cs (1)
357var cts = new CancellationTokenSource();
Internal\TaskExtensions.cs (2)
24var cts = new CancellationTokenSource(); 48var cts = new CancellationTokenSource();
src\aspnetcore\src\SignalR\common\testassets\Tests.Utils\TestClient.cs (1)
31private readonly CancellationTokenSource _cts;
Microsoft.AspNetCore.SignalR.StackExchangeRedis (2)
src\aspnetcore\src\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
Microsoft.AspNetCore.SpaProxy (4)
SpaProxyLaunchManager.cs (4)
77using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 108using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.AspNetCore.SpaServices.Extensions (2)
AngularCli\AngularCliMiddleware.cs (1)
112using var cancellationTokenSource = new CancellationTokenSource(timeoutMilliseconds);
Proxying\SpaProxy.cs (1)
62var proxyCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(
Microsoft.AspNetCore.StaticAssets (2)
StaticAssetEndpointDataSource.cs (2)
24private CancellationTokenSource _cancellationTokenSource; 112var oldCancellationTokenSource = _cancellationTokenSource;
Microsoft.AspNetCore.TestHost (1)
RequestLifetimeFeature.cs (1)
10private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.Bcl.TimeProvider (6)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (6)
231/// <summary>Initializes a new instance of the <see cref="CancellationTokenSource"/> class that will be canceled after the specified <see cref="TimeSpan"/>. </summary> 233/// <param name="delay">The time interval to wait before canceling this <see cref="CancellationTokenSource"/>. </param> 235/// <returns><see cref="CancellationTokenSource"/> that will be canceled after the specified <paramref name="delay"/>.</returns> 239/// the constructed <see cref="CancellationTokenSource"/> is canceled if it has 243/// If running on .NET versions earlier than .NET 8.0, there is a constraint when invoking <see cref="CancellationTokenSource.CancelAfter(TimeSpan)"/> on the resultant object. 247public static CancellationTokenSource CreateCancellationTokenSource(this TimeProvider timeProvider, TimeSpan delay)
Microsoft.Build (5)
BackEnd\BuildManager\BuildManager.cs (1)
144private CancellationTokenSource? _executionCancellationTokenSource;
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (1)
1009private readonly CancellationTokenSource _packetQueueDrainDelayCancellation;
BackEnd\Components\Logging\LoggingService.cs (1)
282private CancellationTokenSource _loggingEventProcessingCancellation;
BackEnd\Components\RequestBuilder\RequestBuilder.cs (1)
72private CancellationTokenSource _cancellationTokenSource;
Logging\TerminalLogger\TerminalLogger.cs (1)
97private readonly CancellationTokenSource _cts = new();
Microsoft.Build.Framework (2)
src\msbuild\artifacts\.packages\microsoft.codeanalysis.contracts\5.0.0-1.25277.114\contentFiles\cs\net9.0\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Microsoft.Build.Tasks.CodeAnalysis (5)
src\roslyn\src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
54private CancellationTokenSource? _sharedCompileCts;
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (2)
310var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Microsoft.Build.Tasks.Core (14)
AssemblyDependency\Node\OutOfProcRarNode.cs (2)
87using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Copy.cs (1)
107private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
DownloadFile.cs (1)
24private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\GetFileHash.cs (1)
126private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\VerifyFileHash.cs (1)
80private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
src\msbuild\src\Shared\NodePipeServer.cs (2)
99using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
TarDirectory.cs (2)
28/// Stores a <see cref="CancellationTokenSource"/> used for cancellation. 30private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Untar.cs (2)
31/// Stores a <see cref="CancellationTokenSource"/> used for cancellation. 33private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Unzip.cs (2)
31/// Stores a <see cref="CancellationTokenSource"/> used for cancellation. 33private readonly CancellationTokenSource _cancellationToken = new CancellationTokenSource();
Microsoft.CodeAnalysis (7)
CommandLine\CommonCompiler.cs (5)
983out CancellationTokenSource? analyzerCts, 1122out CancellationTokenSource? analyzerCts, 1539(CancellationTokenSource, DiagnosticBag, AnalyzerDriver) initializeAnalyzerDriver(AnalyzerOptions analyzerOptions, ref Compilation compilation) 1541var analyzerCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Microsoft.CodeAnalysis.Analyzers (16)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Microsoft.CodeAnalysis.AnalyzerUtilities (16)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Microsoft.CodeAnalysis.CodeStyle (16)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Microsoft.CodeAnalysis.CSharp (1)
CommandLine\CSharpCommandLineParser.cs (1)
298using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.Extensions.Package (2)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Microsoft.CodeAnalysis.Features (20)
AddImport\AbstractAddImportFeatureService.cs (5)
230using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 281using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 354CancellationTokenSource linkedTokenSource)
CodeFixes\Service\CodeFixService.cs (2)
122using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CodeLens\CodeLensFindReferenceProgress.cs (2)
30private readonly CancellationTokenSource _aggregateCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CodeRefactorings\CodeRefactoringService.cs (2)
128using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
EditAndContinue\DebuggingSession.cs (1)
35private readonly CancellationTokenSource _cancellationSource = new();
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (1)
30private readonly CancellationTokenSource _shutdownNotificationSource = new();
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs (7)
29private readonly Dictionary<object, CancellationTokenSource> _cancellationMap = []; 124List<CancellationTokenSource>? cancellations; 136List<CancellationTokenSource>? cancellations; 152private static void RaiseCancellation_NoLock(List<CancellationTokenSource>? cancellations) 163private List<CancellationTokenSource>? CancelAll_NoLock() 182if (_cancellationMap.TryGetValue(key, out var source)) 234var source = new CancellationTokenSource();
Microsoft.CodeAnalysis.Features.ExternalAccess (3)
Copilot\Internal\SemanticSearch\CopilotSemanticSearchQueryExecutor.cs (3)
26private sealed class ResultsObserver(CancellationTokenSource cancellationSource, int resultCountLimit) : ISemanticSearchResultsDefinitionObserver 81using var cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.CodeAnalysis.ResxSourceGenerator (16)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Microsoft.CodeAnalysis.Workspaces (23)
Remote\IRemoteKeepAliveService.cs (3)
52private CancellationTokenSource KeepAliveTokenSource { get; } = new(); 147using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
Shared\TestHooks\AsynchronousOperationListener.cs (5)
21private CancellationTokenSource _expeditedDelayCancellationTokenSource; 55var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, expeditedDelayCancellationToken); 72static Task<bool> DelaySlowAsync(Task delayTask, CancellationTokenSource cancellationTokenSourceToDispose, CancellationToken cancellationToken) 132var oldSource = Interlocked.Exchange(ref _expeditedDelayCancellationTokenSource, new CancellationTokenSource());
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
Rpc\RpcClient.cs (1)
39private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Rpc\RpcServer.cs (1)
44private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (2)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
Microsoft.Diagnostics.NETCore.Client (37)
DiagnosticsIpc\IpcServerTransport.cs (6)
99private readonly CancellationTokenSource _cancellation = new(); 127using CancellationTokenSource linkedSource = CancellationTokenSource.CreateLinkedTokenSource(token, _cancellation.Token); 166private readonly CancellationTokenSource _cancellation = new(); 199using CancellationTokenSource linkedSource = CancellationTokenSource.CreateLinkedTokenSource(token, _cancellation.Token);
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (26)
228using CancellationTokenSource acceptTimeoutTokenSource = new(); 229using CancellationTokenSource acceptTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, acceptTimeoutTokenSource.Token); 253using CancellationTokenSource connectTimeoutTokenSource = new(); 254using CancellationTokenSource connectTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, connectTimeoutTokenSource.Token); 459using CancellationTokenSource connectTimeoutTokenSource = new(); 460using CancellationTokenSource connectTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, connectTimeoutTokenSource.Token); 582using CancellationTokenSource connectTimeoutTokenSource = new(); 583using CancellationTokenSource connectTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, connectTimeoutTokenSource.Token); 672using CancellationTokenSource connectTimeoutTokenSource = new(); 673using CancellationTokenSource connectTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, connectTimeoutTokenSource.Token); 792using CancellationTokenSource cancelRouter = CancellationTokenSource.CreateLinkedTokenSource(token); 986using CancellationTokenSource cancelRouter = CancellationTokenSource.CreateLinkedTokenSource(token); 1120using CancellationTokenSource cancelRouter = CancellationTokenSource.CreateLinkedTokenSource(token); 1265using CancellationTokenSource cancelRouter = CancellationTokenSource.CreateLinkedTokenSource(token); 1349using CancellationTokenSource cancelReadConnect = CancellationTokenSource.CreateLinkedTokenSource(token); 1447private CancellationTokenSource _cancelRouterTokenSource;
HandleableCollection.cs (1)
141using CancellationTokenSource cancellation = new(timeout);
ReversedServer\ReversedDiagnosticsServer.cs (4)
26private readonly CancellationTokenSource _disposalSource = new(); 273using CancellationTokenSource parseCancellationSource = new(); 274using CancellationTokenSource linkedSource = CancellationTokenSource.CreateLinkedTokenSource(token, parseCancellationSource.Token);
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
41private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ExecWithRetries.cs (1)
52private CancellationTokenSource _cancelTokenSource = new CancellationTokenSource();
Microsoft.DotNet.Cli.Telemetry (4)
Implementation\PersistentStorageTelemetryUploader.cs (2)
82using var perBlobCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
PersistentStorageLogExporter.cs (1)
38private CancellationTokenSource? _drainCts;
PersistentStorageTraceExporter.cs (1)
37private CancellationTokenSource? _drainCts;
Microsoft.DotNet.HotReload.Watch (22)
Build\ProjectBuildManager.cs (2)
45using var buildCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
HotReload\HotReloadDotNetWatcher.cs (5)
66CancellationTokenSource? forceRestartCancellationSource = null; 88using var iterationCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(shutdownCancellationToken, forceRestartCancellationSource.Token); 516using var shutdownOrForcedRestartSource = CancellationTokenSource.CreateLinkedTokenSource(shutdownCancellationToken, forceRestartCancellationSource.Token);
HotReload\RunningProjectsManager.cs (4)
60var processExitedSource = new CancellationTokenSource(); 61var processTerminationSource = new CancellationTokenSource(); 65using var processCommunicationCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(processTerminationSource.Token, processExitedSource.Token, cancellationToken);
Process\ProcessRunner.cs (2)
266using var cancellationSource = new CancellationTokenSource(); 304using var cancellationSource = new CancellationTokenSource();
Process\RunningProcess.cs (4)
9CancellationTokenSource exitedSource, 10CancellationTokenSource terminationSource) : IAsyncDisposable 12private CancellationTokenSource? _terminationSource = terminationSource; 28var terminationSource = Interlocked.Exchange(ref _terminationSource, null);
src\sdk\src\Dotnet.Watch\AspireService\AspireServerService.cs (3)
49private readonly CancellationTokenSource _shutdownCancellationSource = new(); 397using var cancelTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
src\sdk\src\Dotnet.Watch\HotReloadClient\Web\AbstractBrowserRefreshServer.cs (1)
154using var progressCancellationSource = new CancellationTokenSource();
UI\ShutdownHandler.cs (1)
10private readonly CancellationTokenSource _cancellationSource = new();
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatClientExtensionsTests.cs (4)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 216using var cts = new CancellationTokenSource();
ChatRouting\RoutingChatClientTests.cs (1)
25using var cancellationSource = new CancellationTokenSource();
Contents\DataContentTests.cs (3)
776using CancellationTokenSource cts = new(); 798using CancellationTokenSource cts = new(); 825using CancellationTokenSource cts = new();
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
25using var cts = new CancellationTokenSource();
Image\ImageGeneratorTests.cs (1)
49using var cts = new CancellationTokenSource();
SpeechToText\SpeechToTextClientExtensionsTests.cs (1)
57using var cts = new CancellationTokenSource();
SpeechToText\SpeechToTextClientTests.cs (2)
19using var cts = new CancellationTokenSource(); 47using var cts = new CancellationTokenSource();
TextToSpeech\TextToSpeechClientTests.cs (2)
18using var cts = new CancellationTokenSource(); 42using var cts = new CancellationTokenSource();
Microsoft.Extensions.AI.OpenAI.Tests (7)
OpenAIRealtimeClientSessionTests.cs (2)
68using var cts = new CancellationTokenSource(); 88using var cts = new CancellationTokenSource();
OpenAIRealtimeClientTests.cs (1)
55using var cts = new CancellationTokenSource();
OpenAISpeechToTextClientTests.cs (2)
111using var cancellationTokenSource = new CancellationTokenSource(); 125using var cancellationTokenSource = new CancellationTokenSource();
OpenAITextToSpeechClientTests.cs (2)
224using var cancellationTokenSource = new CancellationTokenSource(); 237using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (37)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
1470using CancellationTokenSource cts = new(); 1546using CancellationTokenSource cts = new(); 1961using CancellationTokenSource cts = new(); 2049using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
2209using CancellationTokenSource cts = new(); 2279using CancellationTokenSource cts = new();
ChatCompletion\UseDelegateChatClientTests.cs (4)
30using CancellationTokenSource expectedCts = new(); 80using CancellationTokenSource expectedCts = new(); 122using CancellationTokenSource expectedCts = new(); 173using CancellationTokenSource expectedCts = new();
ChatReduction\SummarizingChatReducerTests.cs (1)
281using var cts = new CancellationTokenSource();
ChatRouting\FailoverChatClientTests.cs (7)
73using var cancellationSource = new CancellationTokenSource(); 513using var cancellationSource = new CancellationTokenSource(); 538using var cancellationSource = new CancellationTokenSource(); 566using var cancellationSource = new CancellationTokenSource(); 661using var cancellationSource = new CancellationTokenSource(); 707using var cancellationSource = new CancellationTokenSource(); 929using var cancellationSource = new CancellationTokenSource();
ChatRouting\OrderedFailoverChatClientTests.cs (1)
296using var cancellationSource = new CancellationTokenSource();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
196using var cts = new CancellationTokenSource(); 975using CancellationTokenSource cts = new(); 998using CancellationTokenSource cts = new(); 1021using CancellationTokenSource cts = new(); 1044using CancellationTokenSource cts = new(); 1067using CancellationTokenSource cts = new(); 1090using CancellationTokenSource cts = new(); 1113using CancellationTokenSource cts = new(); 1136using CancellationTokenSource cts = new();
Image\ConfigureOptionsImageGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Realtime\LoggingRealtimeClientTests.cs (3)
211using var cts = new CancellationTokenSource(); 272using var cts = new CancellationTokenSource(); 375using var cts = new CancellationTokenSource();
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (1)
40using CancellationTokenSource cts = new();
TextToSpeech\ConfigureOptionsTextToSpeechClientTests.cs (1)
39using CancellationTokenSource cts = new();
Microsoft.Extensions.AsyncState (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Caching.Hybrid (2)
Internal\DefaultHybridCache.L2.cs (1)
143using var cts = new CancellationTokenSource(millisecondsDelay: READ_TIMEOUT);
Internal\DefaultHybridCache.StampedeState.cs (1)
24private readonly CancellationTokenSource? _sharedCancellation;
Microsoft.Extensions.Caching.Hybrid.Tests (7)
StampedeTests.cs (7)
91using var cts = canBeCanceled ? new CancellationTokenSource() : null; 184var cancels = new CancellationTokenSource[callerCount]; 213foreach (var cancel in cancels) 265var cancels = new CancellationTokenSource[callerCount]; 339using CancellationTokenSource? cts = withCancelation ? new() : null; 379using var cts = withCancelation ? new CancellationTokenSource() : null; 423using CancellationTokenSource? cts = withCancelation ? new() : null;
Microsoft.Extensions.Compliance.Abstractions (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Configuration (1)
ConfigurationReloadToken.cs (1)
16private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Microsoft.Extensions.DataIngestion.Tests (2)
Readers\DocumentReaderConformanceTests.cs (2)
38using CancellationTokenSource cts = new(); 56using CancellationTokenSource cts = new();
Microsoft.Extensions.Diagnostics.ExceptionSummarization.Tests (2)
ExceptionSummarizerTests.cs (1)
212using var tokenSource = new CancellationTokenSource(TimeSpan.Zero);
HttpExceptionSummaryProviderTests.cs (1)
120using var tokenSource = new CancellationTokenSource(TimeSpan.Zero);
Microsoft.Extensions.Diagnostics.HealthChecks (6)
DefaultHealthCheckService.cs (2)
93CancellationTokenSource? timeoutCancellationTokenSource = null; 101timeoutCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
HealthCheckPublisherHostedService.cs (4)
28private readonly CancellationTokenSource _stopping; 29private CancellationTokenSource? _runTokenSource; 149CancellationTokenSource? cancellation = null; 154cancellation = CancellationTokenSource.CreateLinkedTokenSource(_stopping.Token);
Microsoft.Extensions.Diagnostics.HealthChecks.Common (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (3)
MockHostApplicationLifetime.cs (3)
12private readonly CancellationTokenSource _started = new(); 13private readonly CancellationTokenSource _stopping = new(); 14private readonly CancellationTokenSource _stopped = new();
Microsoft.Extensions.Diagnostics.Probes.Tests (2)
TcpEndpointProbesServiceTests.cs (2)
23using var cts = new CancellationTokenSource(); 89using var cts = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Diagnostics.Testing (3)
Logging\FakeLogCollector.LogEnumeration.cs (2)
77private readonly CancellationTokenSource _mainCts; 92? CancellationTokenSource.CreateLinkedTokenSource(enumerableCancellationToken, enumeratorCancellationToken)
Metrics\MetricCollector.cs (1)
256using var cancellationTokenSource = _timeProvider.CreateCancellationTokenSource(timeout);
Microsoft.Extensions.Diagnostics.Testing.Tests (2)
Logging\FakeLogCollectorTests.LogEnumeration.cs (1)
32using var cts = new CancellationTokenSource();
Metrics\MetricCollectorTests.cs (1)
283using var cts = new CancellationTokenSource();
Microsoft.Extensions.DotNetDeltaApplier (2)
src\sdk\src\Dotnet.Watch\HotReloadAgent.Host\WebSocketTransport.cs (2)
48using var connectCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.Extensions.FileProviders.Physical (14)
IPollingChangeToken.cs (1)
11CancellationTokenSource? CancellationTokenSource { get; }
PhysicalFilesWatcher.cs (7)
27private static readonly Action<object?> _cancelTokenSource = state => ((CancellationTokenSource?)state)!.Cancel(); 211var cancellationTokenSource = new CancellationTokenSource(); 255var cancellationTokenSource = new CancellationTokenSource(); 871CancellationTokenSource tokenSource, 878CancellationTokenSource tokenSource, 887public CancellationTokenSource TokenSource { get; } 906private readonly CancellationTokenSource _cts = new();
PollingFileChangeToken.cs (3)
30private CancellationTokenSource? _tokenSource; 75internal CancellationTokenSource? CancellationTokenSource 87CancellationTokenSource? IPollingChangeToken.CancellationTokenSource => CancellationTokenSource;
PollingWildCardChangeToken.cs (3)
33private CancellationTokenSource? _tokenSource; 72internal CancellationTokenSource? CancellationTokenSource 84CancellationTokenSource? IPollingChangeToken.CancellationTokenSource => CancellationTokenSource;
Microsoft.Extensions.Hosting (7)
Internal\ApplicationLifetime.cs (3)
21private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 22private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 23private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
Internal\Host.cs (4)
78using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _applicationLifetime.ApplicationStopping)) 321CancellationTokenSource? cts = null; 324cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.Extensions.Hosting.Abstractions (3)
BackgroundService.cs (2)
16private CancellationTokenSource? _stoppingCts; 43_stoppingCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
HostingAbstractionsHostExtensions.cs (1)
34using CancellationTokenSource cts = new CancellationTokenSource(timeout);
Microsoft.Extensions.Hosting.Testing (9)
FakeHost.cs (6)
70using var cancellationTokenSource = TimeProvider.CreateCancellationTokenSource(_options.StartUpTimeout); 78using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource( 93using var cancellationTokenSource = TimeProvider.CreateCancellationTokenSource(_options.ShutDownTimeout); 101using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
HostTerminatorService.cs (3)
52using var timeoutTokenSource = TimeProvider.CreateCancellationTokenSource(_options.ShutDownTimeout); 54using var combinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
Microsoft.Extensions.Hosting.Testing.Tests (5)
FakeHostTests.cs (4)
81using var tokenSource = new CancellationTokenSource(); 99var cancellationTokenSource = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1)); 140using var tokenSource = new CancellationTokenSource(); 159var cancellationTokenSource = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1));
HostingFakesExtensionsTests.cs (1)
28using var tokenSource = new CancellationTokenSource();
Microsoft.Extensions.Http.Diagnostics (4)
Logging\Internal\HttpRequestBodyReader.cs (2)
61using var joinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Logging\Internal\HttpResponseBodyReader.cs (2)
65using var joinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.Extensions.Http.Diagnostics.Tests (2)
Logging\HttpClientLoggerTest.cs (1)
117using var cancellationTokenSource = new CancellationTokenSource();
Logging\HttpResponseBodyReaderTest.cs (1)
186using var cts = new CancellationTokenSource();
Microsoft.Extensions.Http.Resilience (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Http.Resilience.Tests (2)
Hedging\HedgingTests.cs (1)
33private readonly CancellationTokenSource _cancellationTokenSource;
Resilience\ResilienceHandlerTest.cs (1)
128using var source = new CancellationTokenSource();
Microsoft.Extensions.Logging.AzureAppServices (1)
BatchingLoggerProvider.cs (1)
28private CancellationTokenSource _cancellationTokenSource;
Microsoft.Extensions.Logging.EventSource (3)
LoggingEventSource.cs (3)
135private CancellationTokenSource? _cancellationTokenSource; 401CancellationTokenSource cts = LazyInitializer.EnsureInitialized(ref _cancellationTokenSource, () => new CancellationTokenSource()); 408CancellationTokenSource? tcs = Interlocked.Exchange(ref _cancellationTokenSource, null);
Microsoft.Extensions.ML (4)
ModelLoaders\UriModelLoader.cs (3)
32private readonly CancellationTokenSource _stopping; 72CancellationTokenSource cancellation = null; 77cancellation = CancellationTokenSource.CreateLinkedTokenSource(_stopping.Token);
ModelReloadToken.cs (1)
16private readonly CancellationTokenSource _cts;
Microsoft.Extensions.Primitives (1)
CompositeChangeToken.cs (1)
25private CancellationTokenSource? _cancellationTokenSource;
Microsoft.Extensions.ServiceDiscovery (1)
ServiceEndpointWatcher.cs (1)
30private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.Extensions.ServiceDiscovery.Dns (12)
DnsServiceEndpointProviderBase.cs (4)
16private readonly CancellationTokenSource _disposeCancellation = new(); 22private CancellationTokenSource _lastCollectionCancellation; 42var cancellation = _lastCollectionCancellation = new CancellationTokenSource(); 129var cancellation = _lastCollectionCancellation = new CancellationTokenSource(validityPeriod, _timeProvider);
Resolver\DnsResolver.cs (8)
25private readonly CancellationTokenSource _pendingRequestsCts = new(); 482(CancellationTokenSource cts, bool disposeTokenSource, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 878private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 890CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 896CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, pendingRequestsCts.Token);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (2)
Resolver\CancellationTests.cs (2)
18CancellationTokenSource cts = new CancellationTokenSource(); 29CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.Extensions.Telemetry (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.Telemetry.Abstractions (5)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Microsoft.Extensions.TimeProvider.Testing.Tests (4)
FakeTimeProviderTests.cs (4)
317using var cs = new CancellationTokenSource(); 332using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000)); 348using var cts = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1)); 431using var cts = new CancellationTokenSource();
Microsoft.JSInterop (11)
JSObjectReferenceExtensions.cs (5)
97using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 115using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 165using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 183using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 202using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout);
JSRuntime.cs (1)
126using var cts = new CancellationTokenSource(DefaultAsyncTimeout.Value);
JSRuntimeExtensions.cs (5)
97using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 115using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 165using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 183using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); 202using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout);
Microsoft.Maui (1)
ImageSources\ImageSourceServiceResultManager.cs (1)
26 CancellationTokenSource? _sourceCancellation;
Microsoft.Maui.Controls (2)
ImageSource.cs (2)
15 CancellationTokenSource _cancellationTokenSource; 34 private protected CancellationTokenSource CancellationTokenSource
Microsoft.Maui.Essentials (2)
Types\Shared\Utils.shared.cs (2)
24 var cancelTokenSrc = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.Maui.Resizetizer (1)
AsyncTask.cs (1)
18 readonly CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.ML.AutoML (4)
AutoMLExperiment\AutoMLExperiment.cs (1)
252var trialCancellationTokenSource = new CancellationTokenSource();
AutoMLExperiment\IPerformanceMonitor.cs (2)
34void OnPerformanceMetricsUpdatedHandler(TrialSettings trialSettings, TrialPerformanceMetrics metrics, CancellationTokenSource trialCancellationTokenSource); 147public virtual void OnPerformanceMetricsUpdatedHandler(TrialSettings trialSettings, TrialPerformanceMetrics metrics, CancellationTokenSource trialCancellationTokenSource)
AutoMLExperiment\IStopTrainingManager.cs (1)
60private readonly CancellationTokenSource _cts;
Microsoft.ML.AutoML.Tests (6)
AutoMLExperimentTests.cs (4)
47var cts = new CancellationTokenSource(); 134var cts = new CancellationTokenSource(); 173var cts = new CancellationTokenSource(); 489public void OnPerformanceMetricsUpdatedHandler(TrialSettings trialSettings, TrialPerformanceMetrics metrics, CancellationTokenSource trialCancellationTokenSource)
StopTrainingManagerTests.cs (2)
28var cts = new CancellationTokenSource(); 72var cts = new CancellationTokenSource();
Microsoft.ML.Core (2)
Utilities\ResourceManagerUtils.cs (1)
158using (var downloadCancel = new CancellationTokenSource())
Utilities\ThreadUtils.cs (1)
179private readonly CancellationTokenSource _ctSource;
Microsoft.ML.Maml (1)
MAML.cs (1)
63using (var progressCancel = new CancellationTokenSource())
Microsoft.ML.Sweeper (1)
AsyncSweeper.cs (1)
169private readonly CancellationTokenSource _cts;
Microsoft.ML.TestFrameworkCommon (1)
TestDownloadUtils.cs (1)
30using (var cancellationSource = new CancellationTokenSource(timeout))
Microsoft.NET.Build.Containers (6)
LocalDaemons\ContainerRuntime.cs (2)
193using CancellationTokenSource timeout = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
LocalDaemons\ContainerRuntimeOperations.cs (2)
60using CancellationTokenSource processCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Tasks\CreateImageIndex.cs (1)
17private readonly CancellationTokenSource _cancellationTokenSource = new();
Tasks\CreateNewImage.cs (1)
15private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.NET.Build.Tasks (1)
GenerateBundle.cs (1)
15private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.NET.Sdk.Publish.Tasks (5)
Tasks\OneDeploy\OneDeployStatusService.cs (3)
40var maxWaitForResultTokenSource = new CancellationTokenSource(s_maximumWaitForResult); 41var retryTokenSource = CancellationTokenSource.CreateLinkedTokenSource(maxWaitForResultTokenSource.Token, cancellationToken);
Tasks\ZipDeploy\ZipDeploymentStatus.cs (2)
34var tokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(MaxMinutesToWait)); 74private async Task<T?> InvokeGetRequestWithRetryAsync<T>(string url, string? userName, string? password, int retryCount, TimeSpan retryDelay, CancellationTokenSource cts)
Microsoft.NET.Sdk.Razor.Tasks (3)
DotnetToolTask.cs (1)
21private CancellationTokenSource _razorServerCts;
src\sdk\src\RazorSdk\Tool\ServerProtocol\ServerConnection.cs (2)
243var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.TemplateEngine.Cli (3)
Commands\create\InstantiateCommand.TabCompletion.cs (2)
143CancellationTokenSource cancellationTokenSource = new(); 173CancellationTokenSource cancellationTokenSource = new();
Commands\create\TemplateCommand.cs (1)
171CancellationTokenSource cancellationTokenSource = new();
Microsoft.TemplateEngine.Edge (4)
BuiltInManagedProvider\GlobalSettings.cs (1)
205CancellationTokenSource cts = new();
Installers\NuGet\NugetApiPackageManager.cs (2)
325using CancellationTokenSource linkedCts = 326CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
TemplateConstraintManager.cs (1)
16private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Microsoft.TestPlatform.CommunicationUtilities (3)
DataCollectionRequestHandler.cs (1)
60private readonly CancellationTokenSource _cancellationTokenSource;
SocketClient.cs (1)
23private readonly CancellationTokenSource _cancellation;
SocketServer.cs (1)
23private readonly CancellationTokenSource _cancellation;
Microsoft.TestPlatform.CrossPlatEngine (3)
Client\ProxyExecutionManager.cs (1)
51public CancellationTokenSource CancellationTokenSource
Client\ProxyOperationManager.cs (1)
135public CancellationTokenSource CancellationTokenSource { get; set; }
Discovery\DiscoveryManager.cs (1)
38private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.TestPlatform.Extensions.BlameDataCollector (1)
NetClientHangDumper.cs (1)
59var timeout = new CancellationTokenSource();
Microsoft.TestPlatform.PlatformAbstractions (1)
common\System\ProcessHelper.cs (1)
144var cts = new CancellationTokenSource(timeout);
Microsoft.TestPlatform.VsTestConsole.TranslationLayer (2)
VsTestConsoleRequestSender.cs (2)
48private CancellationTokenSource? _processExitCancellationTokenSource; 134var timeoutSource = new CancellationTokenSource(clientConnectionTimeout);
Microsoft.VisualStudio.TestPlatform.Common (1)
DataCollection\DataCollectionAttachmentManager.cs (1)
59private readonly CancellationTokenSource _cancellationTokenSource;
MSBuild (1)
XMake.cs (1)
144private static readonly CancellationTokenSource s_buildCancellationSource = new CancellationTokenSource();
MSBuild.Coordinator (4)
CoordinatorServer.cs (3)
30private readonly CancellationTokenSource _cts = new(); 56using CancellationTokenSource linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token);
Program.cs (1)
30using CancellationTokenSource cts = new();
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1123[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
Nats.Backend (1)
Program.cs (1)
18private readonly CancellationTokenSource _cts = new();
netstandard (1)
netstandard.cs (1)
2072[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
NuGet.Build.Tasks (2)
RestoreTask.cs (1)
33private readonly CancellationTokenSource _cts = new CancellationTokenSource();
StaticGraphRestoreTaskBase.cs (1)
27internal readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
NuGet.CommandLine.XPlat (2)
Commands\PackageReferenceCommands\ListPackage\ListPackageCommandRunner.cs (2)
480using CancellationTokenSource faultCancelationTokenSource = 481CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
NuGet.PackageManagement (7)
NuGetPackageManager.cs (3)
2058using var tokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 2552CancellationTokenSource downloadTokenSource = null; 2570downloadTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);
PackageDownloader.cs (2)
80var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);
Resolution\ResolverGather.cs (2)
423using (var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token))
NuGet.Protocol (14)
Plugins\AutomaticProgressReporter.cs (2)
16private readonly CancellationTokenSource _cancellationTokenSource; 31_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Plugins\InboundRequestContext.cs (2)
16private readonly CancellationTokenSource _cancellationTokenSource; 90_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Plugins\OutboundRequestContext`1.cs (2)
21private readonly CancellationTokenSource _cancellationTokenSource; 120_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Plugins\PluginFactory.cs (3)
213using (var combinedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(sessionCancellationToken)) 454using (var cancellationTokenSource = new CancellationTokenSource(PluginConstants.CloseTimeout))
Plugins\RequestHandlers\SymmetricHandshake.cs (1)
27private readonly CancellationTokenSource _timeoutCancellationTokenSource;
Plugins\StandardInputReceiver.cs (1)
23private readonly CancellationTokenSource _receiveCancellationTokenSource;
Resources\PackageUpdateResource.cs (1)
98using var tokenSource = new CancellationTokenSource();
Utility\TimeoutUtility.cs (2)
35using (var timeoutTcs = new CancellationTokenSource()) 36using (var taskTcs = new CancellationTokenSource())
Roslyn.Diagnostics.Analyzers (16)
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (2)
19/// Thrown when async code must cancel the current execution but does not have access to the <see cref="CancellationTokenSource"/> of the <see cref="CancellationToken"/> passed to the code. 20/// Should be used in very rare cases where the <see cref="CancellationTokenSource"/> is out of our control (e.g. owned but not exposed by JSON RPC in certain call-back scenarios).
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
52private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
src\roslyn\src\Dependencies\Threading\CancellationSeries.cs (6)
28private CancellationTokenSource? _cts; 70var nextSource = CancellationTokenSource.CreateLinkedTokenSource(token, _superToken); 80var priorSource = Volatile.Read(ref _cts); 83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource); 118var source = Interlocked.Exchange(ref _cts, null);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncPriorityWorkQueue.cs (1)
49private readonly CancellationTokenSource _entireQueueCancellationTokenSource;
rzc (6)
DefaultRequestDispatcher.cs (3)
25private CancellationTokenSource _listenCancellationTokenSource; 361var buildCancelled = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Program.cs (1)
27var cancel = new CancellationTokenSource();
ServerProtocol\ServerConnection.cs (2)
243var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Shared (5)
Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
Pools\PoolFactory.cs (2)
180/// Creates an object pool of <see cref="CancellationTokenSource" /> instances. 194public static ObjectPool<CancellationTokenSource> CreateCancellationTokenSourcePool(int maxCapacity = DefaultCapacity)
Shared.Tests (4)
Pools\PoolTests.cs (4)
196var s = pool.Get(); 198var s2 = pool.Get(); 212var s = pool.Get(); 216var s2 = pool.Get();
Stress.AppHost (3)
InteractionCommands.cs (2)
855using var cts = CancellationTokenSource.CreateLinkedTokenSource(commandContext.CancellationToken);
TestResource.cs (1)
152private readonly CancellationTokenSource _tokenSource = new();
System.Collections.Concurrent (13)
System\Collections\Concurrent\BlockingCollection.cs (13)
53private CancellationTokenSource _consumersCancellationTokenSource; 54private CancellationTokenSource _producersCancellationTokenSource; 411CancellationTokenSource? linkedTokenSource = null; 417linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource( 645private bool TryTakeWithNoTimeValidation([MaybeNullWhen(false)] out T item, int millisecondsTimeout, CancellationToken cancellationToken, CancellationTokenSource? combinedTokenSource) 660CancellationTokenSource? linkedTokenSource = combinedTokenSource; 667linkedTokenSource ??= CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _consumersCancellationTokenSource.Token); 982using (CancellationTokenSource linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(collatedCancellationTokens)) 1385using (CancellationTokenSource linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(collatedCancellationTokens)) 1620using CancellationTokenSource linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _consumersCancellationTokenSource.Token);
System.CommandLine (4)
Invocation\InvocationPipeline.cs (2)
14using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Invocation\ProcessTerminationHandler.cs (2)
16private readonly CancellationTokenSource _handlerCancellationTokenSource; 26CancellationTokenSource handlerCancellationTokenSource,
System.ComponentModel.Annotations (4)
System\ComponentModel\DataAnnotations\Validator.cs (4)
721using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 865using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
System.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionFactory.cs (1)
48CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
System.Data.OleDb (1)
System\Data\ProviderBase\DbConnectionFactory.cs (1)
157CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\AggregationManager.cs (1)
29private readonly CancellationTokenSource _cts = new();
System.Diagnostics.Process (4)
System\Diagnostics\AsyncStreamReader.cs (1)
35private readonly CancellationTokenSource _cts;
System\Diagnostics\Process.Multiplexing.cs (2)
544CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
System\Diagnostics\ProcessWaitState.Unix.cs (1)
436CancellationTokenSource? cts = null;
System.IO.Pipelines (9)
System\IO\Pipelines\StreamPipeReader.cs (7)
17private CancellationTokenSource? _internalTokenSource; 73private CancellationTokenSource InternalTokenSource 224CancellationTokenSource tokenSource = InternalTokenSource; 242static async ValueTask<ReadResult> Core(StreamPipeReader reader, int? minimumSize, CancellationTokenSource tokenSource, CancellationToken cancellationToken) 314CancellationTokenSource tokenSource = InternalTokenSource; 385CancellationTokenSource tokenSource = InternalTokenSource; 463private bool TryReadInternal(CancellationTokenSource source, out ReadResult result)
System\IO\Pipelines\StreamPipeWriter.cs (2)
28private CancellationTokenSource? _internalTokenSource; 35private CancellationTokenSource InternalTokenSource
System.IO.Pipes (3)
System\IO\Pipes\NamedPipeServerStream.Unix.cs (3)
22private readonly CancellationTokenSource _internalTokenSource = new CancellationTokenSource(); 83CancellationTokenSource linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_internalTokenSource.Token, cancellationToken);
System.IO.Ports (3)
System\IO\Ports\SerialStream.Unix.cs (3)
424using (CancellationTokenSource cts = GetCancellationTokenSourceFromTimeout(timeout)) 561using (CancellationTokenSource cts = GetCancellationTokenSourceFromTimeout(timeout)) 1065private static CancellationTokenSource GetCancellationTokenSourceFromTimeout(int timeoutMs)
System.Linq.Parallel (6)
System\Linq\Parallel\QueryOperators\QueryOpeningEnumerator.cs (1)
45private readonly CancellationTokenSource _topLevelCancellationTokenSource = new CancellationTokenSource();
System\Linq\Parallel\QueryOperators\QuerySettings.cs (2)
140internal QuerySettings WithPerExecutionSettings(CancellationTokenSource topLevelCancellationTokenSource, Shared<bool> topLevelDisposedFlag) 154CancellationTokenSource.CreateLinkedTokenSource(settings.CancellationState.InternalCancellationTokenSource.Token, settings.CancellationState.ExternalCancellationToken);
System\Linq\Parallel\QueryOperators\Unary\ForAllOperator.cs (1)
53CancellationTokenSource dummyInternalCancellationTokenSource = new CancellationTokenSource();
System\Linq\Parallel\Scheduling\CancellationState.cs (2)
21internal CancellationTokenSource? InternalCancellationTokenSource; 29internal CancellationTokenSource? MergedCancellationTokenSource;
System.Net.Http (38)
System\Net\Http\HttpClient.cs (22)
27private CancellationTokenSource _pendingRequestsCts; 188(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 262(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 338(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 481(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 530(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 536CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 598private void HandleFailure(Exception e, bool telemetryStarted, HttpResponseMessage? response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) 659private static void FinishSend(HttpResponseMessage? response, CancellationTokenSource cts, bool disposeCts, bool telemetryStarted, bool responseContentTelemetryStarted) 702CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingRequestsCts, new CancellationTokenSource()); 802private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 814CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 819CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, pendingRequestsCts.Token);
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (1)
472CancellationTokenSource? cts = null;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
847private CancellationTokenSource GetConnectTimeoutCancellationTokenSource<T>(HttpConnectionWaiter<T> waiter) 850var cts = new CancellationTokenSource(Settings._connectTimeout);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (1)
262CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (1)
193CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (2)
55private CancellationTokenSource? _altSvcBlocklistTimerCancellation; 261CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionWaiter.cs (1)
15public CancellationTokenSource? ConnectionCancellationTokenSource;
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (1)
212CancellationTokenSource? cts = null;
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (4)
84private readonly CancellationTokenSource? _requestBodyCancellationSource; 406CancellationTokenSource? requestBodyCancellationSource = null; 947CancellationTokenSource? requestBodyCancellationSource = null; 1412cancellationToken.UnsafeRegister(static s => ((CancellationTokenSource)s!).Cancel(), _requestBodyCancellationSource);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (2)
35private readonly CancellationTokenSource _requestBodyCancellationSource; 162CancellationTokenRegistration linkedTokenRegistration = cancellationToken.UnsafeRegister(cts => ((CancellationTokenSource)cts!).Cancel(), _requestBodyCancellationSource);
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (1)
43private CancellationTokenSource? _connectionDisposalCts;
System.Net.Http.Json (3)
System\Net\Http\Json\HttpClientJsonExtensions.cs (3)
46CancellationTokenSource? linkedCTS = null; 49linkedCTS = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 76CancellationTokenSource? linkedCTS,
System.Net.Mail (4)
System\Net\Mail\SmtpClient.cs (4)
53private CancellationTokenSource _pendingSendCts; 424CancellationTokenSource? cts = null; 428cts = CancellationTokenSource.CreateLinkedTokenSource(_pendingSendCts.Token, cancellationToken); 631CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingSendCts, new CancellationTokenSource());
System.Net.NameResolution (4)
System\Net\DnsResolverPal.Managed.cs (4)
636using CancellationTokenSource timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 696using CancellationTokenSource timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.cs (1)
23private CancellationTokenSource? _timeoutOrCancellationSource;
System.Net.Quic (8)
System\Net\Quic\QuicConnection.cs (3)
77using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 145private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
System\Net\Quic\QuicListener.cs (3)
91private readonly CancellationTokenSource _disposeCts = new CancellationTokenSource(); 232using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeCts.Token, connection.ConnectionShutdownToken);
System\Net\Quic\QuicStream.Stream.cs (2)
119CancellationTokenSource? cts = null; 180CancellationTokenSource? cts = null;
System.Net.Requests (1)
System\Net\HttpWebRequest.cs (1)
78private CancellationTokenSource? _sendRequestCts;
System.Net.Security (1)
src\runtime\src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (1)
61CancellationTokenSource? cts = totalMillis > int.MaxValue ? null : new CancellationTokenSource((int)totalMillis);
System.Net.Sockets (2)
System\Net\Sockets\SocketAsyncEventArgs.cs (2)
89private CancellationTokenSource? _multipleConnectCancellation; 617CancellationTokenSource? multipleConnectCancellation = _multipleConnectCancellation;
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketStream.cs (1)
255CancellationTokenSource? cts = null;
System.Private.CoreLib (100)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs (1)
29private CancellationTokenSource? m_dispatchTaskCancellationSource;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
1690using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ctEnumerable, ctEnumerator);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationToken.cs (19)
17/// <see cref="CancellationTokenSource">CancellationTokenSource</see> must be used. 19/// <see cref="CancellationTokenSource.Token">Token</see> property. 35private readonly CancellationTokenSource? _source; 54/// calling <see cref="CancellationTokenSource.Cancel()">Cancel</see> 55/// on the token's associated <see cref="CancellationTokenSource"/>. 82/// dispose the associated <see cref="CancellationTokenSource"/> instance at the earliest opportunity (disposing 86/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception> 87public WaitHandle WaitHandle => (_source ?? CancellationTokenSource.s_neverCanceledSource).WaitHandle; 96internal CancellationToken(CancellationTokenSource? source) => _source = source; 111public CancellationToken(bool canceled) : this(canceled ? CancellationTokenSource.s_canceledSource : null) 227/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception> 286/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception> 291CancellationTokenSource? source = _source; 304/// with the same <see cref="CancellationTokenSource">CancellationTokenSource</see> or if they were both constructed 315/// with the same <see cref="CancellationTokenSource">CancellationTokenSource</see> or if they were both constructed 318/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception> 325public override int GetHashCode() => (_source ?? CancellationTokenSource.s_neverCanceledSource).GetHashCode(); 334/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception> 344/// cref="CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception>
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenRegistration.cs (10)
18private readonly CancellationTokenSource.CallbackNode _node; 20internal CancellationTokenRegistration(long id, CancellationTokenSource.CallbackNode node) 34if (_node is CancellationTokenSource.CallbackNode node && !node.Registrations.Unregister(_id, node)) 38static void WaitForCallbackIfNecessary(long id, CancellationTokenSource.CallbackNode node) 49CancellationTokenSource source = node.Registrations.Source; 71return _node is CancellationTokenSource.CallbackNode node && !node.Registrations.Unregister(_id, node) ? 75static ValueTask WaitForCallbackIfNecessaryAsync(long id, CancellationTokenSource.CallbackNode node) 79CancellationTokenSource source = node.Registrations.Source; 101_node is CancellationTokenSource.CallbackNode node ? 110_node is CancellationTokenSource.CallbackNode node && node.Registrations.Unregister(_id, node);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (66)
15/// <see cref="CancellationTokenSource"/> is used to instantiate a <see cref="CancellationToken"/> (via 28/// <summary>A <see cref="CancellationTokenSource"/> that's already canceled.</summary> 29internal static readonly CancellationTokenSource s_canceledSource = new CancellationTokenSource() { _state = States.NotifyingCompleteState }; 30/// <summary>A <see cref="CancellationTokenSource"/> that's never canceled. This isn't enforced programmatically, only by usage. Do not cancel!</summary> 31internal static readonly CancellationTokenSource s_neverCanceledSource = new CancellationTokenSource(); 33/// <summary>Delegate used with <see cref="Timer"/> to trigger cancellation of a <see cref="CancellationTokenSource"/>.</summary> 36((CancellationTokenSource)state!).NotifyCancellation(throwOnFirstException: false); // skip ThrowIfDisposed() check in Cancel() 40/// <summary>Whether this <see cref="CancellationTokenSource"/> has been disposed.</summary> 58/// <summary>Gets whether cancellation has been requested for this <see cref="CancellationTokenSource" />.</summary> 59/// <value>Whether cancellation has been requested for this <see cref="CancellationTokenSource" />.</value> 78/// <summary>Gets the <see cref="CancellationToken"/> associated with this <see cref="CancellationTokenSource"/>.</summary> 79/// <value>The <see cref="CancellationToken"/> associated with this <see cref="CancellationTokenSource"/>.</value> 122/// <summary>Initializes the <see cref="CancellationTokenSource"/>.</summary> 126/// Constructs a <see cref="CancellationTokenSource"/> that will be canceled after a specified time span. 128/// <param name="delay">The time span to wait before canceling this <see cref="CancellationTokenSource"/></param> 135/// the constructed <see cref="CancellationTokenSource"/> is canceled, if it has 140/// <see cref="CancellationTokenSource"/>, if it has not been 148/// <summary>Initializes a new instance of the <see cref="CancellationTokenSource"/> class that will be canceled after the specified <see cref="TimeSpan"/>.</summary> 149/// <param name="delay">The time interval to wait before canceling this <see cref="CancellationTokenSource"/>.</param> 155/// the constructed <see cref="CancellationTokenSource"/> is canceled, if it has 157/// <see cref="CancellationTokenSource"/>, if it has not been canceled already. 172/// Constructs a <see cref="CancellationTokenSource"/> that will be canceled after a specified time span. 174/// <param name="millisecondsDelay">The time span to wait before canceling this <see cref="CancellationTokenSource"/></param> 181/// the constructed <see cref="CancellationTokenSource"/> is canceled (if it has 186/// <see cref="CancellationTokenSource"/>, if it has not been 249/// <exception cref="ObjectDisposedException">This <see cref="CancellationTokenSource"/> has been disposed.</exception> 275/// <exception cref="ObjectDisposedException">This <see cref="CancellationTokenSource"/> has been disposed.</exception> 304/// <exception cref="ObjectDisposedException">This <see cref="CancellationTokenSource"/> has been disposed.</exception> 345((CancellationTokenSource)s!).ExecuteCallbackHandlers(throwOnFirstException: false); 357/// <summary>Schedules a Cancel operation on this <see cref="CancellationTokenSource"/>.</summary> 358/// <param name="delay">The time span to wait before canceling this <see cref="CancellationTokenSource"/>. 361/// cref="CancellationTokenSource"/> has been disposed. 369/// this <see cref="CancellationTokenSource"/> is canceled, if it has 374/// <see cref="CancellationTokenSource"/>, if it has not been canceled already. 389/// Schedules a Cancel operation on this <see cref="CancellationTokenSource"/>. 392/// cref="CancellationTokenSource"/>. 395/// cref="CancellationTokenSource"/> has been disposed. 403/// this <see cref="CancellationTokenSource"/> is canceled, if it has 408/// <see cref="CancellationTokenSource"/>, if it has not been 463/// Attempts to reset the <see cref="CancellationTokenSource"/> to be used for an unrelated operation. 466/// true if the <see cref="CancellationTokenSource"/> has not had cancellation requested and could 470/// <see cref="TryReset"/> is intended to be used by the sole owner of the <see cref="CancellationTokenSource"/> 471/// when it is known that the operation with which the <see cref="CancellationTokenSource"/> was used has 474/// <see cref="CancellationTokenSource"/>; however, if any component still holds a reference to this 475/// <see cref="CancellationTokenSource"/> either directly or indirectly via a <see cref="CancellationToken"/> 509/// <summary>Releases the resources used by this <see cref="CancellationTokenSource" />.</summary> 518/// Releases the unmanaged resources used by the <see cref="CancellationTokenSource" /> class and optionally releases the managed resources. 835/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 840/// <returns>A <see cref="CancellationTokenSource"/> that is linked 842public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2) => 845(CancellationTokenSource)new Linked1CancellationTokenSource(token1); 848/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 852/// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source token.</returns> 853public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token) => 857/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 861/// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source tokens.</returns> 863public static CancellationTokenSource CreateLinkedTokenSource(params CancellationToken[] tokens) 870/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 874/// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source tokens.</returns> 875public static CancellationTokenSource CreateLinkedTokenSource(params ReadOnlySpan<CancellationToken> tokens) 938Debug.Assert(s is CancellationTokenSource, $"Expected {typeof(CancellationTokenSource)}, got {s}"); 939((CancellationTokenSource)s).NotifyCancellation(throwOnFirstException: false); // skip ThrowIfDisposed() check in Cancel() 980private static void Invoke(Delegate d, object? state, CancellationTokenSource source) 1002public readonly CancellationTokenSource Source; 1023public Registrations(CancellationTokenSource source) => Source = source;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5873/// The <see cref="CancellationTokenSource"/> associated 5921/// The <see cref="CancellationTokenSource"/> associated
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
829[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
System.Security.Cryptography (1)
src\runtime\src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (1)
61CancellationTokenSource? cts = totalMillis > int.MaxValue ? null : new CancellationTokenSource((int)totalMillis);
System.ServiceModel.Http (2)
System\ServiceModel\Channels\HttpChannelFactory.cs (2)
964((CancellationTokenSource)state).Cancel(); 982private readonly CancellationTokenSource _httpSendCts;
System.ServiceModel.Primitives (3)
Internals\System\Runtime\TaskHelpers.cs (1)
232using (CancellationTokenSource cts = new CancellationTokenSource())
Internals\System\Runtime\TimeoutHelper.cs (2)
263var args = (Tuple<long, CancellationTokenSource>)state; 320var tokenSource = new CancellationTokenSource((int)(targetTime - currentTime));
System.Threading.Tasks (1)
System.Threading.Tasks.cs (1)
22[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
System.Threading.Tasks.Dataflow (6)
Base\DataflowBlock.cs (6)
1030private static readonly Action<object?> _cancelCts = static state => ((CancellationTokenSource)state!).Cancel(); 1125internal readonly CancellationTokenSource _cts = new CancellationTokenSource(); 1923CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(dataflowBlockOptions.CancellationToken, CancellationToken.None); 2002StrongBox<Task> boxedCompleted, CancellationTokenSource cts, 2358internal readonly CancellationTokenSource Canceler = new CancellationTokenSource();
System.Threading.Tasks.Parallel (18)
System\Threading\Tasks\Parallel.cs (17)
183/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 436/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 473/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 586/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 625/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 780/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 845/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1207/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1277/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1349/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1453/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1572/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2147/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2211/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2280/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2360/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2451/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the
System\Threading\Tasks\Parallel.ForEachAsync.cs (1)
537public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
System.Windows.Extensions (2)
System\Media\SoundPlayer.cs (2)
33private CancellationTokenSource? _copyTaskCancellation; 326var cts = new CancellationTokenSource();
System.Windows.Forms.Primitives (1)
System\Windows\Forms\Animation\HighPrecisionTimer.cs (1)
709public CancellationTokenSource CancellationSource { get; }
Testing.Tests (15)
WaitFailures.cs (15)
13private static CancellationTokenSource DefaultCancellationTokenSource() 15var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken); 25var cts = DefaultCancellationTokenSource(); 40var cts = DefaultCancellationTokenSource(); 58var cts = DefaultCancellationTokenSource(); 78var cts = DefaultCancellationTokenSource(); 93var cts = DefaultCancellationTokenSource(); 108var cts = DefaultCancellationTokenSource(); 126var cts = DefaultCancellationTokenSource(); 142var cts = DefaultCancellationTokenSource(); 165var cts = DefaultCancellationTokenSource(); 189var cts = DefaultCancellationTokenSource(); 212var cts = DefaultCancellationTokenSource(); 238var cts = DefaultCancellationTokenSource();
vbc (2)
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (2)
310var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
VBCSCompiler (7)
src\roslyn\src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
36var cancellationTokenSource = new CancellationTokenSource();
src\roslyn\src\Compilers\Server\VBCSCompiler\ClientConnectionHandler.cs (2)
116var buildCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\roslyn\src\Compilers\Server\VBCSCompiler\NamedPipeClientConnection.cs (1)
20private CancellationTokenSource DisconnectCancellationTokenSource { get; } = new CancellationTokenSource();
src\roslyn\src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (1)
33private CancellationTokenSource? _cancellationTokenSource;
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (2)
310var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
vstest.console (1)
TestPlatformHelpers\TestRequestManager.cs (1)
91private CancellationTokenSource? _currentAttachmentsProcessingCancellationTokenSource;
vstest.console.arm64 (1)
src\vstest\src\vstest.console\TestPlatformHelpers\TestRequestManager.cs (1)
91private CancellationTokenSource? _currentAttachmentsProcessingCancellationTokenSource;