Skip to content

InvalidCastException: Unable to cast object of type 'Sentry.Internal.UnsampledTransaction' to type 'Sentry.TransactionTracer' #4235

@danports

Description

@danports

Package

Sentry.Extensions.Logging
Sentry.OpenTelemetry

.NET Flavor

.NET Core

.NET Version

9.0.5

OS

Any (not platform specific)

OS Version

No response

Development Environment

Visual Studio v17.x

SDK Version

5.9.0

Self-Hosted Sentry Version

No response

Workload Versions

N/A

UseSentry or SentrySdk.Init call

logging.AddSentry(options =>
{
    options.UseOpenTelemetry();
    options.DisableUnobservedTaskExceptionCapture();
});

Steps to Reproduce

After upgrading the Sentry SDK from 5.8.0 to 5.9.0, this exception started appearing - seems like a regression in this release.

Expected Result

No exception thrown.

Actual Result

System.InvalidCastException: Unable to cast object of type 'Sentry.Internal.UnsampledTransaction' to type 'Sentry.TransactionTracer'.
  ?, in void SentrySpanProcessor.CreateRootSpan(Activity data)
  ?, in void SentrySpanProcessor.OnStart(Activity data)
  ?, in TracerProviderSdk(IServiceProvider serviceProvider, bool ownsServiceProvider)+(Activity activity) => { }
  ?, in Activity Activity.Start()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    Status

    Done

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions