Fix a deadlock which happens when running the the AspNetSynchronizationContext or LegacyAspNetSynchronizationContext. When using with a null SynchronizationContext, as what we have in a console app, the deadlock issue not occur.