[Mono-bugs] [Bug 72658][Wis] New - System.Uri class doesn't serialize

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 16 Feb 2005 17:40:30 -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 dsd@gentoo.org.

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

--- shadow/72658	2005-02-16 17:40:30.000000000 -0500
+++ shadow/72658.tmp.16449	2005-02-16 17:40:30.000000000 -0500
@@ -0,0 +1,83 @@
+Bug#: 72658
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Gentoo Linux, Linux 2.6.11-rc4, NPTL
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dsd@gentoo.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Uri class doesn't serialize
+
+Description of Problem:
+The Uri class seems to include some code related to serialization. However
+I can't get it to serialize as standard.
+
+Steps to reproduce the problem:
+1. Compile and run the the attached sample app
+
+Actual Results: (with mono 1.1.3)
+Unhandled Exception: System.InvalidOperationException: System.Uri cannot be
+serialized because it does not have a default public constructor
+in [0x000ab]
+System.Xml.Serialization.ReflectionHelper:CheckSerializableType
+(System.Type,bool)
+in [0x00032] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:262)
+System.Xml.Serialization.XmlReflectionImporter:ImportClassMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0008c] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:177)
+System.Xml.Serialization.XmlReflectionImporter:ImportTypeMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0005f] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:816)
+System.Xml.Serialization.XmlReflectionImporter:ImportElementInfo
+(string,string,System.Type,System.Xml.Serialization.XmlTypeMapMemberElement,System.Xml.Serialization.XmlAttributes)
+in [0x0042e] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:793)
+System.Xml.Serialization.XmlReflectionImporter:CreateMapMember
+(System.Xml.Serialization.XmlReflectionMember,string)
+in [0x000fa] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:284)
+System.Xml.Serialization.XmlReflectionImporter:ImportClassMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0008c] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:177)
+System.Xml.Serialization.XmlReflectionImporter:ImportTypeMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+in [0x0004e] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:190)
+System.Xml.Serialization.XmlSerializer:.ctor
+(System.Type,System.Xml.Serialization.XmlAttributeOverrides,System.Type[],System.Xml.Serialization.XmlRootAttribute,string)
+in [0x00006] (at
+/var/tmp/portage/mono-1.1.4/work/mono-1.1.4/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:139)
+System.Xml.Serialization.XmlSerializer:.ctor (System.Type)
+in [0x00026] (at /home/dsd/projects/monotest/xml/XmlTest4.cs:15)
+XmlSerializerTest:Main (string[])
+
+Expected Results:
+Some XML representation of a class containing a Uri being printed out
+
+How often does this happen? 
+Every time
+
+Additional Information:
+According to evarlast on IRC, a simple example like this works fine in MS
+Visual C#.
+
+Perhaps I'm not understanding serialization right, but on deserialization,
+I would have expected it to try the "protected Uri(SerializationInfo,
+StreamingContext)" constructor of the Uri class before looking for a
+default one (so I wouldnt have thought requiring a default one is
+necessary). However I also created another simple test case, a serializable
+class (not containing a URI) with a default ctor and a
+(SerializationInfo,StreamingContext) ctor, and it seems that only the
+default one gets called on deserialization. Should I file another bug for this?