Bug 6606 - RemotingException when using a cross domain marshaller object
Summary: RemotingException when using a cross domain marshaller object
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Linux
: Low normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-08-20 03:43 UTC by Timotheus Pokorra
Modified: 2017-07-12 23:57 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 6606 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Timotheus Pokorra 2012-08-20 03:43:59 UTC
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 here: http://www.codeproject.com/KB/IP/CrossDomainRemoting.aspx

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 service.

It works fine on MS.net.

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

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

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 unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.MessageFormatter.ReadMethodCall (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 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  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 [MSFT] 2012-09-02 12:49:10 UTC
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, _methodSignature);
+                                       return;
+                               }
I do not think we should get this patch as-is.

CCing Lluis.
Comment 2 Rodrigo Kumpera 2017-07-12 23:57:52 UTC
This looks like a BCL issue.