jbogard / Respawn

Intelligent database cleaner for integration tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ConfigureAwait(false) to async method calls, to prevent potential deadlocks in the presence of a SynchronizationContext

Insire opened this issue · comments

Hi,

thanks for this awesome library! I'm using this at work to improve runtimes for our integration test suite. Using it with mssql even outperforms our previous solution with the inmemory variant of sqlite.

While it works great for our tests with x-unit that don't use a SynchronizationContext, i cant claim the same for our tests that bootstrap a WPF client in the same process as our backend. I'm encountering random deadlocks in our tests, that use Respawn.

I investigated this and the deadlocks all involve one of the async method calls in Respawn. To remedy this, i tried configuring all relevant async methods in my code with ConfigureAwait(false);. Sadly that didn't help, so i went one step further and added a reference to a local copy of the Respawn repository and added ConfigureAwait(false); to all the async methods in there aswell.

That did the trick for my use case and i was hoping I could open a PR to remedy this for everybody doing something similar.

Is there anything i can do to get this checked and maybe even merged @jbogard ?