[Mono-bugs] [Bug 595613] New: RemotingException when accessing members of System.Object on a remote object marshaled via an interface.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Apr 11 21:42:57 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=595613

http://bugzilla.novell.com/show_bug.cgi?id=595613#c0


           Summary: RemotingException when accessing members of
                    System.Object on a remote object marshaled via an
                    interface.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86
        OS/Version: openSUSE 11.2
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mono-dev at seamuscasey.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=353617)
 --> (http://bugzilla.novell.com/attachment.cgi?id=353617)
test case source

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3

When accessing a remote object that has been manually marshaled via an
interface, such as:

RemotingServices.Marshal( server, ServerUri, typeof(IServerEx) );

..the Mono remoting subsystem prevents access to the members of Object (in
this case, ToString).
An exception is thrown, containing the message "Cannot cast from client type
'System.Object ...' to server type 'IServerEx'"

The .NET runtime allows for this, however.


The client side resembles:

IServerEx client1 = (IServerEx) Activator.GetObject( typeof(IServerEx),
ServerUri );
Console.WriteLine( client1.ToString() );


The issue appears to be in:
mcs/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs, within CastTo().
Perhaps the simplest way to correct this, would be to add an explicit check for
System.Object in CastTo.


Full stack trace of the exception:

System.Runtime.Remoting.RemotingException: Cannot cast from client type
'System.Object, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' to server type
'LePouletFou.MonoTest.RemotingSpecificType.Shared.IServerEx'

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.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
   at System.Object.ToString()
   at LePouletFou.MonoTest.RemotingSpecificType.Client.Client.Main(String[]
args) in W:\_Code\mono\tests\RemotingSpecificType\Client\Client.cs:line 54


I have created the necessary test code, including a shell script for building
it with Mono under Linux, etc., plus a Visual Studio 2005 solution.

To test it, simply run:

mono Server.exe
mono Client.exe

The client app accepts an optional parameter to connect to a specific host.
If omitted, localhost is used.


Various combinations of client and server:
Mono client, Mono server - fails as described above.
NET client, Mono server - fails as described above.
Mono client, .NET server - success.
NET client, .NET server - success.



Reproducible: Always

Steps to Reproduce:
1. extract contents of ZIP, "chmod 755 makemono"
2. ./makemono
3. mono Server.exe
4. from second session, "mono Client.exe"
Actual Results:  
An execption is thrown, as described above

Expected Results:  
With the server running under .NET, the client should display the following:

Calling client1.DoIt
Calling client1.ToString:
LePouletFou.MonoTest.RemotingSpecificType.Server.Server
Calling client2.DoIt
Calling client2.DoItEx
Calling client2.ToString:
LePouletFou.MonoTest.RemotingSpecificType.Server.Server
Press enter to continue.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list