static async Task NestedLeakingSynchronizationContext_DoWorkAsync() { var sc = new NestedSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(sc); Assert.AreSame(sc, SynchronizationContext.Current); await Task.Yield(); Assert.AreSame(sc, SynchronizationContext.Current); }
static async Task NestedLeakingSynchronizationContext_DoWorkAsync () { var sc = new NestedSynchronizationContext (); SynchronizationContext.SetSynchronizationContext (sc); Assert.AreSame (sc, SynchronizationContext.Current); await Task.Yield (); Assert.AreSame (sc, SynchronizationContext.Current); }