163 references to CanBeCanceled
Aspire.Hosting (1)
Dcp\ResourceLogSource.cs (1)
23if (!cancellationToken.CanBeCanceled)
Aspire.Hosting.Tests (4)
PublishingTests.cs (4)
27Assert.True(context.CancellationToken.CanBeCanceled); 87Assert.True(context.CancellationToken.CanBeCanceled); 98Assert.True(context.CancellationToken.CanBeCanceled); 193Assert.True(context.CancellationToken.CanBeCanceled);
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TimeoutStream.cs (2)
51Contract.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable"); 78Contract.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable");
GenerateDocumentationAndConfigFiles (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
InMemory.FunctionalTests (8)
Http2\Http2StreamTests.cs (4)
5464Assert.False(context.RequestAborted.CanBeCanceled); 5551Assert.False(context.RequestAborted.CanBeCanceled); 5638Assert.False(context.RequestAborted.CanBeCanceled); 5727Assert.False(context.RequestAborted.CanBeCanceled);
Http3\Http3StreamTests.cs (4)
1725Assert.False(context.RequestAborted.CanBeCanceled); 1786Assert.False(context.RequestAborted.CanBeCanceled); 1848Assert.False(context.RequestAborted.CanBeCanceled); 1913Assert.False(context.RequestAborted.CanBeCanceled);
Metrics (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Metrics.Legacy (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.AspNetCore.Components.Server (2)
Circuits\RemoteJSDataStream.cs (2)
248if (!token1.CanBeCanceled) 253if (!token2.CanBeCanceled)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\HttpContextStreamWriter.cs (1)
48if (cancellationToken.CanBeCanceled)
Microsoft.AspNetCore.Hosting (1)
WebHostExtensions.cs (1)
82if (token.CanBeCanceled)
Microsoft.AspNetCore.Http.Extensions (7)
HttpResponseJsonExtensions.cs (5)
94if (!cancellationToken.CanBeCanceled) 125if (!cancellationToken.CanBeCanceled) 167if (!cancellationToken.CanBeCanceled) 273if (!cancellationToken.CanBeCanceled) 324if (!cancellationToken.CanBeCanceled)
SendFileResponseExtensions.cs (2)
92var useRequestAborted = !cancellationToken.CanBeCanceled; 114var useRequestAborted = !cancellationToken.CanBeCanceled;
Microsoft.AspNetCore.Server.HttpSys (4)
RequestProcessing\ClientCertLoader.cs (1)
41if (cancellationToken.CanBeCanceled)
RequestProcessing\RequestContext.cs (1)
57if (connectionDisconnectToken.CanBeCanceled)
RequestProcessing\RequestStream.cs (1)
233if (cancellationToken.CanBeCanceled)
RequestProcessing\ResponseStreamAsyncResult.cs (1)
30if (cancellationToken.CanBeCanceled)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (6)
Listener\ServerTests.cs (3)
41Assert.True(ct.CanBeCanceled, "CanBeCanceled"); 72Assert.False(ct.CanBeCanceled, "CanBeCanceled"); 94Assert.True(ct.CanBeCanceled, "CanBeCanceled");
RequestTests.cs (1)
514if (!ct.CanBeCanceled || ct.IsCancellationRequested)
ServerTests.cs (2)
285Assert.True(ct.CanBeCanceled, "CanBeCanceled"); 318Assert.True(ct.CanBeCanceled, "CanBeCanceled");
Microsoft.AspNetCore.SignalR.Client.Core (5)
HubConnection.cs (2)
674var cts = cancellationToken.CanBeCanceled ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : new CancellationTokenSource(); 752if (cancellationToken.CanBeCanceled)
src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (1)
85if (cancellationToken.CanBeCanceled)
src\SignalR\common\Shared\CreateLinkedToken.cs (2)
16if (!token1.CanBeCanceled) 21else if (!token2.CanBeCanceled)
Microsoft.AspNetCore.SignalR.Core (4)
src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (1)
85if (cancellationToken.CanBeCanceled)
src\SignalR\common\Shared\ClientResultsManager.cs (1)
138if (_token.CanBeCanceled)
src\SignalR\common\Shared\CreateLinkedToken.cs (2)
16if (!token1.CanBeCanceled) 21else if (!token2.CanBeCanceled)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
src\SignalR\common\Shared\ClientResultsManager.cs (1)
138if (_token.CanBeCanceled)
src\SignalR\common\Shared\CreateLinkedToken.cs (2)
16if (!token1.CanBeCanceled) 21else if (!token2.CanBeCanceled)
Microsoft.AspNetCore.TestHost.Tests (3)
ClientHandlerTests.cs (2)
27Assert.True(features.Get<IHttpRequestLifetimeFeature>().RequestAborted.CanBeCanceled); 76Assert.True(features.Get<IHttpRequestLifetimeFeature>().RequestAborted.CanBeCanceled);
HttpContextBuilderTests.cs (1)
41Assert.True(context.RequestAborted.CanBeCanceled);
Microsoft.CodeAnalysis (2)
DiagnosticAnalyzer\AsyncQueue.cs (1)
297if (!cancellationToken.CanBeCanceled || taskCompletionSource.Task.IsCompleted)
InternalUtilities\RoslynParallel.cs (1)
20var parallelOptions = cancellationToken.CanBeCanceled
Microsoft.CodeAnalysis.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.CSharp (1)
Parser\SyntaxParser.cs (1)
83if (preLexIfNotIncremental && !this.IsIncremental && !cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.InteractiveHost (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
Build\ProjectBuildManager.cs (1)
346if (cancellationToken.CanBeCanceled)
src\Compilers\Core\Portable\InternalUtilities\RoslynParallel.cs (1)
20var parallelOptions = cancellationToken.CanBeCanceled
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
RpcTests.cs (1)
242Assert.False(cancellationToken.CanBeCanceled);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
UtilityTest\CancellationSeriesTests.cs (1)
28Assert.True(token.CanBeCanceled);
Microsoft.Extensions.Caching.Hybrid (2)
Internal\DefaultHybridCache.cs (1)
131bool canBeCanceled = cancellationToken.CanBeCanceled;
Internal\DefaultHybridCache.StampedeStateT.cs (1)
87return token.CanBeCanceled && !Task.IsCompleted ? WithCancellationAsync(log, this, token) : UnwrapReservedAsync(log);
Microsoft.Extensions.Diagnostics.Testing (1)
Metrics\MetricCollector.cs (1)
227if (cancellationToken.CanBeCanceled)
Microsoft.Extensions.Http.Diagnostics (1)
src\LegacySupport\TaskWaitAsync\TaskExtensions.cs (1)
24if (task.IsCompleted || (!cancellationToken.CanBeCanceled))
Microsoft.Extensions.Http.Polly.Tests (1)
PolicyHttpMessageHandlerTest.cs (1)
245Assert.True(ct.CanBeCanceled);
Microsoft.Extensions.ServiceDiscovery.Dns (1)
Resolver\DnsResolver.cs (1)
880if (hasTimeout || cancellationToken.CanBeCanceled)
Microsoft.JSInterop (1)
JSRuntime.cs (1)
133if (cancellationToken.CanBeCanceled)
Microsoft.JSInterop.Tests (4)
JSRuntimeExtensionsTest.cs (4)
101Assert.True(cts.CanBeCanceled); 123Assert.False(cts.CanBeCanceled); 147Assert.True(cts.CanBeCanceled); 167Assert.False(cts.CanBeCanceled);
Roslyn.Diagnostics.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
System.Data.Common (3)
System\Data\Common\DbCommand.cs (3)
130if (cancellationToken.CanBeCanceled) 171if (cancellationToken.CanBeCanceled) 203if (cancellationToken.CanBeCanceled)
System.IO.Pipelines (5)
System\IO\Pipelines\PipeAwaitable.cs (1)
49if (cancellationToken.CanBeCanceled && !IsCompleted)
System\IO\Pipelines\StreamPipeReader.cs (3)
248if (cancellationToken.CanBeCanceled) 323if (cancellationToken.CanBeCanceled) 394if (cancellationToken.CanBeCanceled)
System\IO\Pipelines\StreamPipeWriter.cs (1)
297if (cancellationToken.CanBeCanceled)
System.IO.Pipes (1)
System\IO\Pipes\NamedPipeClientStream.cs (1)
142if (cancellationToken.CanBeCanceled && waitTime > CancellationCheckInterval)
System.Linq.Parallel (4)
System\Linq\Parallel\QueryOperators\QuerySettings.cs (4)
111if (this.CancellationState.ExternalCancellationToken.CanBeCanceled && settings2.CancellationState.ExternalCancellationToken.CanBeCanceled) 128CancellationToken externalCancellationToken = (this.CancellationState.ExternalCancellationToken.CanBeCanceled) ? this.CancellationState.ExternalCancellationToken : settings2.CancellationState.ExternalCancellationToken; 160Debug.Assert(settings.CancellationState.MergedCancellationToken.CanBeCanceled);
System.Net.Http (3)
System\Net\Http\HttpClient.cs (1)
796if (hasTimeout || cancellationToken.CanBeCanceled)
System\Net\Http\SocketsHttpHandler\CreditWaiter.cs (1)
95_registration.Unregister() || !_cancellationToken.CanBeCanceled;
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
1271CancellationTokenRegistration linkedRegistration = cancellationToken.CanBeCanceled && cancellationToken != _requestBodyCancellationSource.Token ?
System.Net.Mail (1)
System\Net\Mail\SmtpClient.cs (1)
425if (cancellationToken.CanBeCanceled)
System.Net.NameResolution (1)
System\Net\Dns.cs (1)
768if (cancellationToken.CanBeCanceled)
System.Net.Quic (2)
System\Net\Quic\Internal\ResettableValueTaskSource.cs (1)
78if (cancellationToken.CanBeCanceled)
System\Net\Quic\Internal\ValueTaskSource.cs (1)
65if (cancellationToken.CanBeCanceled)
System.Net.Sockets (2)
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
888if (cancellationToken.CanBeCanceled)
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
689Debug.Assert(!cancellationToken.CanBeCanceled, "Task-based connect logic should not use _multipleConnectCancellation for cancellation.");
System.Net.WebSockets (1)
System\Net\WebSockets\ManagedWebSocket.cs (1)
481return cancellationToken.CanBeCanceled || !lockTask.IsCompletedSuccessfully ?
System.Net.WebSockets.Client (1)
System\Net\WebSockets\WebSocketHandle.Managed.cs (1)
113if (cancellationToken.CanBeCanceled) // avoid allocating linked source if external token is not cancelable
System.Private.CoreLib (17)
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationToken.cs (3)
23/// <see cref="CanBeCanceled"/> is false will never change to one that can be canceled. 107/// both <see cref="CanBeCanceled"/> and <see cref="IsCancellationRequested"/> will be false. 109/// both <see cref="CanBeCanceled"/> and <see cref="IsCancellationRequested"/> will be true.
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (4)
852!token1.CanBeCanceled ? CreateLinkedTokenSource(token2) : 853token2.CanBeCanceled ? new Linked2CancellationTokenSource(token1, token2) : 863token.CanBeCanceled ? new Linked1CancellationTokenSource(token) : new CancellationTokenSource(); 958if (tokens[i].CanBeCanceled)
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
712return (millisecondsTimeout == Timeout.Infinite && !cancellationToken.CanBeCanceled) ?
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs (1)
588if (IsCompleted || (!cancellationToken.CanBeCanceled && millisecondsTimeout == Timeout.UnsignedInfinite))
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (8)
593if (cancellationToken.CanBeCanceled) 2834if (IsCompleted || (!cancellationToken.CanBeCanceled && millisecondsTimeout == Timeout.UnsignedInfinite)) 3002if (millisecondsTimeout == Timeout.Infinite && !cancellationToken.CanBeCanceled && 4462if (cancellationToken.CanBeCanceled) 4991if (millisecondsTimeout != Timeout.Infinite || cancellationToken.CanBeCanceled) 5776cancellationToken.CanBeCanceled ? new DelayPromiseWithCancellation(millisecondsDelay, timeProvider, cancellationToken) : 5857Debug.Assert(token.CanBeCanceled); 7052if (cancellationToken.CanBeCanceled && !waitTask.IsCompleted)
System.ServiceModel.Primitives (4)
System\ServiceModel\Channels\TimeoutStream.cs (4)
59Fx.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable"); 69Fx.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable"); 102Fx.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable"); 112Fx.Assert(!cancellationToken.CanBeCanceled, "cancellationToken shouldn't be cancellable");
System.Threading.Channels (18)
System\Threading\Channels\AsyncOperation.cs (4)
106Debug.Assert(!pooled || !cancellationToken.CanBeCanceled); 112if (cancellationToken.CanBeCanceled) 181!CancellationToken.CanBeCanceled || 193!CancellationToken.CanBeCanceled ||
System\Threading\Channels\BoundedChannel.cs (4)
173if (!cancellationToken.CanBeCanceled) 220if (!cancellationToken.CanBeCanceled) 498if (!cancellationToken.CanBeCanceled) 574if (!cancellationToken.CanBeCanceled)
System\Threading\Channels\RendezvousChannel.cs (4)
159!cancellationToken.CanBeCanceled && _readerSingleton.TryOwnAndReset() ? _readerSingleton : 215!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset() ? _waiterSingleton : 365!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset() ? _waiterSingleton : 401!cancellationToken.CanBeCanceled && _writerSingleton.TryOwnAndReset() ? _writerSingleton :
System\Threading\Channels\SingleConsumerUnboundedChannel.cs (2)
102if (!cancellationToken.CanBeCanceled && _readerSingleton.TryOwnAndReset()) 174if (!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset())
System\Threading\Channels\UnboundedChannel.cs (2)
102!cancellationToken.CanBeCanceled && _readerSingleton.TryOwnAndReset() ? _readerSingleton : 170!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset() ? _waiterSingleton :
System\Threading\Channels\UnboundedPriorityChannel.cs (2)
103!cancellationToken.CanBeCanceled && _readerSingleton.TryOwnAndReset() ? _readerSingleton : 175!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset() ? _waiterSingleton :
System.Threading.RateLimiting (4)
System\Threading\RateLimiting\ConcurrencyLimiter.cs (1)
431if (cancellationToken.CanBeCanceled)
System\Threading\RateLimiting\FixedWindowRateLimiter.cs (1)
469if (cancellationToken.CanBeCanceled)
System\Threading\RateLimiting\SlidingWindowRateLimiter.cs (1)
482if (cancellationToken.CanBeCanceled)
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (1)
483if (cancellationToken.CanBeCanceled)
System.Threading.Tasks.Dataflow (6)
Base\DataflowBlock.cs (3)
398if (cancellationToken.CanBeCanceled) 1047if (cancellationToken.CanBeCanceled) 1070if (target._cts.Token.CanBeCanceled)
Blocks\ActionBlock.cs (1)
83!dataflowBlockOptions.CancellationToken.CanBeCanceled &&
Blocks\WriteOnceBlock.cs (1)
78if (dataflowBlockOptions.CancellationToken.CanBeCanceled)
Internal\Common.cs (1)
187else if (cancellationToken.CanBeCanceled)
System.Threading.Tasks.Parallel (4)
System\Threading\Tasks\Parallel.cs (4)
958CancellationTokenRegistration ctr = (!parallelOptions.CancellationToken.CanBeCanceled) 1120if (parallelOptions.CancellationToken.CanBeCanceled) 2557CancellationTokenRegistration ctr = (!parallelOptions.CancellationToken.CanBeCanceled) 2757if (parallelOptions.CancellationToken.CanBeCanceled)
System.Windows.Forms.Primitives.TestUtilities (2)
Extensions\AssertExtensions.cs (2)
259if (cancellationToken.CanBeCanceled) 274if (cancellationToken.CanBeCanceled)
Test.Utilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)
Text.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
91if (cancellationToken.CanBeCanceled)