Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calls to SentryTracingBuilder can now be chained correctly #2726

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixes

- Fixed chaining on the IApplicationBuilder for methods like UseRouting and UseEndpoints ([#2726](https://github.com/getsentry/sentry-dotnet/pull/2726))

### Dependencies

- Bump Cocoa SDK from v8.13.0 to v8.13.1 ([#2722](https://github.com/getsentry/sentry-dotnet/pull/2722))
Expand Down
6 changes: 4 additions & 2 deletions src/Sentry.AspNetCore/SentryTracingBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware
var instrumenter = options?.Value.Instrumenter ?? Instrumenter.Sentry;
if (instrumenter == Instrumenter.Sentry)
{
return InnerBuilder.Use(middleware).UseSentryTracing();
InnerBuilder.Use(middleware).UseSentryTracing();
return this; // Make sure we return the same builder (not the inner builder), for chaining
}
this.StoreInstrumenter(instrumenter); // Saves us from having to resolve the options to make this check again
}

return InnerBuilder.Use(middleware);
InnerBuilder.Use(middleware);
return this; // Make sure we return the same builder (not the inner builder), for chaining
}
}