This documentation is archived and is not being maintained.

Handling Exceptions

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:

Note   (Visual C# only) When an uncaught exception occurs, a pseudovariable $exception is added to the Locals window. You can expand this pseudovariable to see information on the exception.

See Also

Exceptions Dialog Box | Using the Debugger | Visual Studio Debugger Model