Exception Handling under /clr
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Exception Handling under /clr

You can use both structured exception handling (SEH) and C++ exception handling under /clr. Under /clr, you can also handle CLR exceptions. A CLR exception is any exception thrown by a managed type. The System::Exception class provides many useful methods for processing CLR exceptions and is recommended as a base class for user-defined exception classes.


Catching exception types derived from an interface is not supported under /clr. Also, the common language runtime does not permit you to catch stack overflow exceptions; a stack overflow exception will terminate the process.

In This Section

Basic Concepts in Using Managed Exceptions

Describes throwing exceptions and using try/catch blocks.

Differences in Exception Handling Behavior Under /CLR

Discusses the differences from the standard behavior of C++ exception handling.


Discusses how to use the finally keyword.

How to: Define and Install a Global Exception Handler

Demonstrates how unhandled exceptions can be captured.

How to: Catch Exceptions in Native Code Thrown from MSIL

Discusses how to catch CLR and C++ exceptions in native code.

How to: Define and Install a Global Exception Handler

Demonstrates how to catch all unhandled exceptions.

Related Sections

Exception Handling

Describes exception handling in C++.

See Also

© 2015 Microsoft