Skip to content

Commit de6f4df

Browse files
SimonCropplforst
authored andcommitted
add IsGlobalModeEnabled docs for dotnet (#5531)
1 parent 2630c47 commit de6f4df

File tree

7 files changed

+74
-5
lines changed

7 files changed

+74
-5
lines changed

src/platform-includes/configuration/config-intro/dotnet.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ using (SentrySdk.Init(o =>
99
o.Dsn = "___PUBLIC_DSN___";
1010
o.MaxBreadcrumbs = 50;
1111
o.Debug = true;
12+
// Enable Global Mode if running in a client app
13+
o.IsGlobalModeEnabled = true;
1214
})
1315
{
1416
// app code here
@@ -22,6 +24,8 @@ use __ = SentrySdk.Init(fun o ->
2224
o.Dsn <- "___PUBLIC_DSN___"
2325
o.MaxBreadcrumbs <- 50
2426
o.Debug <- true
27+
// Enable Global Mode if running in a client app
28+
o.IsGlobalModeEnabled <- true
2529
)
2630

2731
// app code here

src/platform-includes/getting-started-config/dotnet.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
For example, initialize in the `Main` method in `Program.cs`:
22

33
```csharp {filename:Program.cs}
4-
using (SentrySdk.Init(o =>
4+
using (SentrySdk.Init(o =>
55
{
66
// Tells which project in Sentry to send events to:
77
o.Dsn = "___PUBLIC_DSN___";
88
// When configuring for the first time, to see what the SDK is doing:
99
o.Debug = true;
1010
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
1111
// We recommend adjusting this value in production.
12-
o.TracesSampleRate = 1.0;
12+
o.TracesSampleRate = 1.0;
13+
// Enable Global Mode if running in a client app
14+
o.IsGlobalModeEnabled = true;
1315
}))
1416
{
1517
// App code goes here - Disposing will flush events out
@@ -24,6 +26,8 @@ use __ = SentrySdk.Init (fun o ->
2426
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
2527
// We recommend adjusting this value in production.
2628
o.TracesSampleRate <- 1.0
29+
// Enable Global Mode if running in a client app
30+
o.IsGlobalModeEnabled <- true
2731
)
2832
2933
// App code goes here - Disposing will flush events out

src/platforms/common/configuration/options.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ Changing this value will affect issue grouping. Since the frame significantly ch
4141

4242
</ConfigKey>
4343

44+
<ConfigKey name="is-global-mode-enabled" supported={["dotnet"]}>
45+
46+
Specifies whether to use global scope management mode. Should be `true` for client applications and `false` for server applications.
47+
48+
Example scenarios where it should be explicitly set to true:
49+
50+
* Universal Windows platform (UWP) applications
51+
* WinForms applications
52+
* Windows Presentation Foundation (WPF) applications
53+
* Single user console applications
54+
55+
Defaults to `false`, unless in Blazor WASM, MAUI, Unity, or Xamarin where the default is `true`.
56+
57+
</ConfigKey>
58+
4459
<ConfigKey name="database-path" supported={["native"]}>
4560

4661
Allows you to specify a path to the local event- and crash-database of the Native SDK. This path will default to `.sentry-native` relative to the current working directory (`CWD`). While this is a convenient setting for development, we strongly urge you to provide an explicit database path for our production deployments. In many deployment scenarios, the path relative to the `CWD` will not be writable. For this reason, you should store the database in your application's user-specific data/cache directory (e.g., under `%AppData%\Local` on Windows, `~/Library/Application Support` on macOS, or `XDG_CACHE_HOME` on Linux).

src/platforms/dotnet/guides/uwp/index.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ sealed partial class App : Application
3232
{
3333
// Tells which project in Sentry to send events to:
3434
o.Dsn = "___PUBLIC_DSN___";
35+
3536
// When configuring for the first time, to see what the SDK is doing:
3637
o.Debug = true;
38+
3739
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
3840
// We recommend adjusting this value in production.
3941
o.TracesSampleRate = 1.0;
42+
43+
// Enable Global Mode since this is a client app
44+
o.IsGlobalModeEnabled = true;
45+
46+
//TODO: any other options you need go here
4047
});
4148
Current.UnhandledException += ExceptionHandler;
4249
}

src/platforms/dotnet/guides/winforms/index.mdx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,20 @@ namespace WindowsFormsApp1
4545
// Configure the options for Sentry
4646
var sentryOptions = new SentryOptions
4747
{
48-
Dsn = "___PUBLIC_DSN___",
49-
// any other options you need go here
48+
// Tells which project in Sentry to send events to:
49+
o.Dsn = "___PUBLIC_DSN___",
50+
51+
// When configuring for the first time, to see what the SDK is doing:
52+
o.Debug = true,
53+
54+
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
55+
// We recommend adjusting this value in production.
56+
o.TracesSampleRate = 1.0,
57+
58+
// Enable Global Mode since this is a client app
59+
o.IsGlobalModeEnabled = true,
60+
61+
//TODO: any other options you need go here
5062
};
5163

5264
// Initialize Sentry and run the main form of the application
@@ -61,7 +73,7 @@ namespace WindowsFormsApp1
6173

6274
### Visual Basic Initialization
6375

64-
Windows Forms applications written in VB have two different intialization options. Pick one of them (not both).
76+
Windows Forms applications written in VB have two different initialization options. Pick one of them (not both).
6577

6678
#### Option 1
6779

@@ -97,6 +109,10 @@ Module Program
97109
Dim sentryOptions = New SentryOptions With
98110
{
99111
.Dsn = "___PUBLIC_DSN___",
112+
113+
' Enable Global Mode since this is a client app
114+
.IsGlobalModeEnabled = True,
115+
100116
' any other options you need go here
101117
}
102118

@@ -148,6 +164,10 @@ Namespace My
148164
Dim sentryOptions = New SentryOptions With
149165
{
150166
.Dsn = "___PUBLIC_DSN___",
167+
168+
' Enable Global Mode since this is a client app
169+
.IsGlobalModeEnabled = True,
170+
151171
' any other options you need go here
152172
}
153173

src/platforms/dotnet/guides/wpf/index.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ public partial class App : Application
2626
{
2727
public App()
2828
{
29+
SentrySdk.Init(o =>
30+
{
31+
// Tells which project in Sentry to send events to:
32+
o.Dsn = "___PUBLIC_DSN___";
33+
34+
// When configuring for the first time, to see what the SDK is doing:
35+
o.Debug = true;
36+
37+
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
38+
// We recommend adjusting this value in production.
39+
o.TracesSampleRate = 1.0;
40+
41+
// Enable Global Mode since this is a client app
42+
o.IsGlobalModeEnabled = true;
43+
44+
//TODO: any other options you need go here
45+
});
2946
DispatcherUnhandledException += App_DispatcherUnhandledException;
3047
}
3148

src/wizard/dotnet/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ using (SentrySdk.Init(o =>
3030
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
3131
// We recommend adjusting this value in production.
3232
o.TracesSampleRate = 1.0;
33+
// Enable Global Mode if running in a client app
34+
o.IsGlobalModeEnabled = true;
3335
}))
3436
{
3537
// App code goes here. Dispose the SDK before exiting to flush events.

0 commit comments

Comments
 (0)