Open fiseni opened 10 months ago
It seems there is a race condition. If there is an asynchronous execution, the ToBegin
returns before the callback is invoked. On the other hand, if the task is already completed, the callback is invoked before the ToBegin
manages to return a result.
Just to confirm this, I tried adding a small delay before the callback is invoked, and it works properly then.
EDIT: There is no even race condition here. If the task is already completed, CompleteAsync
will run synchronously, and a callback always will be invoked before ToBegin
returns;
Hi,
I observed a strange behavior in ApmAsyncFactory. If the task contains a path that returns synchronously, then the execution hangs. It's easy to reproduce, so I'll just provide an example. I'll use asmx web service to demonstrate the issue.
To be sure that this is not a generic problem, I tried the solution provided in this article, and it works without issues.