Closed zdamir closed 2 weeks ago
Hello,
the problem is that DiagnosticsActivityEventSubscriber
wants to return previously captured current activity to Activity.Current
property again. In the Activity.Current
setter there is a check that fails when the activity is stopped.
There is actually one more issue. The same code raises the exception also when you call a sync version of a mongo command. In this case, command's activity is the same as the Activity.Current
activity. Inside action()
, activity gets stopped, and afterwards activity is again assigned to Activity.Current
property.
Both issues are fixed in my PR: #32
Hi, I'm spammed with following exceptions, when running [MongoDB.Driver.Core.Extensions.DiagnosticSources] as a Source in Otel Tracing
System.InvalidOperationException HResult=0x80131509 Message=Trying to set an Activity that is not running Source=System.Diagnostics.DiagnosticSource StackTrace: at System.Diagnostics.Activity.NotifyError(Exception exception) in System.Diagnostics\Activity.cs:line 1146
Here's a stacktrace of issue
Any Idea why is this happening?
I can provide snippets if needed.
Thanks