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)
898private sealed class Linked1CancellationTokenSource : CancellationTokenSource 919private sealed class Linked2CancellationTokenSource : CancellationTokenSource 943private sealed class LinkedNCancellationTokenSource : CancellationTokenSource
883 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 (1)
Commands\BaseCommand.cs (1)
32var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Cli.Tests (2)
Commands\RunCommandTests.cs (2)
223using var cts = new CancellationTokenSource(); 277using var cts = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (14)
Components\Controls\ApplicationName.razor.cs (1)
33_disposalCts = new CancellationTokenSource();
Components\Controls\Chart\ChartBase.cs (1)
23private readonly CancellationTokenSource _cts = new();
Components\Controls\SpanDetails.razor.cs (1)
67private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
35private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
25private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (2)
33private readonly CancellationTokenSource _cts = new(); 101private readonly CancellationTokenSource _resourceSubscriptionCts = new();
Components\Pages\Resources.razor.cs (1)
97private readonly CancellationTokenSource _watchTaskCancellationTokenSource = new();
Model\DashboardCommandExecutor.cs (1)
133closeToastCts = new CancellationTokenSource();
Model\MetricsHelpers.cs (1)
31using var cts = new CancellationTokenSource();
Model\ResourceOutgoingPeerResolver.cs (1)
16private readonly CancellationTokenSource _watchContainersTokenSource = new();
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 (8)
ChannelExtensionsTests.cs (4)
18var cts = new CancellationTokenSource(); 42var cts = new CancellationTokenSource(); 66var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource();
Model\DashboardClientTests.cs (3)
47var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 158var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.EndToEnd.Tests (2)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
357CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Hosting (10)
ApplicationModel\ResourceLoggerService.cs (1)
345private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (1)
27private readonly CancellationTokenSource _disposing = new();
Backchannel\BackchannelLoggerProvider.cs (1)
15private readonly CancellationTokenSource _backgroundChannelRegistrationCts = new();
Dashboard\DashboardServiceData.cs (1)
19private readonly CancellationTokenSource _cts = new();
Dcp\DcpExecutor.cs (3)
56private readonly CancellationTokenSource _shutdownCancellation = new(); 214var disposeCts = new CancellationTokenSource(); 508var cancellation = new CancellationTokenSource();
Dcp\DcpHost.cs (1)
28private readonly CancellationTokenSource _shutdownCts = new();
Orchestrator\ApplicationOrchestrator.cs (1)
27private readonly CancellationTokenSource _shutdownCancellation = new();
Publishing\PublishingActivityProgressReporter.cs (1)
361private readonly CancellationTokenSource _cancellationTokenSource = new();
Aspire.Hosting.Azure.Tests (18)
AzureAIFoundryExtensionsTests.cs (1)
71var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureBicepProvisionerTests.cs (1)
50var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 139var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 272var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
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)
73var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 116var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 776var 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 (3)
20var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 69var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 148var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultUserPrincipalProviderTests.cs (1)
71using var cts = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (1)
DockerSocketBindMountTests.cs (1)
39using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Aspire.Hosting.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
22var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 60var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 104var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Kafka.Tests (3)
KafkaFunctionalTests.cs (2)
61var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 117var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.MongoDB.Tests (5)
MongoDbFunctionalTests.cs (5)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 71var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 109var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 253var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 351var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (12)
MySqlFunctionalTests.cs (11)
31using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 123using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 300using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 387using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 471using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 544using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 615var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 689var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 764var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 814var 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)); 110var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 324var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.NodeJs.Tests (4)
NodeAppFixture.cs (1)
43using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
26using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 39using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration);
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Oracle.Tests (5)
OracleFunctionalTests.cs (5)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 81var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 251var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 349var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 442var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (10)
PostgresFunctionalTests.cs (9)
100var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 196var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 363var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 451var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 535var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 594var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 639var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 684var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 761var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Qdrant.Tests (3)
QdrantFunctionalTests.cs (3)
28var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 92var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 255var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (2)
RabbitMQFunctionalTests.cs (1)
99var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 131var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 183var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 438var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 599var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
25var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 65var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 130var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 338var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 404var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 457var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 533var 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)
138private readonly CancellationTokenSource _startedCts = new(); 139private readonly CancellationTokenSource _stoppingCts = new(); 140private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
445using var cts = new CancellationTokenSource(timeout); 490using var cts = new CancellationTokenSource(timeout); 511using var cts = new CancellationTokenSource(timeout);
TestingFactoryCrashTests.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Hosting.Tests (31)
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 66var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceTests.cs (4)
180var cts = new CancellationTokenSource(); 234var cts = new CancellationTokenSource(); 303var cts = new CancellationTokenSource(); 339var 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)
589var watchCts = new CancellationTokenSource(); 1218var tokenSource = new CancellationTokenSource();
DistributedApplicationTests.cs (2)
63var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource();
InteractionServiceTests.cs (1)
47var cts = new CancellationTokenSource();
Publishing\PublishingActivityProgressReporterTests.cs (1)
498using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Publishing\ResourceContainerImageBuilderTests.cs (2)
27using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 43using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceNotificationTests.cs (3)
270using var cts = new CancellationTokenSource(); 302using var cts = new CancellationTokenSource(); 446private 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();
WithHttpCommandTests.cs (2)
382var watchCts = new CancellationTokenSource(); 452var watchCts = new CancellationTokenSource();
WithUrlsTests.cs (4)
336var cts = new CancellationTokenSource(); 372var cts = new CancellationTokenSource(); 460var cts = new CancellationTokenSource(); 581var cts = new CancellationTokenSource();
Aspire.Hosting.Valkey.Tests (2)
tests\Shared\AsyncTestHelpers.cs (1)
43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
201var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
77var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v3.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(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)
357CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
ClientSample (1)
HubSample.cs (1)
56using var closedTokenSource = new CancellationTokenSource();
CustomResources.AppHost (1)
TestResource.cs (1)
32private 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);
HtmlGenerationWebSite (1)
SignalTokenProviderService.cs (1)
20var cancellationTokenSource = new CancellationTokenSource();
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.NewShim.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.Tests (2)
ClientDisconnectTests.cs (2)
147var cancellationTokenSource = new CancellationTokenSource(); 189var cancellationTokenSource = new CancellationTokenSource();
IISExpress.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
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)
1028public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1030public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
TestTransport\InMemoryTransportConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
InProcessWebSite (1)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (1)
1013var cts = new CancellationTokenSource();
IntegrationTestsWebsite (1)
Infrastructure\DynamicEndpointDataSource.cs (1)
24_cts = new CancellationTokenSource();
Interop.FunctionalTests (9)
Http3\Http3RequestTests.cs (5)
486var cts = new CancellationTokenSource(); 732using var cts = new CancellationTokenSource(); 1011var cts = new CancellationTokenSource(); 1108var cts = new CancellationTokenSource(); 1256var 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Metrics.Legacy (4)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = 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();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.AspNetCore.Components (2)
NavigationManager.cs (1)
368var cts = new CancellationTokenSource();
Routing\Router.cs (1)
354_onNavigateCts = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Endpoints (4)
Builder\RazorComponentEndpointDataSource.cs (2)
63_cancellationTokenSource = new CancellationTokenSource(); 165_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)
307var 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)
206validationTcs.TrySetCanceled(new CancellationTokenSource().Token);
Microsoft.AspNetCore.Components.Tests (2)
ComponentBaseTest.cs (1)
358var cts = new CancellationTokenSource();
RendererTest.cs (1)
4112var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Web (1)
Virtualization\Virtualize.cs (1)
408_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 (3)
Hosting\WebAssemblyHostTest.cs (3)
26var cts = new CancellationTokenSource(); 46var cts = new CancellationTokenSource(); 71var cts = new CancellationTokenSource();
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
ConcurrencyLimiterEventSourceTests.cs (2)
57using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 98using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(5));
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)
26using var cts = new CancellationTokenSource(timeout); 89using (var cts = new CancellationTokenSource())
Microsoft.AspNetCore.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (1)
39using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(timeout);
Internal\HostingEventSourceTests.cs (1)
192using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WebHostTests.cs (3)
169var cts = new CancellationTokenSource(); 223var cts = new CancellationTokenSource(); 298var 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.Extensions.Tests (9)
HttpRequestJsonExtensionsTests.cs (1)
141var cts = new CancellationTokenSource();
HttpResponseJsonExtensionsTests.cs (5)
129var cts = new CancellationTokenSource(); 313var cts = new CancellationTokenSource(); 347var cts = new CancellationTokenSource(); 385var cts = new CancellationTokenSource(); 419var cts = new CancellationTokenSource();
RequestDelegateFactoryTests.cs (2)
1222using var cts = new CancellationTokenSource(); 3751private readonly CancellationTokenSource _requestAbortedCts = new();
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (1)
55using var 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(); 502var cts = new CancellationTokenSource(); 504var stopTask2 = server.StopAsync(new CancellationTokenSource().Token); 505var stopTask3 = server.StopAsync(new CancellationTokenSource().Token); 539var cts = new CancellationTokenSource(); 540var stopTask1 = server.StopAsync(new CancellationTokenSource().Token); 542var stopTask3 = server.StopAsync(new CancellationTokenSource().Token); 578stopTask1 = server.StopAsync(new CancellationTokenSource().Token); 579stopTask2 = 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)
220var 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)
1028public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1030public 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)
477CancellationTokenSource cts = new CancellationTokenSource();
HttpContextBuilderTests.cs (2)
231var cts = new CancellationTokenSource(); 258var cts = new CancellationTokenSource();
TestClientTests.cs (2)
730var tokenSource = new CancellationTokenSource(); 879using 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 (5)
BackEnd\BuildManager\BuildManager.cs (1)
538_executionCancellationTokenSource = new CancellationTokenSource();
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (1)
637_packetQueueDrainDelayCancellation = new CancellationTokenSource();
BackEnd\Components\Logging\LoggingService.cs (1)
1356_loggingEventProcessingCancellation = new CancellationTokenSource();
BackEnd\Components\RequestBuilder\RequestBuilder.cs (1)
642_cancellationTokenSource = new CancellationTokenSource();
Logging\TerminalLogger\TerminalLogger.cs (1)
83private readonly CancellationTokenSource _cts = new();
Microsoft.Build.Engine.UnitTests (1)
BackEnd\TargetBuilder_Tests.cs (1)
1398using (CancellationTokenSource source = new CancellationTokenSource())
Microsoft.Build.Tasks.CodeAnalysis (1)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
540_sharedCompileCts = new CancellationTokenSource();
Microsoft.Build.Tasks.CodeAnalysis.Sdk (1)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
540_sharedCompileCts = new CancellationTokenSource();
Microsoft.Build.Tasks.Core (5)
Copy.cs (1)
107private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
DownloadFile.cs (1)
23private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\GetFileHash.cs (1)
121private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\VerifyFileHash.cs (1)
74private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Unzip.cs (1)
32private readonly CancellationTokenSource _cancellationToken = new CancellationTokenSource();
Microsoft.Build.Tasks.UnitTests (1)
DownloadFile_Tests.cs (1)
255using CancellationTokenSource timeout = new CancellationTokenSource();
Microsoft.CodeAnalysis.Analyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.BannedApiAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.CodeStyle (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
96_cancellationTokenSource = new();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
4248var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
SemanticSearch\CSharpSemanticSearchServiceTests.cs (1)
294var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (3)
InteractiveSessionTests.cs (3)
2026var cancellationSource = new CancellationTokenSource(); 2060var cancellationSource = new CancellationTokenSource(); 2094var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\GeneratorDriverTests.cs (2)
744CancellationTokenSource cts = new CancellationTokenSource(); 2591CancellationTokenSource cts = new CancellationTokenSource();
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
1986CancellationTokenSource cts = new CancellationTokenSource(); 2012CancellationTokenSource cts = new CancellationTokenSource();
Microsoft.CodeAnalysis.EditorFeatures (19)
AutomaticCompletion\BraceCompletionSessionProvider.cs (1)
100var 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)
118private readonly CancellationTokenSource _cancellationTokenSource = new(); 129private CancellationTokenSource _conflictResolutionTaskCancellationSource = new(); 527_conflictResolutionTaskCancellationSource = new CancellationTokenSource();
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (2)
46private CancellationTokenSource _cancellationTokenSource = new(); 193_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.Test.Utilities2 (1)
Intellisense\TestState.vb (1)
608Dim ct = New CancellationTokenSource(timeoutMs)
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)
34private 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 (3)
Interactive\Core\InteractiveHost.LazyRemoteService.cs (1)
34_cancellationSource = 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();
Microsoft.CodeAnalysis.LanguageServer (3)
BrokeredServices\ServiceBrokerFactory.cs (1)
34private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
HostWorkspace\FileWatching\LspFileChangeWatcher.cs (1)
213_cancellationTokenSource = new CancellationTokenSource();
Program.cs (1)
84using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\AbstractRefreshQueue.cs (1)
48_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.PerformanceSensitiveAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
src\Dependencies\Threading\CancellationSeries.cs (1)
40_cts = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Host\RemoteWorkspace.InFlightSolution.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource_doNotAccessDirectly = new();
Services\ProcessTelemetry\RemoteProcessTelemetryService.cs (1)
32private 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
2220public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource(); 2676private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); 2911private 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)
26private readonly CancellationTokenSource _cancellationTokenSource = new();
Shared\TestHooks\AsynchronousOperationListener.cs (2)
35_expeditedDelayCancellationTokenSource = new CancellationTokenSource(); 133var 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)
154private 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)
39private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Rpc\RpcServer.cs (1)
36private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (1)
209var tokenSource = new CancellationTokenSource();
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
36private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
MEF\UseExportProviderAttribute.cs (1)
123using (var timeoutTokenSource = new CancellationTokenSource(CleanupTimeout))
Microsoft.CodeAnalysis.Workspaces.UnitTests (23)
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();
UtilityTest\SpecializedTasksTests.cs (13)
103using var cts = new CancellationTokenSource(); 148using var cts = new CancellationTokenSource(); 180using var cts = new CancellationTokenSource(); 204using var cts = new CancellationTokenSource(); 237using var unexpectedCts = new CancellationTokenSource(); 264using var unexpectedCts = new CancellationTokenSource(); 301using var cts = new CancellationTokenSource(); 304using var unexpectedCts = new CancellationTokenSource(); 328using var cts = new CancellationTokenSource(); 331using var unexpectedCts = new CancellationTokenSource(); 439using var cts = new CancellationTokenSource(); 464using var cts = new CancellationTokenSource(); 489using var 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)
942using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(TimeoutInMinutes)); 977new 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 (6)
ChatCompletion\ChatClientExtensionsTests.cs (2)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource();
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
25using 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)
113using var cancellationTokenSource = new CancellationTokenSource(); 127using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
Infrastructure\TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (19)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
942using CancellationTokenSource cts = new(); 1042using CancellationTokenSource cts = new();
ChatCompletion\UseDelegateChatClientTests.cs (4)
30using CancellationTokenSource expectedCts = new(); 80using CancellationTokenSource expectedCts = new(); 122using CancellationTokenSource expectedCts = new(); 173using CancellationTokenSource expectedCts = new();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
81using var cts = new CancellationTokenSource(); 584using CancellationTokenSource cts = new(); 607using CancellationTokenSource cts = new(); 630using CancellationTokenSource cts = new(); 653using CancellationTokenSource cts = new(); 676using CancellationTokenSource cts = new(); 699using CancellationTokenSource cts = new(); 722using CancellationTokenSource cts = new(); 745using 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)
146using 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.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 (2)
TcpEndpointProbesServiceTests.cs (2)
23using var cts = new CancellationTokenSource(); 89using var cts = new CancellationTokenSource();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
src\Shared\Pools\PooledCancellationTokenSourcePolicy.cs (1)
22public override CancellationTokenSource Create() => new();
Microsoft.Extensions.Diagnostics.Testing (1)
Metrics\MetricCollector.cs (1)
256using var cancellationTokenSource = new CancellationTokenSource(timeout, _timeProvider);
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Metrics\MetricCollectorTests.cs (1)
283using var cts = new CancellationTokenSource();
Microsoft.Extensions.FileProviders.Physical (4)
PhysicalFilesWatcher.cs (4)
178var cancellationTokenSource = new CancellationTokenSource(); 194pollingChangeToken.CancellationTokenSource = new CancellationTokenSource(); 213var cancellationTokenSource = new CancellationTokenSource(); 231pollingChangeToken.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)
59using var tokenSource = new CancellationTokenSource(); 118using 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)
388CancellationTokenSource 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(); 132var cancellation = _lastCollectionCancellation = new CancellationTokenSource(validityPeriod, _timeProvider);
Resolver\DnsResolver.cs (1)
27private 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)
86var cts = new[] { new CancellationTokenSource() }; 95cts[0] = new(); 138var cts = new[] { new CancellationTokenSource() }; 147cts[0] = new(); 174var cts = new[] { new CancellationTokenSource() }; 183cts[0] = new(); 212var cts = new[] { new CancellationTokenSource() }; 221cts[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 (7)
JSObjectReferenceExtensions.cs (3)
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);
JSRuntime.cs (1)
115using var cts = new CancellationTokenSource(DefaultAsyncTimeout.Value);
JSRuntimeExtensions.cs (3)
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);
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.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 (2)
Microsoft\VisualBasic\ApplicationServices\WindowsFormsApplicationBase.vb (2)
1064Dim tokenSource As New CancellationTokenSource() 1077Dim tokenSource As 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.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)
250private 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)
377var cancellationSource = new CancellationTokenSource();
Microsoft.VisualStudio.LanguageServices.UnitTests (13)
SymbolSearch\SymbolSearchUpdateEngineTests.vb (13)
24Dim cancellationTokenSource = New CancellationTokenSource() 55Dim cancellationTokenSource = New CancellationTokenSource() 83Dim cancellationTokenSource = New CancellationTokenSource() 121Dim cancellationTokenSource = New CancellationTokenSource() 164Dim cancellationTokenSource = New CancellationTokenSource() 197Dim cancellationTokenSource = New CancellationTokenSource() 245Dim cancellationTokenSource = New CancellationTokenSource() 288Dim cancellationTokenSource = New CancellationTokenSource() 336Dim cancellationTokenSource = New CancellationTokenSource() 395Dim cancellationTokenSource = New CancellationTokenSource() 439Dim cancellationTokenSource = New CancellationTokenSource() 493Dim cancellationTokenSource = New CancellationTokenSource() 553Dim cancellationTokenSource = New CancellationTokenSource()
MSBuild (1)
XMake.cs (1)
142private static readonly CancellationTokenSource s_buildCancellationSource = new CancellationTokenSource();
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Roslyn.VisualStudio.DiagnosticsWindow (1)
OptionPages\ForceLowMemoryMode.cs (1)
61private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (2)
147var cancellationTokenSource = new CancellationTokenSource(); 198var cancellationTokenSource = new CancellationTokenSource();
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
119var source = new CancellationTokenSource();
RunTests (1)
Program.cs (1)
65using 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)
51private 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.FileSystem.Watcher (1)
System\IO\FileSystemWatcher.Linux.cs (1)
59CancellationTokenSource cancellation = new CancellationTokenSource();
System.IO.Pipelines (2)
System\IO\Pipelines\StreamPipeReader.cs (1)
80return _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)
1070new 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(); 681CancellationTokenSource 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)
818var cts = new CancellationTokenSource(Settings._connectTimeout);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
833_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)
79_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)
144private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
System\Net\Quic\QuicListener.cs (1)
89private 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)
604_multipleConnectCancellation = saeaMultiConnectCancelable ? new CancellationTokenSource() : null;
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketStream.cs (1)
267cts = 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(); 863token.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.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 (1)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (1)
380_asynchronousComputationCancellationSource = new CancellationTokenSource();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = 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; 89using var runCancellationToken = new CancellationTokenSource(timeForEachRun);
1678 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 (3)
Backchannel\ExtensionBackchannel.cs (2)
74using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Commands\BaseCommand.cs (1)
32var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
Aspire.Cli.Tests (2)
Commands\RunCommandTests.cs (2)
223using var cts = new CancellationTokenSource(); 277using var cts = new CancellationTokenSource();
Aspire.Components.Common.TestUtilities (1)
ActivityNotifier.cs (1)
21using var cts = new CancellationTokenSource(timeout);
Aspire.Dashboard (29)
Components\Controls\ApplicationName.razor.cs (1)
12private CancellationTokenSource? _disposalCts;
Components\Controls\Chart\ChartBase.cs (1)
23private readonly CancellationTokenSource _cts = new();
Components\Controls\SpanDetails.razor.cs (1)
67private readonly CancellationTokenSource _cts = new();
Components\Dialogs\ExemplarsDialog.razor.cs (1)
35private readonly CancellationTokenSource _cts = new();
Components\Interactions\InteractionsProvider.cs (1)
25private readonly CancellationTokenSource _cts = new();
Components\Pages\ConsoleLogs.razor.cs (2)
33private readonly CancellationTokenSource _cts = new(); 101private readonly CancellationTokenSource _resourceSubscriptionCts = new();
Components\Pages\Resources.razor.cs (1)
97private readonly CancellationTokenSource _watchTaskCancellationTokenSource = new();
Model\DashboardCommandExecutor.cs (1)
126CancellationTokenSource closeToastCts;
Model\MetricsHelpers.cs (1)
31using var cts = new CancellationTokenSource();
Model\ResourceOutgoingPeerResolver.cs (1)
16private readonly CancellationTokenSource _watchContainersTokenSource = new();
ServiceClient\DashboardClient.cs (13)
47private readonly CancellationTokenSource _cts = new(); 434var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 557var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 605var cts = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 647using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 694using var combinedTokens = CancellationTokenSource.CreateLinkedTokenSource(_clientCancellationToken, cancellationToken); 733using 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 (9)
ChannelExtensionsTests.cs (4)
18var cts = new CancellationTokenSource(); 42var cts = new CancellationTokenSource(); 66var cts = new CancellationTokenSource(); 110var cts = new CancellationTokenSource();
Model\DashboardClientTests.cs (3)
47var cts = new CancellationTokenSource(); 133var cts = new CancellationTokenSource(); 158var cts = new CancellationTokenSource();
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
Aspire.EndToEnd.Tests (2)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
357CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
Aspire.Hosting (43)
ApplicationModel\ResourceLoggerService.cs (1)
345private readonly CancellationTokenSource _logStreamCts = new();
ApplicationModel\ResourceNotificationService.cs (5)
27private readonly CancellationTokenSource _disposing = new(); 127using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken); 419using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_disposing.Token, cancellationToken);
Backchannel\BackchannelLoggerProvider.cs (1)
15private readonly CancellationTokenSource _backgroundChannelRegistrationCts = new();
Dashboard\DashboardLifecycleHook.cs (2)
48private CancellationTokenSource? _dashboardLogsCts; 70_dashboardLogsCts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping);
Dashboard\DashboardService.cs (4)
63var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 337using var cts = CancellationTokenSource.CreateLinkedTokenSource(hostApplicationLifetime.ApplicationStopping, serverCallContext.CancellationToken);
Dashboard\DashboardServiceData.cs (5)
19private readonly CancellationTokenSource _cts = new(); 127using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token); 144using var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cts.Token);
Dashboard\ResourcePublisher.cs (2)
60using var linked = CancellationTokenSource.CreateLinkedTokenSource(enumeratorCancellationToken, cancellationToken);
Dcp\DcpExecutor.cs (4)
56private readonly CancellationTokenSource _shutdownCancellation = new(); 67private readonly ConcurrentDictionary<string, (CancellationTokenSource Cancellation, Task Task)> _logStreams = new(); 214var disposeCts = new CancellationTokenSource(); 508var cancellation = new CancellationTokenSource();
Dcp\DcpHost.cs (3)
28private readonly CancellationTokenSource _shutdownCts = new(); 85using var timeoutCancellation = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Dcp\DcpKubernetesClient.cs (6)
52using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 92using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 118using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Health\ResourceHealthCheckService.cs (2)
306private readonly CancellationTokenSource _cts; 314_cts = CancellationTokenSource.CreateLinkedTokenSource(serviceStoppingToken);
Orchestrator\ApplicationOrchestrator.cs (3)
27private readonly CancellationTokenSource _shutdownCancellation = new(); 77using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Publishing\PublishingActivityProgressReporter.cs (1)
361private readonly CancellationTokenSource _cancellationTokenSource = new();
Utils\PeriodicRestartAsyncEnumerable.cs (4)
26using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 82using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Aspire.Hosting.Azure.Tests (18)
AzureAIFoundryExtensionsTests.cs (1)
71var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
AzureBicepProvisionerTests.cs (1)
50var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
AzureCosmosDBEmulatorFunctionalTests.cs (4)
27var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 68var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 139var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 272var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
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)
73var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 116var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 776var 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 (3)
20var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 69var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 148var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
DefaultUserPrincipalProviderTests.cs (1)
71using var cts = new CancellationTokenSource();
Aspire.Hosting.Containers.Tests (1)
DockerSocketBindMountTests.cs (1)
39using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
Aspire.Hosting.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
22var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 60var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 104var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Kafka.Tests (4)
KafkaFunctionalTests.cs (2)
61var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 117var 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)
34var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 71var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 109var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 253var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6)); 351var cts = new CancellationTokenSource(TimeSpan.FromMinutes(6));
Aspire.Hosting.MySql.Tests (13)
MySqlFunctionalTests.cs (11)
31using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan); 69using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 123using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 300using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 387using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 471using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 544using var cts = new CancellationTokenSource(TestConstants.ExtraLongTimeoutTimeSpan * 2); 615var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 689var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 764var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 814var 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)); 110var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 324var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.NodeJs.Tests (5)
NodeAppFixture.cs (1)
43using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
NodeFunctionalTests.cs (2)
26using var cts = new CancellationTokenSource(TestConstants.LongTimeoutDuration); 39using 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)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 81var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 251var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 349var cts = new CancellationTokenSource(TimeSpan.FromMinutes(15)); 442var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.PostgreSQL.Tests (11)
PostgresFunctionalTests.cs (9)
100var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 196var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 363var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 451var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 535var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 594var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 639var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 684var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 761var 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)
28var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 92var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 255var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.RabbitMQ.Tests (3)
RabbitMQFunctionalTests.cs (1)
99var 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)
33var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 131var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 183var cts2 = new CancellationTokenSource(TimeSpan.FromSeconds(2)); 438var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 599var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.SqlServer.Tests (7)
SqlServerFunctionalTests.cs (7)
25var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3)); 65var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 130var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); 338var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 404var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 457var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); 533var 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)
138private readonly CancellationTokenSource _startedCts = new(); 139private readonly CancellationTokenSource _stoppingCts = new(); 140private readonly CancellationTokenSource _stoppedCts = new();
TestingBuilderTests.cs (3)
445using var cts = new CancellationTokenSource(timeout); 490using var cts = new CancellationTokenSource(timeout); 511using 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 (83)
Codespaces\CodespacesUrlRewriterTests.cs (2)
29var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60)); 66var abortToken = new CancellationTokenSource(TimeSpan.FromSeconds(60));
Dashboard\DashboardServiceTests.cs (5)
180var cts = new CancellationTokenSource(); 234var cts = new CancellationTokenSource(); 303var cts = new CancellationTokenSource(); 339var cts = new CancellationTokenSource(); 415private 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)
589var watchCts = new CancellationTokenSource(); 1218var tokenSource = new CancellationTokenSource();
DistributedApplicationTests.cs (5)
63var cts = new CancellationTokenSource(); 104var cts = new CancellationTokenSource(); 486var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 631using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.DefaultOrchestratorTestLongTimeout); 1101using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
Health\ResourceHealthCheckServiceTests.cs (3)
226var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 267var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 310var abortTokenSource = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
InteractionServiceTests.cs (1)
47var cts = new CancellationTokenSource();
Publishing\PublishingActivityProgressReporterTests.cs (1)
498using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
Publishing\ResourceContainerImageBuilderTests.cs (2)
27using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan); 43using var cts = new CancellationTokenSource(TestConstants.LongTimeoutTimeSpan);
ResourceNotificationTests.cs (6)
68using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 121using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 178using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(); 270using var cts = new CancellationTokenSource(); 302using var cts = new CancellationTokenSource(); 446private 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)
33using 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();
WaitForTests.cs (33)
28var abortCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 103using var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 106using var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 134using var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 137using var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 167var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 173var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 211var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 214var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 322var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 325var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 356var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 359var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 403var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 406var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 445var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 451var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 467var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 492var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 498var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 514var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 547var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 553var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 570var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 601var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 607var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 622var runningStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 652var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 658var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 705var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 711var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 754var startupCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration); 760var waitingStateCts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
WithHttpCommandTests.cs (2)
382var watchCts = new CancellationTokenSource(); 452var watchCts = new CancellationTokenSource();
WithUrlsTests.cs (4)
336var cts = new CancellationTokenSource(); 372var cts = new CancellationTokenSource(); 460var cts = new CancellationTokenSource(); 581var cts = new CancellationTokenSource();
Aspire.Hosting.Valkey.Tests (3)
tests\Shared\AsyncTestHelpers.cs (2)
36public static CancellationTokenSource CreateDefaultTimeoutTokenSource(int milliseconds = -1) 43var cts = new CancellationTokenSource();
ValkeyFunctionalTests.cs (1)
201var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
77var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(10);
Aspire.MongoDB.Driver.v3.Tests (1)
tests\Aspire.MongoDB.Driver.Tests\ConformanceTests.cs (1)
111using var source = new CancellationTokenSource(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)
357CancellationTokenSource cts = new();
tests\Shared\TemplatesTesting\ToolCommand.cs (1)
84CancellationTokenSource cts = new();
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)
296var serverCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CustomResources.AppHost (1)
TestResource.cs (1)
32private 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);
HtmlGenerationWebSite (3)
SignalTokenProviderService.cs (3)
20var cancellationTokenSource = new CancellationTokenSource(); 37public ChangeTokenInfo(IChangeToken changeToken, CancellationTokenSource tokenSource) 45public CancellationTokenSource TokenSource { get; }
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.NewShim.FunctionalTests (1)
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
IIS.Tests (2)
ClientDisconnectTests.cs (2)
147var cancellationTokenSource = new CancellationTokenSource(); 189var 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)
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)
1028public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1030public CancellationTokenSource ConnectionClosedCts { get; set; } = new CancellationTokenSource();
TestTransport\InMemoryTransportConnection.cs (1)
18private readonly CancellationTokenSource _connectionClosedTokenSource = new CancellationTokenSource();
InProcessWebSite (1)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (1)
1013var cts = new CancellationTokenSource();
IntegrationTestsWebsite (2)
Infrastructure\DynamicEndpointDataSource.cs (2)
15private CancellationTokenSource? _cts; 55var localCts = _cts;
Interop.FunctionalTests (9)
Http3\Http3RequestTests.cs (5)
486var cts = new CancellationTokenSource(); 732using var cts = new CancellationTokenSource(); 1011var cts = new CancellationTokenSource(); 1108var cts = new CancellationTokenSource(); 1256var 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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\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;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.AspNetCore.Components (3)
NavigationManager.cs (2)
36private CancellationTokenSource? _locationChangingCts; 368var cts = new CancellationTokenSource();
Routing\Router.cs (1)
36private CancellationTokenSource _onNavigateCts;
Microsoft.AspNetCore.Components.Endpoints (4)
Builder\RazorComponentEndpointDataSource.cs (2)
31private CancellationTokenSource _cancellationTokenSource; 163var oldCancellationTokenSource = _cancellationTokenSource;
DependencyInjection\HotReloadService.cs (2)
19private CancellationTokenSource _tokenSource = new(); 39var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Components.QuickGrid (2)
QuickGrid.razor.cs (2)
150private CancellationTokenSource? _pendingDataLoadCancellationTokenSource; 307var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Server (13)
Circuits\CircuitRegistry.cs (3)
148var cancellationTokenSource = new CancellationTokenSource(_options.DisconnectedCircuitRetentionPeriod); 424public DisconnectedCircuitEntry(CircuitHost circuitHost, CancellationTokenSource tokenSource) 431public 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 (2)
ComponentBaseTest.cs (1)
358var cts = new CancellationTokenSource();
RendererTest.cs (1)
4112var cancellationTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Components.Web (5)
Forms\InputFile\BrowserFileStream.cs (4)
15private readonly CancellationTokenSource _openReadStreamCts; 20private CancellationTokenSource? _copyFileDataCts; 33_openReadStreamCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 104_copyFileDataCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Virtualization\Virtualize.cs (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 (3)
Hosting\WebAssemblyHostTest.cs (3)
26var cts = new CancellationTokenSource(); 46var cts = new CancellationTokenSource(); 71var cts = new CancellationTokenSource();
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
ConcurrencyLimiterEventSourceTests.cs (2)
57using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); 98using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(5));
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)
289using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Internal\WebHostLifetime.cs (2)
10private readonly CancellationTokenSource _cts; 20public WebHostLifetime(CancellationTokenSource cts, ManualResetEventSlim resetEvent, string shutdownMessage)
WebHostExtensions.cs (4)
26using var cts = new CancellationTokenSource(timeout); 48using (var cts = CancellationTokenSource.CreateLinkedTokenSource(token)) 89using (var cts = new CancellationTokenSource())
Microsoft.AspNetCore.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (1)
39using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(timeout);
Internal\HostingEventSourceTests.cs (1)
192using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
WebHostTests.cs (3)
169var cts = new CancellationTokenSource(); 223var cts = new CancellationTokenSource(); 298var 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.Extensions.Tests (9)
HttpRequestJsonExtensionsTests.cs (1)
141var cts = new CancellationTokenSource();
HttpResponseJsonExtensionsTests.cs (5)
129var cts = new CancellationTokenSource(); 313var cts = new CancellationTokenSource(); 347var cts = new CancellationTokenSource(); 385var cts = new CancellationTokenSource(); 419var cts = new CancellationTokenSource();
RequestDelegateFactoryTests.cs (2)
1222using var cts = new CancellationTokenSource(); 3751private readonly CancellationTokenSource _requestAbortedCts = new();
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (1)
55using var 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 (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)
18private CancellationTokenSource? _requestAbortSource; 59_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(); 502var cts = new CancellationTokenSource(); 539var cts = new CancellationTokenSource();
src\Shared\Http2cat\Http2CatHostedService.cs (1)
28private readonly CancellationTokenSource _stopTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.IIS (3)
Core\IISHttpContext.cs (1)
818CancellationTokenSource? 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)
220var hostExitTokenSource = new CancellationTokenSource();
Microsoft.AspNetCore.Server.Kestrel.Core (9)
Internal\Http\HttpProtocol.cs (3)
49private CancellationTokenSource? _abortedCts; 411CancellationTokenSource? localAbortCts = null; 471CancellationTokenSource? 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)
1028public CancellationTokenSource ConnectionClosingCts { get; set; } = new CancellationTokenSource(); 1030public 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 (20)
HubConnection.cs (14)
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) 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)
477CancellationTokenSource cts = new CancellationTokenSource();
HttpContextBuilderTests.cs (2)
231var cts = new CancellationTokenSource(); 258var cts = new CancellationTokenSource();
TestClientTests.cs (2)
730var tokenSource = new CancellationTokenSource(); 879using 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 (5)
BackEnd\BuildManager\BuildManager.cs (1)
143private CancellationTokenSource? _executionCancellationTokenSource;
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (1)
609private readonly CancellationTokenSource _packetQueueDrainDelayCancellation;
BackEnd\Components\Logging\LoggingService.cs (1)
270private CancellationTokenSource _loggingEventProcessingCancellation;
BackEnd\Components\RequestBuilder\RequestBuilder.cs (1)
70private CancellationTokenSource _cancellationTokenSource;
Logging\TerminalLogger\TerminalLogger.cs (1)
83private readonly CancellationTokenSource _cts = new();
Microsoft.Build.Engine.UnitTests (1)
BackEnd\TargetBuilder_Tests.cs (1)
1398using (CancellationTokenSource source = new CancellationTokenSource())
Microsoft.Build.Tasks.CodeAnalysis (5)
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
53private CancellationTokenSource? _sharedCompileCts;
src\Compilers\Shared\BuildServerConnection.cs (2)
296var 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)
53private CancellationTokenSource? _sharedCompileCts;
src\Compilers\Shared\BuildServerConnection.cs (2)
296var 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.Core (8)
AssemblyDependency\Node\OutOfProcRarNode.cs (2)
89using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Copy.cs (1)
107private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
DownloadFile.cs (1)
23private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\GetFileHash.cs (1)
121private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
FileIO\VerifyFileHash.cs (1)
74private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Unzip.cs (2)
30/// Stores a <see cref="CancellationTokenSource"/> used for cancellation. 32private readonly CancellationTokenSource _cancellationToken = new CancellationTokenSource();
Microsoft.Build.Tasks.UnitTests (1)
DownloadFile_Tests.cs (1)
255using CancellationTokenSource timeout = new CancellationTokenSource();
Microsoft.CodeAnalysis (7)
CommandLine\CommonCompiler.cs (5)
973out CancellationTokenSource? analyzerCts, 1106out CancellationTokenSource? analyzerCts, 1514(CancellationTokenSource, DiagnosticBag, AnalyzerDriver) initializeAnalyzerDriver(AnalyzerOptions analyzerOptions, ref Compilation compilation) 1516var 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
48private readonly CancellationTokenSource _cancellationTokenSource;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
4248var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
SemanticSearch\CSharpSemanticSearchServiceTests.cs (1)
294var cancellationSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (6)
InteractiveSessionTests.cs (6)
2026var cancellationSource = new CancellationTokenSource(); 2028var globals = new StrongBox<CancellationTokenSource>(); 2060var cancellationSource = new CancellationTokenSource(); 2062var globals = new StrongBox<CancellationTokenSource>(); 2094var cancellationSource = new CancellationTokenSource(); 2096var globals = new StrongBox<CancellationTokenSource>();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\GeneratorDriverTests.cs (2)
744CancellationTokenSource cts = new CancellationTokenSource(); 2591CancellationTokenSource 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)
100var 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)
118private readonly CancellationTokenSource _cancellationTokenSource = new(); 129private CancellationTokenSource _conflictResolutionTaskCancellationSource = new();
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (1)
46private CancellationTokenSource _cancellationTokenSource = new();
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (2)
136var 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)
47CancellationTokenSource 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.Test.Utilities2 (1)
Intellisense\TestState.vb (1)
273Using cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(threadingContext.DisposalToken)
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)
25private sealed class ResultsObserver(CancellationTokenSource cancellationSource, int resultCountLimit) : ISemanticSearchResultsObserver 76using var cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (1)
Cohost\RazorStartupServiceFactory.cs (1)
36private readonly CancellationTokenSource _disposalTokenSource = new();
Microsoft.CodeAnalysis.Features (23)
AddImport\AbstractAddImportFeatureService.cs (5)
228using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 279using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 352CancellationTokenSource linkedTokenSource)
CodeFixes\Service\CodeFixService.cs (2)
125using 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)
34private 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();
SemanticSearch\QueryExecutionContext.cs (3)
50using var symbolEnumerationCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 122private async ValueTask InvokeAsync(Project project, Compilation compilation, object entity, CancellationTokenSource symbolEnumerationCancellationSource, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.InteractiveHost (14)
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\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 CancellationTokenSource();
HostWorkspace\FileWatching\LspFileChangeWatcher.cs (1)
206private readonly CancellationTokenSource _cancellationTokenSource;
Program.cs (1)
84using var timeoutSource = new CancellationTokenSource(timeout);
Microsoft.CodeAnalysis.LanguageServer.Protocol (13)
Handler\AbstractRefreshQueue.cs (1)
30private readonly CancellationTokenSource _disposalTokenSource;
Handler\SourceGenerators\SourceGeneratorRefreshQueue.cs (1)
26private readonly CancellationTokenSource _disposalTokenSource = new();
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); 303/// Reflection invokes <see cref="ProcessQueueCoreAsync{TRequest, TResponse}(IQueueItem{TRequestContext}, IMethodHandler, RequestHandlerMetadata, ConcurrentDictionary{Task, CancellationTokenSource}, CancellationTokenSource?, CancellationToken)"/> 311ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 312CancellationTokenSource? currentWorkCts, 333ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 334CancellationTokenSource? currentWorkCts, 394if (!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.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Host\RemoteWorkspace.InFlightSolution.cs (1)
32private readonly CancellationTokenSource _cancellationTokenSource_doNotAccessDirectly = new();
Services\ProcessTelemetry\RemoteProcessTelemetryService.cs (1)
32private 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
2220public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource(); 2676private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); 2911private 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 (24)
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (1)
33private readonly CancellationTokenSource _tokenSource = new();
Remote\IRemoteKeepAliveService.cs (1)
26private readonly CancellationTokenSource _cancellationTokenSource = new();
Shared\TestHooks\AsynchronousOperationListener.cs (5)
21private CancellationTokenSource _expeditedDelayCancellationTokenSource; 56var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, expeditedDelayCancellationToken); 73static Task<bool> DelaySlowAsync(Task delayTask, CancellationTokenSource cancellationTokenSourceToDispose, CancellationToken cancellationToken) 133var 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)
154private 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)
39private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
Rpc\RpcServer.cs (1)
36private readonly CancellationTokenSource _shutdownTokenSource = 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).
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (1)
209var tokenSource = new CancellationTokenSource();
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
36private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
MEF\UseExportProviderAttribute.cs (1)
123using (var timeoutTokenSource = new CancellationTokenSource(CleanupTimeout))
Microsoft.CodeAnalysis.Workspaces.UnitTests (23)
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();
UtilityTest\SpecializedTasksTests.cs (13)
103using var cts = new CancellationTokenSource(); 148using var cts = new CancellationTokenSource(); 180using var cts = new CancellationTokenSource(); 204using var cts = new CancellationTokenSource(); 237using var unexpectedCts = new CancellationTokenSource(); 264using var unexpectedCts = new CancellationTokenSource(); 301using var cts = new CancellationTokenSource(); 304using var unexpectedCts = new CancellationTokenSource(); 328using var cts = new CancellationTokenSource(); 331using var unexpectedCts = new CancellationTokenSource(); 439using var cts = new CancellationTokenSource(); 464using var cts = new CancellationTokenSource(); 489using var cts = new CancellationTokenSource();
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); 303/// Reflection invokes <see cref="ProcessQueueCoreAsync{TRequest, TResponse}(IQueueItem{TRequestContext}, IMethodHandler, RequestHandlerMetadata, ConcurrentDictionary{Task, CancellationTokenSource}, CancellationTokenSource?, CancellationToken)"/> 311ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 312CancellationTokenSource? currentWorkCts, 333ConcurrentDictionary<Task, CancellationTokenSource> concurrentlyExecutingTasks, 334CancellationTokenSource? currentWorkCts, 394if (!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)
942using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(TimeoutInMinutes)); 976CancellationTokenSource 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)
63CancellationTokenSource 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.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatClientExtensionsTests.cs (2)
105using var cts = new CancellationTokenSource(); 132using var cts = new CancellationTokenSource();
Embeddings\DelegatingEmbeddingGeneratorTests.cs (1)
25using 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)
113using var cancellationTokenSource = new CancellationTokenSource(); 127using var cancellationTokenSource = new CancellationTokenSource();
Microsoft.Extensions.AI.Templates.Tests (1)
Infrastructure\TestCommand.cs (1)
88using var timeoutCts = new CancellationTokenSource();
Microsoft.Extensions.AI.Tests (19)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
39using CancellationTokenSource cts = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
942using CancellationTokenSource cts = new(); 1042using CancellationTokenSource cts = new();
ChatCompletion\UseDelegateChatClientTests.cs (4)
30using CancellationTokenSource expectedCts = new(); 80using CancellationTokenSource expectedCts = new(); 122using CancellationTokenSource expectedCts = new(); 173using CancellationTokenSource expectedCts = new();
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
36using CancellationTokenSource cts = new();
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
30using CancellationTokenSource expectedCts = new();
Functions\AIFunctionFactoryTest.cs (9)
81using var cts = new CancellationTokenSource(); 584using CancellationTokenSource cts = new(); 607using CancellationTokenSource cts = new(); 630using CancellationTokenSource cts = new(); 653using CancellationTokenSource cts = new(); 676using CancellationTokenSource cts = new(); 699using CancellationTokenSource cts = new(); 722using CancellationTokenSource cts = new(); 745using 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)
146using 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.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 (2)
TcpEndpointProbesServiceTests.cs (2)
23using var cts = new CancellationTokenSource(); 89using 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 (1)
Metrics\MetricCollector.cs (1)
256using var cancellationTokenSource = new CancellationTokenSource(timeout, _timeProvider);
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
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(); 178var cancellationTokenSource = new CancellationTokenSource(); 213var cancellationTokenSource = new CancellationTokenSource(); 505CancellationTokenSource tokenSource, 512CancellationTokenSource tokenSource, 521public 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)
59using var tokenSource = new CancellationTokenSource(); 77var cancellationTokenSource = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1)); 118using var tokenSource = new CancellationTokenSource(); 137var cancellationTokenSource = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1));
HostingFakesExtensionsTests.cs (1)
28using var tokenSource = new CancellationTokenSource();
Microsoft.Extensions.Http.Diagnostics (4)
Logging\Internal\HttpRequestBodyReader.cs (2)
71using 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)
122private CancellationTokenSource? _cancellationTokenSource; 388CancellationTokenSource cts = LazyInitializer.EnsureInitialized(ref _cancellationTokenSource, () => new CancellationTokenSource()); 395CancellationTokenSource? 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(); 132var cancellation = _lastCollectionCancellation = new CancellationTokenSource(validityPeriod, _timeProvider);
Resolver\DnsResolver.cs (8)
27private readonly CancellationTokenSource _pendingRequestsCts = new(); 468(CancellationTokenSource cts, bool disposeTokenSource, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 864private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 876CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 882CancellationTokenSource 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 (7)
JSObjectReferenceExtensions.cs (3)
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);
JSRuntime.cs (1)
115using var cts = new CancellationTokenSource(DefaultAsyncTimeout.Value);
JSRuntimeExtensions.cs (3)
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);
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.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 (1)
XUnit\SkippedFactTestCase.cs (1)
30CancellationTokenSource cancellationTokenSource)
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
58CancellationTokenSource tokenSource = new();
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)
250private 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)
30using var queryCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(presenterCancellationToken, cancellationToken);
SemanticSearch\SemanticSearchToolWindowImpl.cs (4)
78private volatile CancellationTokenSource? _pendingExecutionCancellationSource; 361var pendingExecutionCancellationSource = Interlocked.Exchange(ref _pendingExecutionCancellationSource, null); 377var cancellationSource = new CancellationTokenSource(); 408var source = Interlocked.Exchange(ref cancellationSource, null);
MSBuild (1)
XMake.cs (1)
142private static readonly CancellationTokenSource s_buildCancellationSource = new CancellationTokenSource();
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)
296var 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
Roslyn.VisualStudio.DiagnosticsWindow (1)
OptionPages\ForceLowMemoryMode.cs (1)
61private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (2)
147var cancellationTokenSource = new CancellationTokenSource(); 198var cancellationTokenSource = new CancellationTokenSource();
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
119var source = new CancellationTokenSource();
RunTests (3)
Program.cs (3)
65using var cts = new CancellationTokenSource(); 101using 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)
51private 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)) 1384using (CancellationTokenSource linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(collatedCancellationTokens)) 1619using 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.FileSystem.Watcher (3)
System\IO\FileSystemWatcher.Linux.cs (3)
59CancellationTokenSource cancellation = new CancellationTokenSource(); 112var cts = _cancellation; 139private CancellationTokenSource? _cancellation;
System.IO.Pipelines (9)
System\IO\Pipelines\StreamPipeReader.cs (7)
17private CancellationTokenSource? _internalTokenSource; 74private CancellationTokenSource InternalTokenSource 222CancellationTokenSource tokenSource = InternalTokenSource; 245static async ValueTask<ReadResult> Core(StreamPipeReader reader, int? minimumSize, CancellationTokenSource tokenSource, CancellationToken cancellationToken) 316CancellationTokenSource tokenSource = InternalTokenSource; 387CancellationTokenSource tokenSource = InternalTokenSource; 465private 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)
425using (CancellationTokenSource cts = GetCancellationTokenSourceFromTimeout(timeout)) 562using (CancellationTokenSource cts = GetCancellationTokenSourceFromTimeout(timeout)) 1066private 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); 460(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 509(CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts) = PrepareCancellationTokenSource(cancellationToken); 515CancellationTokenSource cts, bool disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 577private void HandleFailure(Exception e, bool telemetryStarted, HttpResponseMessage? response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) 638private static void FinishSend(HttpResponseMessage? response, CancellationTokenSource cts, bool disposeCts, bool telemetryStarted, bool responseContentTelemetryStarted) 681CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingRequestsCts, new CancellationTokenSource()); 781private (CancellationTokenSource TokenSource, bool DisposeTokenSource, CancellationTokenSource PendingRequestsCts) PrepareCancellationTokenSource(CancellationToken cancellationToken) 793CancellationTokenSource pendingRequestsCts = _pendingRequestsCts; 798CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, pendingRequestsCts.Token);
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (1)
472CancellationTokenSource? cts = null;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
815private CancellationTokenSource GetConnectTimeoutCancellationTokenSource<T>(HttpConnectionWaiter<T> waiter) 818var 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)
59private CancellationTokenSource? _altSvcBlocklistTimerCancellation; 265CancellationTokenSource 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)
33private readonly CancellationTokenSource _requestBodyCancellationSource; 150CancellationTokenRegistration 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)
76using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); 144private readonly CancellationTokenSource _shutdownTokenSource = new CancellationTokenSource();
System\Net\Quic\QuicListener.cs (3)
89private readonly CancellationTokenSource _disposeCts = new CancellationTokenSource(); 230using 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; 613CancellationTokenSource? multipleConnectCancellation = _multipleConnectCancellation;
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketStream.cs (1)
254CancellationTokenSource? 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)
1638using 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. 844/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 849/// <returns>A <see cref="CancellationTokenSource"/> that is linked 851public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2) => 854(CancellationTokenSource)new Linked1CancellationTokenSource(token1); 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 token.</returns> 862public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token) => 866/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 870/// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source tokens.</returns> 872public static CancellationTokenSource CreateLinkedTokenSource(params CancellationToken[] tokens) 879/// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state 883/// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source tokens.</returns> 884public static CancellationTokenSource CreateLinkedTokenSource(params ReadOnlySpan<CancellationToken> tokens) 947Debug.Assert(s is CancellationTokenSource, $"Expected {typeof(CancellationTokenSource)}, got {s}"); 948((CancellationTokenSource)s).NotifyCancellation(throwOnFirstException: false); // skip ThrowIfDisposed() check in Cancel() 989private static void Invoke(Delegate d, object? state, CancellationTokenSource source) 1011public readonly CancellationTokenSource Source; 1032public Registrations(CancellationTokenSource source) => Source = source;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5706/// The <see cref="CancellationTokenSource"/> associated 5754/// The <see cref="CancellationTokenSource"/> associated
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
807[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.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)
181/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 441/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 478/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 591/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 630/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 785/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 850/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1212/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1282/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1354/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1458/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 1577/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2152/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2216/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2285/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2365/// the <see cref="System.Threading.CancellationTokenSource">CancellationTokenSource</see> associated with the 2456/// 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 (1)
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;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (5)
82private CancellationTokenSource? _asynchronousComputationCancellationSource; 386private readonly struct AsynchronousComputationToStart(Func<TData, CancellationToken, Task<T>> asynchronousComputeFunction, CancellationTokenSource cancellationTokenSource) 389public readonly CancellationTokenSource CancellationTokenSource = cancellationTokenSource; 431(t, s) => CompleteWithTask(t, ((CancellationTokenSource)s!).Token), 507CancellationTokenSource? cancellationTokenSource = null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
419public readonly CancellationTokenSource Cancellation = new CancellationTokenSource();
vbc (2)
src\Compilers\Shared\BuildServerConnection.cs (2)
296var 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)
296var 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)
89using 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,