Skip to content

Commit

Permalink
Save Scope rather than Scope.Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrosswell committed Oct 9, 2023
1 parent 9fb54a5 commit d189a78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Sentry.AspNetCore/SentryMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
// The middleware pipeline finishes up before the Otel Activity.OnEnd callback is invoked so we need
// so save a copy of the scope that can be restored by our SentrySpanProcessor
hub.ConfigureScope(scope => activity.SetFused(scope.Clone()));
hub.ConfigureScope(scope => activity.SetFused(scope));
}

// When an exception was handled by other component (i.e: UseExceptionHandler feature).
Expand Down
2 changes: 1 addition & 1 deletion test/Sentry.AspNetCore.Tests/SentryMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public async Task InvokeAsync_InstrumenterOpenTelemetry_SavesScope()
await sut.InvokeAsync(_fixture.HttpContext, _fixture.RequestDelegate);

// Assert
activity.GetFused<Scope>().Should().NotBeNull();
activity.GetFused<Scope>().Should().Be(scope);
}
finally
{
Expand Down

0 comments on commit d189a78

Please sign in to comment.