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 ...

Get .NET and COM: The Complete Interoperability Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.