[Mono-dev] COM Interop Remoting Patch

Jonathan Chambers joncham at gmail.com
Mon Apr 2 14:12:18 EDT 2007

     Attached is a patch to fix remoting involving COM Interop types. I had
previsouly broken this unintentionally. COM Interop uses transparent
proxies, and there was lots of places that didn't distinguish between a
remoting transparent proxy and a COM Interop transparent proxy. To
distinguish I check to see if the real proxy associated with the transparent
proxy is a COM Interop proxy.

The main cases I needed to handle was the casting of transparent proxy
objects, method calls, and field access. For the casting of transparent
proxies, I added a new field to the MonoRemoteClass for the COM Interop
vtable. I was previously overwriting the default_vtable. For method calls,
and probably the most important thing to notice, is that I added another
check to mono_marshal_get_remoting_invoke_with_check to see if a transparent
proxy is used for COM Interop. This does add some overhead to remoting; the
overhead should always be emitting a method that simply loads all the
arguments and calls the wrapped method on the underlying managed object the
proxy wraps. No real COM Interop code or marshalling code should unless the
type has a ComImport attribute. Unless COM is used the method should never
be called, only emitted.

The field access was done via checks in mono_load_remote_field,
mono_load_remote_field_new, mono_store_remote_field, and
mono_store_remote_field_new. This avoids emitting any additional checks or
methods for remoting wrappers.

Please make any suggestions if my changes could be done in a better way;
especially if my changes related to methods should be more like the ones for
fields, or vice versa.

This patch allows anyone one using COM Interop to remote those objects. This
obviously would be much more likely to occur on windows, but an example use
of this on other platforms would be accessing the Mozilla DOM cross process
in the ASP.Net designer.

Code is contributed under MIT/X11 license.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070402/bb5b5fce/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remoting_cominterop.diff
Type: text/x-patch
Size: 17331 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070402/bb5b5fce/attachment.bin 

More information about the Mono-devel-list mailing list