Skip to content

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

Draft
jamescrosswell wants to merge 2 commits into
masterfrom
dotnet-v7-extensions-hosting
Draft

jamescrosswell wants to merge 2 commits into
masterfrom
dotnet-v7-extensions-hosting

Conversation

@jamescrosswell

Copy link
Copy Markdown
Collaborator

Warning

Do not merge before sentry-dotnet 7.0.0 is released (planned 2026-11-30).

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 stays a draft until 7.0.0 ships.

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 2, 2026 12:09am UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Nov 2, 2026 12:09am 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>
}
```

`EnableLogs` doesn't change how errors and breadcrumbs are captured. Entries at `Error` and above are sent as events, and entries at `Information` and above are kept as breadcrumbs. To change that, set `MinimumEventLevel` and `MinimumBreadcrumbLevel`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddLogEntryFilter works on the UseSentry options too. If #19961 drops its Generic Host content, this page is the only place left that shows it. Maybe something like:

Suggested change
`EnableLogs` doesn't change how errors and breadcrumbs are captured. Entries at `Error` and above are sent as events, and entries at `Information` and above are kept as breadcrumbs. To change that, set `MinimumEventLevel` and `MinimumBreadcrumbLevel`.
`EnableLogs` doesn't change how errors and breadcrumbs are captured. Entries at `Error` and above are sent as events, and entries at `Information` and above are kept as breadcrumbs. To change that, set `MinimumEventLevel` and `MinimumBreadcrumbLevel`.
To drop specific entries before they become breadcrumbs or events, add a filter with `AddLogEntryFilter`. Return `true` to drop the entry:
```csharp {filename:Program.cs}
using Sentry.Extensions.Logging;
builder.UseSentry(options =>
{
options.AddLogEntryFilter((category, level, eventId, exception) =>
exception is OperationCanceledException);
});
```

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To drop specific entries before they become breadcrumbs or events, add a filter with AddLogEntryFilter

This bit's good. We could link to the docs for that option rather than trying to re-explain it here (which means two different copies of the same explanation to keep in sync)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just this?

Suggested change
`EnableLogs` doesn't change how errors and breadcrumbs are captured. Entries at `Error` and above are sent as events, and entries at `Information` and above are kept as breadcrumbs. To change that, set `MinimumEventLevel` and `MinimumBreadcrumbLevel`.
`EnableLogs` doesn't change how errors and breadcrumbs are captured. Entries at `Error` and above are sent as events, and entries at `Information` and above are kept as breadcrumbs. To change that, set `MinimumEventLevel` and `MinimumBreadcrumbLevel`.
To drop specific entries before they become breadcrumbs or events, call [`AddLogEntryFilter`](/platforms/dotnet/guides/extensions-logging/#filters) in the `UseSentry` callback.

#19961 renames that heading to Log Entry Filters, so it'd need to update this anchor when it lands.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that looks cleaner 👍🏻

@ric-oliv
ric-oliv self-requested a review October 29, 2026 13:36

This branch was successfully deployed

1 active deployment
Preview – sentry-docs — ebae0dec Deployed Nov 2, 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