GetErrorInfo COM API

0

I'm using a Interrop COM, which is throwing an 0x80020009 DISP_E_EXCEPTION with meaning "Exception occurred", as it doesn’t have a dedicated error list.

The software manual says :

"in this case a text description of the error can be obtained using GetErrorInfo COM API function. This is a standard error handling function, more info see link."

I have spent the morning trying to learn/research and implement this, without much luck.

I've installed Pinvoke add in and searched for GetErrorInfo, and inserted signature, which produced this:

[DllImport("ole32.dll")]
static extern int GetErrorInfo(uint dwReserved, out IErrorInfo pperrinfo);

Which give this error:

Error   CS0592  Attribute 'DllImport' is not valid on this declaration type. It is 
only valid on 'method' declarations.    

Does anyone have a working example of how to capture the error code from a COM that doesn't have a dedicated error list, or any nudges in the write direction please?

c#
exception-handling
com
asked on Stack Overflow Oct 18, 2018 by chasher

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0