-
-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathProgram.cs
More file actions
35 lines (30 loc) · 1.11 KB
/
Program.cs
File metadata and controls
35 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* This sample demonstrates a native crash handling in a NativeAOT published application.
*/
// Initialize the Sentry SDK. (It is not necessary to dispose it.)
SentrySdk.Init(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif
// When debug is enabled, the Sentry client will emit detailed debugging information to the console.
// This might be helpful, or might interfere with the normal operation of your application.
// We enable it here for demonstration purposes.
// You should not do this in your applications unless you are troubleshooting issues with Sentry.
options.Debug = true;
});
await FirstFunctionAsync();
async Task FirstFunctionAsync()
{
await Task.Delay(100);
await SecondFunctionAsync();
}
async Task SecondFunctionAsync()
{
await Task.Delay(100);
#pragma warning disable CS0618
SentrySdk.CauseCrash(CrashType.Native);
#pragma warning restore CS0618
}