scientistproject / Scientist.net

A .NET library for carefully refactoring critical paths. It's a port of GitHub's Ruby Scientist library
MIT License
1.46k stars 95 forks source link

Resolve deadlock issue on async experiments when caller uses sync ove… #131

Closed zizhong-zhang closed 4 years ago

zizhong-zhang commented 4 years ago

…r async

zizhong-zhang commented 4 years ago

We have some legacy mvc (netframework 4.6.1) which has lots of synchronous code. We've found that when caller gets the Task.Result synchronously from Scientist.SicenceAsync<T>, context thread is blocked forever.

By appending configureAwait(false), it suggests task continuation resumes from threadpool hence avoid deadlock situation.

zizhong-zhang commented 4 years ago

thank you for the instant response on this. this is truly amazing! would you be okay to merge this in?

zizhong-zhang commented 4 years ago

hi @paulbreen , thanks for help merging the PR in. it would be fantastic if a new nuget release can be out so we will be able to consume it.

At the moment, we've forked your repo and publish a nuget from there however we know the best way to go long-term is to stick with the upstream.

Hope it does not take much effort for you to bump the version (e.g. 2.0.1)

Many thanks!

kmc059000 commented 3 years ago

We ran into a similar issue and in researching, we found that this PR had been merged almost a year ago, with no corresponding nuget package release. Would it be possible to deploy a new nuget package for this?