.NET

This section will describe features, configurations and general functionality which are specific to the .NET SDK.

Compatibility

The main Sentry NuGet package targets .NET Standard 2.0. That means, according to the compatibility table, it is compatible with the following versions or newer:

  • .NET Framework 4.6.1 (4.7.2 advised)
  • .NET Core 2.0
  • Mono 5.4
  • Xamarin.Android 8.0
  • Xamarin.Mac 3.8
  • Xamarin.iOS 10.14
  • Universal Windows Platform 10.0.16299

Of those, we run our unit/integration tests against:

  • .NET 5 - Windows, macOS and Linux
  • .NET Core 3.1 - Windows, macOS and Linux
  • .NET Core 2.1 - Windows, macOS and Linux
  • .NET Framework 4.8 - Windows
  • Mono 5.12 - macOS and Linux

Install

Add the Sentry dependency:

Copied
Install-Package Sentry -Version 2.1.8

Configure

Initialize the SDK as early as possible, like in the Main method in Program.cs/Program.fs:

Program.cs
Copied
using (SentrySdk.Init("https://examplePublicKey@o0.ingest.sentry.io/0"))
{
    // App code
}

Verify

Verify Sentry is capturing unhandled exceptions by raising an exception. For example, you can use the following snippet to raise a NullReferenceException:

Copied
using (SentrySdk.Init("https://examplePublicKey@o0.ingest.sentry.io/0"))
{
    throw null;
}

Samples

Resources

You can edit this page on GitHub.