Esben Skov Pedersen
Esben Skov Pedersen

Reputation: 4517

Is there a way to isolate a library that is blocking on async code

It is widely known that blocking on async code is a bad idea. As shown here and numerous other places. http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html

But if using a third party library that does this anyway, is there a way to isolate the problem by providing a proper synchronization context or another fix without rewriting the library.

The offender in this case is: https://github.com/launchdarkly/.net-client/blob/master/src/LaunchDarkly.Client/FeatureRequestor.cs and it seems to be causing us some problems.

Upvotes: 0

Views: 99

Answers (1)

Gusdor
Gusdor

Reputation: 14334

My recommendation is to call into the library from a worker thread.

This will provide the library with the default synchronization context and will no longer marshal to a single thread.

This is not a recommended workaround but it should do the trick.

Upvotes: 1

Related Questions