Skip to content

docs(dotnet): Correct quick-start setup and verification - #20240

Open
sfanahata wants to merge 1 commit into
masterfrom
docs/dotnet-quickstart-accuracy
Open

sfanahata wants to merge 1 commit into
masterfrom
docs/dotnet-quickstart-accuracy

Conversation

@sfanahata

Copy link
Copy Markdown
Contributor

Follow-up to #19990: correct setup and verification across the base .NET quick start and all 19 integration guides, checked against SDK 6.12.1.

Most setup inaccuracies predate the template migration. This also corrects the new claim that Sentry.Profiling installs on .NET Framework and adds the tracing option missing from the WinForms VB examples.

  • Fix package prerequisites, missing imports and terminators, ASP.NET Core and MAUI compatibility guidance, EF6 application-lifetime disposal, and the Google Cloud Functions user-factory interface.
  • Separate AppKit/macOS initialization from iOS and Mac Catalyst, scope Cocoa features to supported targets, and explicitly enable native tracing on Apple and Android.
  • Use the OTLP exporter and OpenTelemetry sampling for the Blazor Server example; remove duplicate logging registration from Blazor WebAssembly.
  • Clarify which integration initializes Sentry, enable structured logs where needed, and verify logging through the configured provider or appender.
  • Add shared verification steps for logs, metrics, and traces, including manual transactions where sampling alone doesn't create tracing data.

Validation: 31 focused documentation tests and all applicable pre-commit checks passed, including typo, external-link, and trailing-slash checks. All 22 changed MDX files compiled through the repository pipeline with website telemetry disabled in the temporary validation harness; shared includes, JSON examples, and the new OTLP link resolved. The .NET SDK is unavailable locally, so C#/VB snippets were source-checked but not compiled or run.

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

Align setup examples and supported platforms with SDK 6.12.1. Clarify logging initialization, use the OTLP exporter for Blazor tracing, and verify each telemetry type.

Refs #19990
@vercel

vercel Bot commented Oct 26, 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 Oct 26, 2026 10:49pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Oct 26, 2026 10:49pm UTC

Request Review

@github-actions github-actions Bot added the Priority: Normal Docs review has no urgent deadline label Oct 26, 2026
@codeowner-assignment
codeowner-assignment Bot requested a review from a team October 26, 2026 22:41
@sfanahata

Copy link
Copy Markdown
Contributor Author

cc @ric-oliv — this follows up on #19990 with corrections to the .NET quick-start setup and verification instructions.

@ric-oliv ric-oliv left a comment

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.

Thank you, @sfanahata!

It looks great in general, I'm just adding a few comments.

The changes that matter most for readers are removing native tracing from the Android and Apple quick starts, the VB snippets that still don't compile, and the Blazor WASM sample rate.

Many lines in these examples set options to their default values (for example options.Native.AnrEnabled = true on Android). Either way works from the SDK side: keeping them shows readers which options exist, and removing them makes the snippets shorter. If you'd rather remove them, let me know and I'll mark the lines.

// Set to 1.0 to capture 100% of spans for tracing.
// We recommend reducing this value in production.
options.TracesSampleRate = 1.0;
options.Native.EnableTracing = true;

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.

I'd remove this line. This snippet is the general quick-start setup, and Native.EnableTracing is an opt-in we deliberately keep off by default. It makes the embedded Android SDK create its own transactions in addition to the .NET ones, which duplicates instrumentation and adds transaction volume (see getsentry/sentry-dotnet#4032).

Suggested change
options.Native.EnableTracing = true;

The snippet also turns on:

- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink>
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink> and `Native.EnableTracing` for the embedded Android SDK

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.

Goes with removing options.Native.EnableTracing from the snippet:

Suggested change
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink> and `Native.EnableTracing` for the embedded Android SDK
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink>

Also, line 35 lists automatic Activity lifecycle and User Interaction tracing among the features you get by default. Those come from the Android SDK's own tracing, so they need the same opt-in. Please change line 35 to:

    - Opt-in automatic [Activity lifecycle tracing](/platforms/android/tracing/instrumentation/automatic-instrumentation/#activity-instrumentation) and [User Interaction tracing](/platforms/android/tracing/instrumentation/automatic-instrumentation/#user-interaction-instrumentation) through the embedded Android SDK. See <PlatformLink to="/configuration/native-options/#Native.EnableTracing">`Native.EnableTracing`</PlatformLink>.

// Set to 1.0 to capture 100% of spans for tracing.
// We recommend reducing this value in production.
options.TracesSampleRate = 1.0;
options.Native.EnableTracing = true;

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.

Same thing, I'd also remove it here.

Suggested change
options.Native.EnableTracing = true;

The snippet also turns on:

- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink>
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink> and `Native.EnableTracing` for the embedded Cocoa SDK

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.

Goes with removing options.Native.EnableTracing from the snippet:

Suggested change
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink> and `Native.EnableTracing` for the embedded Cocoa SDK
- Tracing: via <PlatformLink to="/configuration/options/#TracesSampleRate">`TracesSampleRate`</PlatformLink>

- Native crash reporting, including:
- Automatically [attach screenshots to Native exceptions](/platforms/apple/guides/ios/configuration/options/#attachScreenshot)
- Detect [App Hangs](/platforms/apple/configuration/app-hangs/)
- [Automatic performance tracing](/platforms/apple/tracing/)

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.

Automatic performance tracing comes from the Cocoa SDK's own tracing, which is off unless you opt in. Please say so here:

Suggested change
- [Automatic performance tracing](/platforms/apple/tracing/)
- Opt-in [automatic performance tracing](/platforms/apple/tracing/). See <PlatformLink to="/configuration/native-options/#Native.EnableTracing">`Native.EnableTracing`</PlatformLink>.

<Alert level="warning" title="Note">

The SDK needs to be initialized only once. If a `DSN` is made available to this integration, by default it **will** initialize the SDK. If you do not wish to initialize the SDK via this integration, set the `InitializeSdk` flag to **false**. Not providing a DSN or leaving it as `null` instructs the integration not to initialize the SDK and unless another integration initializes it or you call `SentrySdk.Init`, the SDK will stay disabled.
Initialize the SDK once. `InitializeSdk` defaults to `true`, and initialization can resolve a DSN from `SENTRY_DSN` even when you omit `Dsn`. If another integration or `SentrySdk.Init` owns initialization, set `InitializeSdk = false`. Omitting the DSN doesn't prevent reinitialization and can replace the existing SDK configuration.

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.

Please use this wording. If SENTRY_DSN isn't set either, initialization fails because no DSN was found, so nothing gets replaced.

Suggested change
Initialize the SDK once. `InitializeSdk` defaults to `true`, and initialization can resolve a DSN from `SENTRY_DSN` even when you omit `Dsn`. If another integration or `SentrySdk.Init` owns initialization, set `InitializeSdk = false`. Omitting the DSN doesn't prevent reinitialization and can replace the existing SDK configuration.
Initialize the SDK once. `InitializeSdk` defaults to `true`, and initialization can resolve a DSN from `SENTRY_DSN` even when you omit `Dsn`. If another integration or `SentrySdk.Init` owns initialization, set `InitializeSdk = false`. Omitting the DSN doesn't prevent reinitialization: the target either uses `SENTRY_DSN` and replaces the existing SDK configuration, or fails to initialize because no DSN was found.

<Alert>

The SDK only needs to be initialized once. If a `DSN` is made available to this integration, by default it **will** initialize the SDK. If you do not wish to initialize the SDK via this integration, set the `InitializeSdk` flag to **false**. Not providing a DSN or leaving it as `null` instructs the integration not to initialize the SDK and unless another integration initializes it or you call `SentrySdk.Init`, the SDK will stay disabled.
Initialize the SDK once. The C# callback overload defaults `InitializeSdk` to `true` and can resolve a DSN from `SENTRY_DSN`. Set `InitializeSdk = false` when another integration or `SentrySdk.Init` owns initialization. Omitting the DSN from that callback doesn't prevent reinitialization.

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.

Please use this wording. Without SENTRY_DSN, the callback overload throws because no DSN was found.

Suggested change
Initialize the SDK once. The C# callback overload defaults `InitializeSdk` to `true` and can resolve a DSN from `SENTRY_DSN`. Set `InitializeSdk = false` when another integration or `SentrySdk.Init` owns initialization. Omitting the DSN from that callback doesn't prevent reinitialization.
Initialize the SDK once. The C# callback overload defaults `InitializeSdk` to `true` and can resolve a DSN from `SENTRY_DSN`. Set `InitializeSdk = false` when another integration or `SentrySdk.Init` owns initialization. Omitting the DSN from that callback doesn't prevent reinitialization: it uses `SENTRY_DSN` if set and replaces the existing SDK configuration, and otherwise throws because no DSN was found.

The simplest way to initialize Sentry in ASP.NET Core is by using the `UseSentry` extension method from the `Sentry.AspNetCore` package in conjunction with the [framework configuration system](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/).

Call `UseSentry` with your DSN and the options you want. The SDK provides this as extension methods to support ASP.NET Core `2.X`, `3.X`, and `5.X` and later.
`Sentry.AspNetCore` 6.x requires .NET 8 or later. Call `UseSentry` with your DSN and the options you want. Applications on older .NET versions need a compatible older SDK version; see the <PlatformLink to="/migration/">Migration Guide</PlatformLink>.

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.

Please name the version instead of pointing to the Migration Guide, which doesn't say which one to use. 4.x is the newest version that supports .NET 6 and 7.

Suggested change
`Sentry.AspNetCore` 6.x requires .NET 8 or later. Call `UseSentry` with your DSN and the options you want. Applications on older .NET versions need a compatible older SDK version; see the <PlatformLink to="/migration/">Migration Guide</PlatformLink>.
`Sentry.AspNetCore` 6.x requires .NET 8 or later. Call `UseSentry` with your DSN and the options you want. For .NET 6 or 7, use `Sentry.AspNetCore` 4.x.


```csharp
// Add these to your existing using statements.
using System.Security;

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.

Please add using Sentry; here, as this PR does in the other guides. Without it, the snippet compiles only when implicit usings are turned on. Please also add using Sentry; above using Sentry.Protocol; in the first snippet (line 36).

Suggested change
using System.Security;
using System.Security;
using Sentry;

{
_sentrySdk.Dispose();
base.Dispose();
_sentrySdk?.Dispose();

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.

Moving this to Application_End is the right fix. Please also make the field static:

  • here, change line 67 to private static IDisposable _sentrySdk;
  • in the ASP.NET guide (docs/platforms/dotnet/guides/aspnet/index.mdx, line 48), change private IDisposable _sentry; to private static IDisposable _sentry;

ASP.NET can run Application_Start and Application_End on different HttpApplication instances. With an instance field, this call can do nothing and skip the flush on shutdown.

@sfanahata
sfanahata marked this pull request as ready for review October 27, 2026 20:01
@codeowner-assignment
codeowner-assignment Bot requested review from a team October 27, 2026 20:01
@cursor

cursor Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The plan checks page loads on the changed guides, 404s on that path, and MDX runtime warnings.
An issue escalates when those pages stop loading or 404s rise.
The new guide text itself cannot be checked from telemetry.

Services: sentry-docs.

Mention @change-monitor in a comment to update the plan.

Plan

What changed

Readers of the .NET getting-started pages now see corrected setup and verification steps.
The guides fix package names, init snippets, and tracing options for SDK 6.12.1.
Shared includes now tell readers how to verify logs, metrics, and traces.
sentry-docs must deploy before this change is live.

The changed routes are:

  • /platforms/dotnet/
  • /platforms/dotnet/guides/android/
  • /platforms/dotnet/guides/apple/
  • /platforms/dotnet/guides/aspnet/
  • /platforms/dotnet/guides/aspnetcore/
  • /platforms/dotnet/guides/aws-lambda/
  • /platforms/dotnet/guides/azure-functions-worker/
  • /platforms/dotnet/guides/blazor-server/
  • /platforms/dotnet/guides/blazor-webassembly/
  • /platforms/dotnet/guides/entityframework/
  • /platforms/dotnet/guides/extensions-logging/
  • /platforms/dotnet/guides/google-cloud-functions/
  • /platforms/dotnet/guides/log4net/
  • /platforms/dotnet/guides/maui/
  • /platforms/dotnet/guides/nlog/
  • /platforms/dotnet/guides/serilog/
  • /platforms/dotnet/guides/winforms/
  • /platforms/dotnet/guides/winui/
  • /platforms/dotnet/guides/wpf/
  • /platforms/dotnet/guides/xamarin/

Risk

A broken MDX include can hide the new verification text.
A compile or routing failure can 404 a changed guide.
New code blocks can break the code-tab UI on those pages.
Wrong init advice can send readers to a broken SDK setup.
That last failure is not visible in site telemetry.

Intended effect

The new wording is not queryable from telemetry.
A page load only shows that the route still renders.
Do not treat a load as proof the new text is live.
Absent and confirmed look the same in metrics.
Record intended effect as unknown.

Regression watch

If this change is wrong, the changed guides fail to render or return 404.
Query Sentry org sentry, project docs.

For page loads use docs.page.load with path in the 20 routes above.
For 404s use docs.page.not_found with requested_path:*platforms/dotnet*.
Pair that 404 count with docs.page.load where path:"*/platforms/dotnet*".
For MDX faults use logs matching message:"*MDX file not found at runtime*".
If 404s rise, inspect those MDX logs for the missing path.

The page-load band comes from 90 loads in the prior 24h and 122 loads in the last 24h.
A 7d sample was 656 loads, or 3.9 per hour.
The 404 share uses 1 not-found event against 784 /platforms/dotnet page loads.
A matching 48h sample had 2 not-found events.

Signal Baseline Window Source Rule
docs.page.load on the 20 changed routes 3.7-5.1 loads per hour 2026-10-25T20:00:00Z to 2026-10-27T20:00:00Z Sentry metrics, project docs Hold in this band. A fall below 3.7 per hour is a regression.
docs.page.not_found for requested_path platforms/dotnet 0.00-0.13% of /platforms/dotnet page loads 2026-10-26T20:00:00Z to 2026-10-27T20:00:00Z Sentry metrics, project docs Hold in this band. A rise above 0.3% is a regression.
MDX file not found at runtime logs 0 events 2026-10-26T20:00:00Z to 2026-10-27T20:00:00Z Sentry logs, project docs Hold at 0. Any rise is a regression.

Not observable

Wording correctness of the new C# and VB snippets.
Silent empty PlatformContent includes when the include path does not match.
Client errors on these 20 URLs. Pageload transactions use a catch-all name and do not slice these URLs.
A request.url error search on these routes returned zero events.
Pre-ship load rate for apple, blazor-server, google-cloud-functions, and xamarin.
Those four routes had zero loads in 2026-10-26T20:00:00Z to 2026-10-27T20:00:00Z.
A drop on those four routes is not detectable.

Get Slack DMs about this change: cursor.com/automations/rollouts

This branch was successfully deployed

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

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants