dotnet / reactive

The Reactive Extensions for .NET
http://reactivex.io
MIT License
6.73k stars 751 forks source link

Clear sync context on test that requires it to be absent #2026

Closed idg10 closed 1 year ago

idg10 commented 1 year ago

It turns out that occasionally, the test thread ends up with its SynchronizationContext.Current set to the Windows Forms sync context. That's bad because nothing runs a message loop, so when AsyncSubject attempts to complete an awaited operation, it tries to do so by posting a message to a queue that's never going to be processed.

So we explicitly set the context to null for the test that expects that.

Relates to (but doesn't fully deal with) #1885