Repository navigation
Description
Companion to #5698. That issue covers the logs pages in sentry-docs. This one covers the in-product onboarding flow, the "Copy for LLMs" markdown it generates, and the matching getting-started pages. Two kinds of work: the 7.0.0 changes that break the current snippets, and problems the snippets have had since long before 7.0.0.
The in-product onboarding lives in getsentry/sentry, not in sentry-docs, under static/app/gettingStartedDocs/dotnet*/. It has one folder per platform: dotnet, dotnet-aspnetcore, dotnet-aspnet, dotnet-awslambda, dotnet-gcpfunctions, dotnet-maui, dotnet-winforms, dotnet-wpf, dotnet-xamarin. The logs and metrics verify steps are shared from dotnet/logs.tsx and dotnet/metrics.tsx.
Found while going through the ASP.NET Core onboarding flow on sentry.io against a fresh dotnet new web app on 2026-10-11. Every API claim below was checked against the 6.12.0 tag and the version7 branch of sentry-dotnet.
What breaks in 7.0.0
SentryOptions.EnableLogsis removed (feat!: EnableLogs moves from SentryOptions to ASP.NET Core, MAUI and Blazor, where logs are opt-in #5642). The onboarding setsoptions.EnableLogs = trueinsideSentrySdk.Initfordotnet,dotnet-aspnet,dotnet-winformsanddotnet-wpf, anddotnet/logs.tsxdoes the same in its configure step. Those snippets stop compiling on 7.0.0. Remove the line and the sentence "To enable logging, you need to initialize the SDK with the EnableLogs option set to true."SentrySdk.Loggernever needed the option.dotnet-aspnetcore,dotnet-awslambda,dotnet-gcpfunctionsanddotnet-mauisetEnableLogson the host options (SentryAspNetCoreOptions,SentryMauiOptions), which still exist in 7.0.0. Those stay, but the comment "Enable logs to be sent to Sentry" should say what the flag does: it forwardsILoggeroutput to Sentry Logs. It has no effect onSentrySdk.Logger.- The logs verify step then sends
SentrySdk.Logger.LogInfo(...), which arrives whetherEnableLogsis on or off. As a verification of the flag it proves nothing. For the host platforms, verify with anILoggercall instead, for exampleapp.Logger.LogInformation(...). - The migration guide at
docs/platforms/dotnet/common/migration/index.mdxneeds a 7.x section. Document the logging changes for v7.0.0 #5698 lists the logging entries; add whatever else 7.0.0 removes that an onboarding snippet used to show.
Wrong or stale today, regardless of version
- The ASP.NET Core configure snippet is the pre-.NET 6 template:
CreateHostBuilderplusHost.CreateDefaultBuilder(args).ConfigureWebHostDefaults(...). Every template since .NET 6 is minimal hosting:var builder = WebApplication.CreateBuilder(args);followed bybuilder.WebHost.UseSentry(o => ...). A newcomer gets a method with no class to put it in. Show theWebApplicationform first, as the docs page already does, and keep the generic-host form as a second tab at most. - When the
WebApplicationform is shown, keepbuilder.WebHost.UseSentry(...)andvar app = builder.Build();as two statements.UseSentryreturns theIWebHostBuilder, so chaining.Build()onto it callsIWebHostBuilder.Build(). On .NET 10 and later that is obsolete (ASPDEPR008), the result is anIWebHostwith noMapGet, andConfigureWebHostBuilder.Build()throwsNotSupportedExceptionat runtime. A first-time user trying to fit the call into the template's fluent chain hits exactly this. - The Tracing section says "You can measure the performance of your endpoints by adding a middleware to
Startup.cs:" and then shows nothing. There is noStartup.csin a minimal-hosting app, and no middleware to add.UseSentryregisters the middleware andTracesSampleRateturns transactions on. Replace the sentence with that statement. - The
HomeControllerspan sample does not compile.PersonreturnsIActionResultbut thetryblock has noreturn, so the compiler reports CS0161. It is also an MVC controller, and the template the user most likely has is a minimal API with noAddControllers. Show aMapGetlambda that takesIHubas a parameter.MapGetworks unchanged on every current template (web,webapi,mvc,razor,blazor) because they all build aWebApplication, and controllers and minimal API endpoints share one routing table, so it is the form that serves the whole "ASP.NET Core" page. Keep the controller version as a second tab at most, compiling, and labeled as MVC. Drop the unusedusing Microsoft.Extensions.Logging;. - "If you don't want to depend on the static class, the SDK registers a client in the DI container. In this case, you can take
IHubas a dependency." links to the unit-testing page. Link to a page that shows injection, or explain it inline. - The two F# sample links point at
sentry-demos/fsharp(last push May 2023) andsentry-demos/giraffe(last push February 2021). Both predate the 4.x line. Drop them or refresh them. - Fallback package versions in
getPackageVersionare3.34.0fordotnet-aspnet,dotnet-awslambda,dotnet-gcpfunctions,dotnet-winformsanddotnet-wpf, and1.5.2fordotnet-xamarin. They only show when the release registry is unreachable, but they should move to the current major.
Things the flow does not say that a first-time user needs
- Where to put
SentrySdk.CaptureMessage("Hello Sentry"). In a minimal-hosting app anything afterbuilder.Build()works, an endpoint is the realistic place. - Release and environment. The SDK infers the release from the entry assembly version and ASP.NET Core sets the environment from the hosting environment name. The user sees
developmenton the first event without being told why. SendDefaultPiiis not mentioned, so the first events carry no user or IP. Say so, and point at the option.appsettings.jsonbinding is not mentioned at all, although the docs page leads with it. One sentence and a link is enough.Debug = truewith the defaultDiagnosticLevelofDebugprints every envelope to the console. Say that it is for the first run and should come off afterwards.
Where the changes go
- getsentry/sentry:
static/app/gettingStartedDocs/dotnet-aspnetcore/onboarding.tsxfor the configure, tracing and samples fixes;dotnet/onboarding.tsx,dotnet-aspnet,dotnet-winforms,dotnet-wpfanddotnet/logs.tsxfor theEnableLogsremoval; everydotnet*/onboarding.tsxfor the fallback versions. Theonboarding.spec.tsxfiles next to them assert on the rendered snippets and will need updating. - getsentry/sentry-docs:
docs/platforms/dotnet/guides/aspnetcore/index.mdxalready shows theWebApplicationform, but check the other platform guides for the sameEnableLogsonSentryOptionsand for theHomeControllersample.docs/platforms/dotnet/common/migration/index.mdxfor the 7.x section.
As with #5698, the .NET docs are not versioned. The guiding rule for every snippet on the page: the page is titled "ASP.NET Core", not "ASP.NET Core MVC", so each snippet should work on a fresh dotnet new web app without translation, and where a snippet assumes a hosting model or a framework flavor it should say so. The EnableLogs removals should merge when 7.0.0 ships, or the text should say it applies from 7.0.0 on. The snippet fixes in the second section can ship now.
Activity
linear-code commentedon Oct 11, 2026
NET-853
fix(onboarding): Fix .NET snippets that don't compile and an archived…
fix(onboarding): Update ASP.NET Core snippets to minimal hosting (#12…
ric-oliv commentedon Oct 13, 2026
getsentry/sentry#127238 merged. It covers the ASP.NET Core items under "Wrong or stale today":
WebApplicationform, withvar app = builder.Build();as its own statement and one sentence on why.Startup.csor middleware. The span example is anapp.MapGetendpoint that takesIHubas a parameter.IHubsentence explains the injection inline, and the unit-testing link now fits it.CaptureMessagebetweenbuilder.Build()andapp.Run().using Sentry;, which fails with CS1529 when pasted afterbuilder.Build(). It's removed from the shared snippet.This differs from the issue on one point: there is no generic-host tab and no MVC tab. Every snippet works in a fresh
dotnet new webapp, andMapGetworks on every current template. The "Copy for LLMs" markdown is built from the same steps, so it has the changes too.Still open:
dotnet-aspnet,dotnet-awslambda,dotnet-gcpfunctions,dotnet-winformsanddotnet-wpf, 1.5.2 indotnet-xamarin, and 4.3.0 indotnet-maui, which the list above missed.CaptureMessage.fix(onboarding): Install each .NET platform's own package in the Logs…
fix(onboarding): Install each .NET platform's own package in the Metr…
fix(onboarding): Correct the .NET Logs and Metrics drawer copy for ho…
fix(onboarding): Fix .NET snippets that don't compile and stale sampl…
fix(onboarding): Link the .NET Logs drawer to the platform guide's lo…
fix(onboarding): Update .NET onboarding for sentry-dotnet 7.0.0
fix(onboarding): Install each .NET platform's own package in Logs onb…
fix(onboarding): Install each .NET platform's own package in Metrics …
fix(onboarding): Correct .NET Logs and Metrics onboarding copy for ho…
fix(onboarding): Link .NET Logs onboarding to the platform guide's lo…
fix(onboarding): Show where .NET hosts set EnableLogs and tighten the…
docs(dotnet): Show the scrubbed ASP.NET transaction name and fix Glob…
docs(dotnet): Fix the span samples on the ASP.NET tracing pages
docs(dotnet): Show the scrubbed ASP.NET transaction name and fix Glob…
docs(dotnet): Fix the code samples on the ASP.NET tracing pages (#20828)
docs(dotnet): Say where host apps set EnableLogs (#20829)
fix(onboarding): Drop wrong 6.x caveat from ASP.NET Core setup
fix(onboarding): Set EnableLogs in UseSentry code on .NET hosts
test(onboarding): Drop GCP spec check for absent UseSentry code
fix(onboarding): Update .NET onboarding for sentry-dotnet 7.0.0 (#131236