Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Insire opened this issue Mar 25, 2024 · 1 comment

Comments

@Insire
Copy link

Insire commented Mar 25, 2024

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.

@Insire
Copy link
Author

Insire commented Apr 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant