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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 7853 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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