An exception is an abnormal situation that happens while a program is running. Exceptions are often indications of problems that you need to debug. The Visual Studio debugger recognizes many types of exceptions. These include C++ exceptions, common language runtime exceptions, Win32 exceptions, and native run-time checks. Some types of exceptions, such as C++ exceptions, have handlers — pieces of code that are designed to respond to an exception when it occurs, giving the program a chance to recover from the abnormal situation. C run-time errors do not have handlers. In a Visual Basic application, all errors are represented as exceptions in the debugger, even if you use On Error–style error handlers.
The following topics provide information on handling exceptions:
- Continuing Execution After an Exception
- Changing How the Debugger Handles Exceptions
- Adding New Exceptions
- Deleting User-Added Exceptions
- Using Native Run-Time Checks
- Using Run-Time Checks Without the C Run-Time Library
Note (Visual C# only) When an uncaught exception occurs, a pseudovariable
$exceptionis added to the Locals window. You can expand this pseudovariable to see information on the exception.