Managing Unhandled Exceptions

The AppDomain class represents the application domain, which is an isolated environment where the CLR-managed applications execute. This class generates an event named UnhandledException whenever an unhandled exception occurs in an application. Unhandled exception can occur if there are no try-catch-finally blocks in the code, or if the existing catch blocks in the code cannot catch the thrown exception.

The UnhandledException event handler receives unhandled exception details through its argument, an object of type UnhandledExceptionEventArgs.

Table 3.2 details the most important properties of the UnhandledExceptionEventArgs class.

Table 3.2. Important Properties of the UnhandledExceptionEventArgs Class
Property ...

Get Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.