Diagnostics
The Bulletcode.NET framework makes it possible to handle exceptions in desktop applications in a consistent way. To enable exception handling, call the AddExceptionHandler()
extension method of IServiceCollection
:
services.AddExceptionHandler();
This enables handling of the following exceptions:
Application.DispatcherUnhandledException
AppDomain.UnhandledException
TaskScheduler.UnobservedTaskException
All unhandled exceptions are automatically logged. See the Logging chapter for more information about enabling and configuring the text file logging provider, which can be used in desktop applications.
When an unhandled exception occurs, a custom error window appears, which makes it possible to view the error details. When a DispatcherUnhandledException
occurs and the application is already running, the user may choose to ignore the error and the application keeps running. Otherwise, the application is shut down.