4 instantiations of ExecutionContext
System.Private.CoreLib (4)
334 references to ExecutionContext
Aspire.Dashboard (5)
Aspire.Dashboard.Tests (1)
AzureFunctionsEndToEnd.Functions (1)
Microsoft.AspNetCore.Components (4)
Microsoft.AspNetCore.Components.WebView.Photino (5)
Microsoft.AspNetCore.Http.Connections (3)
Microsoft.AspNetCore.Server.Kestrel.Core (4)
Microsoft.AspNetCore.Shared.Tests (3)
Microsoft.AspNetCore.SignalR.Client.Core (3)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
Microsoft.AspNetCore.TestHost (2)
Microsoft.CodeAnalysis.Workspaces (2)
Microsoft.Extensions.Diagnostics.HealthChecks (3)
Microsoft.Extensions.FileProviders.Physical (3)
Microsoft.Extensions.Http (3)
Microsoft.Extensions.ServiceDiscovery (9)
mscorlib (1)
netstandard (1)
ScenarioTests.Common.Tests (5)
System.Data.Odbc (3)
System.IO.Pipelines (6)
System.Net.Http (6)
System.Net.NetworkInformation (18)
System.Net.Requests (12)
System.Net.Sockets (6)
System.Private.CoreLib (165)
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\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\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\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)
System.Runtime.Caching (6)
System.ServiceModel.NetTcp (11)
System.ServiceModel.UnixDomainSocket (11)
System.Threading (6)
System.Threading.Channels (10)
System.Threading.RateLimiting (3)
System.Threading.Tasks.Parallel (5)
System.Windows.Forms (5)