You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is stopped successfully but only within this Task.Run 'child' context.
The second Task.Run is called from the 'parent' context, where Current is still set to "request" activity.
However the activity instance is shared between contexts, so activity is considered as stopped, and second stop does not attempt to change Current
publicvoidStop(){if(Id==null){
NotifyError(new InvalidOperationException("Trying to stop an Activity that was not started"));return;}if(!isFinished)// it is finished second time!{isFinished=true;if(Duration== TimeSpan.Zero){
SetEndTime(GetUtcNow());}Current=Parent;}}
When we attempt to stop all Activities on the way to parent here
we never alter Activity.Current and the loop never ends.
While it's invalid to expect correct behavior what AsyncLocal is modified in child context, it's totally possible to implement such behavior and we should not hang on it.
The text was updated successfully, but these errors were encountered:
Example:
Output:
What happens here is:
It is stopped successfully but only within this Task.Run 'child' context.
However the activity instance is shared between contexts, so activity is considered as stopped, and second stop does not attempt to change Current
Here is the Activity.Stop code
we never alter Activity.Current and the loop never ends.
While it's invalid to expect correct behavior what AsyncLocal is modified in child context, it's totally possible to implement such behavior and we should not hang on it.
The text was updated successfully, but these errors were encountered: