#876 – Unhandled Exceptions

If an exception is thrown while your code is executing and you don’t have a handler that catches the exception, it is considered an unhandled exception.  An unhandled exception is one that travels all the way back up the call stack without encountering a handler that catches the exception.

When an unhandled exception occurs, the application will stop executing and display an error message.

For example, if we call a method named MethodA from a console application and it throws an exception that we don’t catch, we see some information about the exception dumped to the console and an error window.

876-001

 

Here’s another example where a WPF application throws an exception when we click on a button and we don’t handle the exception:

876-002

Advertisement