O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

COM Exceptions

You would not expect an exception here. One of the core principles behind COM is that exceptions cannot cross COM method boundaries. Here, unlike the unmanaged exceptions of the previous section, no exceptions are thrown in unmanaged code. Where are the exceptions coming from? As you saw in Chapter 8, “Using COM/COM+ in Managed Code,” to call a COM component in managed code, a wrapper must be constructed to form an interop layer between the managed code and unmanaged code. As far as exceptions are concerned, the returned HRESULT from the COM method is turned into an exception by this interop layer. This translation is not unlike that which was occurring when code was imported like this:

#import "msxml3.dll"

When the compiler ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required