[Mono-bugs] [Bug 49469][Nor] New - Xml Serialization doesnt handle structs

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 8 Oct 2003 19:32:21 -0400 (EDT)


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 bmaurer@users.sf.net.

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

--- shadow/49469	2003-10-08 19:32:21.000000000 -0400
+++ shadow/49469.tmp.28130	2003-10-08 19:32:21.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 49469
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: System.XML
+AssignedTo: lluis@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Xml Serialization doesnt handle structs
+
+Description of Problem:
+Xml Serialization cant handle serializing structs, it claims they have no
+default constructor (which is incorrect)
+
+Steps to reproduce the problem:
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+struct T {
+	int i;
+	static void Main ()
+	{
+		XmlSerializer s = new XmlSerializer (typeof (T));
+	}
+}
+
+Actual Results:
+Unhandled Exception: System.InvalidOperationException: T cannot be
+serialized because it does not have a default public constructor
+in [0x00058] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:194)
+System.Xml.Serialization.XmlReflectionImporter:ImportClassMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0008c] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:118)
+System.Xml.Serialization.XmlReflectionImporter:ImportTypeMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0004e] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:91)
+System.Xml.Serialization.XmlSerializer:.ctor
+(System.Type,System.Xml.Serialization.XmlAttributeOverrides,System.Type[],System.Xml.Serialization.XmlRootAttribute,string)
+in [0x00006] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:41)
+System.Xml.Serialization.XmlSerializer:.ctor (System.Type)
+in <0x0002d> .T:Main ()
+
+
+Expected Results:
+It runs
+
+How often does this happen? 
+Always