Understanding Exceptions

When an application encounters an unexpected situation such as a missing file or input parameter, or a logical error such as performing a division by zero, the application generates exceptions. By default, when an exception is generated, the application terminates and generates an error display such as the one shown in Figure 3.1.

Figure 3.1. This is an example error message, caused when an application commits a logical error, such as attempting to divide by zero.

Unhandled exceptions in an application can result in unexpected termination and lost data, and potentially even can create security holes if input values are ...

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.