[Mono-bugs] [Bug 81686][Nor] New - SoapFormatter cannot deserialize the same MBR twice

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat May 19 19:46:13 EDT 2007


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 robertj at gmx.net.

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

--- shadow/81686	2007-05-19 19:46:13.000000000 -0400
+++ shadow/81686.tmp.26915	2007-05-19 19:46:13.000000000 -0400
@@ -0,0 +1,120 @@
+Bug#: 81686
+Product: Mono: Class Libraries
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: lluis at ximian.com                            
+ReportedBy: robertj at gmx.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SoapFormatter cannot deserialize the same MBR twice
+
+Hard to find a concise summary for this problem:
+
+When the same MBR object is returned both as a return value
+and also as part of an "out" array or ArrayList parameter,
+the SOAP formatter doesn't call IObjectReference.GetObject ()
+of the MBR's ObjRef. This leads to an exception (for array params)
+or to invalid content (for ArrayList params).
+
+
+Test case:
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+
+public class Service : MarshalByRefObject
+{
+	public Service Test (out Service[] a)
+	{
+		Service obj = new Service ();
+		a = new Service [] { obj };
+		return obj;
+		// return null or return otherObj works
+	}
+
+	public Service Test (out ArrayList a)
+	{
+		a = new ArrayList ();
+		Service obj = new Service ();
+		a.Add (obj);
+		return obj; 
+		// return null or return otherObj works
+	}
+}
+
+class T
+{
+	static void Main ()
+	{
+		new HttpChannel (8086);
+		RemotingServices.Marshal (new Service (), "test");
+
+		Service remObj = (Service) RemotingServices.Connect (
+			typeof (Service), "http://localhost:8086/test");
+
+		ArrayList list;
+		remObj.Test (out list);
+		// it's of type 'ObjRef' instead of 'Service':
+		Console.WriteLine (list [0]);
+
+		Service [] array;
+		remObj.Test (out array);
+	}
+}
+
+
+Output
+
+
+System.Runtime.Remoting.ObjRef  <-- this must be 'Service'
+
+Unhandled Exception: System.InvalidCastException: Cannot cast from source
+type to destination type.
+  at <0x00000> <unknown method>
+  at (wrapper managed-to-native) System.Array:SetValue (object,int[])
+  at
+System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeArray
+(Int64 id) [0x0019d] in
+/usr/src/mono/head/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs:396
+  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize ()
+[0x0004a] in
+/usr/src/mono/head/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs:449
+  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize
+(System.IO.Stream inStream, ISoapMessage soapMessage) [0x00188] in
+/usr/src/mono/head/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs:137
+  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize
+(System.IO.Stream serializationStream,
+System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00034] in
+/usr/src/mono/head/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs:79
+  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize
+(System.IO.Stream serializationStream) [0x00000] in
+/usr/src/mono/head/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs:70
+  at
+System.Runtime.Remoting.Channels.SoapClientFormatterSink.DeserializeMessage
+(System.IO.Stream responseStream, ITransportHeaders responseHeaders,
+IMethodCallMessage mcm,
+System.Runtime.Remoting.Channels.SoapMessageFormatter soapMsgFormatter)
+[0x0001c] in
+/usr/src/mono/head/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs:177
+  at
+System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncProcessMessage
+(IMessage msg) [0x0001f] in
+/usr/src/mono/head/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs:149
+  at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke (IMessage
+request) [0x000e3] in
+/usr/src/mono/head/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs:100
+  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke
+(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
+System.Exception& exc, System.Object[]& out_args) [0x0009a] in
+/usr/src/mono/head/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:187


More information about the mono-bugs mailing list