Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/platforms/dotnet/common/configuration/heap-dumps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The basic configuration for enabling automatic heap dumps is:

```csharp
options => {
// All your other options like DSN etc.
// All your other options like DSN, SendDefaultPii, etc.
...
options.EnableHeapDumps(
// Triggers if the process uses more than 90% of the total available memory
Expand All @@ -37,7 +37,7 @@ Alternatively, there is an overload of `EnableHeapDumps` that allows you to spec

```csharp
options => {
// All your other options like DSN etc.
// All your other options like DSN, SendDefaultPii, etc.
...
options.EnableHeapDumps(
// Triggers if the process uses more than 10MB of memory
Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/dotnet/guides/aspnet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ as well as your logs as breadcrumbs. The logging integrations also capture event
You configure the SDK in the `Global.asax.cs`:


```csharp {"onboardingOptions": {"performance": "20-23, 33-42"}}
```csharp {"onboardingOptions": {"performance": "22-25, 35-44"}}
using System;
using System.Web;
using Sentry.AspNet;
Expand All @@ -53,6 +53,8 @@ public class MvcApplication : HttpApplication
options.Dsn = "___PUBLIC_DSN___";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace AspNetMvc
// When configuring for the first time, to see what the SDK is doing:
o.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
o.SendDefaultPii = true;

// Example sample rate for your transactions: captures 10% of transactions
o.TracesSampleRate = 0.1;
});
Expand Down
1 change: 1 addition & 0 deletions docs/platforms/dotnet/guides/aspnet/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ To apply `Tags` globally, it's recommended that you set them in `SentryOptions`,
SentrySdk.Init(options =>
{
options.Dsn = "___PUBLIC_DSN___";
options.SendDefaultPii = true;
options.DefaultTags.Add("TagName", "value");
});
```
Expand Down
11 changes: 7 additions & 4 deletions docs/platforms/dotnet/guides/aspnetcore/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ ASP.NET Core will automatically read this environment variable and bind it to th

Finally, any settings that can be configured via `appsettings.json` or environment variables can also be configured via code. Some settings can only be configured in code, such as the `BeforeSend` callback:

```csharp {"onboardingOptions": {"performance": "3"}}
```csharp {"onboardingOptions": {"performance": "4"}}
.UseSentry(options =>
{
options.TracesSampleRate = 1.0; // <- Set this to configure automatic tracing
options.SendDefaultPii = true; // Adds request URL and headers, IP and name for users, etc.
options.TracesSampleRate = 1.0; // Set this to configure automatic tracing
options.SetBeforeSend((@event, hint) =>
{
// Never report server names
Expand All @@ -120,9 +121,10 @@ Finally, any settings that can be configured via `appsettings.json` or environme
})
```

```fsharp {"onboardingOptions": {"performance": "2"}}
```fsharp {"onboardingOptions": {"performance": "3"}}
.UseSentry (fun options ->
options.TracesSampleRate <- 1.0 // <- Set this to configure automatic tracing
options.SendDefaultPii <- true // Adds request URL and headers, IP and name for users, etc.
options.TracesSampleRate <- 1.0 // Set this to configure automatic tracing
options.SetBeforeSend(fun event hint ->
// Never report server names
event.ServerName <- null
Expand Down Expand Up @@ -259,6 +261,7 @@ A tunnel is an HTTP endpoint that acts as a proxy between Sentry and your applic
```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
sendDefaultPii: true,
tunnel: "/tunnel",
});
```
Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/dotnet/guides/aws-lambda/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ All `ASP.NET Core` configurations are valid here. But one configuration in parti
`FlushOnCompletedRequest` ensures all events are flushed out. This is because the general ASP.NET Core hooks for when the process is exiting are not guaranteed to run in a serverless environment. This setting ensures that no event is lost if AWS recycles the process.


```csharp {"onboardingOptions": {"performance": "12-15"}}
```csharp {"onboardingOptions": {"performance": "14-17"}}
public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction
{
protected override void Init(IWebHostBuilder builder)
Expand All @@ -47,6 +47,8 @@ public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFu
options.Dsn = "___PUBLIC_DSN___";
// When configuring for the first time, to see what the SDK is doing:
o.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
o.SendDefaultPii = true;
// Set TracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
Expand Down
8 changes: 6 additions & 2 deletions docs/platforms/dotnet/guides/azure-functions-worker/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens

Sentry integration with Azure Functions is done by calling `.UseSentry()` and specifying the options, for example:

```csharp {"onboardingOptions": {"performance": "10-12"}}
```csharp {"onboardingOptions": {"performance": "12-14"}}
using Sentry.Azure.Functions.Worker;

var builder = FunctionsApplication.CreateBuilder(args);
Expand All @@ -43,6 +43,8 @@ builder.UseSentry(options =>
options.Dsn = "___PUBLIC_DSN___";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand All @@ -57,7 +59,7 @@ If using the ASP.NET Core integration add `UseSentry` to the `ConfigureFunctions

</Alert>

```csharp {"onboardingOptions": {"performance": "11-13"}}
```csharp {"onboardingOptions": {"performance": "13-15"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch, to also take care of these line numbers!

using Sentry.Azure.Functions.Worker;

var host = new HostBuilder()
Expand All @@ -68,6 +70,8 @@ var host = new HostBuilder()
options.Dsn = "___PUBLIC_DSN___";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down
8 changes: 5 additions & 3 deletions docs/platforms/dotnet/guides/blazor-webassembly/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ Sentry integration with Blazor WebAssembly is done by calling `.UseSentry()` and



```csharp {"onboardingOptions": {"performance": "5"}}
```csharp {"onboardingOptions": {"performance": "9"}}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.UseSentry(options =>
{
options.Dsn = "___PUBLIC_DSN___";
options.TracesSampleRate = 0.1;
// When configuring for the first time, to see what the SDK is doing:
// options.Debug = true;
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
options.TracesSampleRate = 0.1;
});

// Captures logError and higher as events
Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/dotnet/guides/entityframework/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Add the Entity Framework 6 support to your project in one step:

For example, configuring an ASP.NET app with _global.asax_:

```csharp {filename:global.asax} {"onboardingOptions": {"performance": "15-17, 26-35"}}
```csharp {filename:global.asax} {"onboardingOptions": {"performance": "17-19, 28-37"}}
using System;
using System.Configuration;
using Sentry.AspNet;
Expand All @@ -60,6 +60,8 @@ public class MvcApplication : System.Web.HttpApplication
{
// We store the DSN inside Web.config
options.Dsn = ConfigurationManager.AppSettings["SentryDsn"];
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down
1 change: 1 addition & 0 deletions docs/platforms/dotnet/guides/extensions-logging/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Example using `appsettings.json`:
},
"Sentry": {
"Dsn": "___PUBLIC_DSN___",
"SendDefaultPii": true,
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Warning",
"MaxBreadcrumbs": 50
Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/dotnet/guides/maui/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens
In your `MauiProgram.cs` file, call `UseSentry` on your `MauiAppBuilder`, and include any options you would like to set. The `Dsn` is the only required parameter.


```csharp {"onboardingOptions": {"performance": "19-22"}}
```csharp {"onboardingOptions": {"performance": "22-25"}}
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
Expand All @@ -64,6 +64,9 @@ public static MauiApp CreateMauiApp()
// This option is not recommended when deploying your application.
options.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/dotnet/guides/uwp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The SDK should be initialized in the constructor of your application class (usua
</Alert>


```csharp {"onboardingOptions": {"performance": "17-20"}}
```csharp {"onboardingOptions": {"performance": "20-23"}}
using Sentry.Protocol;
using UnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs;

Expand All @@ -45,6 +45,9 @@ sealed partial class App : Application
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down
11 changes: 10 additions & 1 deletion docs/platforms/dotnet/guides/winforms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You should also set `Application.SetUnhandledExceptionMode(UnhandledExceptionMod
A complete example of the recommended startup is as follows:


```csharp {"onboardingOptions": {"performance": "31-34"}}
```csharp {"onboardingOptions": {"performance": "34-37"}}
using System;
using System.Windows.Forms;

Expand Down Expand Up @@ -61,6 +61,9 @@ namespace WindowsFormsApp1
// When configuring for the first time, to see what the SDK is doing:
Debug = true,

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
TracesSampleRate = 1.0,
Expand Down Expand Up @@ -122,6 +125,9 @@ Module Program
{
.Dsn = "___PUBLIC_DSN___",

' Adds request URL and headers, IP and name for users, etc.
.SendDefaultPii = True,
Copy link
Member Author

@Flash0ver Flash0ver Apr 16, 2025

Choose a reason for hiding this comment

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

note: Both Visual Basic With Statements don't look quite right. I will follow up with a non-urgent PR to revise these.


' Enable Global Mode since this is a client app
.IsGlobalModeEnabled = True,

Expand Down Expand Up @@ -180,6 +186,9 @@ Namespace My
{
.Dsn = "___PUBLIC_DSN___",

' Adds request URL and headers, IP and name for users, etc.
.SendDefaultPii = True,

' Enable Global Mode since this is a client app
.IsGlobalModeEnabled = True,

Expand Down
10 changes: 8 additions & 2 deletions docs/platforms/dotnet/guides/winui/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ In addition to capturing errors, you can monitor interactions between multiple s

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

```csharp {"onboardingOptions": {"performance": "16-19"}}
```csharp {"onboardingOptions": {"performance": "19-22"}}
using Sentry.Protocol;

sealed partial class App : Application
Expand All @@ -48,6 +48,9 @@ sealed partial class App : Application
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down Expand Up @@ -77,7 +80,7 @@ Do not initialize the SDK in the `OnLaunched` event of the application or the `H
</Alert>


```csharp {"onboardingOptions": {"performance": "18-21"}}
```csharp {"onboardingOptions": {"performance": "21-24"}}
// Add these to your existing using statements.
using Sentry.Protocol;
using UnhandledExceptionEventArgs = Microsoft.UI.Xaml.UnhandledExceptionEventArgs;
Expand All @@ -95,6 +98,9 @@ sealed partial class App : Application
// When configuring for the first time, to see what the SDK is doing:
o.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
o.SendDefaultPii = true;

// Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
o.TracesSampleRate = 1.0;
Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/dotnet/guides/wpf/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The SDK should be initialized in the constructor of your application class (usua
The SDK automatically handles `AppDomain.UnhandledException`. On WPF, for production apps (when no debugger is attached), WPF catches exception to show the dialog to the user. You can also configure your app to capture those exceptions before the dialog shows up:


```csharp {"onboardingOptions": {"performance": "15-18"}}
```csharp {"onboardingOptions": {"performance": "18-21"}}
using System.Windows;

public partial class App : Application
Expand All @@ -45,6 +45,9 @@ public partial class App : Application
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/dotnet/guides/xamarin/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ After you’ve completed setting up a project in Sentry, Sentry will give you a
You should initialize the SDK as early as possible, for an example, the start of OnCreate
on MainActivity for Android, and, the top of FinishedLaunching on AppDelegate for iOS).

```csharp {"onboardingOptions": {"performance": "8-11"}}
```csharp {"onboardingOptions": {"performance": "10-13"}}
SentryXamarin.Init(options =>
{
options.AddXamarinFormsIntegration();
// Tells which project in Sentry to send events to:
options.Dsn = "___PUBLIC_DSN___";
// When configuring for the first time, to see what the SDK is doing:
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
// Set TracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/dotnet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ Install the **NuGet** package to add the Sentry dependency:
To capture all errors, even the one during the startup of your application, you should initialize the Sentry .NET SDK as soon as possible.


```csharp {"onboardingOptions": {"performance": "5-6", "profiling": "7-8"}}
```csharp {"onboardingOptions": {"performance": "7-8", "profiling": "9-10"}}
SentrySdk.Init(options =>
{
options.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.us.sentry.io/5428537";
options.Debug = true;
// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;
// A fixed sample rate of 1.0 - 100% of all transactions are getting sent
options.TracesSampleRate = 1.0f;
// A sample rate for profiling - this is relative to TracesSampleRate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static IWebHost BuildWebHost(string[] args) =>
o.Dsn = "___PUBLIC_DSN___";
o.MaxBreadcrumbs = 50;
o.Debug = true;
o.SendDefaultPii = true;
});
```

Expand All @@ -30,6 +31,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
o.Dsn = "___PUBLIC_DSN___";
o.MaxBreadcrumbs = 50;
o.Debug = true;
o.SendDefaultPii = true;
});
});
```
Expand All @@ -41,7 +43,8 @@ Additionally, you can set your options on `appsettings.json` when using `UseSent
"Sentry": {
"Dsn": "___PUBLIC_DSN___",
"MaxBreadcrumbs": 50,
"Debug": true
"Debug": true,
"SendDefaultPii": true
}
```

Expand Down
3 changes: 3 additions & 0 deletions platform-includes/configuration/config-intro/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ SentrySdk.Init(options =>
// You shouldn't do this in your applications unless you're troubleshooting issues with Sentry.
options.Debug = true;

// Adds request URL and headers, IP and name for users, etc.
options.SendDefaultPii = true;

// This option is recommended. It enables Sentry's "Release Health" feature.
options.AutoSessionTracking = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SentryXamarin.Init(options =>
options.AddXamarinFormsIntegration();
options.MaxBreadcrumbs = 50;
options.Debug = true;
options.SendDefaultPii = true;
});
// app code here
```
Loading