Workaround for issue in .NET 4.0 where SynchronizationContext.Current is null
问题 What is a workaround for the issue where the SynchronizationContext.Current is null unexpectedly on the main thread in .NET 4.0? See: SynchronizationContext.Current is null in Continuation on the main UI thread 回答1: I created several extension methods that matched ContinueWith and StartNew except that they also take an additional SyncronizationContext . I then use this argument to restore the expected SynchronizationContext before executing the action: Below, I've given examples: public