Windows Forms

In addition to initializing the SDK with SentrySdk.Init](/platforms/dotnet/), you must also configure WinForms to error handler.

Sentry's .NET SDK works with WinForms applications through the Sentry NuGet package. It works with WinForms apps running on .NET Framework 4.6.1, .NET Core 3.0, or higher.

Configuration

The SDK automatically handles AppDomain.UnhandledException. On Windows Forms, for production apps (when no debugger is attached), the small Window pops up when an unhandled error occurs. To get the exception to rethrow the error so it is captured by Sentry, also configure:

Copied
using System.Windows.Forms;

Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

Resources

Discussion on GitHub Application.SetUnhandledExceptionMode

You can edit this page on GitHub.