Install the NuGet package:
# Using Package Manager
Install-Package Sentry
# Or using .NET Core CLI
dotnet add package Sentry
You should initialize the SDK as early as possible, like in the Main
method in Program.cs
:
using (SentrySdk.Init("YOUR-GLITCHTIP-DSN-HERE"))
{
// App code
}
You can verify GlitchTip is capturing unhandled exceptions by raising an exception. For example, you can use the following snippet to raise a DivideByZeroException
:
using (SentrySdk.Init("YOUR-GLITCHTIP-DSN-HERE"))
{
Console.WriteLine(1 / 0);
}