Skip to content

docs(dotnet): Add a Generic Host guide for SDK 7.0.0 - #20311

Merged
jamescrosswell merged 4 commits into
dotnet-v7from
dotnet-v7-extensions-hosting
Nov 10, 2026
Merged

jamescrosswell merged 4 commits into
dotnet-v7from
dotnet-v7-extensions-hosting

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

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 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 call UseSentry from 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:

It also adds platform-includes/configuration/config-intro/dotnet.extensions-hosting.mdx, so the guide's Options page starts with UseSentry instead of SentrySdk.Init.

Closes getsentry/sentry-dotnet#5707

Notes for review

  • Registration. A new .NET guide only needs its index.mdx. The platform key dotnet.extensions-hosting comes from the folder name, guides without sidebar_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.
  • Package version. The install snippets use packages.version('sentry.dotnet'), because the release registry has no sentry.dotnet.extensions.hosting entry 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. The sdk: frontmatter already uses sentry.dotnet.extensions.hosting (from Constants.cs). Without a registry entry, the page just has no package details box.
  • Shared includes that render wrongly for dotnet.extensions-hosting. I left them alone, since other PRs own them:
    • platform-includes/logs/setup/dotnet.mdx falls into the SentrySdk.Init section instead of UseSentry with EnableLogs. docs(dotnet): Update logging docs for SDK 7.0.0 #19925 is adding the key to the host sections.
    • platform-includes/logs/options/dotnet.mdx shows the generic EnableLogs text and leaves out "Configure Microsoft.Extensions.Logging Filters". Same PR.
    • platform-includes/logs/usage/dotnet.mdx shows only the SentrySdk.Logger APIs. The key belongs in the ILogger section too.
    • platform-includes/logs/requirements/dotnet.mdx says logs need SDK version 5.14.0. This package starts at 7.0.0.
  • Additions to the brief from the version7 source:
    • "Dsn": "" turns the SDK off, but SENTRY_DSN still wins over an empty Dsn (SettingLocator.GetDsn). The page says so.
    • Logging:Sentry only accepts LogLevel, MinimumBreadcrumbLevel and MinimumEventLevel. Any other key makes Build() throw NotSupportedException. With no DSN anywhere, Build() throws ArgumentNullException.
    • Calling Sentry.AspNetCore's UseSentry twice 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 in Program.cs.
  • Azure Functions gets one line in the intro. The Azure Functions guide still shows logging.AddSentry(...). docs(dotnet): Update logging docs for SDK 7.0.0 #19925 owns it.
  • Links to add once the other PRs merge:
    • Microsoft.Extensions.Logging guide: send generic host apps here, from the "If you use a host integration such as ASP.NET Core or MAUI" paragraph. Its Sentry.Samples.GenericHost sample link belongs here too, since the sample now calls UseSentry.
    • Azure Functions guide: link here from the UseSentry setup.
    • platform-includes/logs/integrations/dotnet.mdx: add Generic Host to the list.
    • docs/product/logs/getting-started/index.mdx and docs/product/metrics/getting-started/index.mdx: add Generic Host to the .NET lists.
    • Migration guide, "Generic Host Apps Call UseSentry": link to this page.
  • The sample link points at main, where Sentry.Samples.GenericHost keeps the 6.x setup until version7 is merged.
  • The C# snippets compile against version7, on net10.0, and on net48 for the IHostBuilder example and the .NET Framework fallback. On net48, UseSentry on HostApplicationBuilder fails 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-DD with the due date. You can update this information later by editing the PR description.

  • 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

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>
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-docs Ready Ready Preview Nov 10, 2026 2:15am UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Nov 10, 2026 2:15am UTC

Request Review

@codeowner-assignment
codeowner-assignment Bot requested a review from a team October 29, 2026 06:37
@github-actions github-actions Bot added the Priority: Urgent Docs review is needed immediately for an urgent deadline label Oct 29, 2026
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>
@ric-oliv
ric-oliv self-requested a review October 29, 2026 13:36
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
@jamescrosswell
jamescrosswell marked this pull request as ready for review November 4, 2026 00:41
@codeowner-assignment
codeowner-assignment Bot requested a review from a team November 4, 2026 00:42
@cursor

cursor Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Getting ready to monitor this change · Rollout details

Status Service Environment
⏳ Getting ready to monitor this change

@ric-oliv ric-oliv mentioned this pull request Nov 9, 2026
1 of 8 tasks
@ric-oliv
ric-oliv changed the base branch from master to dotnet-v7 November 9, 2026 14:04
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
@codeowner-assignment
codeowner-assignment Bot requested a review from a team November 10, 2026 02:10
@jamescrosswell
jamescrosswell merged commit 3c5edfb into dotnet-v7 Nov 10, 2026
12 checks passed
@jamescrosswell
jamescrosswell deleted the dotnet-v7-extensions-hosting branch November 10, 2026 02:16
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>
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>
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

1 active deployment
Preview – sentry-docs — 97770811 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Urgent Docs review is needed immediately for an urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to initialize Sentry in generic host apps for v7.0.0

2 participants