diff --git a/CHANGELOG.md b/CHANGELOG.md index 603d78489d..9d82176544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/src/Sentry.AspNetCore/SentryTracingBuilder.cs b/src/Sentry.AspNetCore/SentryTracingBuilder.cs index e34379f4c5..9713c44eca 100644 --- a/src/Sentry.AspNetCore/SentryTracingBuilder.cs +++ b/src/Sentry.AspNetCore/SentryTracingBuilder.cs @@ -51,11 +51,13 @@ public IApplicationBuilder Use(Func 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 } }