diff --git a/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs b/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs index 15941557d4..cd81496927 100644 --- a/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs +++ b/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs @@ -42,8 +42,10 @@ namespace Perspex.Threading /// public override void Send(SendOrPostCallback d, object state) { - // TODO: Add check for being on the main thread, we should invoke the method immediately in this case - Dispatcher.UIThread.InvokeTaskAsync(() => d(state)).Wait(); + if (Dispatcher.UIThread.CheckAccess()) + d(state); + else + Dispatcher.UIThread.InvokeTaskAsync(() => d(state)).Wait(); } } } \ No newline at end of file