[Mono-bugs] [Bug 53201][Maj] New - Deserialization of XmlElement fails.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jan 2004 04:44:42 -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 erezl@mainsoft.com.

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

--- shadow/53201	2004-01-22 04:44:42.000000000 -0500
+++ shadow/53201.tmp.13343	2004-01-22 04:44:42.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 53201
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Major
+Component: Sys.XML
+AssignedTo: lluis@ximian.com                            
+ReportedBy: erezl@mainsoft.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Deserialization of XmlElement fails.
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+Trying to deserialize a XmlElment throws unexpected 
+InvalidOperationException.
+
+Steps to reproduce the problem:
+1. Compile and run the following code:
+public class Deserializer
+{
+	static void Main(string[] args)
+	{
+		XmlSerializer serializer = new XmlSerializer(typeof
+(XmlElement));
+		XmlElement e;
+
+		XmlDocument doc = new XmlDocument();
+		e = doc.CreateElement("TestElement");
+		System.IO.StreamWriter sout = new System.IO.StreamWriter
+("XmlElement.xml");
+		serializer.Serialize(sout, e);
+		sout.Close();
+
+		System.IO.StreamReader sin = new System.IO.StreamReader
+("XmlElement.xml");
+		e = (XmlElement)serializer.Deserialize(sin);
+		sin.Close();
+	}
+}
+
+Actual Results:
+1). I get the following exception:
+Unhandled Exception: System.InvalidOperationException: <TestElement 
+xmlns=''> was not expected
+in <0x000bb> 
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadRoot 
+(System.Xml.Serialization.XmlTypeMapping)
+in <0x0008d> 
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject ()
+in <0x00075> System.Xml.Serialization.XmlSerializer:Deserialize 
+(System.Xml.Serialization.XmlSerializationReader)
+in <0x00068> System.Xml.Serialization.XmlSerializer:Deserialize 
+(System.Xml.XmlReader)
+in <0x0003f> System.Xml.Serialization.XmlSerializer:Deserialize 
+(System.IO.TextReader)
+in <0x000fd> .Deserializer:Main (string[])
+
+Expected Results:
+The XmlElement should deserialize successfully.
+
+How often does this happen? 
+Always.
+
+Additional Information: