Open vaind opened 9 months ago
As an additional issue docs explicitly say:
In cases where you want to attach Spans to an already ongoing Transaction you can use SentrySdk.GetSpan(). If there is a running Transaction or Span currently on the scope, this method will return a SentryTransaction or Span; otherwise, it returns null.
and then in another part they call
var span = SentrySdk.GetSpan(); // or hub.GetSpan() if (span != null) { var transaction = span.GetTransaction();
However, that doesn't seem to be right because SentryTransction doesn't have such a method.
However, that doesn't seem to be right because SentryTransction doesn't have such a method.
I take it this is related to the comment re extension methods vs class methods.
@vaind I think you might have bumped into this:
I hit that when I first started working with Sentry as well. Still not sure what the implications of setting scope.Transaction automatically would be... At the very least, I guess we could try it out and see if it breaks any of our unit tests. It's hard to say whether such a change might break any of our customers' code though.
Package
Sentry
.NET Flavor
.NET
.NET Version
any
OS
Any (not platform specific)
SDK Version
4.1.2
Self-Hosted Sentry Version
No response
Steps to Reproduce
Expected Result
test pass
See docs with the example suggesting GetSpan() should work:
Actual Result
test fails