Windows Forms

In addition to initializing the SDK with SentrySdk.Init, you must also configure the WinForms 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

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").