This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 6606 - RemotingException when using a cross domain marshaller object
: RemotingException when using a cross domain marshaller object
Status: NEW
Product: Runtime
Classification: Mono
Component: remoting
: unspecified
: PC Linux
: Low normal
: ---
Assigned To: Lluis Sanchez
  Show dependency treegraph
Reported: 2012-08-20 03:43 EDT by Timotheus Pokorra
Modified: 2012-09-02 12:49 EDT (History)
3 users (show)

See Also:

patch to make cross domain marshalling work on Mono (3.57 KB, application/octet-stream)
2012-08-20 03:43 EDT, Timotheus Pokorra

Description Timotheus Pokorra 2012-08-20 03:43:59 EDT
Created attachment 2376 [details]
patch to make cross domain marshalling work on Mono

I was trying to make the CrossDomainMarshaller example work which is available

The goal is to have several appdomains, but the server is only listening to one
IP port and distributes the messages from the clients to each appdomain and

It works fine on

Unfortunately, using even the latest Mono 2.11.3, you get this exception:

System.Runtime.Remoting.RemotingException: Cannot cast from client type
Touchcom.Prototypes.ContextBoundRemoting.Shared, Version=,
Culture=neutral, PublicKeyToken=null' to server type

Server stack trace: 
  at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod () [0x00000] in
<filename unknown>:0 
  at System.Runtime.Remoting.Messaging.MethodCall..ctor
(System.Runtime.Remoting.Messaging.Header[] h1) [0x00000] in <filename
(BinaryElement elem, System.IO.BinaryReader reader, Boolean hasHeaders,
System.Runtime.Remoting.Messaging.HeaderHandler headerHandler,
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter)
[0x00000] in <filename unknown>:0 
(System.IO.Stream serializationStream,
System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
(System.IO.Stream serializationStream,
System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename
  at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage
(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders
requestHeaders, System.IO.Stream requestStream, IMessage& responseMsg,
ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000]
in <filename unknown>:0 

Exception rethrown at [0]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke
(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception&
exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0 

I was able to get it to work for Mono with the attached patch. I don't know
enough about .net remoting, so I guess it is not the cleanest solution. But
perhaps it helps others as well...
Comment 1 Miguel de Icaza 2012-09-02 12:49:10 EDT
The patch contains this code:

+                               // Special behaviour for OpenPetra: need this
for cross domain marshalling
+                               if ((requestType == null) &&
type.FullName.EndsWith("CrossDomainMarshaller")) {
+                                       requestType = Type.GetType(_typeName);
+                                       _methodBase =
RemotingServices.GetMethodBaseFromName (requestType, _methodName,
+                                       return;
+                               }

I do not think we should get this patch as-is.

CCing Lluis.

Note You need to log in before you can comment on or make changes to this bug.