You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add UseSentry overloads on WebApplicationBuilder #5719
On a minimal-hosting app, Sentry is added with builder.WebHost.UseSentry(...), which returns the IWebHostBuilder. In the template's fluent style, the following .Build() then resolves to IWebHostBuilder.Build():
varapp=WebApplication.CreateBuilder(args).WebHost.UseSentry(o =>o.Dsn="...").Build();// an IWebHost, not a WebApplicationapp.MapGet("/",()=>"Hello");
That gives warning ASPDEPR008 (IWebHost is obsolete in .NET 10) and CS1929 on MapGet. If it compiled, ConfigureWebHostBuilder.Build() would throw NotSupportedException. Found with a fresh dotnet new web app while checking the onboarding snippets (#5700).
Proposal
Add UseSentry overloads on WebApplicationBuilder in Sentry.AspNetCore, mirroring the IWebHostBuilder set and returning the application builder:
Each one calls the matching builder.WebHost.UseSentry(...) overload and returns builder, so the behavior is the same as today's call: on WebApplicationBuilder, builder.WebHost applies those registrations immediately. The WebHostBuilderContext overloads aren't needed, since configuration and environment are in scope where UseSentry is called.
The change is additive, so it targets main (6.x) and reaches v7 with the next merge of main into version7. The samples switch to builder.UseSentry(...); docs and onboarding snippets follow in #5700.
Split out of #5572. That issue adds a generic-host UseSentry on IHostApplicationBuilder in v7, and WebApplicationBuilder implements that interface, so in apps that reference both packages this overload is what keeps builder.UseSentry() on the ASP.NET Core integration.
Activity
linear-code commentedon Oct 13, 2026
NET-866
feat(aspnetcore): add UseSentry overloads on WebApplicationBuilder (g…