[Mono-bugs] [Bug 61837][Nor] New - Remoting over HTTP fails when returning a null reference.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jul 2004 13:19:26 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kronos@people.it.

http://bugzilla.ximian.com/show_bug.cgi?id=61837

--- shadow/61837	2004-07-22 13:19:26.000000000 -0400
+++ shadow/61837.tmp.6979	2004-07-22 13:19:26.000000000 -0400
@@ -0,0 +1,113 @@
+Bug#: 61837
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: kronos@people.it               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Remoting over HTTP fails when returning a null reference.
+
+[Note about the component in the bugreport: there's no
+System.Runtime.Remoting...]
+
+I'm using remoting with a http channel. The remote object has method that
+returns a new object (if login is ok) or null. When null is returned I see the
+following exception:
+
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
+range.
+in [0x0008f] (at
+/home/kronos/download/mcs-1.0/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs:108)
+System.Runtime.Remoting.Channels.SoapMessageFormatter:FormatResponse
+(System.Runtime.Serialization.Formatters.ISoapMessage,System.Runtime.Remoting.Messaging.IMethodCallMessage)
+in [0x00047] (at
+/home/kronos/download/mcs-1.0/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs:183)
+System.Runtime.Remoting.Channels.SoapClientFormatterSink:DeserializeMessage
+(System.IO.Stream,System.Runtime.Remoting.Channels.ITransportHeaders,System.Runtime.Remoting.Messaging.IMethodCallMessage,System.Runtime.Remoting.Channels.SoapMessageFormatter)
+in [0x0002a] (at
+/home/kronos/download/mcs-1.0/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs:150)
+System.Runtime.Remoting.Channels.SoapClientFormatterSink:SyncProcessMessage
+(System.Runtime.Remoting.Messaging.IMessage)
+in [0x000be] (at
+/home/kronos/download/mcs-1.0/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs:98)
+System.Runtime.Remoting.Proxies.RemotingProxy:Invoke
+(System.Runtime.Remoting.Messaging.IMessage)
+in [0x0009a] (at
+/home/kronos/download/mcs-1.0/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:180)
+System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
+(System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messaging.IMessage,System.Exception&,object[]&)
+
+Same code works using MS framework under VS.NET. The testcase is the following:
+
+--- common.cs ---
+using System;
+using System.Runtime.Remoting;
+using System.Xml;
+
+public class Foo: MarshalByRefObject {
+	public Bar Login() {
+		return null;
+	}
+}
+
+public class Bar: MarshalByRefObject {
+	public void Foobar() {
+		Console.WriteLine("Bar::foo()");
+	}
+}
+
+--- server.cs ---
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+
+public class Server {
+	public static void Main() {
+		HttpChannel c = new HttpChannel(4321);
+		ChannelServices.RegisterChannel(c);
+		
+		Type t = typeof(Foo);
+		RemotingConfiguration.RegisterWellKnownServiceType(t, "Test",
+WellKnownObjectMode.SingleCall);
+		Console.ReadLine();
+	}
+}
+
+--- client.cs ---
+using System;
+using System.Runtime.Remoting;
+
+public class Client {
+	public static void Main() {
+		Foo foo = (Foo) Activator.GetObject(typeof(Foo),
+"http://localhost:4321/Test");
+		Console.WriteLine("rem ok");
+
+		Bar bar = foo.Login();
+		if (bar != null)
+			bar.Foobar();
+
+		Console.ReadLine();
+	}
+}
+
+mono is:
+kronos:~$ mono --version
+Mono JIT compiler version 1.0, (C) 2002-2004 Novell, Inc and Contributors.
+www.go-mono.com
+        TLS:           __thread
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: none
+
+I'll attach the trace of the messages exchanged by the client and the server.