13 types derived from SynchronizationContext
Microsoft.AspNetCore.Components (1)
Rendering\RendererSynchronizationContext.cs (1)
10internal sealed class RendererSynchronizationContext : SynchronizationContext
Microsoft.AspNetCore.Components.WebView.Photino (1)
PhotinoSynchronizationContext.cs (1)
22internal class PhotinoSynchronizationContext : SynchronizationContext
Microsoft.AspNetCore.Shared.Tests (1)
SingleThreadedSynchronizationContext.cs (1)
12internal class SingleThreadedSynchronizationContext : SynchronizationContext
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
HubConnectionTests.cs (1)
2923private class OneAtATimeSynchronizationContext : SynchronizationContext, IAsyncDisposable
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs (1)
36internal sealed class DenyExecutionSynchronizationContext : SynchronizationContext
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (1)
src\Shared\test\Shared.Tests\SingleThreadedSynchronizationContext.cs (1)
12internal class SingleThreadedSynchronizationContext : SynchronizationContext
Microsoft.Extensions.Http.Polly.Tests (1)
src\Shared\test\Shared.Tests\SingleThreadedSynchronizationContext.cs (1)
12internal class SingleThreadedSynchronizationContext : SynchronizationContext
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (1)
src\Graphics\src\Graphics\Platforms\Windows\AsyncPump.cs (1)
88 private sealed class SingleThreadSynchronizationContext : SynchronizationContext
ScenarioTests.Common.Tests (2)
ScenarioTestTypes.cs (1)
176public class SingleThreadSynchronizationContext : SynchronizationContext
ThreadHoppingSynchronizationContext.cs (1)
9public class ThreadHoppingSynchronizationContext : SynchronizationContext
System.Windows.Forms (1)
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (1)
11public sealed class WindowsFormsSynchronizationContext : SynchronizationContext, IDisposable
System.Windows.Forms.UI.IntegrationTests (1)
Infra\DenyExecutionSynchronizationContext.cs (1)
9internal class DenyExecutionSynchronizationContext : SynchronizationContext
UnitTests.Common (1)
TestTypes.cs (1)
266public class SingleThreadSynchronizationContext : SynchronizationContext
8 instantiations of SynchronizationContext
Client.ChannelLayer.IntegrationTests (1)
DuplexChannelWithSynchronizationContext.cs (1)
178context.SynchronizationContext = new SynchronizationContext();
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs (1)
60UnderlyingContext = underlyingContext ?? new SynchronizationContext();
System.ComponentModel.EventBasedAsync (1)
System\ComponentModel\AsyncOperationManager.cs (1)
24SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
System.Private.CoreLib (2)
src\libraries\System.Private.CoreLib\src\System\Progress.cs (1)
102internal static readonly SynchronizationContext DefaultContext = new SynchronizationContext();
src\libraries\System.Private.CoreLib\src\System\Threading\SynchronizationContext.cs (1)
57public virtual SynchronizationContext CreateCopy() => new SynchronizationContext();
System.Windows.Forms (1)
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (1)
165? new SynchronizationContext()
System.Windows.Forms.UI.IntegrationTests (2)
Infra\DenyExecutionSynchronizationContext.cs (2)
58(_underlyingContext ?? new SynchronizationContext()).Post(d, state); 77(_underlyingContext ?? new SynchronizationContext()).Send(d, state);
275 references to SynchronizationContext
Binding.Http.IntegrationTests (4)
OperationContextTests.cs (4)
34var exisitingSyncContext = SynchronizationContext.Current; 37SynchronizationContext.SetSynchronizationContext(ThreadHoppingSynchronizationContext.Instance); 58SynchronizationContext.SetSynchronizationContext(exisitingSyncContext);
Binding.Tcp.IntegrationTests (12)
OperationContextAsyncFlowTests.cs (12)
23var exisitingSyncContext = SynchronizationContext.Current; 26SynchronizationContext.SetSynchronizationContext(ThreadHoppingSynchronizationContext.Instance); 45SynchronizationContext.SetSynchronizationContext(exisitingSyncContext); 58var exisitingSyncContext = SynchronizationContext.Current; 61SynchronizationContext.SetSynchronizationContext(ThreadHoppingSynchronizationContext.Instance); 92SynchronizationContext.SetSynchronizationContext(exisitingSyncContext); 153var exisitingSyncContext = SynchronizationContext.Current; 156SynchronizationContext.SetSynchronizationContext(ThreadHoppingSynchronizationContext.Instance); 174SynchronizationContext.SetSynchronizationContext(exisitingSyncContext);
Client.ChannelLayer.IntegrationTests (11)
DuplexChannelWithSynchronizationContext.cs (11)
58SynchronizationContext callbackSyncContext = callbackService.SynchronizationContext; 99var prevCtx = SynchronizationContext.Current; 100SynchronizationContext.SetSynchronizationContext(syncCtx); 113SynchronizationContext.SetSynchronizationContext(prevCtx); 122SynchronizationContext callbackSyncContext = callbackService.SynchronizationContext; 164Assert.IsType<TestTypes.SingleThreadSynchronizationContext>(SynchronizationContext.Current); 193SynchronizationContext callbackSyncContext = callbackService.SynchronizationContext; 229Assert.IsType<TestTypes.SingleThreadSynchronizationContext>(SynchronizationContext.Current); 268SynchronizationContext = SynchronizationContext.Current; 283public SynchronizationContext SynchronizationContext { get; private set; }
dotnet-svcutil-lib (14)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (3)
282(SynchronizationContext.Current == null || 283(SynchronizationContext.Current.GetType() == typeof(SynchronizationContext)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DispatchRuntime.cs (2)
32private SynchronizationContext _synchronizationContext; 180public SynchronizationContext SynchronizationContext
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ThreadBehavior.cs (7)
17private readonly SynchronizationContext _context; 71SynchronizationContext syncContext = GetSyncContext(rpc.InstanceContext); 93private SynchronizationContext GetSyncContext(InstanceContext instanceContext) 96SynchronizationContext syncContext = instanceContext.SynchronizationContext ?? _context; 110SynchronizationContext syncContext = GetSyncContext(resume.GetMessageInstanceContext()); 137internal static SynchronizationContext GetCurrentSynchronizationContext() 139return SynchronizationContext.Current;
FrameworkFork\System.ServiceModel\System\ServiceModel\InstanceContext.cs (2)
24private SynchronizationContext _synchronizationContext; 128public SynchronizationContext SynchronizationContext
Microsoft.AspNetCore.Components (5)
Rendering\RendererSynchronizationContext.cs (4)
26public override SynchronizationContext CreateCopy() => 62var original = Current; 101var original = Current; 239var original = Current;
Rendering\RendererSynchronizationContextDispatcher.cs (1)
19public override bool CheckAccess() => SynchronizationContext.Current == _context;
Microsoft.AspNetCore.Components.Server.Tests (7)
Circuits\CircuitHostTest.cs (7)
108var original = SynchronizationContext.Current; 109SynchronizationContext.SetSynchronizationContext(null); 114Assert.Null(SynchronizationContext.Current); 117Assert.Null(SynchronizationContext.Current); 122SynchronizationContext.SetSynchronizationContext(original); 745Assert.Same(Dispatcher, SynchronizationContext.Current);
Microsoft.AspNetCore.Components.Tests (10)
Rendering\RendererSynchronizationContextTest.cs (10)
113SynchronizationContext capturedContext = null; 131SynchronizationContext original = SynchronizationContext.Current; 135SynchronizationContext.SetSynchronizationContext(context); 139capturedContext = SynchronizationContext.Current; 145SynchronizationContext.SetSynchronizationContext(original); 273SynchronizationContext capturedContext = null; 281capturedContext = SynchronizationContext.Current; 381SynchronizationContext capturedContext = null; 389capturedContext = SynchronizationContext.Current;
Microsoft.AspNetCore.Components.WebAssembly (3)
Hosting\WebAssemblyHostBuilder.cs (2)
214if (WebAssemblyDispatcher._mainSynchronizationContext == null && SynchronizationContext.Current != null) 216WebAssemblyDispatcher._mainSynchronizationContext = SynchronizationContext.Current;
Rendering\WebAssemblyDispatcher.cs (1)
12internal static SynchronizationContext? _mainSynchronizationContext;
Microsoft.AspNetCore.Components.WebView.Photino (3)
PhotinoDispatcher.cs (1)
21public override bool CheckAccess() => SynchronizationContext.Current == _context;
PhotinoSynchronizationContext.cs (2)
188public override SynchronizationContext CreateCopy() 252var original = Current;
Microsoft.AspNetCore.Shared.Tests (1)
SingleThreadedSynchronizationContext.cs (1)
28var previous = Current;
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (4)
HubConnectionTests.cs (4)
2331var originalSynchronizationContext = SynchronizationContext.Current; 2332SynchronizationContext.SetSynchronizationContext(oneAtATimeSynchronizationContext); 2356SynchronizationContext.SetSynchronizationContext(originalSynchronizationContext);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (10)
Threading\StaTaskScheduler.cs (4)
69var oldContext = SynchronizationContext.Current; 78SynchronizationContext.SetSynchronizationContext(synchronizationContext); 86SynchronizationContext.SetSynchronizationContext(oldContext);
Threading\SynchronizationContextTaskScheduler.cs (3)
18private readonly SynchronizationContext _synchronizationContext; 20internal SynchronizationContextTaskScheduler(SynchronizationContext synchronizationContext) 36if (SynchronizationContext.Current == _synchronizationContext)
Threading\WpfDispatcherTaskJoiner.cs (1)
19public bool IsDispatcherSynchronizationContext(SynchronizationContext context)
Threading\WpfTestRunner.cs (2)
65Debug.Assert(SynchronizationContext.Current is DispatcherSynchronizationContext); 77SynchronizationContext.SetSynchronizationContext(null);
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Host\TaskScheduler\TaskSchedulerProvider.cs (1)
24=> (SynchronizationContext.Current != null) ? TaskScheduler.FromCurrentSynchronizationContext() : TaskScheduler.Default;
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (19)
MEF\IDispatcherTaskJoiner.cs (1)
12bool IsDispatcherSynchronizationContext(SynchronizationContext current);
TestExportJoinableTaskContext.cs (14)
33var synchronizationContext = SynchronizationContext.Current; 36SynchronizationContext.SetSynchronizationContext(GetEffectiveSynchronizationContext()); 42SynchronizationContext.SetSynchronizationContext(synchronizationContext); 46private static (JoinableTaskContext joinableTaskContext, SynchronizationContext synchronizationContext) CreateJoinableTaskContext(IDispatcherTaskJoiner? dispatcherTaskJoiner) 49SynchronizationContext synchronizationContext; 51var currentContext = SynchronizationContext.Current; 82internal SynchronizationContext SynchronizationContext 87internal static SynchronizationContext? GetEffectiveSynchronizationContext() 89if (SynchronizationContext.Current is AsyncTestSyncContext asyncTestSyncContext) 91SynchronizationContext? innerSynchronizationContext = null; 95innerSynchronizationContext = SynchronizationContext.Current; 103return SynchronizationContext.Current;
TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs (4)
53public DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext) 58private DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer) 67private SynchronizationContext UnderlyingContext 141public override SynchronizationContext CreateCopy()
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (1)
src\Shared\test\Shared.Tests\SingleThreadedSynchronizationContext.cs (1)
28var previous = Current;
Microsoft.Extensions.Http.Polly.Tests (1)
src\Shared\test\Shared.Tests\SingleThreadedSynchronizationContext.cs (1)
28var previous = Current;
Microsoft.Maui (3)
Dispatching\DispatcherExtensions.cs (3)
96 /// <returns>A <see cref="SynchronizationContext"/> object representing the current synchronization context.</returns> 97 public static Task<SynchronizationContext> GetSynchronizationContextAsync(this IDispatcher dispatcher) => 98 dispatcher.DispatchAsync(() => SynchronizationContext.Current!);
Microsoft.Maui.Controls (1)
Device.cs (1)
115 public static Task<SynchronizationContext> GetMainThreadSynchronizationContextAsync() =>
Microsoft.Maui.Controls.Compatibility (1)
Tizen\Forms.cs (1)
223 if (System.Threading.SynchronizationContext.Current == null)
Microsoft.Maui.Essentials (3)
MainThread\MainThread.shared.cs (3)
163 public static async Task<SynchronizationContext> GetMainThreadSynchronizationContextAsync() 165 SynchronizationContext ret = null; 167 ret = SynchronizationContext.Current).ConfigureAwait(false);
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (8)
src\Graphics\src\Graphics\Platforms\Windows\AsyncPump.cs (8)
32 var prevCtx = SynchronizationContext.Current; 37 SynchronizationContext.SetSynchronizationContext(syncCtx); 52 SynchronizationContext.SetSynchronizationContext(prevCtx); 63 var prevCtx = SynchronizationContext.Current; 68 SynchronizationContext.SetSynchronizationContext(syncCtx); 83 SynchronizationContext.SetSynchronizationContext(prevCtx);
Microsoft.VisualBasic.Forms (2)
Microsoft\VisualBasic\ApplicationServices\WindowsFormsApplicationBase.vb (1)
66Private _appSynchronizationContext As SynchronizationContext
Microsoft\VisualBasic\Devices\Network.Availability.vb (1)
29Private _synchronizationContext As SynchronizationContext
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1153[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.SynchronizationContext))]
netstandard (1)
netstandard.cs (1)
2105[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.SynchronizationContext))]
ScenarioTests.Common.Tests (8)
ScenarioTestTypes.cs (8)
251var prevCtx = SynchronizationContext.Current; 255SynchronizationContext.SetSynchronizationContext(syncCtx); 265SynchronizationContext.SetSynchronizationContext(prevCtx); 271var prevCtx = SynchronizationContext.Current; 275SynchronizationContext.SetSynchronizationContext(syncCtx); 285SynchronizationContext.SetSynchronizationContext(prevCtx);
System.ComponentModel.EventBasedAsync (9)
System\ComponentModel\AsyncOperation.cs (4)
10private readonly SynchronizationContext _syncContext; 17private AsyncOperation(object? userSuppliedState, SynchronizationContext syncContext) 38public SynchronizationContext SynchronizationContext 102internal static AsyncOperation CreateOperation(object? userSuppliedState, SynchronizationContext syncContext)
System\ComponentModel\AsyncOperationManager.cs (5)
18public static SynchronizationContext SynchronizationContext 22if (SynchronizationContext.Current == null) 24SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); 27return SynchronizationContext.Current!; 33SynchronizationContext.SetSynchronizationContext(value);
System.IO.Pipelines (10)
System\IO\Pipelines\CompletionData.cs (2)
13public SynchronizationContext? SynchronizationContext { get; } 15public CompletionData(Action<object?> completion, object? completionState, ExecutionContext? executionContext, SynchronizationContext? synchronizationContext)
System\IO\Pipelines\PipeAwaitable.cs (5)
92SynchronizationContext? synchronizationContext = schedulingContext?.SynchronizationContext; 131SynchronizationContext? sc = SynchronizationContext.Current; 132if (sc != null && sc.GetType() != typeof(SynchronizationContext)) 206public SynchronizationContext? SynchronizationContext { get; set; }
System\IO\Pipelines\PipeOptions.cs (3)
25/// <param name="useSynchronizationContext"><see langword="true" /> if asynchronous continuations should be executed on the <see cref="System.Threading.SynchronizationContext" /> they were captured on; <see langword="false" /> otherwise. This takes precedence over the schedulers specified in <see cref="System.IO.Pipelines.PipeOptions.ReaderScheduler" /> and <see cref="System.IO.Pipelines.PipeOptions.WriterScheduler" />.</param> 88/// <summary>Gets a value that determines if asynchronous callbacks and continuations should be executed on the <see cref="System.Threading.SynchronizationContext" /> they were captured on. This takes precedence over the schedulers specified in <see cref="System.IO.Pipelines.PipeOptions.ReaderScheduler" /> and <see cref="System.IO.Pipelines.PipeOptions.WriterScheduler" />.</summary> 89/// <value><see langword="true" /> if asynchronous callbacks and continuations should be executed on the <see cref="System.Threading.SynchronizationContext" /> they were captured on; otherwise, <see langword="false" />.</value>
System.Private.CoreLib (79)
src\libraries\System.Private.CoreLib\src\System\Progress.cs (6)
16/// <see cref="SynchronizationContext"/> instance captured 23private readonly SynchronizationContext _synchronizationContext; 34_synchronizationContext = SynchronizationContext.Current ?? ProgressStatics.DefaultContext; 43/// Depending on the <see cref="SynchronizationContext"/> instance captured by 58/// <see cref="SynchronizationContext"/> captured when the instance was constructed. 102internal static readonly SynchronizationContext DefaultContext = new SynchronizationContext();
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs (1)
34SynchronizationContext? previousSyncCtx = currentThread._synchronizationContext;
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncVoidMethodBuilder.cs (6)
17private SynchronizationContext? _synchronizationContext; 25SynchronizationContext? sc = SynchronizationContext.Current; 94SynchronizationContext? context = _synchronizationContext; 123SynchronizationContext? context = _synchronizationContext; 150private static void NotifySynchronizationContextOfCompletion(SynchronizationContext context)
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\YieldAwaitable.cs (6)
85SynchronizationContext? syncCtx = SynchronizationContext.Current; 86if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext)) 129SynchronizationContext? syncCtx = SynchronizationContext.Current; 130if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationToken.cs (5)
152/// the current <see cref="SynchronizationContext">SynchronizationContext</see> and use it 194/// will be captured along with the delegate and will be used when executing it. The current <see cref="SynchronizationContext"/> is not captured. 221/// the current <see cref="SynchronizationContext">SynchronizationContext</see> and use it 279/// the current <see cref="SynchronizationContext">SynchronizationContext</see> and use it 293source.Register(callback, state, useSynchronizationContext ? SynchronizationContext.Current : null, useExecutionContext ? ExecutionContext.Capture() : null) :
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (2)
587Delegate callback, object? stateForCallback, SynchronizationContext? syncContext, ExecutionContext? executionContext) 1203public SynchronizationContext? SynchronizationContext;
src\libraries\System.Private.CoreLib\src\System\Threading\ExecutionContext.cs (1)
163SynchronizationContext? previousSyncCtx = currentThread._synchronizationContext;
src\libraries\System.Private.CoreLib\src\System\Threading\SynchronizationContext.cs (3)
16public static SynchronizationContext? Current => Thread.CurrentThread._synchronizationContext; 55public static void SetSynchronizationContext(SynchronizationContext? syncContext) => Thread.CurrentThread._synchronizationContext = syncContext; 57public virtual SynchronizationContext CreateCopy() => new SynchronizationContext();
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ConfigureAwaitOptions.cs (1)
18/// Attempt to marshal the continuation back to the original <see cref="SynchronizationContext"/> or
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs (12)
135if (SynchronizationContext.Current is SynchronizationContext sc && 136sc.GetType() != typeof(SynchronizationContext)) 244Debug.Assert(context is TaskScheduler or SynchronizationContext, $"context is {context}"); 259Debug.Assert(scheduler is SynchronizationContext or TaskScheduler, $"{nameof(scheduler)} is {scheduler}"); 280context is SynchronizationContext or TaskScheduler or CapturedSchedulerAndExecutionContext, 285case SynchronizationContext sc: 295if (cc._scheduler is SynchronizationContext ccsc) 307static void ScheduleSynchronizationContext(SynchronizationContext sc, Action<object?> continuation, object? state) => 344SynchronizationContext? syncContext = SynchronizationContext.Current; 360SynchronizationContext.SetSynchronizationContext(syncContext);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (7)
1900internal static void ThrowAsync(Exception exception, SynchronizationContext? targetContext) 2502if (SynchronizationContext.Current is SynchronizationContext syncCtx && syncCtx.GetType() != typeof(SynchronizationContext)) 2575if (SynchronizationContext.Current is SynchronizationContext syncCtx && syncCtx.GetType() != typeof(SynchronizationContext))
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (6)
375private readonly SynchronizationContext m_syncContext; 382SynchronizationContext context, Action action, bool flowExecutionContext) : 396m_syncContext == SynchronizationContext.Current) 610SynchronizationContext? ctx = SynchronizationContext.Current; 611if (ctx != null && ctx.GetType() != typeof(SynchronizationContext)) return false;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskScheduler.cs (15)
328/// associated with the current <see cref="SynchronizationContext"/>. 333/// <see cref="SynchronizationContext.Post">Post</see> method 338/// the current <see cref="SynchronizationContext">SynchronizationContext</see>, as 339/// determined by <see cref="SynchronizationContext.Current">SynchronizationContext.Current</see>. 539/// <see cref="SynchronizationContext.Post"/> on the <see cref="SynchronizationContext"/> 540/// that its associated with. The default constructor for this class binds to the current <see cref="SynchronizationContext"/> 544private readonly SynchronizationContext m_synchronizationContext; 547/// Constructs a SynchronizationContextTaskScheduler associated with <see cref="SynchronizationContext.Current"/> 549/// <exception cref="InvalidOperationException">This constructor expects <see cref="SynchronizationContext.Current"/> to be set.</exception> 552m_synchronizationContext = SynchronizationContext.Current ?? 560/// Simply posts the tasks to be executed on the associated <see cref="SynchronizationContext"/>. 572/// the associated <see cref="SynchronizationContext"/>. 578if (SynchronizationContext.Current == m_synchronizationContext) 597/// By default it returns 1, because a <see cref="SynchronizationContext"/> based
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (6)
136SynchronizationContext? context = SynchronizationContext.Current; 309SynchronizationContext? context = SynchronizationContext.Current; 371SynchronizationContext? context = SynchronizationContext.Current;
src\System\Threading\SynchronizationContext.CoreCLR.cs (1)
8private static int InvokeWaitMethodHelper(SynchronizationContext syncContext, IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
src\System\Threading\Thread.CoreCLR.cs (1)
31internal SynchronizationContext? _synchronizationContext; // maintained separately from ExecutionContext
System.Threading (1)
artifacts\obj\System.Threading\Debug\net10.0\System.Threading.Forwards.cs (1)
27[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.SynchronizationContext))]
System.Threading.Channels (6)
System\Threading\Channels\AsyncOperation.cs (6)
68/// <summary>Scheduling context (a <see cref="SynchronizationContext"/> or <see cref="TaskScheduler"/>) to which to queue the continuation. May be null.</summary> 229SynchronizationContext? sc = null; 233sc = SynchronizationContext.Current; 234if (sc != null && sc.GetType() != typeof(SynchronizationContext)) 398else if (_schedulingContext is SynchronizationContext sc) 403if (_runContinuationsAsynchronously || sc != SynchronizationContext.Current)
System.Windows.Forms (21)
System\Windows\Forms\Control.cs (6)
6007if (SynchronizationContext.Current is null) 6012tme._syncContext = SynchronizationContext.Current; 6030SynchronizationContext? oldContext = SynchronizationContext.Current; 6034SynchronizationContext.SetSynchronizationContext(tme._syncContext); 6040SynchronizationContext.SetSynchronizationContext(oldContext);
System\Windows\Forms\Control.ThreadMethodEntry.cs (1)
29internal SynchronizationContext? _syncContext;
System\Windows\Forms\Dialogs\TaskDialog\TaskDialog.cs (3)
406if (SynchronizationContext.Current is null) 411var syncContext = SynchronizationContext.Current
System\Windows\Forms\Form.cs (6)
5503if (SynchronizationContext.Current is null) 5508var syncContext = SynchronizationContext.Current 5814if (SynchronizationContext.Current is null) 5819var syncContext = SynchronizationContext.Current
System\Windows\Forms\ToolTip\KeyboardToolTipStateMachine.cs (1)
180SynchronizationContext.Current?.Post(expirationCallback, tool);
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (4)
24private static SynchronizationContext? t_previousSyncContext; 92public override SynchronizationContext CreateCopy() 140SynchronizationContext currentContext = AsyncOperationManager.SynchronizationContext; 143if (currentContext is null || currentContext.GetType() == typeof(SynchronizationContext))
System.Windows.Forms.UI.IntegrationTests (7)
Infra\ControlTestBase.cs (2)
77_denyExecutionSynchronizationContext = new DenyExecutionSynchronizationContext(SynchronizationContext.Current!); 103SynchronizationContext.SetSynchronizationContext(_denyExecutionSynchronizationContext.UnderlyingContext);
Infra\DenyExecutionSynchronizationContext.cs (5)
11private readonly SynchronizationContext _underlyingContext; 15public DenyExecutionSynchronizationContext(SynchronizationContext underlyingContext) 20private DenyExecutionSynchronizationContext(SynchronizationContext underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer) 27internal SynchronizationContext UnderlyingContext => _underlyingContext; 81public override SynchronizationContext CreateCopy()
UnitTests.Common (8)
TestTypes.cs (8)
319var prevCtx = SynchronizationContext.Current; 323SynchronizationContext.SetSynchronizationContext(syncCtx); 333SynchronizationContext.SetSynchronizationContext(prevCtx); 339var prevCtx = SynchronizationContext.Current; 343SynchronizationContext.SetSynchronizationContext(syncCtx); 353SynchronizationContext.SetSynchronizationContext(prevCtx);