[Mono-bugs] [Bug 73901][Nor] Changed - Objects of type 'System.Xml.XmlCDataSection' can't be serialized
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Mar 2005 18:34:14 -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 extremo@tiscali.nl.
http://bugzilla.ximian.com/show_bug.cgi?id=73901
--- shadow/73901 2005-03-22 14:36:28.000000000 -0500
+++ shadow/73901.tmp.2452 2005-03-23 18:34:14.000000000 -0500
@@ -116,6 +116,62 @@
runnable repro code would be nice
------- Additional Comments From atsushi@ximian.com 2005-03-22 14:36 -------
It works fine when the type of property/field is XmlNode, not specific
XmlCDataSection.
+
+------- Additional Comments From extremo@tiscali.nl 2005-03-23 18:34 -------
+Here's a runnable repro. Compile, run and see the exception. On MS
+.NET 1.1 it doesn't raise exception, but outputs the template.
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+
+class Test
+{
+ [STAThread]
+ static void Main(string[] args)
+ {
+ string xml =
+"<formatter><template><![CDATA[{timestamp} :
+{message}]]></template></formatter>";
+
+ XmlSerializer serializer = new
+XmlSerializer(typeof(TextFormatterData));
+ TextFormatterData destObj =
+(TextFormatterData)serializer.Deserialize(new StringReader(xml));
+
+ Console.WriteLine(destObj.Template.InnerText);
+ Console.Read();
+ }
+}
+
+[XmlRoot("formatter")]
+public class TextFormatterData
+{
+ private XmlCDataSection templateData;
+
+ public TextFormatterData() { }
+
+ [XmlElement("template")]
+ public XmlCDataSection Template
+ {
+ get { return this.templateData; }
+ set { this.templateData = value; }
+ }
+}
+
+
+
+[mono@extremo monobug73901]# mono test.exe
+
+Unhandled Exception: System.InvalidOperationException: Objects of type
+'System.Xml.XmlCDataSection' can't be serialized
+
+
+Hope this helps!
+
+ExtRemo
+