O'Reilly logo

.NET and COM: The Complete Interoperability Guide by Adam Nathan

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

Appendix C. HRESULT to .NET Exception Transformations

When a COM member (or PInvoke signature marked with PreserveSig=false) returns a failure HRESULT, a .NET exception is thrown. The type of the exception depends on the HRESULT value, according to the tables in this appendix. The exceptions listed are the only ones that can be directly thrown by the CLR in response to a COM object returning a failure HRESULT, and are a subset of the exceptions defined in the mscorlib assembly. The only reason that the list doesn’t include all exceptions defined in mscorlib is that a handful of exceptions share the same HRESULT values, so one exception type must be chosen when the shared value is returned from COM.

Table C.1 lists exception types alphabetically ...

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