views:

278

answers:

1

I'm writing a COM object in C# and I'd like to raise errors to vba/asp client software using the mechanism it understands - the Err object.

In good ol' days that would have meant implementing ISupportErrorInfo on the COM object but I can't find any information about how to implement that interface in a C# object.

Can anybody help?

thanks!

+1  A: 

You should be able to simulate this by throwing a custom exception from the Managed code. All CCW's automatically implement ISupportErrorInfo (Reference) and understand how to return error information for a thrown exception.

All you need to do is create a custom exception (if a current one does not suite you) and provide the appropriate HResult by setting the base Exception.HResult member.

JaredPar