4 instantiations of ExecutionContext
System.Private.CoreLib (4)
src\libraries\System.Private.CoreLib\src\System\Threading\ExecutionContext.cs (4)
22internal static readonly ExecutionContext Default = new ExecutionContext(); 24internal static readonly ExecutionContext DefaultFlowSuppressed = new ExecutionContext(AsyncLocalValueMap.Empty, new IAsyncLocal[0], isFlowSuppressed: true); 110return new ExecutionContext(m_localValues, m_localChangeNotifications, isFlowSuppressed); 546new ExecutionContext(newValues, newChangeNotifications, isFlowSuppressed);
334 references to ExecutionContext
Aspire.Dashboard (5)
Otlp\Storage\Subscription.cs (1)
27public Subscription(string name, ResourceKey? resourceKey, SubscriptionType subscriptionType, Func<Task> callback, Action unsubscribe, ExecutionContext? executionContext, TelemetryRepository telemetryRepository)
Otlp\Storage\TelemetryRepository.cs (1)
282}, ExecutionContext.Capture(), this);
Utils\CallbackThrottler.cs (3)
14public CallbackThrottler(string name, ILogger logger, TimeSpan minExecuteInterval, Func<Task> callback, ExecutionContext? executionContext) 30private readonly ExecutionContext? _executionContext; 111ExecutionContext.Restore(_executionContext);
Aspire.Dashboard.Tests (1)
TelemetryRepositoryTests\LogTests.cs (1)
584using (ExecutionContext.SuppressFlow())
AzureFunctionsEndToEnd.Functions (1)
artifacts\obj\AzureFunctionsEndToEnd.Functions\Debug\net8.0\AzureFunctionsEndToEnd.Functions.GlobalUsings.g.cs (1)
9global using ExecutionContext = System.Threading.ExecutionContext;
Microsoft.AspNetCore.Components (4)
RenderTree\Renderer.cs (4)
245var executionContext = ExecutionContext.Capture(); 1388private sealed class HotReloadRenderHandler(Renderer renderer, ExecutionContext? executionContext) 1398ExecutionContext.Run(executionContext, static s => ((Renderer)s!).RenderRootComponentsOnHotReload(), renderer);
Microsoft.AspNetCore.Components.WebView.Photino (5)
PhotinoSynchronizationContext.cs (5)
227ExecutionContext executionContext = null; 228if (!ExecutionContext.IsFlowSuppressed()) 230executionContext = ExecutionContext.Capture(); 288ExecutionContext.Run(item.ExecutionContext, ExecutionContextThunk, item); 320public ExecutionContext ExecutionContext;
Microsoft.AspNetCore.Http.Connections (3)
src\Shared\NonCapturingTimer\NonCapturingTimer.cs (3)
24if (!ExecutionContext.IsFlowSuppressed()) 26ExecutionContext.SuppressFlow(); 37ExecutionContext.RestoreFlow();
Microsoft.AspNetCore.Server.Kestrel.Core (4)
Internal\BaseHttpConnectionContext.cs (1)
50public ExecutionContext? InitialExecutionContext { get; set; }
Internal\Http\HttpProtocol.cs (2)
635_context.InitialExecutionContext = ExecutionContext.Capture(); 642ExecutionContext.Restore(_context.InitialExecutionContext);
Internal\Http2\Http2Connection.cs (1)
163_context.InitialExecutionContext = ExecutionContext.Capture();
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\NonCapturingTimer\NonCapturingTimer.cs (3)
24if (!ExecutionContext.IsFlowSuppressed()) 26ExecutionContext.SuppressFlow(); 37ExecutionContext.RestoreFlow();
Microsoft.AspNetCore.SignalR.Client.Core (3)
src\Shared\NonCapturingTimer\NonCapturingTimer.cs (3)
24if (!ExecutionContext.IsFlowSuppressed()) 26ExecutionContext.SuppressFlow(); 37ExecutionContext.RestoreFlow();
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
src\Shared\NonCapturingTimer\NonCapturingTimer.cs (3)
24if (!ExecutionContext.IsFlowSuppressed()) 26ExecutionContext.SuppressFlow(); 37ExecutionContext.RestoreFlow();
Microsoft.AspNetCore.TestHost (2)
TestServer.cs (1)
143/// Gets or sets a value that controls if <see cref="ExecutionContext"/> and <see cref="AsyncLocal{T}"/> values are preserved from the client to the server. The default value is <see langword="false" />.
TestServerOptions.cs (1)
19/// Gets or sets a value that controls if <see cref="ExecutionContext"/> and <see cref="AsyncLocal{T}"/> values are preserved from the client to the server. The default value is <see langword="false" />.
Microsoft.CodeAnalysis.Workspaces (2)
Utilities\FlowControlHelper.cs (2)
13=> new(ExecutionContext.IsFlowSuppressed() ? default : ExecutionContext.SuppressFlow());
Microsoft.Extensions.Diagnostics.HealthChecks (3)
src\Shared\NonCapturingTimer\NonCapturingTimer.cs (3)
24if (!ExecutionContext.IsFlowSuppressed()) 26ExecutionContext.SuppressFlow(); 37ExecutionContext.RestoreFlow();
Microsoft.Extensions.FileProviders.Physical (3)
src\libraries\Common\src\Extensions\NonCapturingTimer\NonCapturingTimer.cs (3)
22if (!ExecutionContext.IsFlowSuppressed()) 24ExecutionContext.SuppressFlow(); 35ExecutionContext.RestoreFlow();
Microsoft.Extensions.Http (3)
src\libraries\Common\src\Extensions\NonCapturingTimer\NonCapturingTimer.cs (3)
22if (!ExecutionContext.IsFlowSuppressed()) 24ExecutionContext.SuppressFlow(); 35ExecutionContext.RestoreFlow();
Microsoft.Extensions.ServiceDiscovery (9)
Http\HttpServiceEndpointResolver.cs (3)
85if (!ExecutionContext.IsFlowSuppressed()) 87ExecutionContext.SuppressFlow(); 98ExecutionContext.RestoreFlow();
ServiceEndpointResolver.cs (3)
93if (!ExecutionContext.IsFlowSuppressed()) 95ExecutionContext.SuppressFlow(); 106ExecutionContext.RestoreFlow();
ServiceEndpointWatcher.cs (3)
108if (!ExecutionContext.IsFlowSuppressed()) 110ExecutionContext.SuppressFlow(); 120ExecutionContext.RestoreFlow();
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1129[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.ExecutionContext))]
netstandard (1)
netstandard.cs (1)
2078[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.ExecutionContext))]
ScenarioTests.Common.Tests (5)
ScenarioTestTypes.cs (5)
189if (ExecutionContext.IsFlowSuppressed()) 195var ec = ExecutionContext.Capture(); 199var s = ((SendOrPostCallback d, object state, ExecutionContext ec))obj; 200ExecutionContext.Run(s.ec, new ContextCallback(d), s.state);
System.Data.Odbc (3)
src\libraries\Common\src\System\Data\Common\AdapterUtil.Drivers.cs (3)
18if (!ExecutionContext.IsFlowSuppressed()) 20ExecutionContext.SuppressFlow(); 30ExecutionContext.RestoreFlow();
System.IO.Pipelines (6)
System\IO\Pipelines\CompletionData.cs (2)
12public ExecutionContext? ExecutionContext { get; } 15public CompletionData(Action<object?> completion, object? completionState, ExecutionContext? executionContext, SynchronizationContext? synchronizationContext)
System\IO\Pipelines\Pipe.cs (1)
869ExecutionContext.Run(completionData.ExecutionContext, s_executionContextRawCallback, state);
System\IO\Pipelines\PipeAwaitable.cs (3)
91ExecutionContext? executionContext = schedulingContext?.ExecutionContext; 143_schedulingContext.ExecutionContext = ExecutionContext.Capture(); 207public ExecutionContext? ExecutionContext { get; set; }
System.Net.Http (6)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
733using (ExecutionContext.SuppressFlow())
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
234using (ExecutionContext.SuppressFlow()) 263using (ExecutionContext.SuppressFlow())
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (1)
100using (ExecutionContext.SuppressFlow())
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (2)
97using (ExecutionContext.SuppressFlow()) // Don't capture the current ExecutionContext and its AsyncLocals onto the timer causing them to live forever 189using (ExecutionContext.SuppressFlow())
System.Net.NetworkInformation (18)
System\Net\NetworkInformation\NetworkAddressChange.cs (4)
13private static readonly Dictionary<NetworkAddressChangedEventHandler, ExecutionContext?> s_addressChangedSubscribers = 14new Dictionary<NetworkAddressChangedEventHandler, ExecutionContext?>(); 17private static readonly Dictionary<NetworkAvailabilityChangedEventHandler, ExecutionContext?> s_availabilityChangedSubscribers = 18new Dictionary<NetworkAvailabilityChangedEventHandler, ExecutionContext?>();
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (14)
63s_addressChangedSubscribers.TryAdd(value, ExecutionContext.Capture()); 109using (ExecutionContext.SuppressFlow()) 115s_availabilityChangedSubscribers.TryAdd(value, ExecutionContext.Capture()); 171using (ExecutionContext.SuppressFlow()) 266Dictionary<NetworkAddressChangedEventHandler, ExecutionContext?>? addressChangedSubscribers = null; 272addressChangedSubscribers = new Dictionary<NetworkAddressChangedEventHandler, ExecutionContext?>(s_addressChangedSubscribers); 278foreach (KeyValuePair<NetworkAddressChangedEventHandler, ExecutionContext?> 282ExecutionContext? ec = subscriber.Value; 290ExecutionContext.Run(ec, s_runAddressChangedHandler, handler); 298Dictionary<NetworkAvailabilityChangedEventHandler, ExecutionContext?>? availabilityChangedSubscribers = null; 308new Dictionary<NetworkAvailabilityChangedEventHandler, ExecutionContext?>( 320foreach (KeyValuePair<NetworkAvailabilityChangedEventHandler, ExecutionContext?> 324ExecutionContext? ec = subscriber.Value; 332ExecutionContext.Run(ec, callbackContext, handler);
System.Net.Requests (12)
src\libraries\Common\src\System\Net\ContextAwareResult.cs (12)
24private readonly ExecutionContext? _savedContext; 26internal CallbackClosure(ExecutionContext context, AsyncCallback? callback) 60internal ExecutionContext? Context 85private volatile ExecutionContext? _context; 127internal ExecutionContext? ContextCopy 137ExecutionContext? context = _context; 205ExecutionContext? cachedContext = null; 223ExecutionContext? cachedContext; 268private bool CaptureOrComplete(ref ExecutionContext? cachedContext, bool returnContext) 290cachedContext ??= ExecutionContext.Capture(); 350ExecutionContext? context = _context; 361ExecutionContext.Run(context, s => ((ContextAwareResult)s!).CompleteCallback(), this);
System.Net.Sockets (6)
System\Net\Sockets\SocketAsyncEventArgs.cs (6)
73private ExecutionContext? _context; 564_context = ExecutionContext.Capture(); 661ExecutionContext? context = _context; // store context before it's cleared as part of finishing the operation 671ExecutionContext.Run(context, s_executionCallback, this); 1030ExecutionContext? context = _context; // store context before it's cleared as part of finishing the operation 1041ExecutionContext.Run(context, s_executionCallback, this);
System.Private.CoreLib (165)
src\libraries\Common\src\System\TimeProvider.cs (2)
156/// <see cref="CreateTimer"/> captures the <see cref="ExecutionContext"/> and stores that with the <see cref="ITimer"/> for use in invoking <paramref name="callback"/> 157/// each time it's called. That capture can be suppressed with <see cref="ExecutionContext.SuppressFlow"/>.
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.ThreadPoolValueTaskSource.cs (3)
35private ExecutionContext? _context; 161ExecutionContext.RunForThreadPoolUnsafe(_context, static x => x.ExecuteInternal(), this); 167_context = ExecutionContext.Capture();
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (4)
644private ExecutionContext? _context; 678_context = ExecutionContext.Capture(); 700ExecutionContext? context = _context; 714ExecutionContext.RunInternal(context, invokeAsyncCallback, this);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs (1)
26/// <summary>Invokes <see cref="IAsyncStateMachine.MoveNext"/> on the state machine while guarding the <see cref="ExecutionContext"/>.</summary>
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs (3)
33ExecutionContext? previousExecutionCtx = currentThread._executionContext; 49ExecutionContext? currentExecutionCtx = currentThread._executionContext; 52ExecutionContext.RestoreChangedContextToThread(currentThread, previousExecutionCtx, currentExecutionCtx);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (9)
158ExecutionContext? currentContext = ExecutionContext.CaptureForSuspension(Thread.CurrentThread); 338public ref ExecutionContext? Context 342Debug.Assert(m_stateObject is null or ExecutionContext, $"Expected {nameof(m_stateObject)} to be null or an ExecutionContext but was {(m_stateObject is object o ? o.GetType().ToString() : "(null)")}."); 343return ref Unsafe.As<object?, ExecutionContext?>(ref m_stateObject); 362ExecutionContext? context = Context; 363if (context == ExecutionContext.DefaultFlowSuppressed) 372ExecutionContext.RunInternal(context, s_callback, this); 376ExecutionContext.RunFromThreadPoolDispatchLoop(threadPoolThread, context, s_callback, this);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (6)
157ExecutionContext? currentContext = ExecutionContext.CaptureForSuspension(Thread.CurrentThread); 242public ExecutionContext? Context; 404ExecutionContext? context = Context; 406if (context == ExecutionContext.DefaultFlowSuppressed) 413ExecutionContext.RunInternal(context, s_callback, this);
src\libraries\System.Private.CoreLib\src\System\Threading\AsyncLocal.cs (2)
35object? value = ExecutionContext.GetLocalValue(this); 45ExecutionContext.SetLocalValue(this, value, _valueChangedHandler is not null);
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationToken.cs (8)
125/// The current <see cref="ExecutionContext">ExecutionContext</see>, if one exists, will be captured 146/// The current <see cref="ExecutionContext">ExecutionContext</see>, if one exists, will be captured 178/// The current <see cref="ExecutionContext">ExecutionContext</see>, if one exists, will be captured 193/// generates will be propagated out of this method call. The current <see cref="ExecutionContext">ExecutionContext</see>, if one exists, 214/// The current <see cref="ExecutionContext">ExecutionContext</see>, if one exists, 241/// <see cref="ExecutionContext">ExecutionContext</see> is not captured nor flowed 256/// generates will be propagated out of this method call. <see cref="ExecutionContext"/> is not captured nor flowed to the callback's invocation. 293source.Register(callback, state, useSynchronizationContext ? SynchronizationContext.Current : null, useExecutionContext ? ExecutionContext.Capture() : null) :
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (8)
218using (ExecutionContext.SuppressFlow()) 243/// The <see cref="ExecutionContext"/> that was captured when each callback was registered 268/// The <see cref="ExecutionContext"/> that was captured when each callback was registered 300/// The <see cref="ExecutionContext"/> that was captured when each callback was registered 587Delegate callback, object? stateForCallback, SynchronizationContext? syncContext, ExecutionContext? executionContext) 1190public ExecutionContext? ExecutionContext; 1201ExecutionContext? context = ExecutionContext; 1209ExecutionContext.RunInternal(context, static s =>
src\libraries\System.Private.CoreLib\src\System\Threading\ExecutionContext.cs (32)
22internal static readonly ExecutionContext Default = new ExecutionContext(); 24internal static readonly ExecutionContext DefaultFlowSuppressed = new ExecutionContext(AsyncLocalValueMap.Empty, new IAsyncLocal[0], isFlowSuppressed: true); 54public static ExecutionContext? Capture() 56ExecutionContext? executionContext = Thread.CurrentThread._executionContext; 70internal static ExecutionContext? CaptureForRestore() 86internal static ExecutionContext? CaptureForSuspension(Thread currentThread) 90ExecutionContext? executionContext = currentThread._executionContext; 99private ExecutionContext? ShallowClone(bool isFlowSuppressed) 116ExecutionContext? executionContext = currentThread._executionContext ?? Default; 131ExecutionContext? executionContext = currentThread._executionContext; 142ExecutionContext? executionContext = Thread.CurrentThread._executionContext; 150public static void Run(ExecutionContext executionContext, ContextCallback callback, object? state) 161internal static void RunInternal(ExecutionContext? executionContext, ContextCallback callback, object? state) 170ExecutionContext? previousExecutionCtx0 = currentThread._executionContext; 177ExecutionContext? previousExecutionCtx = previousExecutionCtx0; 211ExecutionContext? currentExecutionCtx = currentThread._executionContext; 230public static void Restore(ExecutionContext executionContext) 240internal static void RestoreInternal(ExecutionContext? executionContext) 244ExecutionContext? currentExecutionCtx = currentThread._executionContext; 263internal static void RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext? executionContext, ContextCallback callback, object state) 292ExecutionContext? currentExecutionCtx = currentThread._executionContext; 307internal static void RunForThreadPoolUnsafe<TState>(ExecutionContext executionContext, Action<TState> callback, in TState state) 327internal static void RestoreChangedContextToThread(Thread currentThread, ExecutionContext? contextToRestore, ExecutionContext? currentContext) 346ExecutionContext? currentExecutionCtx = currentThread._executionContext; 370internal static void OnValuesChanged(ExecutionContext? previousExecutionCtx, ExecutionContext? nextExecutionCtx) 465ExecutionContext? current = Thread.CurrentThread._executionContext; 479ExecutionContext? current = Thread.CurrentThread._executionContext; 554public ExecutionContext CreateCopy() 597if (!ExecutionContext.IsFlowSuppressed()) 603ExecutionContext.RestoreFlow();
src\libraries\System.Private.CoreLib\src\System\Threading\IOCompletionCallbackHelper.cs (3)
12private readonly ExecutionContext _executionContext; 17public IOCompletionCallbackHelper(IOCompletionCallback ioCompletionCallback, ExecutionContext executionContext) 57ExecutionContext.RunInternal(helper._executionContext, IOCompletionCallback_Context_Delegate, helper);
src\libraries\System.Private.CoreLib\src\System\Threading\Overlapped.cs (2)
83ExecutionContext? ec = ExecutionContext.Capture();
src\libraries\System.Private.CoreLib\src\System\Threading\PeriodicTimer.cs (1)
73using (ExecutionContext.SuppressFlow())
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs (16)
130_capturedContext = ExecutionContext.Capture(); 140new CapturedSchedulerAndExecutionContext(sc, (ExecutionContext)_capturedContext); 149new CapturedSchedulerAndExecutionContext(ts, (ExecutionContext)_capturedContext); 189case ExecutionContext: 238else if (context is ExecutionContext or CapturedSchedulerAndExecutionContext) 255internal readonly ExecutionContext _executionContext; 257public CapturedSchedulerAndExecutionContext(object scheduler, ExecutionContext executionContext) 320Debug.Assert(capturedContext is ExecutionContext or CapturedSchedulerAndExecutionContext, $"{nameof(capturedContext)} is {capturedContext}"); 323ExecutionContext? currentContext = ExecutionContext.CaptureForRestore(); 325if (capturedContext is ExecutionContext ec) 327ExecutionContext.RestoreInternal(ec); // Restore the captured ExecutionContext before executing anything. 336ExecutionContext.RestoreInternal(currentContext); // Restore the current ExecutionContext. 361ExecutionContext.RestoreInternal(currentContext); 371ExecutionContext.Restore(cc._executionContext); // Restore the captured ExecutionContext before executing anything. 378ExecutionContext.RestoreInternal(currentContext); // Restore the current ExecutionContext.
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (10)
222internal ExecutionContext? m_capturedContext; // The execution context to run the task within, if any. Only set from non-concurrent contexts. 521CapturedContext = ExecutionContext.Capture(); 1532internal ExecutionContext? CapturedContext 1542return m_contingentProperties?.m_capturedContext ?? ExecutionContext.Default; 1552else if (value != ExecutionContext.Default) // not the default context, then inflate the contingent properties and set it 2332ExecutionContext? ec = CapturedContext; 2343ExecutionContext.RunInternal(ec, s_ecCallback, this); 2347ExecutionContext.RunFromThreadPoolDispatchLoop(threadPoolThread, ec, s_ecCallback, this); 2890using (ExecutionContext.SuppressFlow()) 5818using (ExecutionContext.SuppressFlow())
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (7)
523private readonly ExecutionContext? m_capturedContext; 538m_capturedContext = ExecutionContext.Capture(); 623ExecutionContext? context = m_capturedContext; 642ExecutionContext.CheckThreadPoolAndContextsAreDefault(); 652ExecutionContext.RunForThreadPoolUnsafe(context, s_invokeAction, m_action); 693ExecutionContext? context = m_capturedContext; 702ExecutionContext.RunInternal(context, callback, state);
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (6)
33internal ExecutionContext? _executionContext; 53ExecutionContext.RunInternal(_executionContext, s_threadStartContextCallback, this); 233startHelper._executionContext = captureContext ? ExecutionContext.Capture() : null; 269startHelper._executionContext = captureContext ? ExecutionContext.Capture() : null; 417public ExecutionContext? ExecutionContext => ExecutionContext.Capture();
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolBoundHandle.Unix.cs (1)
160/// <see cref="ExecutionContext"/> is not flowed to the invocation of the callback.
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (17)
1060ExecutionContext.ResetThreadPoolThread(currentThread); 1347private readonly ExecutionContext _context; 1358internal QueueUserWorkItemCallback(WaitCallback callback, object? state, ExecutionContext context) 1371ExecutionContext.RunForThreadPoolUnsafe(_context, s_executionContextShim, this); 1379private readonly ExecutionContext _context; 1381internal QueueUserWorkItemCallback(Action<TState> callback, TState state, ExecutionContext context) 1398ExecutionContext.RunForThreadPoolUnsafe(_context, callback, in _state); 1417ExecutionContext.CheckThreadPoolAndContextsAreDefault(); 1445ExecutionContext.CheckThreadPoolAndContextsAreDefault(); 1461private readonly ExecutionContext? _executionContext; 1474_executionContext = ExecutionContext.Capture(); 1495ExecutionContext? context = helper._executionContext; 1503ExecutionContext.Run(context, timedOut ? _ccbt : _ccbf, helper); 1694ExecutionContext? context = ExecutionContext.Capture(); 1712ExecutionContext? context = ExecutionContext.Capture();
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (5)
469private readonly ExecutionContext? _executionContext; 503_executionContext = ExecutionContext.Capture(); 711ExecutionContext? context = _executionContext; 720ExecutionContext.RunFromThreadPoolDispatchLoop(Thread.CurrentThread, context, s_callCallbackInContext, this); 724ExecutionContext.RunInternal(context, s_callCallbackInContext, this);
src\libraries\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.cs (2)
123data._executionContext = flowExecutionContext ? ExecutionContext.Capture() : null; 213ExecutionContext.Run(data._executionContext, callback, args);
src\libraries\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.OverlappedData.cs (1)
16internal ExecutionContext? _executionContext;
src\System\Runtime\CompilerServices\AsyncHelpers.CoreCLR.cs (15)
28public ExecutionContext? _previousExecutionCtx; 51ExecutionContext? currentExecutionCtx = _thread._executionContext; 54ExecutionContext.RestoreChangedContextToThread(_thread, _previousExecutionCtx, currentExecutionCtx); 213public ExecutionContext? ExecutionContext; 675private static ExecutionContext? CaptureExecutionContext() 677return ExecutionContext.CaptureForSuspension(Thread.CurrentThreadAssumedInitialized); 681private static void RestoreExecutionContext(ExecutionContext? previousExecCtx) 683if (previousExecCtx == ExecutionContext.DefaultFlowSuppressed) 689ExecutionContext? currentExecCtx = thread._executionContext; 692ExecutionContext.RestoreChangedContextToThread(thread, previousExecCtx, currentExecCtx); 697private static void CaptureContexts(out ExecutionContext? execCtx, out SynchronizationContext? syncCtx) 709private static void RestoreContexts(bool resumed, ExecutionContext? previousExecCtx, SynchronizationContext? previousSyncCtx) 719ExecutionContext? currentExecCtx = thread._executionContext; 722ExecutionContext.RestoreChangedContextToThread(thread, previousExecCtx, currentExecCtx); 732private static void RestoreContextsOnSuspension(bool resumed, ExecutionContext? previousExecCtx, SynchronizationContext? previousSyncCtx)
src\System\Threading\Thread.CoreCLR.cs (1)
31internal ExecutionContext? _executionContext; // this call context follows the logical thread
System.Runtime.Caching (6)
System\Runtime\Caching\CacheExpires.cs (3)
851if (!ExecutionContext.IsFlowSuppressed()) 853ExecutionContext.SuppressFlow(); 864ExecutionContext.RestoreFlow();
System\Runtime\Caching\MemoryCacheStatistics.cs (3)
176if (!ExecutionContext.IsFlowSuppressed()) 178ExecutionContext.SuppressFlow(); 188ExecutionContext.RestoreFlow();
System.ServiceModel.NetTcp (11)
System\ServiceModel\Channels\SocketConnection.cs (11)
200if (!ExecutionContext.IsFlowSuppressed()) 202ExecutionContext.SuppressFlow(); 210ExecutionContext.RestoreFlow(); 237ExecutionContext.RestoreFlow(); 283if (!ExecutionContext.IsFlowSuppressed()) 285ExecutionContext.SuppressFlow(); 295ExecutionContext.RestoreFlow(); 324ExecutionContext.RestoreFlow(); 766if (!ExecutionContext.IsFlowSuppressed()) 768ExecutionContext.SuppressFlow(); 779ExecutionContext.RestoreFlow();
System.ServiceModel.UnixDomainSocket (11)
System\ServiceModel\Channels\SocketConnection.cs (11)
182if (!ExecutionContext.IsFlowSuppressed()) 184ExecutionContext.SuppressFlow(); 192ExecutionContext.RestoreFlow(); 219ExecutionContext.RestoreFlow(); 264if (!ExecutionContext.IsFlowSuppressed()) 266ExecutionContext.SuppressFlow(); 274ExecutionContext.RestoreFlow(); 303ExecutionContext.RestoreFlow(); 730if (!ExecutionContext.IsFlowSuppressed()) 732ExecutionContext.SuppressFlow(); 743ExecutionContext.RestoreFlow();
System.Threading (6)
artifacts\obj\System.Threading\Debug\net11.0\System.Threading.Forwards.cs (1)
11[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.ExecutionContext))]
System\Threading\Barrier.cs (3)
136private readonly ExecutionContext? _ownerThreadContext; 233_ownerThreadContext = ExecutionContext.Capture(); 777ExecutionContext.Run(_ownerThreadContext, handler, this);
System\Threading\HostExecutionContextManager.cs (2)
9/// Normally, the current <see cref="HostExecutionContext"/> would be stored on the <see cref="ExecutionContext"/>. 11/// separating itself from the <see cref="ExecutionContext"/> to minimize unnecessary additions there.
System.Threading.Channels (10)
System\Threading\Channels\AsyncOperation.cs (10)
212if (ctx is null or ExecutionContext) 264ExecutionContext? ec = 266ctx as ExecutionContext ?? 277ExecutionContext.Run(ec, static s => 313_capturedContext = ExecutionContext.Capture(); 326new CapturedSchedulerAndExecutionContext(sc, (ExecutionContext)_capturedContext); 336new CapturedSchedulerAndExecutionContext(ts, (ExecutionContext)_capturedContext); 385Debug.Assert(_capturedContext is ExecutionContext); 395internal readonly ExecutionContext _executionContext; 397public CapturedSchedulerAndExecutionContext(object scheduler, ExecutionContext executionContext)
System.Threading.RateLimiting (3)
System\Threading\RateLimiting\TimerAwaitable.cs (3)
49if (!ExecutionContext.IsFlowSuppressed()) 51ExecutionContext.SuppressFlow(); 69ExecutionContext.RestoreFlow();
System.Threading.Tasks.Parallel (5)
System\Threading\Tasks\Parallel.ForEachAsync.cs (5)
522/// <summary>The <see cref="ExecutionContext"/> present at the time of the ForEachAsync invocation. This is only used if on the default scheduler.</summary> 523private readonly ExecutionContext? _executionContext; 549_executionContext = ExecutionContext.Capture(); 668/// <summary>Executes the task body using the <see cref="ExecutionContext"/> captured when ForEachAsync was invoked.</summary> 679ExecutionContext.Run(_executionContext, static o => ((ForEachAsyncState<TSource>)o!)._taskBody(o), this);
System.Windows.Forms (5)
System\Windows\Forms\Control.cs (3)
6109ExecutionContext.Run(tme._executionContext, s_invokeMarshaledCallbackHelperDelegate, tme); 6512ExecutionContext? executionContext = null; 6515executionContext = ExecutionContext.Capture();
System\Windows\Forms\Control.ThreadMethodEntry.cs (2)
25internal ExecutionContext? _executionContext; 37ExecutionContext? executionContext)