MongoDB.Driver.Core.Extensions.DiagnosticSources
MongoDB.Driver.Core.Extensions.DiagnosticSources copied to clipboard
Trying to set an Activity that is not running
Hi, could you please release the current master version ?
Thanks!
Hmm... seams that the error that i get is still in master.
System.InvalidOperationException: 'Trying to set an Activity that is not running'
In the Handle methods we always Stop the activity in the delegate from the WithReplacedActivityCurrent and this means that the finally from WithReplacedActivityCurrent will set to the Activity.Current a stopped activity and will throw because => https://github.com/dotnet/runtime/blob/041375910885f3a30ccf0bb8b751566dae7043f4/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L1378
If there is no reason to call Stop in the delegate we could put it after WithReplacedActivityCurrent.
Or if there is no reason to use WithReplacedActivityCurrent we could just remove it.
Fixed by #32