Repository navigation
docs(dotnet): Add a Generic Host guide for SDK 7.0.0 - #20311
Merged
Merged
Conversation
Documents Sentry.Extensions.Hosting, which sentry-dotnet 7.0.0 adds: UseSentry on IHostApplicationBuilder and IHostBuilder, configuration, environment, startup and shutdown, ClearProviders(), web and MAUI apps, Aspire service defaults, the .NET Framework gap and replacing SentrySdk.Init. Adds a config intro for the guide's options page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
jamescrosswell
added a commit
that referenced
this pull request
Oct 29, 2026
The new Generic Host guide (#20311) starts Sentry with UseSentry, so its logs usage page should show the ILogger section like the other host integrations, and its requirements start at 7.0.0. Also say that generic host apps set EnableLogs to send ILogger entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 3 tasks
ric-oliv
approved these changes
Oct 29, 2026
ric-oliv
self-requested a review
October 29, 2026 13:36
Refs getsentry/sentry-dotnet#5844 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
jamescrosswell
marked this pull request as ready for review
November 4, 2026 00:41
Contributor
|
Getting ready to monitor this change · Rollout details
|
9 of 19 tasks
ric-oliv
reviewed
Nov 9, 2026
1 of 8 tasks
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
jamescrosswell
added a commit
that referenced
this pull request
Nov 10, 2026
The Generic Host guide (#20311) now documents UseSentry, so the Microsoft.Extensions.Logging guide only covers apps without a host, which call SentrySdk.Init and AddSentry() themselves. Generic host apps, including those that used builder.Logging.AddSentry(...) on 6.x, are pointed to the new guide next to ASP.NET Core and MAUI. On this page structured logs are now always sent, so the overview says so, and Configure says how to send fewer. Logging Configuration keeps the Logging:Sentry rules but drops the top-level Sentry section, and the ClearProviders() section and the UseSentry tabs are removed. In the Generic Host guide, the AddLogEntryFilter link pointed at #filters, which this page no longer has, and Replacing SentrySdk.Init now says that UseSentry leaves structured logs off until EnableLogs is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 6 tasks
1 of 3 tasks
jamescrosswell
added a commit
that referenced
this pull request
Nov 11, 2026
…#19961) > [!NOTE] > This targets `dotnet-v7`, which collects the .NET docs for sentry-dotnet 7.0.0. #20641 merges that branch into `master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon as it's approved. ## DESCRIBE YOUR PR In sentry-dotnet 7.0.0 the Microsoft.Extensions.Logging integration no longer initializes the SDK (getsentry/sentry-dotnet#5595). Generic host apps call `UseSentry` from the new `Sentry.Extensions.Hosting` package instead, which has its own guide (#20311). This updates the parts of getsentry/sentry-dotnet#5706 that #19925 leaves out: - **Microsoft.Extensions.Logging guide**: - Generic host apps, ASP.NET Core and MAUI skip this setup and go to their own guides. The note names generic host apps that used `builder.Logging.AddSentry(...)` on 6.x. - Apps without a host call `SentrySdk.Init`, then `AddSentry()`, on a `LoggerFactory` or their own `ServiceCollection`. If they inject `IHub`, `ISentryClient` or `Func<IHub>`, they register them with `HubAdapter.Instance`, because `AddSentry()` no longer does (getsentry/sentry-dotnet#5740). .NET Framework apps on `Host.CreateApplicationBuilder()` are pointed to the Generic Host guide's .NET Framework section. - Structured logs are always sent on this page, and Configure says how to send fewer. - Removes the DSN in `AddSentry(...)`, `InitializeSdk`, and SDK settings under `Logging:Sentry`. Documents what `Logging:Sentry` still accepts, and `AddLogEntryFilter`. - **Generic Host guide**: the `AddLogEntryFilter` link pointed at `#filters`, which this page no longer has. "Replacing SentrySdk.Init" now says `UseSentry` leaves structured logs off until `EnableLogs` is set. - **ASP.NET Core guide**: `SentryAspNetCoreOptions` now extends `SentryHostOptions`, not `SentryLoggingOptions`. Closes getsentry/sentry-dotnet#5706 ### Notes for review - Checked against `origin/version7` (51e7d99fb), which includes getsentry/sentry-dotnet#5869: - Every C# snippet on the Microsoft.Extensions.Logging guide compiles on net10.0 with only `Sentry.Extensions.Logging` referenced. - With `SentrySdk.Init` and `AddSentry()`, every `ILogger` entry is sent as a structured log without `EnableLogs`. - `Logging:Sentry`, added with `AddConfiguration`, is read: `MinimumEventLevel` applies, and a category entry under `LogLevel` drops only that category's structured logs. A `Dsn` key there throws `NotSupportedException` from `LoggerFactory.Create`. - Without the `HubAdapter` lines, a service that injects `IHub` fails with `Unable to resolve service for type 'Sentry.IHub' while attempting to activate ...`. - `ClearProviders()` moved out with the generic host content. It applies to ASP.NET Core's `UseSentry` too, which the ASP.NET Core guide doesn't mention yet. - `Filters` was always internal. The page shows `AddLogEntryFilter`. - The ASP.NET Core paragraph leaves out namespaces. `SentryHostOptions` is still in `Sentry.Extensions.Logging` on `version7`. - On 6.x, `AddSentry()` after `SentrySdk.Init` initializes the SDK again without a DSN, and that throws. That's why the 7.0.0 note tells 6.x users to set the DSN in `AddSentry(...)` instead. - #20240 also edits this page, against 6.x. Whichever merges second needs a merge from `master`. This PR leaves the `Sentry` prefix alert alone, which #20240 rewrites. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description. - [x] Urgent deadline (GA date, etc.): 2026-11-30 - [ ] Other deadline: YYYY-MM-DD - [ ] No deadline: Not urgent, can wait up to 1 week+ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
jamescrosswell
added a commit
that referenced
this pull request
Nov 11, 2026
… SDK 7.0.0 (#20715) > [!NOTE] > This targets `dotnet-v7`, which collects the .NET docs for sentry-dotnet 7.0.0. #20641 merges that branch into `master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon as it's approved. ## DESCRIBE YOUR PR Adds a "Clearing Logger Providers" section to the ASP.NET Core guide, matching the one in the Generic Host guide (#20311). ASP.NET Core's `UseSentry` registers Sentry's logger providers the same way, so `ClearProviders()` after it removes them and `ILogger` entries stop reaching Sentry. The section says to call `UseSentry` after `ClearProviders()`, or to add the providers back with `builder.Logging.AddSentry()`. Closes getsentry/sentry-dotnet#5911 ### Notes for review - Checked with a web app on `Sentry.AspNetCore` 7.0.0-rc.3. `version7` hasn't changed this code since rc.3. - `ClearProviders()` before `UseSentry`: a logged warning becomes an event. - `ClearProviders()` after `UseSentry`: the SDK starts, but the warning doesn't reach Sentry. With `Debug` on, the SDK logs the "logger providers were removed" warning during `StartAsync`. - `AddSentry()` after `ClearProviders()`: the warning becomes an event again, using `MinimumEventLevel` from the `UseSentry` options. - Both snippets compile on net10.0. - The Generic Host guide says the warning comes "during `Build()`". Here it's "when the app starts", because ASP.NET Core starts the SDK when the host starts (getsentry/sentry-dotnet#5815). - The snippet uses `builder.WebHost.UseSentry()` to match the rest of this page, which doesn't use the 7.0 `builder.UseSentry()` overload yet. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description. - [x] Urgent deadline (GA date, etc.): 2026-11-30 - [ ] Other deadline: YYYY-MM-DD - [ ] No deadline: Not urgent, can wait up to 1 week+ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
1 of 3 tasks
jamescrosswell
added a commit
that referenced
this pull request
Nov 12, 2026
…or SDK 7.0.0 (#20742) > [!NOTE] > This targets `dotnet-v7`, which collects the .NET docs for sentry-dotnet 7.0.0. #20641 merges that branch into `master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon as it's approved. ## DESCRIBE YOUR PR #20311 added the Generic Host guide (`/platforms/dotnet/guides/extensions-hosting/`). Only the Microsoft.Extensions.Logging guide linked to it. This adds links from the other pages that tell generic host apps to call `UseSentry`: - **Azure Functions guide**: links the guide for the options `UseSentry` takes. - **Logs**: the Generic Host paragraph in the Microsoft.Extensions.Logging logs setup, and a Generic Host entry in the .NET logs integrations list. - **Logs and Metrics getting-started pages**: a Generic Host entry in the .NET lists. - **7.0 migration guide**: the overview, "Generic Host Apps Call UseSentry", and the Generic Host row of the table in "Logging Integrations No Longer Initialize Sentry". - **Environment option**: links ".NET Generic Host". Closes getsentry/sentry-dotnet#5912 ### Notes for review - "Update All Sentry Packages Together" names `Sentry.Extensions.Hosting` too, but it already links to "Generic Host Apps Call UseSentry", which now links the guide. I left it alone rather than add a second link in the same paragraph. - `dotnet.extensions-hosting` has no entry in `platformIcon.tsx`, so the new list entries fall back to the .NET icon, the same as Microsoft.Extensions.Logging. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description. - [x] Urgent deadline (GA date, etc.): 2026-11-30 - [ ] Other deadline: YYYY-MM-DD - [ ] No deadline: Not urgent, can wait up to 1 week+ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This targets
dotnet-v7, which collects the .NET docs for sentry-dotnet 7.0.0. #20641 merges that branch intomasterwhen 7.0.0 ships, so this PR can merge intodotnet-v7as soon as it's approved.DESCRIBE YOUR PR
Adds a Generic Host guide for
Sentry.Extensions.Hosting, which sentry-dotnet 7.0.0 adds (getsentry/sentry-dotnet#5739). In 7.0.0,Logging.AddSentry()no longer initializes the SDK. Worker services, console apps on the generic host, Windows services and Azure Functions (isolated) apps callUseSentryfrom this package instead. The page is written for 7.x. The docs aren't versioned, so this goes live with the rest of the 7.0.0 docs.The guide follows the quick start template from #19990 and covers:
UseSentryonIHostApplicationBuilderandIHostBuilder, theSentryandLogging:Sentrysections, and why not to callLogging.AddSentry()as well"Dsn": "", and when the SDK starts (Build()) and closes (ApplicationStopped)ClearProviders()ordering (fix(hosting): start the SDK during Build() even when the app clears or replaces logger providers sentry-dotnet#5772, fix(logging): make Logging.AddSentry() work after UseSentry and ClearProviders() sentry-dotnet#5776, fix(logging): warn when ClearProviders() removes the logger providers UseSentry added sentry-dotnet#5789, docs: add an ASP.NET Core NLog sample and stop advising AddSentry() when another integration handles ILogger sentry-dotnet#5821)UseSentrycall that Aspire'sAddServiceDefaultsneedsSentrySdk.InitandLogging.AddSentry()fallback and itsHubAdapter.Instanceregistrations (feat(mel)!: Logging.AddSentry() no longer registers IHub or ISentryClient sentry-dotnet#5740)SentrySdk.Init, briefly. The migration guide (docs(dotnet): Add 6.x to 7.x migration guide for 7.0.0-rc.2 #20143) covers upgrades.It also adds
platform-includes/configuration/config-intro/dotnet.extensions-hosting.mdx, so the guide's Options page starts withUseSentryinstead ofSentrySdk.Init.Closes getsentry/sentry-dotnet#5707
Notes for review
index.mdx. The platform keydotnet.extensions-hostingcomes from the folder name, guides withoutsidebar_order, like the other .NET guides, are listed by title, and the icon falls back to the .NET one, as for the Microsoft.Extensions.Logging, Serilog and NLog guides. The page is new, so it needs no redirects.packages.version('sentry.dotnet'), because the release registry has nosentry.dotnet.extensions.hostingentry yet. Until 7.0.0 is out, the preview shows 6.12.1, which doesn't exist for this package. Once the registry has the package, switch to its own key. Thesdk:frontmatter already usessentry.dotnet.extensions.hosting(fromConstants.cs). Without a registry entry, the page just has no package details box.dotnet.extensions-hosting. I left them alone, since other PRs own them:platform-includes/logs/setup/dotnet.mdxfalls into theSentrySdk.Initsection instead ofUseSentrywithEnableLogs. docs(dotnet): Update logging docs for SDK 7.0.0 #19925 is adding the key to the host sections.platform-includes/logs/options/dotnet.mdxshows the genericEnableLogstext and leaves out "Configure Microsoft.Extensions.Logging Filters". Same PR.platform-includes/logs/usage/dotnet.mdxshows only theSentrySdk.LoggerAPIs. The key belongs in theILoggersection too.platform-includes/logs/requirements/dotnet.mdxsays logs need SDK version 5.14.0. This package starts at 7.0.0.version7source:"Dsn": ""turns the SDK off, butSENTRY_DSNstill wins over an emptyDsn(SettingLocator.GetDsn). The page says so.Logging:Sentryonly acceptsLogLevel,MinimumBreadcrumbLevelandMinimumEventLevel. Any other key makesBuild()throwNotSupportedException. With no DSN anywhere,Build()throwsArgumentNullException.Sentry.AspNetCore'sUseSentrytwice still sends each error twice (a follow-up in feat: add Sentry.Extensions.Hosting with UseSentry for generic host apps sentry-dotnet#5739). The Aspire section says not to call it again inProgram.cs.logging.AddSentry(...). docs(dotnet): Update logging docs for SDK 7.0.0 #19925 owns it.Sentry.Samples.GenericHostsample link belongs here too, since the sample now callsUseSentry.UseSentrysetup.platform-includes/logs/integrations/dotnet.mdx: add Generic Host to the list.docs/product/logs/getting-started/index.mdxanddocs/product/metrics/getting-started/index.mdx: add Generic Host to the .NET lists.main, whereSentry.Samples.GenericHostkeeps the 6.x setup untilversion7is merged.version7, on net10.0, and on net48 for theIHostBuilderexample and the .NET Framework fallback. On net48,UseSentryonHostApplicationBuilderfails with CS1929, as the page says.IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace
YYYY-MM-DDwith the due date. You can update this information later by editing the PR description.🤖 Generated with Claude Code