[Mono-dev] Status of COM interop

Ivo Smits Ivo at UFO-Net.nl
Tue Apr 26 16:47:36 EDT 2011

In Mono COM/XPCOM interop, Runtime Callable Wrappers appear to be 
implemented and work correctly with VirtualBox, although it's not 
directly compatible with COM interop in the Microsoft .Net runtime: the 
interop assemblies generated by VS.Net cause crashes (segmentation 
fault) and for interfaces written in C#, Mono needs the 
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] attribute on the 
interfaces, while this attribute breaks the interface in MS .Net. If 
anyone has more information, or would like to have more information, let 
me know. For now, I will work around this by using different, equally 
named interop assemblies exposing the same interfaces.

I have not been able to get COM Callable Wrappers to work yet. I can get 
an IUnknown interface pointer for the managed object (using 
Marshal.GetIUnknownForObject), I can use Marshal.AddRef on this pointer, 
and I can pass this pointer to the COM code. Presumably when the COM 
code makes a call on the CCW interface, a segmentation fault occurs. 
This is still pretty much a black box for me, so before I investigate 
any further: have CCWs been implemented in Mono and are they supposed to 
work? Has anyone successfully used them?

The stack trace of the crash is short and not very useful:
Native stacktrace:



More information about the Mono-devel-list mailing list