5 types derived from CancellationTokenSource
Microsoft.AspNetCore.Http (1)
src\Shared\CancellationTokenSourcePool.cs (1)
41public sealed class PooledCancellationTokenSource : CancellationTokenSource
Microsoft.AspNetCore.Server.Kestrel.Core (1)
src\Shared\CancellationTokenSourcePool.cs (1)
41public sealed class PooledCancellationTokenSource : CancellationTokenSource
System.Private.CoreLib (3)
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
1003 instantiations of CancellationTokenSource
AnalyzerRunner (1)
Program.cs (1)
42var cts = new CancellationTokenSource();
ApiExplorerWebSite (2)
ActionDescriptorChangeProvider.cs (1)
22var changeTokenSource = new CancellationTokenSource();
WellKnownChangeToken.cs (1)
8public CancellationTokenSource TokenSource { get; } = new CancellationTokenSource();
aspire (3)
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
139using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1));
NuGet\NuGetPackagePrefetcher.cs (1)
77using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Program.cs (1)
575using var cts = new CancellationTokenSource();
Aspire.Cli.Tests (18)
Agents\AgentEnvironmentApplicatorTests.cs (1)
31using var cts = new CancellationTokenSource();
Commands\AgentMcpCommandTests.cs (2)
39_cts = new CancellationTokenSource(); 474using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(200));
Commands\RunCommandTests.cs (11)
321using var cts = new CancellationTokenSource(); 376using var cts = new CancellationTokenSource(); 546using var cts = new CancellationTokenSource(); 616using var cts = new CancellationTokenSource(); 686using var cts = new CancellationTokenSource(); 748using var cts = new CancellationTokenSource(); 807using var cts = new CancellationTokenSource(); 866using var cts = new CancellationTokenSource(); 925using var cts = new CancellationTokenSource(); 1343using var cts = new CancellationTokenSource(); 1415using var cts = new CancellationTokenSource();
Mcp\Docs\DocsFetcherTests.cs (1)
204using var cts = new CancellationTokenSource();
Mcp\Docs\DocsIndexServiceTests.cs (1)
604using var cts = new CancellationTokenSource();
Mcp\Docs\LlmsTxtParserTests.cs (1)
381var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (20)
Components\Controls\ApplicationName.razor.cs (1)
33_disposalCts = new CancellationTokenSource();
Components\Controls\AssistantChat.razor.cs (1)
45private readonly CancellationTokenSource _cts = new();
Components\Controls\Chart\ChartBase.cs (1)
23private readonly CancellationTokenSource _cts = new();
Components\Controls\SpanDetails.razor.cs (1)
89private readonly CancellationTokenSource _cts = new();
Components\Dialogs\AssistantModalDialog.razor.cs (1)
37private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
34private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ManageDataDialog.razor.cs (1)
63private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (3)
36private readonly CancellationTokenSource _cts = new(); 51_cts = new(); 145private readonly CancellationTokenSource _resourceSubscriptionCts = new();
Components\Pages\Resources.razor.cs (1)
116private readonly CancellationTokenSource _watchTaskCancellationTokenSource = new();
Model\Assistant\AIHelpers.cs (1)
310var messageCts = new CancellationTokenSource();
Model\Assistant\AssistantChatViewModel.cs (1)
157_cts = new CancellationTokenSource();
Model\DashboardCommandExecutor.cs (1)
131closeToastCts = new CancellationTokenSource();
Model\ResourceOutgoingPeerResolver.cs (1)
22private readonly CancellationTokenSource _watchContainersTokenSource = new();
Model\TraceLinkHelpers.cs (1)
48using var cts = new CancellationTokenSource();
ServiceClient\DashboardClient.cs (1)
47private readonly CancellationTokenSource _cts = new();
Utils\CallbackThrottler.cs (1)
21_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 (22)
ChannelExtensionsTests.cs (4)
18var cts = new CancellationTokenSource(); 42var cts = new CancellationTokenSource(); 66var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource();
Integration\TelemetryApiTests.cs (2)
434using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 465using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Model\DashboardClientTests.cs (3)
47var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 158var cts = new CancellationTokenSource();
TelemetryApiServiceTests.cs (4)
50using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 97using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 344using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 391using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (8)
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(); 727using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 785using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 876using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Deployment.EndToEnd.Tests (26)
AcaCompactNamingDeploymentTests.cs (1)
28using var cts = new CancellationTokenSource(s_testTimeout);
AcaCompactNamingUpgradeDeploymentTests.cs (1)
27using var cts = new CancellationTokenSource(s_testTimeout);
AcaCustomRegistryDeploymentTests.cs (1)
24using var cts = new CancellationTokenSource(s_testTimeout);
AcaDeploymentErrorOutputTests.cs (1)
30using var cts = new CancellationTokenSource(s_testTimeout);
AcaExistingRegistryDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AcaManagedRedisDeploymentTests.cs (1)
24using var cts = new CancellationTokenSource(s_testTimeout);
AcaStarterDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AcrPurgeTaskDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AksStarterDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
AksStarterWithRedisDeploymentTests.cs (1)
23using 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);
AzureAppConfigDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureContainerRegistryDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureEventHubsDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureKeyVaultDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureLogAnalyticsDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureServiceBusDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
AzureStorageDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
PythonFastApiDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
VnetKeyVaultConnectivityDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
VnetKeyVaultInfraDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
VnetSqlServerConnectivityDeploymentTests.cs (1)
23using var cts = new CancellationTokenSource(s_testTimeout);
VnetSqlServerInfraDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
VnetStorageBlobConnectivityDeploymentTests.cs (1)
22using var cts = new CancellationTokenSource(s_testTimeout);
VnetStorageBlobInfraDeploymentTests.cs (1)
22using 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 (16)
ApplicationModel\ResourceLoggerService.cs (2)
23private readonly CancellationTokenSource _disposing = new(); 362private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (1)
28private readonly CancellationTokenSource _disposing = new();
Backchannel\AppHostRpcTarget.cs (1)
22private readonly CancellationTokenSource _shutdownCts = new();
Backchannel\AuxiliaryBackchannelRpcTarget.cs (2)
250using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(request.TimeoutSeconds)); 872using var timeoutCts = new CancellationTokenSource(s_mcpDiscoveryTimeout);
Dashboard\DashboardServiceData.cs (1)
19private readonly CancellationTokenSource _cts = new();
Dcp\DcpExecutor.cs (3)
77private readonly CancellationTokenSource _shutdownCancellation = new(); 359var disposeCts = new CancellationTokenSource(); 711var cancellation = new CancellationTokenSource();
Dcp\DcpHost.cs (1)
32private readonly CancellationTokenSource _shutdownCts = new();
Dcp\ResourceLogSource.cs (1)
34ownedCts = new CancellationTokenSource();
Devcontainers\DevcontainerSettingsWriter.cs (1)
34private readonly CancellationTokenSource _processingCancellation = new();
Orchestrator\ApplicationOrchestrator.cs (1)
36private readonly CancellationTokenSource _shutdownCancellation = new();
Orchestrator\ParameterProcessor.cs (1)
75var cts = new CancellationTokenSource();
Pipelines\PipelineActivityReporter.cs (1)
22private readonly CancellationTokenSource _cancellationTokenSource = new();
Aspire.Hosting.Azure.Kusto.Tests (6)
KustoFunctionalTests.cs (5)
46using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 96using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 174using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 201using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 232using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Azure.Tests (22)
AzureAIFoundryExtensionsTests.cs (1)
72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureBicepProvisionerTests.cs (1)
55var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 140var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 274var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureDeployerTests.cs (1)
1642using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureEventHubsExtensionsTests.cs (3)
25var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 66var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 118var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureServiceBusExtensionsTests.cs (3)
74var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 117var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 777var 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)
21var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 113var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 156var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 212var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 252var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultUserPrincipalProviderTests.cs (1)
71using var cts = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (1)
DockerSocketBindMountTests.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Aspire.Hosting.DevTunnels.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.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
21var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 59var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 104var 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 (4)
NodeAppFixture.cs (1)
41using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
24using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 36using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Kafka.Tests (3)
KafkaFunctionalTests.cs (2)
62var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 120var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.MongoDB.Tests (5)
MongoDbFunctionalTests.cs (5)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 109var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 355var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (12)
MySqlFunctionalTests.cs (11)
30using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 68using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 123using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 304using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 391using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 475using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 549using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 620var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 695var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 771var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 822var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Nats.Tests (3)
NatsFunctionalTests.cs (3)
68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 111var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 328var 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)
32var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 81var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 255var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 353var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 446var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (10)
PostgresFunctionalTests.cs (9)
99var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 195var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 364var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 452var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 536var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 595var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 641var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 687var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 765var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Qdrant.Tests (3)
QdrantFunctionalTests.cs (3)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 92var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (2)
RabbitMQFunctionalTests.cs (1)
98var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
32var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 137var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 189var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 449var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 610var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.RemoteHost.Tests (2)
CallbackProxyTests.cs (1)
167using var cts = new CancellationTokenSource();
CancellationTokenRegistryTests.cs (1)
38using var cts = new CancellationTokenSource();
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
24var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 64var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 130var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 342var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 409var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 463var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 540var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (3)
DistributedApplicationFactory.cs (3)
29private readonly CancellationTokenSource _disposingCts = new(); 426using var cts = new CancellationTokenSource(GetConfiguredTimeout()); 520using var shutdownTimeoutCts = new CancellationTokenSource(_shutdownTimeout);
Aspire.Hosting.Testing.Tests (7)
ResourceLoggerForwarderServiceTests.cs (3)
156private readonly CancellationTokenSource _startedCts = new(); 157private readonly CancellationTokenSource _stoppingCts = new(); 158private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
456using var cts = new CancellationTokenSource(timeout); 501using var cts = new CancellationTokenSource(timeout); 522using var cts = new CancellationTokenSource(timeout);
TestingFactoryCrashTests.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Hosting.Tests (65)
ApplicationModel\McpServerEndpointAnnotationTests.cs (1)
171using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (1)
383using var cts = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelTests.cs (1)
418using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
Backchannel\Exec\ExecTestsBase.cs (1)
26var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutSec));
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 65var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceTests.cs (6)
181var cts = new CancellationTokenSource(); 236var cts = new CancellationTokenSource(); 306var cts = new CancellationTokenSource(); 353var cts = new CancellationTokenSource(); 412var cts = new CancellationTokenSource(); 449var cts = new CancellationTokenSource();
Dashboard\ResourcePublisherTests.cs (5)
16CancellationTokenSource cts = new(); 69CancellationTokenSource cts = new(); 116CancellationTokenSource cts = new(); 137CancellationTokenSource cts = new(); 158CancellationTokenSource cts = new();
Dcp\DcpExecutorTests.cs (2)
629var watchCts = new CancellationTokenSource(); 1336var tokenSource = new CancellationTokenSource();
Dcp\DcpHostNotificationTests.cs (7)
90using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 140using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 195using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 249using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 300using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 322using (var testTimeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(5))) 367using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
DistributedApplicationTests.cs (2)
69var cts = new CancellationTokenSource(); 114var cts = new CancellationTokenSource();
EndpointReferenceTests.cs (1)
173using var cts = new CancellationTokenSource();
InteractionServiceTests.cs (1)
50var cts = new CancellationTokenSource();
Publishing\ResourceContainerImageManagerTests.cs (27)
37using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 100using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 137using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 171using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 201using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 237using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 276using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 311using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 343using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 372using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 422using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 451using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 475using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 510using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 541using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 573using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 609using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 656using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 729using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 824using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 876using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1216using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1264using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1297using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1340using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1373using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
ResourceNotificationTests.cs (3)
314using var cts = new CancellationTokenSource(); 346using var cts = new CancellationTokenSource(); 734private 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();
Aspire.Hosting.Valkey.Tests (2)
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
206var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
30var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v2.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.EntityFrameworkCore.Tests (1)
ConformanceTests.cs (1)
89using 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.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-server (2)
CancellationTokenRegistry.cs (2)
30var cts = new CancellationTokenSource(); 137var cts = new CancellationTokenSource();
ClientSample (1)
HubSample.cs (1)
56using var closedTokenSource = new CancellationTokenSource();
CustomResources.AppHost (1)
TestResource.cs (1)
36private readonly CancellationTokenSource _tokenSource = new();
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();
GenerateDocumentationAndConfigFiles (2)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
HelixTestRunner (8)
ProcessUtil.cs (1)
190var cancel = new CancellationTokenSource();
TestRunner.cs (7)
140cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 148cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 156cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 178cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 187cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 206cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); 230var cts = new CancellationTokenSource(testProcessTimeout);
http2cat (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
HttpStress (2)
Program.cs (2)
217var cts = new CancellationTokenSource(); 304var cts = new CancellationTokenSource();
IIS.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.LongTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.NewHandler.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.Tests (2)
ClientDisconnectTests.cs (2)
146var cancellationTokenSource = new CancellationTokenSource(); 188var cancellationTokenSource = new CancellationTokenSource();
IISExpress.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
Infrastructure.Tests (3)
ExtractTestPartitions\ExtractTestPartitionsFixture.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
ExtractTestPartitions\ExtractTestPartitionsTests.cs (1)
338using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
PowerShellScripts\PowerShellCommand.cs (1)
57CancellationTokenSource cts = new();
InMemory.FunctionalTests (10)
ConnectionMiddlewareTests.cs (1)
193using (var shutdownCts = new CancellationTokenSource(TestConstants.DefaultTimeout))
EventSourceTests.cs (1)
301using var handshakeCts = new CancellationTokenSource(TestConstants.DefaultTimeout);
Http2\Http2StreamTests.cs (1)
3820var cts = new CancellationTokenSource();
KeepAliveTimeoutTests.cs (2)
141var cts = new CancellationTokenSource(); 211var cts = new CancellationTokenSource();
RequestTests.cs (1)
114var cts = new CancellationTokenSource();
ResponseTests.cs (1)
148var cts = new CancellationTokenSource();
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
1046public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1048public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
TestTransport\InMemoryTransportConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
InProcessWebSite (1)
Startup.cs (1)
1013var cts = new CancellationTokenSource();
IntegrationTestsWebsite (1)
Infrastructure\DynamicEndpointDataSource.cs (1)
24_cts = new CancellationTokenSource();
Interop.FunctionalTests (10)
Http3\Http3RequestTests.cs (6)
486var cts = new CancellationTokenSource(); 732using var cts = new CancellationTokenSource(); 925var cts1 = new CancellationTokenSource(); 1165var cts = new CancellationTokenSource(); 1262var cts = new CancellationTokenSource(); 1410var cts = new CancellationTokenSource();
HttpClientHttp2InteropTests.cs (4)
214using (var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30))) 234using (var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30))) 250using var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 931var requestCancellation = new CancellationTokenSource();
InteropClient (2)
InteropClient.cs (2)
487var cts = new CancellationTokenSource(); 504var cts = new CancellationTokenSource();
InteropTests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Metrics (4)
Program.cs (1)
24using var tokenSource = new CancellationTokenSource();
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Metrics.Legacy (4)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\RoslynAnalyzers\Tools\Metrics\Program.cs (1)
24using var tokenSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.Agents.AI.ProjectTemplates.Tests (1)
test\ProjectTemplates\Infrastructure\TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components (2)
NavigationManager.cs (1)
426var cts = new CancellationTokenSource();
Routing\Router.cs (1)
354_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.QuickGrid (1)
QuickGrid.razor.cs (1)
330var 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)
186CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(10));
Circuits\RevalidatingServerAuthenticationStateProvider.cs (2)
18private CancellationTokenSource _loopCancellationTokenSource = new CancellationTokenSource(); 41_loopCancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Server.Tests (4)
Circuits\RemoteJSDataStreamTest.cs (3)
295var cts = new CancellationTokenSource(); 326var cts1 = new CancellationTokenSource(); 327var cts2 = new CancellationTokenSource();
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (1)
207validationTcs.TrySetCanceled(new CancellationTokenSource().Token);
Microsoft.AspNetCore.Components.Tests (3)
ComponentBaseTest.cs (1)
358var cts = new CancellationTokenSource();
OwningComponentBaseTest.cs (1)
212_cts = new CancellationTokenSource();
RendererTest.cs (1)
4113var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Web (2)
Media\MediaComponentBase.cs (1)
285_loadCts = new CancellationTokenSource();
Virtualization\Virtualize.cs (1)
414_refreshCts = 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.Components.WebAssembly.Tests (7)
Hosting\WebAssemblyHostTest.cs (7)
27var cts = new CancellationTokenSource(); 47var cts = new CancellationTokenSource(); 72var cts = new CancellationTokenSource(); 100var cts = new CancellationTokenSource(); 130var cts = new CancellationTokenSource(); 163var cts = new CancellationTokenSource(); 194var cts = 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.DataProtection.Tests (14)
KeyManagement\CacheableKeyRingTests.cs (2)
23var cts = new CancellationTokenSource(); 38var cts = new CancellationTokenSource();
KeyManagement\KeyRingProviderTests.cs (12)
22var expirationCts = new CancellationTokenSource(); 60var expirationCts = new CancellationTokenSource(); 103var expirationCts1 = new CancellationTokenSource(); 104var expirationCts2 = new CancellationTokenSource(); 194var expirationCts1 = new CancellationTokenSource(); 195var expirationCts2 = new CancellationTokenSource(); 276var expirationCts1 = new CancellationTokenSource(); 277var expirationCts2 = new CancellationTokenSource(); 326var expirationCts = new CancellationTokenSource(); 364var expirationCts = new CancellationTokenSource(); 727var cts = new CancellationTokenSource(); 819var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (1)
JsonTranscodingServerCallContextTests.cs (1)
24var cts = new CancellationTokenSource();
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.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (1)
40using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(timeout);
Internal\HostingEventSourceTests.cs (1)
199using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WebHostTests.cs (3)
171var cts = new CancellationTokenSource(); 225var cts = new CancellationTokenSource(); 300var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Connections (8)
Internal\HttpConnectionContext.cs (5)
108_connectionClosedTokenSource = new CancellationTokenSource(); 111_connectionCloseRequested = new CancellationTokenSource(); 481Cancellation = new CancellationTokenSource(); 483var timeoutSource = new CancellationTokenSource(); 650_sendCts = new CancellationTokenSource();
Internal\HttpConnectionDispatcher.cs (1)
177connection.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.Http.Connections.Tests (7)
ApplicationLifetime.cs (3)
12private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 13private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 14private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
HttpConnectionDispatcherTests.cs (4)
458var cts = new CancellationTokenSource(); 521var cts = new CancellationTokenSource(); 2907_cts = new CancellationTokenSource(); 3115var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Microbenchmarks (1)
RequestTimeoutsMiddlewareBenchmark.cs (1)
120var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Results.Tests (1)
ServerSentEventsResultTests.cs (1)
223var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Tests (2)
Timeouts\RequestTimeoutsMiddlewareTests.cs (2)
368var cts = new CancellationTokenSource(); 375return (cts, new CancellationTokenSource());
Microsoft.AspNetCore.HttpLogging (1)
FileLoggerProcessor.cs (1)
102_cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.InternalTesting.Tests (4)
TaskExtensionsTest.cs (4)
16var cts = new CancellationTokenSource(); 36var cts = new CancellationTokenSource(); 44var cts = new CancellationTokenSource(); 52var cts = 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.Core.Test (8)
Formatters\SystemTextJsonOutputFormatterTest.cs (1)
125var cts = new CancellationTokenSource();
Infrastructure\AsyncEnumerableReaderTest.cs (1)
210var cts = new CancellationTokenSource();
Infrastructure\DefaultActionDescriptorCollectionProviderTest.cs (1)
180TokenSource = new CancellationTokenSource();
Infrastructure\JsonResultExecutorTestBase.cs (4)
367var cts = new CancellationTokenSource(); 398var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 452var cts = new CancellationTokenSource();
Routing\ActionEndpointDataSourceBaseTest.cs (1)
84cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerOutputFormatterTest.cs (1)
727var cts = new CancellationTokenSource();
XmlSerializerOutputFormatterTest.cs (1)
509var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
ModelBindingTestHelper.cs (1)
210private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (9)
NewtonsoftJsonOutputFormatterTest.cs (3)
443var cts = new CancellationTokenSource(); 488var cts = new CancellationTokenSource(); 522var cts = new CancellationTokenSource();
NewtonsoftJsonResultExecutorTest.cs (1)
37var cts = new CancellationTokenSource();
src\Mvc\Mvc.Core\test\Infrastructure\AsyncEnumerableReaderTest.cs (1)
210var cts = new CancellationTokenSource();
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (4)
367var cts = new CancellationTokenSource(); 398var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 452var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.Razor.Test (3)
RazorViewEngineTest.cs (3)
170var cancellationTokenSource = new CancellationTokenSource(); 905var cancellationTokenSource = new CancellationTokenSource(); 1004var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
src\Mvc\Mvc.Core\test\Routing\ActionEndpointDataSourceBaseTest.cs (1)
84cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.TagHelpers (1)
CacheTagHelper.cs (1)
92var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (1)
CacheTagHelperTest.cs (1)
488var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.OpenApi.Tests (5)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (1)
293using var cts = new CancellationTokenSource();
Transformers\DocumentTransformerTests.cs (1)
268using var cts = new CancellationTokenSource();
Transformers\OperationTransformerTests.cs (1)
599using var cts = new CancellationTokenSource();
Transformers\SchemaTransformerTests.cs (2)
131var cts = new CancellationTokenSource(); 884using var cts = new CancellationTokenSource();
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
31private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.AspNetCore.OutputCaching.Tests (6)
CachedResponseBodyTests.cs (3)
33using var cts = new CancellationTokenSource(_timeout); 57using var cts = new CancellationTokenSource(_timeout); 82using var cts = new CancellationTokenSource(_timeout);
MemoryOutputCacheStoreTests.cs (3)
78using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 184using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 224using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Microsoft.AspNetCore.ResponseCaching.Tests (3)
CachedResponseBodyTests.cs (3)
41using var cts = new CancellationTokenSource(_timeout); 63using var cts = new CancellationTokenSource(_timeout); 87using var cts = new CancellationTokenSource(_timeout);
Microsoft.AspNetCore.Routing (1)
CompositeEndpointDataSource.cs (1)
245var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Routing.Tests (1)
TestObjects\DynamicEndpointDataSource.cs (1)
48_cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.HttpSys (1)
NativeInterop\DisconnectListener.cs (1)
59var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (38)
Listener\RequestBodyTests.cs (5)
56var cts = new CancellationTokenSource(); 80var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource(); 129var cts = new CancellationTokenSource(); 154var cts = new CancellationTokenSource();
Listener\ResponseBodyTests.cs (10)
110var cts = new CancellationTokenSource(); 131var cts = new CancellationTokenSource(); 154var cts = new CancellationTokenSource(); 174var cts = new CancellationTokenSource(); 195var cts = new CancellationTokenSource(); 217var cts = new CancellationTokenSource(); 238var cts = new CancellationTokenSource(); 274var cts = new CancellationTokenSource(); 309var cts = new CancellationTokenSource(); 337var cts = new CancellationTokenSource();
ResponseSendFileTests.cs (10)
338var cts = new CancellationTokenSource(); 355var cts = new CancellationTokenSource(); 376var cts = new CancellationTokenSource(); 404var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 459var cts = new CancellationTokenSource(); 496using var cts = new CancellationTokenSource(); 518var cts = new CancellationTokenSource(); 561var cts = new CancellationTokenSource(); 586using var cts = new CancellationTokenSource();
ServerTests.cs (12)
158await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token); 201await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token); 431var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 465var cts = new CancellationTokenSource(); 501var cts = new CancellationTokenSource(); 503var stopTask2 = server.StopAsync(new CancellationTokenSource().Token); 504var stopTask3 = server.StopAsync(new CancellationTokenSource().Token); 537var cts = new CancellationTokenSource(); 538var stopTask1 = server.StopAsync(new CancellationTokenSource().Token); 540var stopTask3 = server.StopAsync(new CancellationTokenSource().Token); 575stopTask1 = server.StopAsync(new CancellationTokenSource().Token); 576stopTask2 = server.StopAsync(new CancellationTokenSource().Token);
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = 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\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
IISDeployer.cs (1)
26private readonly CancellationTokenSource _hostShutdownToken = new CancellationTokenSource();
IISExpressDeployer.cs (1)
222var hostExitTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Core (5)
Internal\Http\HttpProtocol.cs (1)
300_abortedCts = new CancellationTokenSource();
Internal\Http3\Http3Connection.cs (2)
52private CancellationTokenSource _acceptStreamsCts = new(); 372_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.Core.Tests (3)
TlsListenerTests.cs (3)
70var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(3)); 92var cts = new CancellationTokenSource(); 115var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
1046public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1048public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
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.Quic.Tests (1)
QuicConnectionContextTests.cs (1)
92var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\SocketConnection.cs (1)
24private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Session.Tests (3)
SessionTests.cs (3)
801var cts = new CancellationTokenSource(); 982var cts = new CancellationTokenSource(); 1046var cts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.Core (8)
HubConnection.cs (8)
301_state.StopCts = new CancellationTokenSource(); 630_state.StopCts = new CancellationTokenSource(); 674var cts = cancellationToken.CanBeCanceled ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : new CancellationTokenSource(); 1511using var handshakeCts = new CancellationTokenSource(HandshakeTimeout); 1609using var uploadStreamSource = new CancellationTokenSource(); 1778_state.StopCts = new CancellationTokenSource(); 2445StopCts = new CancellationTokenSource(); 2453public CancellationTokenSource StopCts { get; set; } = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (7)
HubConnectionTests.cs (6)
572var cts = new CancellationTokenSource(); 609var cts = new CancellationTokenSource(); 893var cts = new CancellationTokenSource(); 938var cts = new CancellationTokenSource(); 977var cts = new CancellationTokenSource(); 1018var cts = new CancellationTokenSource();
HubConnectionTests.Tracing.cs (1)
402var cts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.Tests (13)
HttpConnectionTests.ConnectionLifecycle.cs (3)
406var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 514var cts = new CancellationTokenSource();
HubConnectionTests.ConnectionLifecycle.cs (1)
577var cts = new CancellationTokenSource();
HubConnectionTests.cs (6)
174var cts = new CancellationTokenSource(); 231var cts = new CancellationTokenSource(); 292using var cts = new CancellationTokenSource(); 321using var cts = new CancellationTokenSource(); 553var cts = new CancellationTokenSource(); 585var cts = new CancellationTokenSource();
HubServerProxyGeneratorTests.cs (2)
177var cts = new CancellationTokenSource(); 264var cts = new CancellationTokenSource();
TestHttpMessageHandler.cs (1)
106var deleteCts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Core (2)
HubConnectionContext.cs (2)
30private readonly CancellationTokenSource _connectionAbortedTokenSource = new CancellationTokenSource(); 500using (var cts = new CancellationTokenSource())
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\SignalR\common\testassets\Tests.Utils\TestClient.cs (1)
65_cts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Tests (16)
DefaultHubLifetimeManagerTests.cs (9)
34var cts = new CancellationTokenSource(); 64var cts = new CancellationTokenSource(); 88var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 160var cts = new CancellationTokenSource(); 185var cts = new CancellationTokenSource(); 210var cts = new CancellationTokenSource(); 240var cts = new CancellationTokenSource();
HubConnectionHandlerTests.ClientResult.cs (2)
372var cts = new CancellationTokenSource(); 417var cts = new CancellationTokenSource();
HubConnectionHandlerTests.cs (1)
2263private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Internal\TypedClientBuilderTests.cs (4)
101CancellationTokenSource cts1 = new CancellationTokenSource(); 105CancellationTokenSource cts2 = new CancellationTokenSource(); 249CancellationTokenSource cts1 = new CancellationTokenSource(); 253CancellationTokenSource cts2 = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Tests.Utils (2)
src\Shared\SignalR\InProcessTestServer.cs (1)
115var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
TestClient.cs (1)
65_cts = new CancellationTokenSource();
Microsoft.AspNetCore.SpaServices.Extensions (1)
AngularCli\AngularCliMiddleware.cs (1)
112using var cancellationTokenSource = new CancellationTokenSource(timeoutMilliseconds);
Microsoft.AspNetCore.SpaServices.Extensions.Tests (2)
SpaServicesExtensionsTests.cs (2)
81_applicationStoppingSource = new CancellationTokenSource(); 84_applicationStoppedSource = new CancellationTokenSource();
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.AspNetCore.TestHost.Tests (5)
ClientHandlerTests.cs (1)
478CancellationTokenSource cts = new CancellationTokenSource();
HttpContextBuilderTests.cs (2)
323var cts = new CancellationTokenSource(); 359var cts = new CancellationTokenSource();
TestClientTests.cs (2)
893var tokenSource = new CancellationTokenSource(); 1078using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Microsoft.AspNetCore.WebSockets.ConformanceTests (2)
Autobahn\AutobahnTester.cs (1)
37var pingCts = new CancellationTokenSource();
AutobahnTests.cs (1)
52var cts = new CancellationTokenSource();
Microsoft.AspNetCore.WebSockets.Tests (1)
WebSocketMiddlewareTests.cs (1)
583CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.Bcl.TimeProvider (1)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (1)
250return new CancellationTokenSource(delay, timeProvider);
Microsoft.Build.Tasks.CodeAnalysis (1)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
541_sharedCompileCts = new CancellationTokenSource();
Microsoft.Build.Tasks.CodeAnalysis.Sdk (1)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
541_sharedCompileCts = new CancellationTokenSource();
Microsoft.CodeAnalysis.Analyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.BannedApiAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CodeStyle (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp (1)
CommandLine\CSharpCommandLineParser.cs (1)
298using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
93_cancellationTokenSource = new();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
4249var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (3)
InteractiveSessionTests.cs (3)
2027var cancellationSource = new CancellationTokenSource(); 2061var cancellationSource = new CancellationTokenSource(); 2095var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\GeneratorDriverTests.cs (2)
748CancellationTokenSource cts = new CancellationTokenSource(); 2597CancellationTokenSource cts = new CancellationTokenSource();
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
1986CancellationTokenSource cts = new CancellationTokenSource(); 2012CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.EditorFeatures (19)
AutomaticCompletion\BraceCompletionSessionProvider.cs (1)
107var cancellationTokenSource = new CancellationTokenSource();
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
48private readonly CancellationTokenSource _disposalCancellationSource = new();
EditAndContinue\ActiveStatementTrackingService.cs (1)
103private readonly CancellationTokenSource _cancellationSource = new();
GoOrFind\AbstractGoOrFindNavigationService.cs (2)
62private CancellationTokenSource _cancellationTokenSource = new(); 98_cancellationTokenSource = new();
InlineRename\InlineRenameSession.cs (3)
110private readonly CancellationTokenSource _cancellationTokenSource = new(); 121private CancellationTokenSource _conflictResolutionTaskCancellationSource = new(); 515_conflictResolutionTaskCancellationSource = new CancellationTokenSource();
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (2)
46private CancellationTokenSource _cancellationTokenSource = new(); 186_cancellationTokenSource = new CancellationTokenSource();
IntelliSense\ModelComputation.cs (1)
57_stopTokenSource = new CancellationTokenSource();
Interactive\InteractiveSession.cs (1)
86_shutdownCancellationSource = new CancellationTokenSource();
NavigateTo\NavigateToItemProvider.cs (2)
26private CancellationTokenSource _cancellationTokenSource = new(); 77_cancellationTokenSource = new CancellationTokenSource();
NavigationBar\NavigationBarController.cs (1)
64private readonly CancellationTokenSource _cancellationTokenSource = new();
QuickInfo\OnTheFlyDocsView.xaml.cs (1)
49private readonly CancellationTokenSource _cancellationTokenSource = new();
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
43private readonly CancellationTokenSource _cancellationTokenSource = new();
Shared\Utilities\ThreadingContext.cs (1)
28private readonly CancellationTokenSource _disposalTokenSource = new();
Tagging\AbstractAsynchronousTaggerProvider.TagSource.cs (1)
102private readonly CancellationTokenSource _disposalTokenSource = new();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Utilities\AsynchronousOperationListenerTests.cs (1)
30=> _tokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (1)
Cohost\RazorStartupServiceFactory.cs (1)
36private readonly CancellationTokenSource _disposalTokenSource = new();
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.InteractiveHost (4)
Interactive\Core\InteractiveHost.LazyRemoteService.cs (1)
34_cancellationSource = new CancellationTokenSource();
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.LanguageServer (3)
BrokeredServices\ServiceBrokerFactory.cs (1)
34private readonly CancellationTokenSource _cancellationTokenSource = new();
HostWorkspace\FileWatching\LspFileChangeWatcher.cs (1)
213_cancellationTokenSource = new CancellationTokenSource();
Program.cs (1)
81using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\AbstractRefreshQueue.cs (1)
46_disposalTokenSource = new();
Handler\SourceGenerators\SourceGeneratorRefreshQueue.cs (1)
26private readonly CancellationTokenSource _disposalTokenSource = new();
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (1)
69private readonly CancellationTokenSource _cancelSource = new();
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Ordering\RequestOrderingTests.cs (1)
142using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Utilities\AbstractLanguageServerClientTests.TestLspClient.cs (1)
55using var cts = new CancellationTokenSource(TimeOutMsNewProcess);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Host\RemoteWorkspace.InFlightSolution.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource_doNotAccessDirectly = new();
Services\ProcessTelemetry\RemoteProcessTelemetryService.cs (1)
31private readonly CancellationTokenSource _shutdownCancellationSource = new();
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
57private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.CodeAnalysis.ResxSourceGenerator (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
2220public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource(); 2679private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); 2914private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.CodeAnalysis.Threading.Package (1)
CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.UnitTests (3)
AsyncQueueTests.cs (3)
166var cts = new CancellationTokenSource(); 178var cts = new CancellationTokenSource(); 195var cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces (10)
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (1)
33private readonly CancellationTokenSource _tokenSource = new();
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\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Storage\SQLite\v2\SQLitePersistentStorage.cs (1)
31private readonly CancellationTokenSource _shutdownTokenSource = new();
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
141private readonly CancellationTokenSource _asynchronousFileChangeProcessingCancellationTokenSource = new();
Workspace\Workspace.cs (1)
44private readonly CancellationTokenSource _workQueueTokenSource = new();
Workspace\Workspace_SourceGeneration.cs (1)
29private readonly CancellationTokenSource _updateSourceGeneratorsQueueTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
Rpc\RpcClient.cs (1)
38private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Rpc\RpcServer.cs (1)
35private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (1)
213var tokenSource = new CancellationTokenSource();
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
35private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
MEF\UseExportProviderAttribute.cs (1)
125using (var timeoutTokenSource = new CancellationTokenSource(CleanupTimeout))
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
UtilityTest\AsyncLazyTests.cs (6)
40var requestCancellationTokenSource = new CancellationTokenSource(); 174var cancellationTokenSource = new CancellationTokenSource(); 197var cancellationTokenSource = new CancellationTokenSource(); 227var requestCancellationTokenSource = new CancellationTokenSource(); 334var cancellationTokenSource = new CancellationTokenSource(); 369var asynchronousRequestCancellationToken = new CancellationTokenSource();
UtilityTest\CancellationSeriesTests.cs (4)
63var cts = new CancellationTokenSource(); 76var cts = new CancellationTokenSource(); 89var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource();
Microsoft.CommonLanguageServerProtocol.Framework.Package (1)
RequestExecutionQueue.cs (1)
69private readonly CancellationTokenSource _cancelSource = new();
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
41private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
Microsoft.DotNet.ArcadeAzureIntegration (1)
AzureCliCredentialWithAzNoUpdateWrapper.cs (1)
94using var tokenSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Feed (6)
src\BlobFeedAction.cs (1)
24private static readonly CancellationTokenSource TokenSource = new CancellationTokenSource();
src\common\UploadToAzure.cs (2)
18private static readonly CancellationTokenSource TokenSource = new CancellationTokenSource(); 117CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(UploadTimeoutInMinutes));
src\PublishArtifactsInManifestBase.cs (2)
996using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(TimeoutInMinutes)); 1031new CancellationTokenSource(TimeSpan.FromMinutes(TimeoutInMinutes));
src\PublishBuildToMaestro.cs (1)
55private readonly CancellationTokenSource _tokenSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ExecWithRetries.cs (1)
52private CancellationTokenSource _cancelTokenSource = new CancellationTokenSource();
Microsoft.DotNet.Helix.Sdk (2)
DownloadFromResultsContainer.cs (1)
31private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
HelixTask.cs (1)
15private readonly CancellationTokenSource _cancel = new CancellationTokenSource();
Microsoft.Extensions.AI.Abstractions.Tests (12)
ChatCompletion\ChatClientExtensionsTests.cs (4)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 216using var cts = new CancellationTokenSource();
Contents\DataContentTests.cs (3)
772using CancellationTokenSource cts = new(); 794using CancellationTokenSource cts = new(); 821using 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();
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAISpeechToTextClientTests.cs (2)
108using var cancellationTokenSource = new CancellationTokenSource(); 122using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
test\ProjectTemplates\Infrastructure\TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (25)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
960using CancellationTokenSource cts = new(); 1036using CancellationTokenSource cts = new(); 1238using CancellationTokenSource cts = new(); 1326using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
2198using CancellationTokenSource cts = new(); 2268using 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();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
193using var cts = new CancellationTokenSource(); 745using CancellationTokenSource cts = new(); 768using CancellationTokenSource cts = new(); 791using CancellationTokenSource cts = new(); 814using CancellationTokenSource cts = new(); 837using CancellationTokenSource cts = new(); 860using CancellationTokenSource cts = new(); 883using CancellationTokenSource cts = new(); 906using CancellationTokenSource cts = new();
Image\ConfigureOptionsImageGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (1)
40using CancellationTokenSource cts = new();
Microsoft.Extensions.ApiDescription.Client.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Microsoft.Extensions.AsyncState (1)
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(); 265cancels[i] = new CancellationTokenSource(); 333using CancellationTokenSource? cts = withCancelation ? new() : null; 373using var cts = withCancelation ? new CancellationTokenSource() : null; 417using CancellationTokenSource? cts = withCancelation ? new() : null;
Microsoft.Extensions.Compliance.Abstractions (1)
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.Configuration.KeyPerFile.Tests (1)
KeyPerFileTests.cs (1)
220using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(250)))
Microsoft.Extensions.DataIngestion.Tests (2)
Readers\DocumentReaderConformanceTests.cs (2)
39using CancellationTokenSource cts = new(); 57using CancellationTokenSource cts = new();
Microsoft.Extensions.Diagnostics.HealthChecks (1)
HealthCheckPublisherHostedService.cs (1)
50_stopping = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.HealthChecks.Common (1)
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.HealthChecks.Tests (2)
DefaultHealthCheckServiceTest.cs (2)
261var cancel = new CancellationTokenSource(); 575using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)))
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
TcpEndpointProbesServiceTests.cs (1)
23using var cts = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Diagnostics.Testing (2)
Logging\FakeLogCollector.LogEnumeration.cs (1)
93: new CancellationTokenSource();
Metrics\MetricCollector.cs (1)
254using var cancellationTokenSource = new CancellationTokenSource(timeout, _timeProvider);
Microsoft.Extensions.Diagnostics.Testing.Tests (2)
Logging\FakeLogCollectorTests.LogEnumeration.cs (1)
33using var cts = new CancellationTokenSource();
Metrics\MetricCollectorTests.cs (1)
283using var cts = new CancellationTokenSource();
Microsoft.Extensions.FileProviders.Physical (4)
PhysicalFilesWatcher.cs (4)
170var cancellationTokenSource = new CancellationTokenSource(); 186pollingChangeToken.CancellationTokenSource = new CancellationTokenSource(); 205var cancellationTokenSource = new CancellationTokenSource(); 223pollingChangeToken.CancellationTokenSource = new CancellationTokenSource();
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)
61using var tokenSource = new CancellationTokenSource(); 120using 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.Polly.Tests (1)
PolicyHttpMessageHandlerTest.cs (1)
394using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)))
Microsoft.Extensions.Http.Resilience (1)
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)
391CancellationTokenSource 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.ObjectPool.Tests (1)
ThreadingTest.cs (1)
31_cts = new CancellationTokenSource();
Microsoft.Extensions.Primitives (1)
CompositeChangeToken.cs (1)
103_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)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Telemetry.Abstractions (1)
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)
115using 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.JSInterop.Tests (4)
Infrastructure\DotNetDispatcherTest.cs (2)
323var cts = new CancellationTokenSource(); 387var cts = new CancellationTokenSource();
JSRuntimeTest.cs (2)
73using var cts = new CancellationTokenSource(); 89using var cts = new CancellationTokenSource();
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.McpServer.ProjectTemplates.Tests (1)
test\ProjectTemplates\Infrastructure\TestCommand.cs (1)
88using var timeoutCts = 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.VisualBasic.Forms.Tests (1)
System\Windows\Forms\SingleInstanceHelpersTests.vb (1)
50Dim tokenSource As New CancellationTokenSource()
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
58CancellationTokenSource tokenSource = new();
Microsoft.VisualStudio.Extensibility.Testing.Xunit (2)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Harness\InProcessIdeTestAssemblyRunner.cs (1)
44using (var cancellationTokenSource = new CancellationTokenSource())
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Harness\VisualStudioInstanceFactory.cs (1)
459using var cancellatokenSource = new CancellationTokenSource();
Microsoft.VisualStudio.IntegrationTest.Setup (1)
AsyncCompletionTracker.cs (1)
47var cancellationSource = new CancellationTokenSource();
Microsoft.VisualStudio.LanguageServices (10)
CallHierarchy\Finders\AbstractCallFinder.cs (1)
23private readonly CancellationTokenSource _cancellationSource = new();
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (1)
57public readonly CancellationTokenSource CancellationTokenSource = new();
KeybindingReset\KeybindingResetDetector.cs (2)
75private CancellationTokenSource _cancellationTokenSource = new(); 163_cancellationTokenSource = new CancellationTokenSource();
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
106using var cancellationTokenSource = new CancellationTokenSource();
PdbSourceDocument\PdbSourceDocumentOutputWindowLogger.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource = new();
ProjectSystem\RuleSets\VisualStudioRuleSetManager.RuleSetFile.cs (1)
41_disposalCancellationSource = new();
PullMemberUp\VisualStudioPullMemberUpService.cs (1)
57using var cancellationTokenSource = new CancellationTokenSource();
Remote\VisualStudioWorkspaceServiceHubConnector.cs (1)
28private readonly CancellationTokenSource _disposalCancellationSource = new();
Workspace\SourceGeneratedFileManager.cs (1)
271private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.VisualStudio.LanguageServices.CodeLens (1)
ReferenceCodeLensProvider.cs (1)
48private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.VisualStudio.LanguageServices.CSharp (1)
SemanticSearch\SemanticSearchToolWindowImpl.cs (1)
395var cancellationSource = new CancellationTokenSource();
Microsoft.VisualStudio.LanguageServices.Implementation (2)
SolutionExplorer\AnalyzerItem\AnalyzerItemSource.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource = new();
SolutionExplorer\DiagnosticItem\BaseDiagnosticAndGeneratorItemSource.cs (1)
31private readonly CancellationTokenSource _cancellationTokenSource = new();
Nats.Backend (1)
Program.cs (1)
22private readonly CancellationTokenSource _cts = new();
RazorBuildWebSite (3)
UpdateableFileProvider.cs (3)
13public CancellationTokenSource _pagesTokenSource = new CancellationTokenSource(); 51_pagesTokenSource = new CancellationTokenSource(); 97public CancellationTokenSource TokenSource { get; } = new CancellationTokenSource();
Roslyn.Diagnostics.Analyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Roslyn.VisualStudio.DiagnosticsWindow (1)
OptionPages\ForceLowMemoryMode.cs (1)
61private readonly CancellationTokenSource _cancellationTokenSource = new();
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (2)
150var cancellationTokenSource = new CancellationTokenSource(); 201var cancellationTokenSource = new CancellationTokenSource();
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
111var source = new CancellationTokenSource();
RunTests (1)
Program.cs (1)
57using var cts = new CancellationTokenSource();
Shared (1)
Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Sockets.FunctionalTests (1)
src\Servers\Kestrel\test\FunctionalTests\Http2\ShutdownTests.cs (1)
202var cts = new CancellationTokenSource();
Stress.AppHost (1)
TestResource.cs (1)
55private 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.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)
466(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 (9)
System\Net\Http\HttpClient.cs (2)
150_pendingRequestsCts = new CancellationTokenSource(); 693CancellationTokenSource 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)
813var cts = new CancellationTokenSource(Settings._connectTimeout);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
828_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.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\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.Net.WebSockets.Client (1)
System\Net\WebSockets\WebSocketHandle.Managed.cs (1)
25private readonly CancellationTokenSource _abortSource = new CancellationTokenSource();
System.Private.CoreLib (4)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.Threads.cs (1)
16m_dispatchTaskCancellationSource = new CancellationTokenSource();
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\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.Forms.Tests (8)
System\Windows\Forms\ControlTests_InvokeAsync.cs (7)
235using var cts = new CancellationTokenSource(); 249using var cts = new CancellationTokenSource(); 271using var cts = new CancellationTokenSource(); 285using var cts = new CancellationTokenSource(); 301using var cts = new CancellationTokenSource(); 327using var cts = new CancellationTokenSource(); 359using var cts = new CancellationTokenSource();
System\Windows\Forms\ToolStripTests.cs (1)
7312using CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
Templates.Blazor.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Templates.Blazor.WebAssembly.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Templates.Mvc.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Templates.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 62_processTimeoutCts = new CancellationTokenSource(timeout);
Test.Utilities (2)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
Text.Analyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
VBCSCompiler (3)
src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
52var cancellationTokenSource = new CancellationTokenSource();
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnection.cs (1)
20private CancellationTokenSource DisconnectCancellationTokenSource { get; } = new CancellationTokenSource();
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (1)
59_cancellationTokenSource = new CancellationTokenSource();
VBCSCompiler.UnitTests (2)
BuildClientTests.cs (1)
149var cts = new CancellationTokenSource();
ServerUtil.cs (1)
92var cts = new CancellationTokenSource();
Wasm.Performance.Driver (2)
Program.cs (2)
48stressRunCancellation = new CancellationTokenSource(stressRunDuration).Token; 94using var runCancellationToken = new CancellationTokenSource(timeForEachRun);
2009 references to CancellationTokenSource
AnalyzerRunner (1)
Program.cs (1)
42var cts = new CancellationTokenSource();
ApiExplorerWebSite (2)
ActionDescriptorChangeProvider.cs (1)
22var changeTokenSource = new CancellationTokenSource();
WellKnownChangeToken.cs (1)
8public CancellationTokenSource TokenSource { get; } = new CancellationTokenSource();
aspire (19)
Backchannel\AuxiliaryBackchannelMonitor.cs (3)
139using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1)); 140using var combined = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken, timeout.Token);
Backchannel\ExtensionBackchannel.cs (2)
91using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
NuGet\NuGetPackagePrefetcher.cs (3)
77using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(1)); 78using var combined = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeout.Token);
Program.cs (1)
575using var cts = new CancellationTokenSource();
Utils\CliDownloader.cs (2)
174using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\EnvironmentChecker\ContainerRuntimeCheck.cs (6)
113using var versionTimeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 264using var psTimeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 471using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Utils\EnvironmentChecker\DeprecatedWorkloadCheck.cs (2)
44using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Cli.Tests (19)
Agents\AgentEnvironmentApplicatorTests.cs (1)
31using var cts = new CancellationTokenSource();
Commands\AgentMcpCommandTests.cs (2)
33private CancellationTokenSource _cts = null!; 474using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMilliseconds(200));
Commands\RunCommandTests.cs (11)
321using var cts = new CancellationTokenSource(); 376using var cts = new CancellationTokenSource(); 546using var cts = new CancellationTokenSource(); 616using var cts = new CancellationTokenSource(); 686using var cts = new CancellationTokenSource(); 748using var cts = new CancellationTokenSource(); 807using var cts = new CancellationTokenSource(); 866using var cts = new CancellationTokenSource(); 925using var cts = new CancellationTokenSource(); 1343using var cts = new CancellationTokenSource(); 1415using var cts = new CancellationTokenSource();
Mcp\Docs\DocsFetcherTests.cs (1)
204using var cts = new CancellationTokenSource();
Mcp\Docs\DocsIndexServiceTests.cs (1)
604using var cts = new CancellationTokenSource();
Mcp\Docs\LlmsTxtParserTests.cs (1)
381var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (44)
Components\Controls\ApplicationName.razor.cs (1)
12private CancellationTokenSource? _disposalCts;
Components\Controls\AssistantChat.razor.cs (1)
45private readonly CancellationTokenSource _cts = new();
Components\Controls\Chart\ChartBase.cs (1)
23private readonly CancellationTokenSource _cts = new();
Components\Controls\SpanDetails.razor.cs (1)
89private readonly CancellationTokenSource _cts = new();
Components\Dialogs\AssistantModalDialog.razor.cs (1)
37private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
34private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ManageDataDialog.razor.cs (1)
63private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
41private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (2)
36private readonly CancellationTokenSource _cts = new(); 145private readonly CancellationTokenSource _resourceSubscriptionCts = new();
Components\Pages\Resources.razor.cs (1)
116private readonly CancellationTokenSource _watchTaskCancellationTokenSource = new();
Mcp\AspireResourceMcpTools.cs (2)
98using var subscribeConsoleLogsCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Model\Assistant\AIHelpers.cs (2)
301CancellationTokenSource responseCts) 310var messageCts = new CancellationTokenSource();
Model\Assistant\AssistantChatDataContext.cs (2)
256using var subscribeConsoleLogsCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Model\Assistant\AssistantChatViewModel.cs (6)
115private readonly CancellationTokenSource _cts; 202private CancellationTokenSource? _currentResponseCts; 480var currentResponseCts = _currentResponseCts = _currentResponseCts?.TryReset() ?? false 482: CancellationTokenSource.CreateLinkedTokenSource(_cts.Token); 502private async Task CallServiceCoreAsync(CancellationTokenSource responseCts) 724private async Task UpdateFollowUpPromptsAsync(List<ChatMessage>? followUpMessages, CancellationTokenSource responseCts)
Model\DashboardCommandExecutor.cs (1)
124CancellationTokenSource closeToastCts;
Model\ResourceOutgoingPeerResolver.cs (1)
22private readonly CancellationTokenSource _watchContainersTokenSource = new();
Model\TraceLinkHelpers.cs (1)
48using var cts = new CancellationTokenSource();
ServiceClient\DashboardClient.cs (13)
47private readonly CancellationTokenSource _cts = new(); 453var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 598var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 646var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 688using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 728using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 767using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken);
Utils\CallbackThrottler.cs (1)
31private 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 (26)
ChannelExtensionsTests.cs (4)
18var cts = new CancellationTokenSource(); 42var cts = new CancellationTokenSource(); 66var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource();
Integration\TelemetryApiTests.cs (2)
434using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 465using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
Model\DashboardClientTests.cs (3)
47var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 158var cts = new CancellationTokenSource();
TelemetryApiServiceTests.cs (4)
50using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 97using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 344using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 391using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (11)
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); 727using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 785using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 876using 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 (78)
AcaCompactNamingDeploymentTests.cs (3)
28using var cts = new CancellationTokenSource(s_testTimeout); 29using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaCompactNamingUpgradeDeploymentTests.cs (3)
27using var cts = new CancellationTokenSource(s_testTimeout); 28using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaCustomRegistryDeploymentTests.cs (3)
24using var cts = new CancellationTokenSource(s_testTimeout); 25using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaDeploymentErrorOutputTests.cs (3)
30using var cts = new CancellationTokenSource(s_testTimeout); 31using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaExistingRegistryDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaManagedRedisDeploymentTests.cs (3)
24using var cts = new CancellationTokenSource(s_testTimeout); 25using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcaStarterDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AcrPurgeTaskDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksStarterDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AksStarterWithRedisDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using 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(
AzureAppConfigDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureContainerRegistryDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureEventHubsDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureKeyVaultDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureLogAnalyticsDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureServiceBusDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
AzureStorageDeploymentTests.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(
VnetKeyVaultConnectivityDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetKeyVaultInfraDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetSqlServerConnectivityDeploymentTests.cs (3)
23using var cts = new CancellationTokenSource(s_testTimeout); 24using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetSqlServerInfraDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetStorageBlobConnectivityDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(
VnetStorageBlobInfraDeploymentTests.cs (3)
22using var cts = new CancellationTokenSource(s_testTimeout); 23using 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 (72)
ApplicationModel\ResourceLoggerService.cs (4)
23private readonly CancellationTokenSource _disposing = new(); 229using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken); 362private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (3)
28private readonly CancellationTokenSource _disposing = new(); 474using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken);
Backchannel\AppHostRpcTarget.cs (7)
22private readonly CancellationTokenSource _shutdownCts = new(); 27using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token); 62using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token); 93using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _shutdownCts.Token);
Backchannel\AuxiliaryBackchannelRpcTarget.cs (6)
250using var timeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(request.TimeoutSeconds)); 251using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); 872using var timeoutCts = new CancellationTokenSource(s_mcpDiscoveryTimeout); 873using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
Dashboard\DashboardEventHandlers.cs (2)
60private CancellationTokenSource? _dashboardLogsCts; 83_dashboardLogsCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping);
Dashboard\DashboardService.cs (4)
67var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 381using var cts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, serverCallContext.CancellationToken);
Dashboard\DashboardServiceData.cs (5)
19private readonly CancellationTokenSource _cts = new(); 133using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token); 150using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token);
Dashboard\ResourcePublisher.cs (2)
60using var linked = CancellationTokenSource.CreateLinkedTokenSource(enumeratorCancellationToken, cancellationToken);
Dcp\DcpExecutor.cs (4)
77private readonly CancellationTokenSource _shutdownCancellation = new(); 91private readonly ConcurrentDictionary<string, (CancellationTokenSource Cancellation, Task Task)> _logStreams = new(); 359var disposeCts = new CancellationTokenSource(); 711var cancellation = new CancellationTokenSource();
Dcp\DcpHost.cs (5)
32private readonly CancellationTokenSource _shutdownCts = new(); 93using var timeoutCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 405var 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\ResourceLogSource.cs (1)
25CancellationTokenSource? ownedCts = null;
Devcontainers\DevcontainerSettingsWriter.cs (1)
34private readonly CancellationTokenSource _processingCancellation = new();
Health\ResourceHealthCheckService.cs (2)
312private readonly CancellationTokenSource _cts; 320_cts = CancellationTokenSource.CreateLinkedTokenSource(serviceStoppingToken);
IInteractionService.cs (2)
116private CancellationTokenSource? _currentCts; 164_currentCts = CancellationTokenSource.CreateLinkedTokenSource(options.CancellationToken);
InteractionService.cs (6)
82using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 156using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 224using var interactionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Orchestrator\ApplicationOrchestrator.cs (3)
36private readonly CancellationTokenSource _shutdownCancellation = new(); 95using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Orchestrator\ParameterProcessor.cs (2)
35private CancellationTokenSource? _allParametersResolvedCts; 75var cts = new CancellationTokenSource();
Pipelines\DistributedApplicationPipeline.cs (2)
593using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken);
Pipelines\PipelineActivityReporter.cs (1)
22private readonly CancellationTokenSource _cancellationTokenSource = new();
Utils\PeriodicRestartAsyncEnumerable.cs (4)
26using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 82using var cts = 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); 96using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 97using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 174using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 175using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 201using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 202using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, TestContext.Current.CancellationToken); 232using var timeout = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 233using 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 (22)
AzureAIFoundryExtensionsTests.cs (1)
72var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureBicepProvisionerTests.cs (1)
55var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 140var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 274var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureDeployerTests.cs (1)
1642using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
AzureEventHubsExtensionsTests.cs (3)
25var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 66var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 118var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
AzureServiceBusExtensionsTests.cs (3)
74var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 117var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 777var 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)
21var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 113var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 156var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 212var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 252var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultUserPrincipalProviderTests.cs (1)
71using var cts = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (1)
DockerSocketBindMountTests.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Aspire.Hosting.DevTunnels (2)
src\Shared\CoalescingAsyncOperation.cs (2)
16private CancellationTokenSource? _cts; 44_cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.DevTunnels.Tests (2)
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.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
21var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 59var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 104var 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 (5)
NodeAppFixture.cs (1)
41using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
24using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 36using 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)
62var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 120var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.MongoDB.Tests (5)
MongoDbFunctionalTests.cs (5)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 70var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 109var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 355var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (13)
MySqlFunctionalTests.cs (11)
30using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 68using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 123using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 304using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 391using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 475using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 549using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 620var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 695var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 771var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 822var 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)
68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 111var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 328var 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)
32var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 81var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 255var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 353var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 446var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (11)
PostgresFunctionalTests.cs (9)
99var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 195var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 364var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 452var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 536var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 595var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 641var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 687var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 765var 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)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 92var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 257var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (3)
RabbitMQFunctionalTests.cs (1)
98var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
32var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 137var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 189var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 449var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 610var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.RemoteHost.Tests (2)
CallbackProxyTests.cs (1)
167using var cts = new CancellationTokenSource();
CancellationTokenRegistryTests.cs (1)
38using var cts = new CancellationTokenSource();
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
24var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 64var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 130var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 342var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 409var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 463var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 540var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (11)
DistributedApplicationFactory.cs (11)
29private readonly CancellationTokenSource _disposingCts = new(); 49using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 59using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 72using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _disposingCts.Token); 426using var cts = new CancellationTokenSource(GetConfiguredTimeout()); 520using var shutdownTimeoutCts = new CancellationTokenSource(_shutdownTimeout); 615using var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, appFactory._disposingCts.Token);
Aspire.Hosting.Testing.Tests (11)
ResourceLoggerForwarderServiceTests.cs (3)
156private readonly CancellationTokenSource _startedCts = new(); 157private readonly CancellationTokenSource _stoppingCts = new(); 158private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
456using var cts = new CancellationTokenSource(timeout); 501using var cts = new CancellationTokenSource(timeout); 522using var cts = new CancellationTokenSource(timeout);
TestingFactoryCrashTests.cs (1)
21using var cts = new CancellationTokenSource(timeout);
tests\Aspire.Hosting.Tests\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)
Aspire.Hosting.Tests (143)
ApplicationModel\McpServerEndpointAnnotationTests.cs (1)
171using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100));
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (1)
383using var cts = new CancellationTokenSource();
Backchannel\AuxiliaryBackchannelTests.cs (1)
418using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
Backchannel\Exec\ExecTestsBase.cs (1)
26var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutSec));
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 65var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceTests.cs (7)
181var cts = new CancellationTokenSource(); 236var cts = new CancellationTokenSource(); 306var cts = new CancellationTokenSource(); 353var cts = new CancellationTokenSource(); 412var cts = new CancellationTokenSource(); 449var cts = new CancellationTokenSource(); 620private static async Task CancelTokenAndAwaitTask(CancellationTokenSource cts, Task task)
Dashboard\ResourcePublisherTests.cs (5)
16CancellationTokenSource cts = new(); 69CancellationTokenSource cts = new(); 116CancellationTokenSource cts = new(); 137CancellationTokenSource cts = new(); 158CancellationTokenSource cts = new();
Dcp\DcpExecutorTests.cs (2)
629var watchCts = new CancellationTokenSource(); 1336var tokenSource = new CancellationTokenSource();
Dcp\DcpHostNotificationTests.cs (9)
90using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 140using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 195using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(100)); 249using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 300using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); 322using (var testTimeoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(5))) 323using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(interaction.CancellationToken, testTimeoutCts.Token)) 367using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
DistributedApplicationTests.cs (16)
69var cts = new CancellationTokenSource(); 114var cts = new CancellationTokenSource(); 140using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 185using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 275using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout); 319using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout); 394using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 473using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.ExtraLongTimeoutDuration); 646var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 1077using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1115using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1560using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 1842using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1857using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout)) 1866using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout)) 1880using (var logCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestTimeout))
EndpointReferenceTests.cs (1)
173using var 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 (1)
50var cts = new CancellationTokenSource();
Publishing\ResourceContainerImageManagerTests.cs (27)
37using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 100using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 137using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 171using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 201using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 237using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 276using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 311using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 343using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 372using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 422using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 451using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 475using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 510using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 541using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 573using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 609using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 656using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 729using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 824using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 876using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1216using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1264using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1297using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 1340using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan); 1373using var cts = new CancellationTokenSource(TestConstants.DefaultTimeoutTimeSpan);
ResourceNotificationTests.cs (10)
69using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 112using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 165using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 222using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 314using var cts = new CancellationTokenSource(); 346using var cts = new CancellationTokenSource(); 507using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 559using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 595using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 734private 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();
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\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);
WithUrlsTests.cs (6)
385using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 412using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 445using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 471using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 589using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 675using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource();
Aspire.Hosting.Valkey.Tests (3)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
206var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
30var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v2.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.EntityFrameworkCore.Tests (1)
ConformanceTests.cs (1)
89using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Playground.Tests (7)
ProjectSpecificTests.cs (1)
157CancellationTokenSource cts = new();
tests\Aspire.Hosting.Tests\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.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-server (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);
BuildActionTelemetryTable (2)
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).
ClientSample (1)
HubSample.cs (1)
56using var closedTokenSource = new CancellationTokenSource();
CodeStyleConfigFileGenerator (2)
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\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CustomResources.AppHost (1)
TestResource.cs (1)
36private readonly CancellationTokenSource _tokenSource = new();
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();
GenerateDocumentationAndConfigFiles (13)
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\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\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;
HelixTestRunner (2)
ProcessUtil.cs (1)
190var cancel = new CancellationTokenSource();
TestRunner.cs (1)
230var cts = new CancellationTokenSource(testProcessTimeout);
http2cat (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
HttpStress (2)
Program.cs (2)
217var cts = new CancellationTokenSource(); 304var cts = new CancellationTokenSource();
IIS.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.LongTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.NewHandler.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.Tests (2)
ClientDisconnectTests.cs (2)
146var cancellationTokenSource = new CancellationTokenSource(); 188var cancellationTokenSource = new CancellationTokenSource();
IISExpress.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
Infrastructure.Common (1)
xunit\WcfTestCase.cs (1)
49ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Infrastructure.Tests (3)
ExtractTestPartitions\ExtractTestPartitionsFixture.cs (1)
38using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
ExtractTestPartitions\ExtractTestPartitionsTests.cs (1)
338using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
PowerShellScripts\PowerShellCommand.cs (1)
57CancellationTokenSource cts = new();
InMemory.FunctionalTests (10)
ConnectionMiddlewareTests.cs (1)
193using (var shutdownCts = new CancellationTokenSource(TestConstants.DefaultTimeout))
EventSourceTests.cs (1)
301using var handshakeCts = new CancellationTokenSource(TestConstants.DefaultTimeout);
Http2\Http2StreamTests.cs (1)
3820var cts = new CancellationTokenSource();
KeepAliveTimeoutTests.cs (2)
141var cts = new CancellationTokenSource(); 211var cts = new CancellationTokenSource();
RequestTests.cs (1)
114var cts = new CancellationTokenSource();
ResponseTests.cs (1)
148var cts = new CancellationTokenSource();
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
1046public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1048public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
TestTransport\InMemoryTransportConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
InProcessWebSite (3)
Startup.cs (1)
1013var cts = new CancellationTokenSource();
Startup.WebSockets.cs (2)
128using var cts = CancellationTokenSource.CreateLinkedTokenSource(appLifetime.ApplicationStopping, context.RequestAborted);
IntegrationTestsWebsite (2)
Infrastructure\DynamicEndpointDataSource.cs (2)
15private CancellationTokenSource? _cts; 55var localCts = _cts;
Interop.FunctionalTests (10)
Http3\Http3RequestTests.cs (6)
486var cts = new CancellationTokenSource(); 732using var cts = new CancellationTokenSource(); 925var cts1 = new CancellationTokenSource(); 1165var cts = new CancellationTokenSource(); 1262var cts = new CancellationTokenSource(); 1410var cts = new CancellationTokenSource();
HttpClientHttp2InteropTests.cs (4)
214using (var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30))) 234using (var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30))) 250using var timer = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 931var requestCancellation = new CancellationTokenSource();
InteropClient (2)
InteropClient.cs (2)
487var cts = new CancellationTokenSource(); 504var cts = new CancellationTokenSource();
InteropTests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Metrics (15)
Program.cs (1)
24using var tokenSource = new CancellationTokenSource();
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Metrics.Legacy (15)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
src\RoslynAnalyzers\Tools\Metrics\Program.cs (1)
24using var tokenSource = new CancellationTokenSource();
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;
Microsoft.Agents.AI.ProjectTemplates.Tests (1)
test\ProjectTemplates\Infrastructure\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.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.Endpoints.Tests (1)
HotReloadServiceTests.cs (1)
154var changeTokenSource = endpointDataSource.ChangeTokenSource;
Microsoft.AspNetCore.Components.QuickGrid (2)
QuickGrid.razor.cs (2)
155private CancellationTokenSource? _pendingDataLoadCancellationTokenSource; 330var 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)
186CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(10)); 236public CancellationTokenSource? CancellationTokenSource { get; set; }
Circuits\RevalidatingServerAuthenticationStateProvider.cs (2)
18private CancellationTokenSource _loopCancellationTokenSource = new CancellationTokenSource(); 34var oldCancellationTokenSource = _loopCancellationTokenSource;
Microsoft.AspNetCore.Components.Server.Tests (3)
Circuits\RemoteJSDataStreamTest.cs (3)
295var cts = new CancellationTokenSource(); 326var cts1 = new CancellationTokenSource(); 327var cts2 = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Tests (3)
ComponentBaseTest.cs (1)
358var cts = new CancellationTokenSource();
OwningComponentBaseTest.cs (1)
200private readonly CancellationTokenSource _cts;
RendererTest.cs (1)
4113var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Web (8)
Forms\InputFile\BrowserFileStream.cs (4)
15private readonly CancellationTokenSource _openReadStreamCts; 20private CancellationTokenSource? _copyFileDataCts; 33_openReadStreamCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 104_copyFileDataCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Media\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.
Virtualization\Virtualize.cs (1)
48private CancellationTokenSource? _refreshCts;
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
DebugProxyLauncher.cs (1)
75using var cts = new CancellationTokenSource(DebugProxyLaunchTimeout);
TargetPickerUi.cs (1)
136var source = new CancellationTokenSource();
Microsoft.AspNetCore.Components.WebAssembly.Tests (7)
Hosting\WebAssemblyHostTest.cs (7)
27var cts = new CancellationTokenSource(); 47var cts = new CancellationTokenSource(); 72var cts = new CancellationTokenSource(); 100var cts = new CancellationTokenSource(); 130var cts = new CancellationTokenSource(); 163var cts = new CancellationTokenSource(); 194var cts = 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.DataProtection.Tests (14)
KeyManagement\CacheableKeyRingTests.cs (2)
23var cts = new CancellationTokenSource(); 38var cts = new CancellationTokenSource();
KeyManagement\KeyRingProviderTests.cs (12)
22var expirationCts = new CancellationTokenSource(); 60var expirationCts = new CancellationTokenSource(); 103var expirationCts1 = new CancellationTokenSource(); 104var expirationCts2 = new CancellationTokenSource(); 194var expirationCts1 = new CancellationTokenSource(); 195var expirationCts2 = new CancellationTokenSource(); 276var expirationCts1 = new CancellationTokenSource(); 277var expirationCts2 = new CancellationTokenSource(); 326var expirationCts = new CancellationTokenSource(); 364var expirationCts = new CancellationTokenSource(); 727var cts = new CancellationTokenSource(); 819var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\RequestLatencyTelemetryMiddleware.cs (2)
28private static readonly ObjectPool<CancellationTokenSource> _cancellationTokenSourcePool = PoolFactory.CreateCancellationTokenSourcePool(); 87var tokenSource = _cancellationTokenSourcePool.Get();
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (1)
JsonTranscodingServerCallContextTests.cs (1)
24var cts = new CancellationTokenSource();
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.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (1)
40using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(timeout);
Internal\HostingEventSourceTests.cs (1)
199using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WebHostTests.cs (3)
171var cts = new CancellationTokenSource(); 225var cts = new CancellationTokenSource(); 300var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http (9)
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)
48private readonly CancellationTokenSource _connectionClosedTokenSource; 49private readonly CancellationTokenSource _connectionCloseRequested; 51private CancellationTokenSource? _sendCts; 119public CancellationTokenSource? Cancellation { get; set; } 215ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 360ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 370ThreadPool.UnsafeQueueUserWorkItem(cts => ((CancellationTokenSource)cts!).Cancel(), _connectionClosedTokenSource); 483var timeoutSource = new CancellationTokenSource(); 484var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(Cancellation.Token, nonClonedContext.RequestAborted, timeoutSource.Token); 534CancellationTokenSource? cts; 694ThreadPool.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.Http.Connections.Tests (9)
ApplicationLifetime.cs (3)
12private readonly CancellationTokenSource _startedSource = new CancellationTokenSource(); 13private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource(); 14private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();
HttpConnectionDispatcherTests.cs (4)
458var cts = new CancellationTokenSource(); 521var cts = new CancellationTokenSource(); 2904private readonly CancellationTokenSource _cts; 3115var cts = new CancellationTokenSource();
LongPollingTests.cs (2)
52using (var cts = CancellationTokenSource.CreateLinkedTokenSource(timeoutToken, context.RequestAborted))
Microsoft.AspNetCore.Http.Microbenchmarks (1)
RequestTimeoutsMiddlewareBenchmark.cs (1)
120var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Results.Tests (1)
ServerSentEventsResultTests.cs (1)
223var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Http.Tests (4)
Timeouts\RequestTimeoutsMiddlewareTests.cs (4)
352public CancellationTokenSource LinkedCts { get; private set; } 362public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan) 368var cts = new CancellationTokenSource();
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.InternalTesting.Tests (4)
TaskExtensionsTest.cs (4)
16var cts = new CancellationTokenSource(); 36var cts = new CancellationTokenSource(); 44var cts = new CancellationTokenSource(); 52var cts = 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 (4)
Infrastructure\DefaultActionDescriptorCollectionProvider.cs (2)
25private CancellationTokenSource? _cancellationTokenSource; 156var oldCancellationTokenSource = _cancellationTokenSource;
Routing\ActionEndpointDataSourceBase.cs (2)
29private CancellationTokenSource? _cancellationTokenSource; 128var oldCancellationTokenSource = _cancellationTokenSource;
Microsoft.AspNetCore.Mvc.Core.Test (8)
Formatters\SystemTextJsonOutputFormatterTest.cs (1)
125var cts = new CancellationTokenSource();
Infrastructure\AsyncEnumerableReaderTest.cs (1)
210var cts = new CancellationTokenSource();
Infrastructure\DefaultActionDescriptorCollectionProviderTest.cs (1)
176public CancellationTokenSource TokenSource { get; private set; }
Infrastructure\JsonResultExecutorTestBase.cs (4)
367var cts = new CancellationTokenSource(); 398var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 452var cts = new CancellationTokenSource();
Routing\ActionEndpointDataSourceBaseTest.cs (1)
79CancellationTokenSource cts = null;
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerOutputFormatterTest.cs (1)
727var cts = new CancellationTokenSource();
XmlSerializerOutputFormatterTest.cs (1)
509var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
ModelBindingTestHelper.cs (1)
210private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (9)
NewtonsoftJsonOutputFormatterTest.cs (3)
443var cts = new CancellationTokenSource(); 488var cts = new CancellationTokenSource(); 522var cts = new CancellationTokenSource();
NewtonsoftJsonResultExecutorTest.cs (1)
37var cts = new CancellationTokenSource();
src\Mvc\Mvc.Core\test\Infrastructure\AsyncEnumerableReaderTest.cs (1)
210var cts = new CancellationTokenSource();
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (4)
367var cts = new CancellationTokenSource(); 398var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 452var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.Razor.Test (3)
RazorViewEngineTest.cs (3)
170var cancellationTokenSource = new CancellationTokenSource(); 905var cancellationTokenSource = new CancellationTokenSource(); 1004var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
src\Mvc\Mvc.Core\test\Routing\ActionEndpointDataSourceBaseTest.cs (1)
79CancellationTokenSource cts = null;
Microsoft.AspNetCore.Mvc.TagHelpers (1)
CacheTagHelper.cs (1)
92var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (1)
CacheTagHelperTest.cs (1)
488var tokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.OpenApi.Tests (5)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (1)
293using var cts = new CancellationTokenSource();
Transformers\DocumentTransformerTests.cs (1)
268using var cts = new CancellationTokenSource();
Transformers\OperationTransformerTests.cs (1)
599using var cts = new CancellationTokenSource();
Transformers\SchemaTransformerTests.cs (2)
131var cts = new CancellationTokenSource(); 884using var cts = new CancellationTokenSource();
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
31private readonly CancellationTokenSource _disposalCancellation = new();
Microsoft.AspNetCore.OutputCaching.Tests (6)
CachedResponseBodyTests.cs (3)
33using var cts = new CancellationTokenSource(_timeout); 57using var cts = new CancellationTokenSource(_timeout); 82using var cts = new CancellationTokenSource(_timeout);
MemoryOutputCacheStoreTests.cs (3)
78using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 184using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 224using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Microsoft.AspNetCore.ResponseCaching.Tests (3)
CachedResponseBodyTests.cs (3)
41using var cts = new CancellationTokenSource(_timeout); 63using var cts = new CancellationTokenSource(_timeout); 87using var cts = new CancellationTokenSource(_timeout);
Microsoft.AspNetCore.Routing (3)
CompositeEndpointDataSource.cs (3)
24private CancellationTokenSource? _cts; 192CancellationTokenSource? oldTokenSource = null; 245var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Routing.Tests (2)
TestObjects\DynamicEndpointDataSource.cs (2)
12private CancellationTokenSource _cts; 36var oldTokenSource = _cts;
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.HttpSys.FunctionalTests (30)
Listener\RequestBodyTests.cs (5)
56var cts = new CancellationTokenSource(); 80var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource(); 129var cts = new CancellationTokenSource(); 154var cts = new CancellationTokenSource();
Listener\ResponseBodyTests.cs (10)
110var cts = new CancellationTokenSource(); 131var cts = new CancellationTokenSource(); 154var cts = new CancellationTokenSource(); 174var cts = new CancellationTokenSource(); 195var cts = new CancellationTokenSource(); 217var cts = new CancellationTokenSource(); 238var cts = new CancellationTokenSource(); 274var cts = new CancellationTokenSource(); 309var cts = new CancellationTokenSource(); 337var cts = new CancellationTokenSource();
ResponseSendFileTests.cs (10)
338var cts = new CancellationTokenSource(); 355var cts = new CancellationTokenSource(); 376var cts = new CancellationTokenSource(); 404var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 459var cts = new CancellationTokenSource(); 496using var cts = new CancellationTokenSource(); 518var cts = new CancellationTokenSource(); 561var cts = new CancellationTokenSource(); 586using var cts = new CancellationTokenSource();
ServerTests.cs (4)
431var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); 465var cts = new CancellationTokenSource(); 501var cts = new CancellationTokenSource(); 537var cts = new CancellationTokenSource();
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.IIS (3)
Core\IISHttpContext.cs (1)
843CancellationTokenSource? 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\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
IISDeployer.cs (1)
26private readonly CancellationTokenSource _hostShutdownToken = new CancellationTokenSource();
IISExpressDeployer.cs (1)
222var hostExitTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Core (8)
Internal\Http\HttpProtocol.cs (2)
49private CancellationTokenSource? _abortedCts; 470CancellationTokenSource? 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\Shared\CancellationTokenSourcePool.cs (1)
38/// A <see cref="CancellationTokenSource"/> with a back pointer to the pool it came from.
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
TlsListenerTests.cs (3)
70var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(3)); 92var cts = new CancellationTokenSource(); 115var cts = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
1046public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1048public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
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.Quic.Tests (1)
QuicConnectionContextTests.cs (1)
92var cts = new CancellationTokenSource();
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.Session.Tests (3)
SessionTests.cs (3)
801var cts = new CancellationTokenSource(); 982var cts = new CancellationTokenSource(); 1046var cts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.Core (21)
HubConnection.cs (15)
674var cts = cancellationToken.CanBeCanceled ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : new CancellationTokenSource(); 680private async IAsyncEnumerable<T> CastIAsyncEnumerable<T>(string methodName, object?[] args, CancellationTokenSource cts) 834var cts = CancellationTokenSource.CreateLinkedTokenSource(connectionState.UploadStreamToken, cancellationToken); 876private void InvokeStreamMethod(MethodInfo methodInfo, Type[] genericTypes, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource) 901private Task ReflectionSendStreamItems(MethodInfo methodInfo, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource) 937private Task SendStreamItems<T>(ConnectionState connectionState, string streamId, ChannelReader<T> reader, CancellationTokenSource tokenSource) 954private Task SendIAsyncEnumerableStreamItems<T>(ConnectionState connectionState, string streamId, IAsyncEnumerable<T> stream, CancellationTokenSource tokenSource) 967private async Task SendStreamItemAsync(ConnectionState connectionState, string streamId, object? item, CancellationTokenSource tokenSource) 973private async Task CommonStreaming(ConnectionState connectionState, string streamId, Func<Task> createAndConsumeStream, CancellationTokenSource cts) 976using var _ = cts; 1511using var handshakeCts = new CancellationTokenSource(HandshakeTimeout); 1609using var uploadStreamSource = new CancellationTokenSource(); 2453public CancellationTokenSource StopCts { get; set; } = new CancellationTokenSource();
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\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (7)
HubConnectionTests.cs (6)
572var cts = new CancellationTokenSource(); 609var cts = new CancellationTokenSource(); 893var cts = new CancellationTokenSource(); 938var cts = new CancellationTokenSource(); 977var cts = new CancellationTokenSource(); 1018var cts = new CancellationTokenSource();
HubConnectionTests.Tracing.cs (1)
402var cts = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Client.Tests (15)
HttpConnectionTests.ConnectionLifecycle.cs (3)
406var cts = new CancellationTokenSource(); 432var cts = new CancellationTokenSource(); 514var cts = new CancellationTokenSource();
HubConnectionTests.ConnectionLifecycle.cs (1)
577var cts = new CancellationTokenSource();
HubConnectionTests.cs (6)
174var cts = new CancellationTokenSource(); 231var cts = new CancellationTokenSource(); 292using var cts = new CancellationTokenSource(); 321using var cts = new CancellationTokenSource(); 553var cts = new CancellationTokenSource(); 585var cts = new CancellationTokenSource();
HubServerProxyGeneratorTests.cs (2)
177var cts = new CancellationTokenSource(); 264var cts = new CancellationTokenSource();
TestHttpMessageHandler.cs (3)
106var deleteCts = new CancellationTokenSource(); 111var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, deleteCts.Token);
Microsoft.AspNetCore.SignalR.Core (16)
HubConnectionContext.cs (4)
30private readonly CancellationTokenSource _connectionAbortedTokenSource = new CancellationTokenSource(); 172internal ConcurrentDictionary<string, CancellationTokenSource> ActiveRequestCancellationSources { get; } = new ConcurrentDictionary<string, CancellationTokenSource>(StringComparer.Ordinal); 500using (var cts = new CancellationTokenSource())
Internal\DefaultHubDispatcher.cs (6)
186if (connection.ActiveRequestCancellationSources.TryGetValue(cancelInvocationMessage.InvocationId!, out var cts)) 363CancellationTokenSource? cts = null; 512IHubActivator<THub> hubActivator, THub hub, CancellationTokenSource? streamCts, HubMethodInvocationMessage hubMethodInvocationMessage, HubMethodDescriptor descriptor) 516streamCts ??= CancellationTokenSource.CreateLinkedTokenSource(connection.ConnectionAborted); 719HubConnectionContext connection, AsyncServiceScope scope, ref object?[] arguments, out CancellationTokenSource? cts) 736cts = CancellationTokenSource.CreateLinkedTokenSource(connection.ConnectionAborted);
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\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
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\SignalR\common\testassets\Tests.Utils\TestClient.cs (1)
31private readonly CancellationTokenSource _cts;
Microsoft.AspNetCore.SignalR.StackExchangeRedis (2)
src\SignalR\common\Shared\CreateLinkedToken.cs (2)
28var cts = CancellationTokenSource.CreateLinkedTokenSource(token1, token2);
Microsoft.AspNetCore.SignalR.Tests (18)
CancellationDisposable.cs (2)
11private readonly CancellationTokenSource _cts; 13public CancellationDisposable(CancellationTokenSource cts)
DefaultHubLifetimeManagerTests.cs (9)
34var cts = new CancellationTokenSource(); 64var cts = new CancellationTokenSource(); 88var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 160var cts = new CancellationTokenSource(); 185var cts = new CancellationTokenSource(); 210var cts = new CancellationTokenSource(); 240var cts = new CancellationTokenSource();
HubConnectionHandlerTests.ClientResult.cs (2)
372var cts = new CancellationTokenSource(); 417var cts = new CancellationTokenSource();
HubConnectionHandlerTests.cs (1)
2263private readonly CancellationTokenSource _cts = new CancellationTokenSource();
Internal\TypedClientBuilderTests.cs (4)
101CancellationTokenSource cts1 = new CancellationTokenSource(); 105CancellationTokenSource cts2 = new CancellationTokenSource(); 249CancellationTokenSource cts1 = new CancellationTokenSource(); 253CancellationTokenSource cts2 = new CancellationTokenSource();
Microsoft.AspNetCore.SignalR.Tests.Utils (2)
src\Shared\SignalR\InProcessTestServer.cs (1)
115var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
TestClient.cs (1)
31private readonly CancellationTokenSource _cts;
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.SpaServices.Extensions.Tests (2)
SpaServicesExtensionsTests.cs (2)
76CancellationTokenSource _applicationStoppingSource; 77CancellationTokenSource _applicationStoppedSource;
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.AspNetCore.TestHost.Tests (5)
ClientHandlerTests.cs (1)
478CancellationTokenSource cts = new CancellationTokenSource();
HttpContextBuilderTests.cs (2)
323var cts = new CancellationTokenSource(); 359var cts = new CancellationTokenSource();
TestClientTests.cs (2)
893var tokenSource = new CancellationTokenSource(); 1078using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(1));
Microsoft.AspNetCore.WebSockets.ConformanceTests (3)
Autobahn\AutobahnTester.cs (2)
37var pingCts = new CancellationTokenSource(); 165}, logger, CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, result.HostShutdownToken).Token);
AutobahnTests.cs (1)
52var cts = new CancellationTokenSource();
Microsoft.AspNetCore.WebSockets.Tests (1)
WebSocketMiddlewareTests.cs (1)
583CancellationTokenSource cts = 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.Framework (2)
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\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
54private CancellationTokenSource? _sharedCompileCts;
src\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
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.CodeAnalysis.Sdk (5)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
54private CancellationTokenSource? _sharedCompileCts;
src\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
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 (7)
CommandLine\CommonCompiler.cs (5)
961out CancellationTokenSource? analyzerCts, 1094out CancellationTokenSource? analyzerCts, 1511(CancellationTokenSource, DiagnosticBag, AnalyzerDriver) initializeAnalyzerDriver(AnalyzerOptions analyzerOptions, ref Compilation compilation) 1513var analyzerCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
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 (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.AnalyzerUtilities (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.BannedApiAnalyzers (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.CodeStyle (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.Collections.Package (2)
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.Contracts.Package (2)
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.CSharp (1)
CommandLine\CSharpCommandLineParser.cs (1)
298using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
45private readonly CancellationTokenSource _cancellationTokenSource;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
4249var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (6)
InteractiveSessionTests.cs (6)
2027var cancellationSource = new CancellationTokenSource(); 2029var globals = new StrongBox<CancellationTokenSource>(); 2061var cancellationSource = new CancellationTokenSource(); 2063var globals = new StrongBox<CancellationTokenSource>(); 2095var cancellationSource = new CancellationTokenSource(); 2097var globals = new StrongBox<CancellationTokenSource>();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\GeneratorDriverTests.cs (2)
748CancellationTokenSource cts = new CancellationTokenSource(); 2597CancellationTokenSource cts = new CancellationTokenSource();
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
1986CancellationTokenSource cts = new CancellationTokenSource(); 2012CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.Debugging.Package (2)
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.EditorFeatures (28)
AutomaticCompletion\BraceCompletionSessionProvider.cs (1)
107var cancellationTokenSource = new CancellationTokenSource();
BackgroundWorkIndicator\BackgroundWorkIndicatorContext.cs (2)
27private readonly CancellationTokenSource _cancellationTokenSource; 67_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_backgroundWorkIndicator.CancellationToken);
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
48private readonly CancellationTokenSource _disposalCancellationSource = new();
EditAndContinue\ActiveStatementTrackingService.cs (1)
103private readonly CancellationTokenSource _cancellationSource = new();
GoOrFind\AbstractGoOrFindNavigationService.cs (4)
62private CancellationTokenSource _cancellationTokenSource = new(); 112CancellationTokenSource cancellationTokenSource) 147CancellationTokenSource cancellationTokenSource) 221CancellationTokenSource cancellationTokenSource)
InlineRename\InlineRenameSession.cs (2)
110private readonly CancellationTokenSource _cancellationTokenSource = new(); 121private CancellationTokenSource _conflictResolutionTaskCancellationSource = new();
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (1)
46private CancellationTokenSource _cancellationTokenSource = new();
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (2)
137var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
IntelliSense\ModelComputation.cs (1)
38private readonly CancellationTokenSource _stopTokenSource;
Interactive\InteractiveSession.cs (1)
40private readonly CancellationTokenSource _shutdownCancellationSource;
NavigateTo\NavigateToItemProvider.cs (1)
26private CancellationTokenSource _cancellationTokenSource = new();
NavigationBar\NavigationBarController.cs (1)
64private readonly CancellationTokenSource _cancellationTokenSource = new();
NavigationBar\NavigationBarController_ModelComputation.cs (2)
48using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(lastNonFrozenComputationToken, cancellationToken);
QuickInfo\OnTheFlyDocsView.xaml.cs (1)
49private readonly CancellationTokenSource _cancellationTokenSource = new();
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
43private readonly CancellationTokenSource _cancellationTokenSource = new();
Shared\Utilities\ThreadingContext.cs (1)
28private readonly CancellationTokenSource _disposalTokenSource = new();
Suggestions\SuggestedActionsSource.cs (2)
160using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Tagging\AbstractAsynchronousTaggerProvider.TagSource.cs (1)
102private readonly CancellationTokenSource _disposalTokenSource = new();
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (2)
215using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(lastNonFrozenComputationToken, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (7)
Threading\WpfTestCase.cs (1)
29public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Threading\WpfTestCaseRunner.cs (2)
29CancellationTokenSource cancellationTokenSource) 35protected override XunitTestRunner CreateTestRunner(ITest test, IMessageBus messageBus, Type testClass, object[] constructorArguments, MethodInfo testMethod, object[] testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Threading\WpfTestRunner.cs (1)
49CancellationTokenSource cancellationTokenSource)
Threading\WpfTheoryTestCase.cs (1)
29public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Threading\WpfTheoryTestCaseRunner.cs (2)
29CancellationTokenSource cancellationTokenSource) 35protected 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.CodeAnalysis.EditorFeatures.UnitTests (1)
Utilities\AsynchronousOperationListenerTests.cs (1)
26private readonly CancellationTokenSource _tokenSource;
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (2)
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.ExpressionEvaluator.ResultProvider.Utilities (2)
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.Extensions.Package (2)
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.ExternalAccess.Copilot (3)
Internal\SemanticSearch\CopilotSemanticSearchQueryExecutor.cs (3)
26private sealed class ResultsObserver(CancellationTokenSource cancellationSource, int resultCountLimit) : ISemanticSearchResultsDefinitionObserver 81using var cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (1)
Cohost\RazorStartupServiceFactory.cs (1)
36private readonly CancellationTokenSource _disposalTokenSource = new();
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.InteractiveHost (15)
Interactive\Core\InteractiveHost.LazyRemoteService.cs (1)
24private readonly CancellationTokenSource _cancellationSource;
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.LanguageServer (3)
BrokeredServices\ServiceBrokerFactory.cs (1)
34private readonly CancellationTokenSource _cancellationTokenSource = new();
HostWorkspace\FileWatching\LspFileChangeWatcher.cs (1)
206private readonly CancellationTokenSource _cancellationTokenSource;
Program.cs (1)
81using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.LanguageServer.Protocol (15)
Handler\AbstractRefreshQueue.cs (1)
30private readonly CancellationTokenSource _disposalTokenSource;
Handler\SourceGenerators\SourceGeneratorRefreshQueue.cs (1)
26private readonly CancellationTokenSource _disposalTokenSource = new();
Handler\WorkDoneProgress\WorkDoneProgressManager.cs (2)
100private readonly CancellationTokenSource _cancellationTokenSource; 109_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(serverCancellationToken);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (11)
69private readonly CancellationTokenSource _cancelSource = new(); 195var concurrentlyExecutingTasks = new ConcurrentDictionary<Task, CancellationTokenSource>(); 216CancellationTokenSource? currentWorkCts = null; 223currentWorkCts = CancellationTokenSource.CreateLinkedTokenSource(CancellationToken, cancellationToken); 306/// Reflection invokes <see cref="ProcessQueueCoreAsync{TRequest, TResponse}(QueueItem{TRequestContext}, IMethodHandler, RequestHandlerMetadata, ConcurrentDictionary{Task, CancellationTokenSource}, CancellationTokenSource?, CancellationToken)"/> 314ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 315CancellationTokenSource? currentWorkCts, 336ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 337CancellationTokenSource? currentWorkCts, 397if (!concurrentlyExecutingTasks.TryRemove(t, out var concurrentlyExecutingTaskCts))
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Ordering\RequestOrderingTests.cs (1)
142using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Utilities\AbstractLanguageServerClientTests.TestLspClient.cs (1)
55using var cts = new CancellationTokenSource(TimeOutMsNewProcess);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.PooledObjects.Package (2)
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.PublicApiAnalyzers (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Host\RemoteWorkspace.InFlightSolution.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource_doNotAccessDirectly = new();
Services\ProcessTelemetry\RemoteProcessTelemetryService.cs (1)
31private readonly CancellationTokenSource _shutdownCancellationSource = new();
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
57private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.CodeAnalysis.Remote.Workspaces (2)
CancellationTokenSourceExtensions.cs (2)
19public static void CancelOnAbnormalCompletion(this CancellationTokenSource cancellationTokenSource, Task task) 29((CancellationTokenSource)state!).Cancel();
Microsoft.CodeAnalysis.ResxSourceGenerator (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
2220public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource(); 2679private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); 2914private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.CodeAnalysis.Threading.Package (8)
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\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.UnitTests (3)
AsyncQueueTests.cs (3)
166var cts = new CancellationTokenSource(); 178var cts = new CancellationTokenSource(); 195var cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces (26)
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (1)
33private readonly CancellationTokenSource _tokenSource = new();
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\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\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\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;
Storage\SQLite\v2\SQLitePersistentStorage.cs (1)
31private readonly CancellationTokenSource _shutdownTokenSource = new();
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
141private readonly CancellationTokenSource _asynchronousFileChangeProcessingCancellationTokenSource = new();
Workspace\Workspace.cs (1)
44private readonly CancellationTokenSource _workQueueTokenSource = new();
Workspace\Workspace_SourceGeneration.cs (1)
29private readonly CancellationTokenSource _updateSourceGeneratorsQueueTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
Rpc\RpcClient.cs (1)
38private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Rpc\RpcServer.cs (1)
35private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (2)
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.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (1)
213var tokenSource = new CancellationTokenSource();
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
35private readonly CancellationTokenSource _shutdownTokenSource = new();
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
MEF\UseExportProviderAttribute.cs (1)
125using (var timeoutTokenSource = new CancellationTokenSource(CleanupTimeout))
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
UtilityTest\AsyncLazyTests.cs (6)
40var requestCancellationTokenSource = new CancellationTokenSource(); 174var cancellationTokenSource = new CancellationTokenSource(); 197var cancellationTokenSource = new CancellationTokenSource(); 227var requestCancellationTokenSource = new CancellationTokenSource(); 334var cancellationTokenSource = new CancellationTokenSource(); 369var asynchronousRequestCancellationToken = new CancellationTokenSource();
UtilityTest\CancellationSeriesTests.cs (4)
63var cts = new CancellationTokenSource(); 76var cts = new CancellationTokenSource(); 89var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource();
Microsoft.CommonLanguageServerProtocol.Framework.Example (2)
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.CommonLanguageServerProtocol.Framework.Package (13)
RequestExecutionQueue.cs (11)
69private readonly CancellationTokenSource _cancelSource = new(); 195var concurrentlyExecutingTasks = new ConcurrentDictionary<Task, CancellationTokenSource>(); 216CancellationTokenSource? currentWorkCts = null; 223currentWorkCts = CancellationTokenSource.CreateLinkedTokenSource(CancellationToken, cancellationToken); 306/// Reflection invokes <see cref="ProcessQueueCoreAsync{TRequest, TResponse}(QueueItem{TRequestContext}, IMethodHandler, RequestHandlerMetadata, ConcurrentDictionary{Task, CancellationTokenSource}, CancellationTokenSource?, CancellationToken)"/> 314ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 315CancellationTokenSource? currentWorkCts, 336ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 337CancellationTokenSource? currentWorkCts, 397if (!concurrentlyExecutingTasks.TryRemove(t, out var concurrentlyExecutingTaskCts))
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.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
41private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
Microsoft.DotNet.ArcadeAzureIntegration (1)
AzureCliCredentialWithAzNoUpdateWrapper.cs (1)
94using var tokenSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Feed (6)
src\BlobFeedAction.cs (1)
24private static readonly CancellationTokenSource TokenSource = new CancellationTokenSource();
src\common\UploadToAzure.cs (2)
18private static readonly CancellationTokenSource TokenSource = new CancellationTokenSource(); 117CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(UploadTimeoutInMinutes));
src\PublishArtifactsInManifestBase.cs (2)
996using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(TimeoutInMinutes)); 1030CancellationTokenSource timeoutTokenSource =
src\PublishBuildToMaestro.cs (1)
55private readonly CancellationTokenSource _tokenSource = new CancellationTokenSource();
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ExecWithRetries.cs (1)
52private CancellationTokenSource _cancelTokenSource = new CancellationTokenSource();
Microsoft.DotNet.Helix.Sdk (2)
DownloadFromResultsContainer.cs (1)
31private readonly CancellationTokenSource _cancellationSource = new CancellationTokenSource();
HelixTask.cs (1)
15private readonly CancellationTokenSource _cancel = new CancellationTokenSource();
Microsoft.DotNet.Internal.SymbolHelper (2)
SymbolUploadHelper.cs (2)
440using CancellationTokenSource lcts = CancellationTokenSource.CreateLinkedTokenSource(ct);
Microsoft.DotNet.XUnitExtensions (4)
src\Microsoft.DotNet.XUnitExtensions.Shared\SkippedFactTestCase.cs (1)
58CancellationTokenSource cancellationTokenSource)
src\Microsoft.DotNet.XUnitExtensions.Shared\SkippedTheoryTestCase.cs (1)
29CancellationTokenSource cancellationTokenSource)
src\Microsoft.DotNet.XUnitExtensions.Shared\XunitParallelTheoryTestCase.cs (1)
29public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\Microsoft.DotNet.XUnitExtensions.Shared\XunitParallelTheoryTestCaseRunner.cs (1)
47CancellationTokenSource cancellationTokenSource)
Microsoft.DotNet.XUnitV3Extensions (1)
src\Microsoft.DotNet.XUnitExtensions.Shared\SkippedFactTestCase.cs (1)
52public async ValueTask<RunSummary> Run(ExplicitOption explicitOption, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Microsoft.Extensions.AI.Abstractions.Tests (12)
ChatCompletion\ChatClientExtensionsTests.cs (4)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource(); 176using var cts = new CancellationTokenSource(); 216using var cts = new CancellationTokenSource();
Contents\DataContentTests.cs (3)
772using CancellationTokenSource cts = new(); 794using CancellationTokenSource cts = new(); 821using 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();
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAISpeechToTextClientTests.cs (2)
108using var cancellationTokenSource = new CancellationTokenSource(); 122using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
test\ProjectTemplates\Infrastructure\TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (25)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (4)
960using CancellationTokenSource cts = new(); 1036using CancellationTokenSource cts = new(); 1238using CancellationTokenSource cts = new(); 1326using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
2198using CancellationTokenSource cts = new(); 2268using 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();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
193using var cts = new CancellationTokenSource(); 745using CancellationTokenSource cts = new(); 768using CancellationTokenSource cts = new(); 791using CancellationTokenSource cts = new(); 814using CancellationTokenSource cts = new(); 837using CancellationTokenSource cts = new(); 860using CancellationTokenSource cts = new(); 883using CancellationTokenSource cts = new(); 906using CancellationTokenSource cts = new();
Image\ConfigureOptionsImageGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (1)
40using CancellationTokenSource cts = new();
Microsoft.Extensions.ApiDescription.Client.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Microsoft.Extensions.AsyncState (5)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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) 262var cancels = new CancellationTokenSource[callerCount]; 333using CancellationTokenSource? cts = withCancelation ? new() : null; 373using var cts = withCancelation ? new CancellationTokenSource() : null; 417using CancellationTokenSource? cts = withCancelation ? new() : null;
Microsoft.Extensions.Compliance.Abstractions (5)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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.Configuration.KeyPerFile.Tests (1)
KeyPerFileTests.cs (1)
220using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(250)))
Microsoft.Extensions.DataIngestion.Tests (2)
Readers\DocumentReaderConformanceTests.cs (2)
39using CancellationTokenSource cts = new(); 57using CancellationTokenSource cts = new();
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)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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.HealthChecks.Tests (2)
DefaultHealthCheckServiceTest.cs (2)
261var cancel = new CancellationTokenSource(); 575using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)))
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
TcpEndpointProbesServiceTests.cs (1)
23using var cts = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (5)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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)
254using var cancellationTokenSource = new CancellationTokenSource(timeout, _timeProvider);
Microsoft.Extensions.Diagnostics.Testing.Tests (2)
Logging\FakeLogCollectorTests.LogEnumeration.cs (1)
33using var cts = new CancellationTokenSource();
Metrics\MetricCollectorTests.cs (1)
283using var cts = new CancellationTokenSource();
Microsoft.Extensions.FileProviders.Physical (13)
IPollingChangeToken.cs (1)
11CancellationTokenSource? CancellationTokenSource { get; }
PhysicalFilesWatcher.cs (6)
25private static readonly Action<object?> _cancelTokenSource = state => ((CancellationTokenSource?)state)!.Cancel(); 170var cancellationTokenSource = new CancellationTokenSource(); 205var cancellationTokenSource = new CancellationTokenSource(); 497CancellationTokenSource tokenSource, 504CancellationTokenSource tokenSource, 513public CancellationTokenSource TokenSource { get; }
PollingFileChangeToken.cs (3)
27private CancellationTokenSource? _tokenSource; 62internal CancellationTokenSource? CancellationTokenSource 74CancellationTokenSource? 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)
76using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _applicationLifetime.ApplicationStopping)) 220CancellationTokenSource? cts = null; 223cts = 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)
61using var tokenSource = new CancellationTokenSource(); 79var cancellationTokenSource = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1)); 120using var tokenSource = new CancellationTokenSource(); 139var 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.Polly.Tests (1)
PolicyHttpMessageHandlerTest.cs (1)
394using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)))
Microsoft.Extensions.Http.Resilience (5)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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)
124private CancellationTokenSource? _cancellationTokenSource; 391CancellationTokenSource cts = LazyInitializer.EnsureInitialized(ref _cancellationTokenSource, () => new CancellationTokenSource()); 398CancellationTokenSource? 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.ObjectPool.Tests (1)
ThreadingTest.cs (1)
11private CancellationTokenSource _cts = default!;
Microsoft.Extensions.Primitives (1)
CompositeChangeToken.cs (1)
20private 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(); 466(CancellationTokenSource cts, bool disposeTokenSource, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 862private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 874CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 880CancellationTokenSource 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)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (3)
14internal sealed class PooledCancellationTokenSourcePolicy : PooledObjectPolicy<CancellationTokenSource> 22public override CancellationTokenSource Create() => new(); 24public override bool Return(CancellationTokenSource obj)
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)
115using 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.JSInterop.Tests (4)
Infrastructure\DotNetDispatcherTest.cs (2)
323var cts = new CancellationTokenSource(); 387var cts = new CancellationTokenSource();
JSRuntimeTest.cs (2)
73using var cts = new CancellationTokenSource(); 89using var cts = new CancellationTokenSource();
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.McpServer.ProjectTemplates.Tests (1)
test\ProjectTemplates\Infrastructure\TestCommand.cs (1)
88using var timeoutCts = 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.TestUtilities (2)
XUnit\SkippedFactTestCase.cs (1)
30CancellationTokenSource cancellationTokenSource)
XUnit\SkippedTheoryTestCase.cs (1)
37CancellationTokenSource cancellationTokenSource)
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
58CancellationTokenSource tokenSource = new();
Microsoft.VisualStudio.Extensibility.Testing.Xunit (18)
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\VisualStudio\IntegrationTest\Harness\XUnitShared\Harness\IdeTestAssemblyRunner.cs (4)
48protected override async Task<RunSummary> RunTestCollectionAsync(IMessageBus messageBus, ITestCollection testCollection, IEnumerable<IXunitTestCase> testCases, CancellationTokenSource cancellationTokenSource) 155protected virtual Task<RunSummary> RunTestCollectionForVersionAsync(VisualStudioInstanceFactory visualStudioInstanceFactory, int currentAttempt, VisualStudioInstanceKey visualStudioInstanceKey, HashSet<string> completedTestCaseIds, IMessageBus messageBus, ITestCollection testCollection, IEnumerable<IXunitTestCase> testCases, CancellationTokenSource cancellationTokenSource) 234private async Task<RunSummary> RunTestCollectionForUnspecifiedVersionAsync(HashSet<string> completedTestCaseIds, IEnumerable<IXunitTestCase> testCases, CancellationTokenSource cancellationTokenSource) 250private Func<Task<RunSummary>> CreateTestCollectionInvoker(VisualStudioInstanceFactory visualStudioInstanceFactory, int currentAttempt, VisualStudioInstanceKey visualStudioInstanceKey, HashSet<string> completedTestCaseIds, IMessageBus messageBus, IEnumerable<IXunitTestCase> testCases, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Harness\InProcessIdeTestAssemblyRunner.cs (1)
44using (var cancellationTokenSource = new CancellationTokenSource())
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Harness\VisualStudioInstanceFactory.cs (1)
459using var cancellatokenSource = new CancellationTokenSource();
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\ErrorReportingIdeTestRunner.cs (1)
19public ErrorReportingIdeTestRunner(Exception exception, ITest test, IMessageBus messageBus, Type testClass, object?[] constructorArguments, MethodInfo testMethod, object?[]? testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\IdeInstanceTestCase.cs (1)
56public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\IdeTestCase.cs (1)
28public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\IdeTestCaseRunner.cs (2)
28CancellationTokenSource cancellationTokenSource) 45protected override XunitTestRunner CreateTestRunner(ITest test, IMessageBus messageBus, Type testClass, object?[] constructorArguments, MethodInfo testMethod, object?[]? testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\IdeTheoryTestCase.cs (1)
28public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\IdeTheoryTestCaseRunner.cs (2)
28CancellationTokenSource cancellationTokenSource) 45protected override XunitTestRunner CreateTestRunner(ITest test, IMessageBus messageBus, Type testClass, object[] constructorArguments, MethodInfo testMethod, object[] testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\InProcessIdeTestInvoker.cs (1)
21public InProcessIdeTestInvoker(ITest test, IMessageBus messageBus, Type testClass, object[] constructorArguments, MethodInfo testMethod, object[] testMethodArguments, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
src\VisualStudio\IntegrationTest\Harness\XUnitShared\Threading\InProcessIdeTestRunner.cs (1)
21public InProcessIdeTestRunner(ITest test, IMessageBus messageBus, Type testClass, object?[] constructorArguments, MethodInfo testMethod, object?[]? testMethodArguments, string skipReason, IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
Microsoft.VisualStudio.IntegrationTest.Setup (1)
AsyncCompletionTracker.cs (1)
47var cancellationSource = new CancellationTokenSource();
Microsoft.VisualStudio.LanguageServices (9)
CallHierarchy\Finders\AbstractCallFinder.cs (1)
23private readonly CancellationTokenSource _cancellationSource = new();
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (1)
57public readonly CancellationTokenSource CancellationTokenSource = new();
KeybindingReset\KeybindingResetDetector.cs (1)
75private CancellationTokenSource _cancellationTokenSource = new();
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
106using var cancellationTokenSource = new CancellationTokenSource();
PdbSourceDocument\PdbSourceDocumentOutputWindowLogger.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource = new();
ProjectSystem\RuleSets\VisualStudioRuleSetManager.RuleSetFile.cs (1)
23private readonly CancellationTokenSource _disposalCancellationSource;
PullMemberUp\VisualStudioPullMemberUpService.cs (1)
57using var cancellationTokenSource = new CancellationTokenSource();
Remote\VisualStudioWorkspaceServiceHubConnector.cs (1)
28private readonly CancellationTokenSource _disposalCancellationSource = new();
Workspace\SourceGeneratedFileManager.cs (1)
271private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.VisualStudio.LanguageServices.CodeLens (1)
ReferenceCodeLensProvider.cs (1)
48private readonly CancellationTokenSource _cancellationTokenSource = new();
Microsoft.VisualStudio.LanguageServices.CSharp (6)
SemanticSearch\SemanticSearchPresenterController.cs (2)
38using var queryCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(presenterCancellationToken, cancellationToken);
SemanticSearch\SemanticSearchToolWindowImpl.cs (4)
88private volatile CancellationTokenSource? _pendingExecutionCancellationSource; 379var pendingExecutionCancellationSource = Interlocked.Exchange(ref _pendingExecutionCancellationSource, null); 395var cancellationSource = new CancellationTokenSource(); 491var source = Interlocked.Exchange(ref cancellationSource, null);
Microsoft.VisualStudio.LanguageServices.Implementation (2)
SolutionExplorer\AnalyzerItem\AnalyzerItemSource.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource = new();
SolutionExplorer\DiagnosticItem\BaseDiagnosticAndGeneratorItemSource.cs (1)
31private readonly CancellationTokenSource _cancellationTokenSource = new();
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1123[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
Nats.Backend (1)
Program.cs (1)
22private readonly CancellationTokenSource _cts = new();
netstandard (1)
netstandard.cs (1)
2072[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
RazorBuildWebSite (3)
UpdateableFileProvider.cs (3)
13public CancellationTokenSource _pagesTokenSource = new CancellationTokenSource(); 50var oldToken = _pagesTokenSource; 97public CancellationTokenSource TokenSource { get; } = new CancellationTokenSource();
Replay (4)
src\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
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).
Roslyn.Diagnostics.Analyzers (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
Roslyn.VisualStudio.DiagnosticsWindow (1)
OptionPages\ForceLowMemoryMode.cs (1)
61private readonly CancellationTokenSource _cancellationTokenSource = new();
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (2)
150var cancellationTokenSource = new CancellationTokenSource(); 201var cancellationTokenSource = new CancellationTokenSource();
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
111var source = new CancellationTokenSource();
RunTests (3)
Program.cs (3)
57using var cts = new CancellationTokenSource(); 93using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
SemanticSearch.BuildTask (2)
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).
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();
Sockets.FunctionalTests (1)
src\Servers\Kestrel\test\FunctionalTests\Http2\ShutdownTests.cs (1)
202var cts = new CancellationTokenSource();
Stress.AppHost (1)
TestResource.cs (1)
55private 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.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionFactory.cs (1)
48CancellationTokenSource 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)
35private readonly CancellationTokenSource _cts;
System\Diagnostics\ProcessWaitState.Unix.cs (1)
421CancellationTokenSource? cts = null;
System.IO.Pipelines (9)
System\IO\Pipelines\StreamPipeReader.cs (7)
17private CancellationTokenSource? _internalTokenSource; 73private CancellationTokenSource InternalTokenSource 224CancellationTokenSource tokenSource = InternalTokenSource; 241static async ValueTask<ReadResult> Core(StreamPipeReader reader, int? minimumSize, CancellationTokenSource tokenSource, CancellationToken cancellationToken) 313CancellationTokenSource tokenSource = InternalTokenSource; 384CancellationTokenSource tokenSource = InternalTokenSource; 462private 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 (37)
System\Net\Http\HttpClient.cs (22)
27private CancellationTokenSource _pendingRequestsCts; 183(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 255(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 329(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 472(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 521(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 527CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 589private void HandleFailure(Exception e, bool telemetryStarted, HttpResponseMessage? response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) 650private static void FinishSend(HttpResponseMessage? response, CancellationTokenSource cts, bool disposeCts, bool telemetryStarted, bool responseContentTelemetryStarted) 693CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingRequestsCts, new CancellationTokenSource()); 793private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 805CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 810CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, pendingRequestsCts.Token);
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (1)
472CancellationTokenSource? cts = null;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
810private CancellationTokenSource GetConnectTimeoutCancellationTokenSource<T>(HttpConnectionWaiter<T> waiter) 813var 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)
184CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (2)
54private CancellationTokenSource? _altSvcBlocklistTimerCancellation; 260CancellationTokenSource 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.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.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\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.Net.WebSockets.Client (4)
System\Net\WebSockets\WebSocketHandle.Managed.cs (4)
25private readonly CancellationTokenSource _abortSource = new CancellationTokenSource(); 111CancellationTokenSource? linkedCancellation; 112CancellationTokenSource externalAndAbortCancellation; 117CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _abortSource.Token);
System.Private.CoreLib (100)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs (1)
29private CancellationTokenSource? m_dispatchTaskCancellationSource;
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
1686using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ctEnumerable, ctEnumerator);
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\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\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\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5772/// The <see cref="CancellationTokenSource"/> associated 5820/// The <see cref="CancellationTokenSource"/> associated
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net11.0\System.Runtime.Forwards.cs (1)
815[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.CancellationTokenSource))]
System.Security.Cryptography (1)
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.Forms.Tests (8)
System\Windows\Forms\ControlTests_InvokeAsync.cs (7)
235using var cts = new CancellationTokenSource(); 249using var cts = new CancellationTokenSource(); 271using var cts = new CancellationTokenSource(); 285using var cts = new CancellationTokenSource(); 301using var cts = new CancellationTokenSource(); 327using var cts = new CancellationTokenSource(); 359using var cts = new CancellationTokenSource();
System\Windows\Forms\ToolStripTests.cs (1)
7312using CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
Templates.Blazor.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Templates.Blazor.WebAssembly.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Templates.Mvc.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Templates.Tests (2)
src\Shared\Process\ProcessEx.cs (2)
32private readonly CancellationTokenSource _stdoutLinesCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 33private readonly CancellationTokenSource _processTimeoutCts;
Test.Utilities (13)
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\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\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;
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();
Text.Analyzers (14)
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\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\Dependencies\Threading\ParallelExtensions.NetFramework.cs (1)
415public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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;
vbc (2)
src\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
VBCSCompiler (7)
src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
52var cancellationTokenSource = new CancellationTokenSource();
src\Compilers\Server\VBCSCompiler\ClientConnectionHandler.cs (2)
116var buildCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnection.cs (1)
20private CancellationTokenSource DisconnectCancellationTokenSource { get; } = new CancellationTokenSource();
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (1)
33private CancellationTokenSource? _cancellationTokenSource;
src\Compilers\Shared\BuildServerConnection.cs (2)
301var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
VBCSCompiler.UnitTests (4)
BuildClientTests.cs (1)
149var cts = new CancellationTokenSource();
ServerUtil.cs (3)
60internal CancellationTokenSource CancellationTokenSource { get; } 65private ServerData(CancellationTokenSource cancellationTokenSource, string pipeName, ICompilerServerLogger logger, Task<TestableDiagnosticListener> serverTask) 92var cts = new CancellationTokenSource();
Wasm.Performance.Driver (1)
Program.cs (1)
94using var runCancellationToken = new CancellationTokenSource(timeForEachRun);
Xunit.NetCore.Extensions (4)
AssemblyFixtureSupport\XunitTestAssemblyRunnerWithAssemblyFixture.cs (1)
66CancellationTokenSource cancellationTokenSource)
AssemblyFixtureSupport\XunitTestClassRunnerWithAssemblyFixture.cs (1)
25CancellationTokenSource cancellationTokenSource, IDictionary<Type, object> collectionFixtureMappings)
AssemblyFixtureSupport\XunitTestCollectionRunnerWithAssemblyFixture.cs (1)
29CancellationTokenSource cancellationTokenSource)
AssemblyFixtureSupport\XunitTestMethodRunnerWithAssemblyFixture.cs (1)
28CancellationTokenSource cancellationTokenSource,