[Mono-bugs] [Bug 49349][Nor] New - XmlSerializer does not complain when class lacks a default constructor

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 5 Oct 2003 13:38:40 -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 mathpup@mylinuxisp.com.

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

--- shadow/49349	2003-10-05 13:38:40.000000000 -0400
+++ shadow/49349.tmp.21200	2003-10-05 13:38:40.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 49349
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlSerializer does not complain when class lacks a default constructor
+
+Description of Problem: 
+ 
+According to the specification, a class that is to be serialized must contain a public 
+default (i.e. parameterless) constructor. In .NET/Rotor, this is verified when the 
+XmlSerializer is created, but Mono does not perform this check. 
+ 
+The test case below *should* fail, but Mono runs it without complaint. 
+ 
+ 
+ 
+Steps to reproduce the problem: 
+1. mcs serial-needs-default-constructor.cs 
+2. mono serial-needs-default-constructor.exe 
+ 
+ 
+Actual Results: 
+ 
+Successful execution 
+ 
+ 
+Expected Results: 
+ 
+Unhandled Exception: System.InvalidOperationException: There was an error 
+reflecting 'MyClass'. ---> System.InvalidOperationException: MyClass cannot be 
+serialized because it does not have a default public constructor. 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: 
+ 
+The XmlSerializer constructor needs to perform a check that the class it is pass 
+contains a public parameterless construction.