[Mono-bugs] [Bug 74295][Nor] New - Mono and MS .Net remoting - type encodings don't agree

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 31 Mar 2005 21:11:35 -0500 (EST)


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 ravitch@nrtc.northrop.com.

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

--- shadow/74295	2005-03-31 21:11:35.000000000 -0500
+++ shadow/74295.tmp.29874	2005-03-31 21:11:35.000000000 -0500
@@ -0,0 +1,161 @@
+Bug#: 74295
+Product: Mono: Class Libraries
+Version: 1.1
+OS: other
+OS Details: Linux (Fedora Core 3) and Windows 2000
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ravitch@nrtc.northrop.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono and MS .Net remoting - type encodings don't agree
+
+Description of Problem:
+
+This is sort of three reports in one.  (Sorry - I'm lazy and didn't
+want to produce three separate yet related patches to the same file.)
+It also subsumes bug #74108.
+
+.Net and Mono don't seem to agree on the serialization of certain types
+in certain circumstances.  (Yes - in certain circumstances!  .Net will
+actually accept an encoding in one context and not in another.)
+
+First, the problem described in bug #74108.  .Net serializes doubles
+in lists as xsd:double - Mono's deserialization doesn't understand them.
+
+Second, .Net chokes on the way Mono serializes bools, but only as
+method parameters.  (I.e., a bool as an object member works fine.)
+
+Finally, .Net chokes on the way Mono serializes bytes, but only as
+return values from method calls.
+
+Steps to reproduce the problem:
+
+1. Download and uncompress attached zip file; build the programs (see
+   the attached Makefile for details if you don't have make).
+2. If testing across a network, change client.config to point to the
+   other host (do this on each machine).
+3. For the double problem... (This is the part that subsumes bug #74108)
+   a. Run server.exe under MS .Net
+   b. Run double.exe under mono (e.g., "mono double.exe")
+4. Edit client.config to remove "RemotingTest" from the end of the url.
+   (For some reason mono servers don't work with it and .Net servers
+   don't work without it - Is that right?  Or is it a bug?)
+5. For the bool problem...
+   a. Run server.exe under mono.  You might need to do this on a Linux
+      box instead of on the same Windows machine - see bug #74081.  If
+      so, you'll need to edit client.config to change the server from
+      "localhost" to the name or IP address of your Linux box.
+   b. Run bool.exe under MS .Net
+6. For the byte problem, do the same as (5), but use byte.exe instead
+   of bool.exe.
+
+Actual Results:
+
+See bug #74081 for the results of the double problem.
+
+For the bool problem...
+
+---- BEGIN BOOL CLIENT OUTPUT ----
+Unhandled Exception: System.ArgumentNullException: Value cannot be null.
+Parameter name: format
+
+Server stack trace:
+   at System.String.Format(IFormatProvider provider, String format,
+Object[] args)
+   at System.String.Format(String format, Object arg0, Object arg1)
+   at
+System.Runtime.Serialization.Formatters.Soap.Converter.FromString(String
+value, InternalPrimitiveTypeE code)
+   at
+System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseMember(ParseRecord
+pr)
+   at
+System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecord pr)
+   at
+System.Runtime.Serialization.Formatters.Soap.SoapHandler.EndElement(String
+prefix, String name, String urn)
+   at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXml()
+   at System.Runtime.Serialization.Formatters.Soap.SoapParser.Run()
+   at
+System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler
+handler, ISerParser serParser)
+   at
+System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream
+serializationStream, HeaderHandler handler)
+   at
+System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoapResponseMessage(Stream
+inputStream, IMessage requestMsg, Header[] h, Boolean bStrictBinding)
+   at
+System.Runtime.Remoting.Channels.SoapClientFormatterSink.DeserializeMessage(IMethodCallMessage
+mcm, ITransportHeaders headers, Stream stream)
+   at
+System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncProcessMessage(IMessage
+msg)
+
+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 RemoteObject.get_bool(Boolean& retval)
+   at Client.Main()
+---- END BOOL CLIENT OUTPUT ----
+
+For the byte problem....
+
+---- BEGIN BYTE CLIENT OUTPUT ----
+Unhandled Exception: System.InvalidCastException: Return argument has an
+invalid type.
+   at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object
+arg, Type paramType)
+   at
+System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage
+msg, Object[] outArgs, Object returnValue)
+   at
+System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
+reqMsg, IMessage retMsg)
+   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
+msgData, Int32 type)
+   at RemoteObject.get_byte()
+   at Client.Main()
+---- END BYTE CLIENT OUTPUT ----
+
+Expected Results:
+
+For double.exe...
+
+---- BEGIN DOUBLE CLIENT OUTPUT ----
+Got System.Double value: 3.14159
+---- END DOUBLE CLIENT OUTPUT ----
+
+For bool.exe...
+
+---- BEGIN BOOL CLIENT OUTPUT ----
+Got value: True
+---- END BOOL CLIENT OUTPUT ----
+
+And for byte.exe...
+
+---- BEGIN BYTE CLIENT OUTPUT ----
+Got byte value: 23
+---- END BYTE CLIENT OUTPUT ----
+
+How often does this happen? 
+
+Every time.
+
+Additional Information:
+
+I implemented a patch (also attached) which fixes the problems by adding
+the appropriate types to Mono's SOAP types mapper.  Also, I added a
+special case for bools so that they are printed all lower case.  (.Net
+didn't like True/False as output by ToString - technically the XSD type
+should be true/false or 1/0)