Skip to content

Commit ee268f0

Browse files
ric-olivclaudejamescrosswellcoolguyzone
authored
docs(dotnet): Add 6.x to 7.x migration guide for 7.0.0-rc.2 (#20143)
<!-- Keep the urgency section so automation can prioritize this PR. You may delete other sections you don't need. --> ## DESCRIBE YOUR PR This PR adds the migration guide for version 7 of the Sentry SDK for .NET, ready for the public release candidate, `7.0.0-rc.2`. It follows the pattern of the Flutter v10 guide from #19390: - A full guide at `/platforms/dotnet/migration/v6-to-v7/`, built from one include per change in `includes/migration/dotnet-v7/`. - An interactive checklist at `/platforms/dotnet/migration/v6-to-v7/interactive/` that renders the same includes through `<MigrationGuide migration="dotnet-v7" />`. - An agent prompt callout that points at the guide's `.md` URL. - A "Migrating to 7.x" section at the top of the existing .NET migration page, which links to both. Both pages live under `common/`, so they render for every .NET guide, such as ASP.NET Core, MAUI, WPF and Serilog. Xamarin uses a separate SDK, so the new pages exclude it. I didn't move the 6.x, 4.x and 3.x sections, so every existing URL and anchor keeps working and the PR needs no redirects. To register the collection, the PR adds `dotnet-v7` to the `MIGRATIONS` map in the `MigrationGuide` component and to the validator's `COLLECTIONS` map, with specs for both. These changes in `src/components/migrationGuide/` and `scripts/` touch code that the JavaScript and Flutter guides share, so they need an approval from the docs team. For reference, msonnb approved the last change to the component in #19729, and andreiborza approved the JavaScript interactive guide that added it in #19076. The checklist shows one step only on the MAUI guide. Every other step applies to every .NET guide, because .NET apps combine integrations, such as a Serilog sink in an ASP.NET Core app. I checked the guide against `7.0.0-rc.2` from nuget.org and against the `version7` branch at getsentry/sentry-dotnet@a56c63455. The guide describes 7.0.0. Where rc.2 still behaves differently, the release candidate note at the top says so. ### Why this goes live during the release candidate I'd like to merge this as soon as it's approved, while 7.0 is still in release candidate. 7.0.0 GA is planned for 2026-11-30. People who try the release candidate need the guide now, and the agent prompt needs a published `.md` URL to point at. Two develop-docs rules pull in different directions here. [Managing Linear projects](https://develop.sentry.dev/sdk/getting-started/playbooks/coordination/managing-linear-projects/#visibility-for-major-releases) says docs "MUST NOT go live before the SDK ships". The [breaking changes playbook](https://develop.sentry.dev/sdk/getting-started/playbooks/sdk-lifecycle/breaking-changes/#6-update-docs-and-changelog) says to publish the migration guide "before or alongside the major release". I read the first rule as protecting users from docs for code they can't get. Version `7.0.0-rc.2` is public on nuget.org, and the guide's first block says it's a release candidate and names that version. Other SDKs made the same call: - The Python 2.0 guide merged on 2024-02-28, while only the `2.0.0a1` alpha was out. Its note at the top said so. - The JavaScript v11 guide merged on 2026-09-08 with `11.0.0-beta.1` out, and its interactive version followed on 2026-09-11. - The Flutter v10 guide merged on 2026-10-05 with `10.0.0-rc.2` out, four days before 10.0.0. ### The release candidate note The guide opens with one `<Alert>`. It says there is no stable 7.0 yet, names `7.0.0-rc.2`, and says the rest of the .NET docs describe 6.x until 7.0.0 ships. It also covers what only the release candidate has: - `Logging.AddSentry()` after `ClearProviders()` doesn't add Sentry's logger providers back yet. That came with getsentry/sentry-dotnet#5776, after rc.2. - `DecompressionMethods` still includes Brotli, which getsentry/sentry-dotnet#5816 takes out of the default after rc.2. The note says how to leave it out until then. - An ASP.NET Core app that sends `ILogger` entries through NLog crashes with `Debug` on, tracked in getsentry/sentry-dotnet#5822. The guide's verify step turns `Debug` on, so the note says to leave it off in those apps. - Its `net11.0` builds depend on the .NET 11 release candidate versions of three `Microsoft.Extensions` packages. The rest of the guide describes 7.0.0 as released. At GA, I'll delete that one block from `includes/dotnet-v7-migration-overview.mdx`, and nothing else needs to change. ### What this PR leaves to other PRs This PR only adds the guide and what it needs. The reference pages are in other PRs, and this one doesn't need any of them to merge first: - Logs and the logging integrations: #19925 - `Microsoft.Extensions.Logging` and ASP.NET Core: #19961 - OpenTelemetry propagation: #19924 - Release and environment: #19960 - Hangfire monitor schedules: #19781 Three links in the guide point to the "Apps That Call UseSentry" sections that #19925 adds to the Serilog, NLog and log4net guides. Until #19925 merges, they open those guides at the top, and the migration guide sums up the same setups itself. There is no page for the new `Sentry.Extensions.Hosting` package yet. I'll link it from the guide once that page exists. Refs https://linear.app/getsentry/issue/NET-860 Refs getsentry/sentry-dotnet#5710 ## 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+ ## PRE-MERGE CHECKLIST _Make sure you've checked the following before merging your changes:_ - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com> Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
1 parent 70e7eb7 commit ee268f0

33 files changed

Lines changed: 1495 additions & 3 deletions

‎docs/platforms/dotnet/common/migration/index.mdx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ sidebar_section: configuration
77

88
Upgrading includes both breaking changes and new features.
99

10+
<PlatformSection notSupported={["dotnet.xamarin"]}>
11+
12+
## Migrating to 7.x
13+
14+
See the <PlatformLink to="/migration/v6-to-v7/">6.x to 7.x migration guide</PlatformLink> for every change, or use the <PlatformLink to="/migration/v6-to-v7/interactive/">interactive migration checklist</PlatformLink> to track your progress.
15+
16+
</PlatformSection>
17+
1018
## Migrating to 6.x
1119

1220
### .NET Target Framework Changes
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: Migrate from 6.x to 7.x
3+
sidebar_order: 1
4+
description: "Learn how to migrate your app from version 6.x to 7.x of the Sentry SDK for .NET."
5+
notSupported:
6+
- dotnet.xamarin
7+
---
8+
9+
<Include name="dotnet-v7-agent-migration" />
10+
11+
<Include name="dotnet-v7-migration-overview" />
12+
13+
<Alert title="Prefer a checklist?" level="info">
14+
15+
The [Interactive 7.x Migration Guide](./interactive/) lets you check off completed migration steps.
16+
17+
</Alert>
18+
19+
## Versions and Packages
20+
21+
### Supported .NET Versions and Platforms
22+
23+
<Include name="migration/dotnet-v7/supported-net-versions-and-platforms" />
24+
25+
### Update All Sentry Packages Together
26+
27+
<Include name="migration/dotnet-v7/update-all-sentry-packages-together" />
28+
29+
## Initializing Sentry
30+
31+
### Logging Integrations No Longer Initialize Sentry
32+
33+
<Include name="migration/dotnet-v7/logging-integrations-no-longer-initialize-sentry" />
34+
35+
### Generic Host Apps Call UseSentry
36+
37+
<Include name="migration/dotnet-v7/generic-host-apps-call-usesentry" />
38+
39+
### Logging Options Only Set Log Levels
40+
41+
<Include name="migration/dotnet-v7/logging-options-only-set-log-levels" />
42+
43+
### IHub Is Registered Only by UseSentry
44+
45+
<Include name="migration/dotnet-v7/ihub-is-registered-only-by-usesentry" />
46+
47+
### Remove Redundant Logging.AddSentry Calls
48+
49+
<Include name="migration/dotnet-v7/remove-redundant-loggingaddsentry-calls" />
50+
51+
### Move SDK Settings Out of the Serilog Sink
52+
53+
<Include name="migration/dotnet-v7/move-sdk-settings-out-of-the-serilog-sink" />
54+
55+
### Move SDK Settings Out of the NLog Target
56+
57+
<Include name="migration/dotnet-v7/move-sdk-settings-out-of-the-nlog-target" />
58+
59+
### Move SDK Settings Out of the log4net Appender
60+
61+
<Include name="migration/dotnet-v7/move-sdk-settings-out-of-the-log4net-appender" />
62+
63+
## Logs and Metrics
64+
65+
### EnableLogs Is Removed from SentryOptions
66+
67+
<Include name="migration/dotnet-v7/enablelogs-is-removed-from-sentryoptions" />
68+
69+
### Logging Integrations Send Logs
70+
71+
<Include name="migration/dotnet-v7/logging-integrations-send-logs" />
72+
73+
### Logging Frameworks No Longer Close Sentry
74+
75+
<Include name="migration/dotnet-v7/logging-frameworks-no-longer-close-sentry" />
76+
77+
### EnableMetrics Is Removed
78+
79+
<Include name="migration/dotnet-v7/enablemetrics-is-removed" />
80+
81+
## Tracing and OpenTelemetry
82+
83+
### Some Requests Are No Longer Traced
84+
85+
<Include name="migration/dotnet-v7/some-requests-are-no-longer-traced" />
86+
87+
### The OpenTelemetry Exporter No Longer Sets a Propagator
88+
89+
<Include name="migration/dotnet-v7/the-opentelemetry-exporter-no-longer-sets-a-propagator" />
90+
91+
## Release, Environment and SDK Name
92+
93+
### Release and Distribution Are Set on Options
94+
95+
<Include name="migration/dotnet-v7/release-and-distribution-are-set-on-options" />
96+
97+
### More Apps Report the Host Environment
98+
99+
<Include name="migration/dotnet-v7/more-apps-report-the-host-environment" />
100+
101+
### SDK Name, Release and Scope Environment
102+
103+
<Include name="migration/dotnet-v7/sdk-name-release-and-scope-environment" />
104+
105+
## Requests to Sentry
106+
107+
### DecompressionMethods No Longer Includes Brotli
108+
109+
<Include name="migration/dotnet-v7/decompressionmethods-no-longer-includes-brotli" />
110+
111+
## Integrations
112+
113+
### UseSentry Overrides appsettings.json in MAUI
114+
115+
<Include name="migration/dotnet-v7/usesentry-overrides-appsettingsjson-in-maui" />
116+
117+
### Hangfire Sends Recurring Job Schedules
118+
119+
<Include name="migration/dotnet-v7/hangfire-sends-recurring-job-schedules" />
120+
121+
## Other Removed and Internal APIs
122+
123+
<Include name="migration/dotnet-v7/other-removed-and-internal-apis" />
124+
125+
## Optional Cleanup
126+
127+
### Call UseSentry on WebApplicationBuilder
128+
129+
<Include name="migration/dotnet-v7/call-usesentry-on-webapplicationbuilder" />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Interactive 7.x Migration Guide
3+
sidebar_order: 2
4+
description: "Migrate from version 6.x to 7.x of the Sentry SDK for .NET with an interactive checklist."
5+
notSupported:
6+
- dotnet.xamarin
7+
---
8+
9+
<Include name="dotnet-v7-agent-migration" />
10+
11+
<Include name="dotnet-v7-migration-overview" />
12+
13+
This checklist covers the 7.x migration. Some steps only apply to specific integrations, platforms or configuration options. Check off a step after you complete it or confirm that it doesn't apply to your app. This browser saves your progress.
14+
15+
For details about each change, see the [migration guide](../).
16+
17+
<Alert level="warning">
18+
19+
The compiler won't catch every change. Read through the steps before upgrading, including the changes to logs, tracing and the reported environment.
20+
21+
</Alert>
22+
23+
## Your Migration Steps
24+
25+
<MigrationGuide migration="dotnet-v7" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<AgentMigrationCallout
2+
guideUrl="migration/v6-to-v7.md"
3+
prompt="Upgrade this project from the Sentry SDK for .NET 6.x to 7.x. Inspect its Sentry NuGet packages, target frameworks, hosting model, logging integrations and how it initializes Sentry. Apply every migration step that applies to this project. Initialize Sentry once with UseSentry or SentrySdk.Init, and move the DSN and other SDK settings out of the logging integrations and the Logging:Sentry configuration section. Preserve the intended telemetry behavior, including the logs the app sends, the requests it traces and the environment it reports. Verify the migration with dotnet build and the project's existing tests, then run the app once and confirm that Sentry initializes, for example with Debug enabled, because a build alone doesn't catch a logging integration that sends nothing. Summarize the changes and any remaining manual steps."
4+
description="Copy this prompt into your AI agent to migrate to 7.x."
5+
/>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Alert level="warning" title="Release candidate">
2+
3+
There is no stable 7.0 release of the Sentry SDK for .NET yet. The current release candidate is `7.0.0-rc.2`. Until 7.0.0 ships, use that version wherever this guide says `7.0.0`. The rest of the .NET docs still describe 6.x until then, so where they differ from this guide, follow this guide. If you run into problems, [open an issue on GitHub](https://github.com/getsentry/sentry-dotnet/issues).
4+
5+
On `7.0.0-rc.2`, three things work differently from what this guide describes:
6+
7+
- `Logging.AddSentry()` after `ClearProviders()` doesn't add Sentry's logger providers back. Call `UseSentry` after `ClearProviders()` instead.
8+
- `DecompressionMethods` still includes Brotli, which the next release takes out of the default. To leave it out now, set `options.DecompressionMethods = DecompressionMethods.GZip | DecompressionMethods.Deflate` where you initialize Sentry.
9+
- An ASP.NET Core app that sends `ILogger` entries through NLog crashes with a stack overflow when `Debug` is on. In these apps, leave `Debug` off and check that the test event arrives in Sentry instead.
10+
11+
The release candidate's `net11.0` builds depend on the .NET 11 release candidate versions of `Microsoft.Extensions.Http`, `Microsoft.Extensions.Logging.Configuration` and `Microsoft.Extensions.Configuration.Binder`. A .NET 11 app that references 10.0.x of one of these packages directly fails to restore with error NU1605. Remove that reference, or update it to the same .NET 11 release candidate version.
12+
13+
</Alert>
14+
15+
Version 7 of the Sentry SDK for .NET adds support for .NET 11 and moves SDK initialization out of the logging integrations. The biggest changes are:
16+
17+
- **One place to initialize Sentry.** The Serilog, NLog, log4net and `Microsoft.Extensions.Logging` integrations no longer start the SDK. Call `UseSentry` or `SentrySdk.Init` first, and move the DSN and other SDK settings there.
18+
- **`UseSentry` for generic host apps.** Worker services, Azure Functions isolated worker apps and other apps on the .NET Generic Host can now call `UseSentry` from the new `Sentry.Extensions.Hosting` package.
19+
- **Logs.** Version 7 removes `SentryOptions.EnableLogs`. Structured logs are now enabled automatically if you add the Serilog, NLog or log4net integrations, or call `Logging.AddSentry()` after `SentrySdk.Init`, so check the volume and content of your logs after upgrading if you use any of these integrations.
20+
- **Platforms.** Android, iOS, Mac Catalyst and MAUI apps need .NET 10 or later.
21+
- **Defaults.** The SDK traces fewer incoming requests, and more apps report the host environment instead of `production`.
22+
23+
Upgrade to the latest 6.x release first, and fix its obsolete warnings. Some APIs that 7.0 removes, such as `EnableMetrics` and the iOS option `EnableAppHangTrackingV2`, are already obsolete in 6.x.
24+
25+
The `Sentry.OpenTelemetry` package has been obsolete since 6.12.0. Code using this integration, such as `AddSentry()` on the tracer provider builder with `options.UseOpenTelemetry()`, still compiles on 7.0, but you will get warnings. The package will not see any future improvements or bug fixes, and it will be removed in a future version. Its replacement is the OTLP exporter from `Sentry.OpenTelemetry.Exporter`, with `AddSentryOtlpExporter` and `UseOtlp`. See [OpenTelemetry (OTLP)](/platforms/dotnet/tracing/instrumentation/opentelemetry-otlp/).
26+
27+
The compiler catches most of the changes. A few only show up at runtime or in your data. A logging integration sends nothing until you initialize Sentry. An app that calls `SentrySdk.Init` and injects `IHub` fails when the container resolves the service. The new defaults change log volume, traced requests and the reported environment. Read the behavior changes before you upgrade.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
id: call-usesentry-on-webapplicationbuilder
3+
title: "Call UseSentry on WebApplicationBuilder"
4+
phase: cleanup
5+
category: rename
6+
severity: informational
7+
frameworks: all
8+
platformCategory: all
9+
order: 10
10+
---
11+
12+
ASP.NET Core apps can now call `UseSentry` on `WebApplicationBuilder` and keep chaining. `builder.WebHost.UseSentry()` still works, so this change is optional.
13+
14+
In 6.x, `UseSentry` was only available on the web host:
15+
16+
```csharp {filename:Program.cs}
17+
var builder = WebApplication.CreateBuilder(args);
18+
builder.WebHost.UseSentry(options => options.Dsn = "___PUBLIC_DSN___");
19+
```
20+
21+
In 7.x, call it on the builder:
22+
23+
```csharp {filename:Program.cs}
24+
var builder = WebApplication.CreateBuilder(args);
25+
builder.UseSentry(options => options.Dsn = "___PUBLIC_DSN___");
26+
```
27+
28+
A helper declared in the `Microsoft.Extensions.Hosting` namespace needs a static call instead. The `AddServiceDefaults` method that .NET Aspire templates generate is one example. Inside that namespace, `web.UseSentry()` binds to the generic host overload from `Sentry.Extensions.Hosting`, even for a `WebApplicationBuilder`. The app then misses request data, the middleware and the transactions for incoming requests. Call the ASP.NET Core overload as a static method:
29+
30+
```csharp {filename:Extensions.cs}
31+
using Microsoft.AspNetCore.Builder;
32+
33+
namespace Microsoft.Extensions.Hosting;
34+
35+
public static class Extensions
36+
{
37+
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder)
38+
where TBuilder : IHostApplicationBuilder
39+
{
40+
if (builder is WebApplicationBuilder web)
41+
{
42+
SentryWebApplicationBuilderExtensions.UseSentry(web);
43+
}
44+
else
45+
{
46+
builder.UseSentry();
47+
}
48+
49+
return builder;
50+
}
51+
}
52+
```
53+
54+
When `UseSentry` from `Sentry.Extensions.Hosting` runs in an ASP.NET Core app, the SDK logs a warning through `ILogger` when the host starts.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: decompressionmethods-no-longer-includes-brotli
3+
title: "DecompressionMethods No Longer Includes Brotli"
4+
phase: verify
5+
category: behavior
6+
severity: informational
7+
frameworks: all
8+
platformCategory: all
9+
order: 80
10+
---
11+
12+
`SentryOptions.DecompressionMethods` now defaults to `GZip | Deflate`. In 6.x, it included every method, so the SDK asked your Sentry server for Brotli-compressed responses and decoded them. Sentry's responses to the SDK are small, so this shouldn't make a visible difference.
13+
14+
The new default keeps the SDK away from the .NET Brotli decoder, which has a security issue in unpatched runtimes. See [CVE-2026-111497](https://github.com/dotnet/announcements/issues/494). This matters most for self-contained, Native AOT and mobile apps, which carry their own runtime.
15+
16+
To accept Brotli-compressed responses again, add it back. `DecompressionMethods.Brotli` is available on .NET Core 3.0 and later:
17+
18+
```csharp {filename:Program.cs}
19+
using System.Net;
20+
21+
SentrySdk.Init(options =>
22+
{
23+
options.Dsn = "___PUBLIC_DSN___";
24+
options.DecompressionMethods |= DecompressionMethods.Brotli;
25+
});
26+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
id: enablelogs-is-removed-from-sentryoptions
3+
title: "EnableLogs Is Removed from SentryOptions"
4+
phase: code-changes
5+
category: removed-api
6+
severity: action-required
7+
frameworks: all
8+
platformCategory: all
9+
order: 90
10+
---
11+
12+
Version 7 removes `EnableLogs` from `SentryOptions`, the core options of the SDK, so setting it in `SentrySdk.Init` fails to compile with error CS1061. Remove the line.
13+
14+
Whether logs are on now depends on how your app writes them:
15+
16+
- **Logging integrations.** If you add the Serilog, NLog or log4net integration, or call `Logging.AddSentry()` after `SentrySdk.Init`, logs are on by default. Your logging framework's configuration, such as its minimum level, controls which entries they send. See [Logging Integrations Send Logs](#logging-integrations-send-logs).
17+
- **Host integrations.** In ASP.NET Core, MAUI, Blazor WebAssembly and generic host apps, `UseSentry` adds an `ILogger` integration. It sends errors and breadcrumbs, but its logs are off by default. To turn them on, set `EnableLogs = true` on the options of `UseSentry`. `EnableLogs` doesn't affect a Serilog, NLog or log4net integration in the same app.
18+
- **`SentrySdk.Logger`.** It sends logs in every app and needs no option.
19+
20+
In 6.x, `SentrySdk.Init` turned logs on:
21+
22+
```csharp {filename:Program.cs}
23+
SentrySdk.Init(options =>
24+
{
25+
options.Dsn = "___PUBLIC_DSN___";
26+
options.EnableLogs = true;
27+
});
28+
```
29+
30+
In 7.x, remove `EnableLogs`:
31+
32+
```csharp {filename:Program.cs}
33+
SentrySdk.Init(options =>
34+
{
35+
options.Dsn = "___PUBLIC_DSN___";
36+
});
37+
```
38+
39+
In apps that call `UseSentry`, keep `EnableLogs` on its options to send `ILogger` entries as logs. You can also set it in the `Sentry` section of `appsettings.json`:
40+
41+
```csharp {filename:Program.cs}
42+
var builder = WebApplication.CreateBuilder(args);
43+
builder.UseSentry(options =>
44+
{
45+
options.Dsn = "___PUBLIC_DSN___";
46+
options.EnableLogs = true;
47+
});
48+
```
49+
50+
A generic host app that set `EnableLogs` on `Logging.AddSentry` in 6.x sets it on `UseSentry` now.
51+
52+
The Serilog sink no longer takes an `enableLogs` argument. NLog's `enableLogs` setting no longer turns logs off, and setting it to `false` writes a warning to standard error. To drop logs and keep errors and breadcrumbs, use `SetBeforeSendLog`, as shown in [Logging Integrations Send Logs](#logging-integrations-send-logs).
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
id: enablemetrics-is-removed
3+
title: "EnableMetrics Is Removed"
4+
phase: code-changes
5+
category: removed-api
6+
severity: action-required
7+
frameworks: all
8+
platformCategory: all
9+
order: 100
10+
---
11+
12+
Version 7 removes `SentryOptions.EnableMetrics`, so setting it fails to compile with error CS1061. The option has been obsolete and ignored since 6.10.0, because metrics are always on. To drop metrics, return `null` from `SetBeforeSendMetric`.
13+
14+
In 6.x, the obsolete option compiled but had no effect:
15+
16+
```csharp {filename:Program.cs}
17+
SentrySdk.Init(options =>
18+
{
19+
options.Dsn = "___PUBLIC_DSN___";
20+
options.EnableMetrics = false;
21+
});
22+
```
23+
24+
In 7.x, drop metrics in the callback:
25+
26+
```csharp {filename:Program.cs}
27+
SentrySdk.Init(options =>
28+
{
29+
options.Dsn = "___PUBLIC_DSN___";
30+
options.SetBeforeSendMetric(_ => null);
31+
});
32+
```
33+
34+
The SDK ignores an `EnableMetrics` key in the `Sentry` section of `appsettings.json`. Remove it.

0 commit comments

Comments
 (0)