[Mono-bugs] [Bug 79278][Min] Changed - XmlSerializer requires default public constructor on Mono, but not on MS.NET

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Sep 4 12:57:54 EDT 2006


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 atsushi at ximian.com.

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

--- shadow/79278	2006-09-04 12:29:38.000000000 -0400
+++ shadow/79278.tmp.32743	2006-09-04 12:57:54.000000000 -0400
@@ -1,17 +1,17 @@
 Bug#: 79278
 Product: Mono: Class Libraries
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: FC5
 Status: NEW   
 Resolution: 
-Severity: 
-Priority: Normal
+Severity: Unknown
+Priority: Minor
 Component: Sys.XML
-AssignedTo: atsushi at ximian.com                            
+AssignedTo: lluis at ximian.com                            
 ReportedBy: juraj at hotfeet.ch               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
 Summary: XmlSerializer requires default public constructor on Mono, but not on MS.NET
@@ -32,6 +32,30 @@
 System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
 
 ------- Additional Comments From juraj at hotfeet.ch  2006-09-04 12:29 -------
 Created an attachment (id=17607)
 xmlser_test.cs (simple testcase)
 
+
+------- Additional Comments From atsushi at ximian.com  2006-09-04 12:57 -------
+Seems like it is a bug in .NET 2.0 XmlSerializer. From MSDN:
+
+http://msdn2.microsoft.com/en-us/library/182eeyhh.aspx
+"A class must have a default constructor to be serialized by
+XmlSerializer."
+
+As for 1.x you are wrong. .NET 1.1 raises an error which is correct.
+
+./79278.exe
+
+Unhandled Exception: System.InvalidOperationException: SomeTest.Test
+cannot be serialized because it does not have a default public
+constructor.
+   at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type,
+MemberInfo source, Boolean directReference)
+   at System.Xml.Serialization.ModelScope.GetTypeModel(Type type,
+Boolean directReference)
+   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String
+defaultNamespace)
+   at System.Xml.Serialization.XmlSerializer..ctor(Type type)
+   at SomeTest.Test.Main()
+


More information about the mono-bugs mailing list