[Mono-bugs] [Bug 73901][Maj] New - Objects of type 'System.Xml.XmlCDataSection' can't be serialized

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 20 Mar 2005 14:49:33 -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-20 14:49:33.000000000 -0500
+++ shadow/73901.tmp.4464	2005-03-20 14:49:33.000000000 -0500
@@ -0,0 +1,108 @@
+Bug#: 73901
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: extremo@tiscali.nl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Objects of type 'System.Xml.XmlCDataSection' can't be serialized
+
+Description of Problem:
+
+Found this bug while attempting to run Microsoft Enterprise Library
+(Logging) under mono 1.1.4.2
+
+Trying to serialize xml (which contains a cdata-section) fails. The
+following exception is thrown:
+--> Objects of type 'System.Xml.XmlCDataSection' can't be serialized <--
+
+
+Steps to reproduce the problem:
+
+1. 
+Stripped sample code from the Microsoft Enterprise Library
+(TextFormatterData.cs):
+
+    [XmlRoot("formatter",
+Namespace=DistributorSettings.ConfigurationNamespace)]
+    public class TextFormatterData : FormatterData
+    {
+        private XmlCDataSection templateData;
+
+        public TextFormatterData()
+        {
+        }
+
+        public TextFormatterData(string name) : base(name)
+        {
+        }
+
+        public TextFormatterData(string name, string templateData) : base(name)
+        {
+            Template.Value = templateData;
+        }
+
+        [XmlElement("template")]
+        public XmlCDataSection Template
+        {
+            get
+            {
+                if (templateData == null)
+                {
+                    XmlDocument doc = new XmlDocument();
+                    this.templateData = doc.CreateCDataSection(String.Empty);
+                }
+                return this.templateData;
+            }
+            set { this.templateData = value; }
+        }
+
+        [XmlIgnore]
+        public override string TypeName
+        {
+            get { return typeof(TextFormatter).AssemblyQualifiedName; }
+            set
+            {
+            }
+        }
+
+    }
+}
+
+
+2. 
+Example xml, used to get the error:
+  <formatter xsi:type="TextFormatterData" name="Trace Formatter">
+    <template><![CDATA[{timestamp} : {message}]]></template>
+  </formatter>
+
+
+
+Actual Results:
+Objects of type 'System.Xml.XmlCDataSection' can't be serialized
+in <0x0035e>
+System.Xml.Serialization.XmlReflectionImporter:ImportXmlNodeMapping
+(System.Type,System.Xml.Serialization.XmlRootAttribute,string)
+
+
+Expected Results:
+No exception, serialized cdata (as it works on MS .NET framework 1.1)
+
+
+How often does this happen? 
+Always
+
+
+Additional Information:
+Incompatible with MS .NET framework 1.1, which is too bad as parts of the
+Enterprise Library work perfectly well on mono, but logging would be useful
+also.