[python-win32] python com server exceptions don't make it to .NET /CLR app

Mark Hammond mhammond at skippinet.com.au
Thu Mar 30 11:53:16 CEST 2006


>     err = pythoncom.com_error(errorcode, desc, ierrorinfo, None)

Try win32com.server.exception.COMException - the framework sees that
exception as something that should be raised to the caller (whereas a normal
pythoncom.com_exception is assumed to have been generated by a COM object
*used* by the COM server, so is handled like any other 'unhandled'
exception.

> 1) What is pythoncom.com_error() and the code that handles it
> doing to get VB to see the (presumably) IErrorInfo?  I'm sorry if
> I've missed where I can get the source as presumably it's the C
> unmarshaling code that's in the C# process calling SetLastError()
> or something, but it'd be nice to know how it's done.

Exactly - SetErrorInfo should always be called - just how the attributes are
set may change.

> 2) Has anyone gotten any win32com.server.exception.COMExceptions
> across to C# with the string/Exception passed to raise()?

I'm not sure about C#, but certainly to another C++ (or similar) based app
that uses IErrorInfo.

I'm sure there are a few cans of worms waiting, so I'd be happy to accept
some C# code to add to the test suite - the com\TestSources directory (in
CVS or a source release) already contains VB6 and C++ COM servers...

Mark



More information about the Python-win32 mailing list