Bug 7853 - Manual Soap based deserialization fails with DateTime objects
Summary: Manual Soap based deserialization fails with DateTime objects
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-15 15:49 UTC by Stefano Angeleri
Modified: 2012-10-15 17:06 UTC (History)
2 users (show)

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


Attachments
Sample showing the issue, works on windows. (962 bytes, text/x-csharp)
2012-10-15 15:49 UTC, Stefano Angeleri
Details

Description Stefano Angeleri 2012-10-15 15:49:09 UTC
Created attachment 2747 [details]
Sample showing the issue, works on windows.

When using Soap Formatter to serialize objects the serialization process will work fine (and will be compatible with windows too) but when attempt to deserialize the same data produced from itself using again a soap formatter and a DateTime object is present in the object being serialized/deserialized, and the process is handled manually from the class (GetObjectData(SerializationInfo info, StreamingContext context)/Class(SerializationInfo info, StreamingContext context)) there will be the exception pasted at the bottom. To note the same code works fine on windows with microsoft.net and the serialization/deserialization process is completed succesfully. Additionally the issue is reproduceable only if manual serialization/deserialization is used, else it will work fine. (attached is a test case showing a class being created, then serialized and then immediately deserialized again which will show the stacktrace under (if it worked no output should be produced), it will need a reference to System.Runtime.Serialization.Formatters.Soap in order to build)
The system it was tested on is ubuntu 11.04 and debian testing (as of 15 october 2012) with mono 2.10.8.1.

Unhandled Exception: System.Xml.XmlException: 'Text' is an invalid node type.  Line 4, position 49.
  at System.Xml.XmlReader.ReadElementString () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeComponent (System.Type componentType, System.Int64& componentId, System.Int64& componentHref, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeISerializableObject (System.Object obj, Int64 id, System.Runtime.Serialization.SerializationInfo& info, System.Boolean& hasFixup) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeObject (System.Type type, Int64 id, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeComponent (System.Type componentType, System.Int64& componentId, System.Int64& componentHref, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeISerializableObject (System.Object obj, Int64 id, System.Runtime.Serialization.SerializationInfo& info, System.Boolean& hasFixup) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeObject (System.Type type, Int64 id, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize (System.IO.Stream inStream, ISoapMessage soapMessage) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0 
  at testcase.Program.Main (System.String[] args) [0x0002e] in /home/stefano/Projects/testcase/testcase/Main.cs:39 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Xml.XmlException: 'Text' is an invalid node type.  Line 4, position 49.
  at System.Xml.XmlReader.ReadElementString () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeComponent (System.Type componentType, System.Int64& componentId, System.Int64& componentHref, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeISerializableObject (System.Object obj, Int64 id, System.Runtime.Serialization.SerializationInfo& info, System.Boolean& hasFixup) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeObject (System.Type type, Int64 id, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeComponent (System.Type componentType, System.Int64& componentId, System.Int64& componentHref, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeISerializableObject (System.Object obj, Int64 id, System.Runtime.Serialization.SerializationInfo& info, System.Boolean& hasFixup) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.DeserializeObject (System.Type type, Int64 id, Int64 parentId, System.Reflection.MemberInfo parentMemberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapReader.Deserialize (System.IO.Stream inStream, ISoapMessage soapMessage) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0 
  at testcase.Program.Main (System.String[] args) [0x0002e] in /home/stefano/Projects/testcase/testcase/Main.cs:39

Note You need to log in before you can comment on or make changes to this bug.