[Mono-bugs] [Bug 68008][Nor] New - DataSet.GetObjectDat(), DataSet serialization, fails to render the xmlns="" attribute tag on the <xs:schema> element
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 11 Oct 2004 19:54:24 -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 dclough@prconline.com.
http://bugzilla.ximian.com/show_bug.cgi?id=68008
--- shadow/68008 2004-10-11 19:54:24.000000000 -0400
+++ shadow/68008.tmp.30321 2004-10-11 19:54:24.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 68008
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Fedora Core 2
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dclough@prconline.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DataSet.GetObjectDat(), DataSet serialization, fails to render the xmlns="" attribute tag on the <xs:schema> element
+
+Steps to reproduce the problem:
+
+Paste the following code into a Console App (same code as bug #68007):
+
+DataSet ds = new DataSet("Example");
+
+// Add a DataTable
+ds.Tables.Add("Packages");
+
+// Add an ID DataColumn w/ ColumnMapping = MappingType.Attribute
+ds.Tables["Packages"].Columns.Add(new DataColumn("ID", typeof(int), "",
+MappingType.Attribute));
+ds.Tables["Packages"].Columns["ID"].AllowDBNull = false;
+
+// Add a nullable DataColumn w/ ColumnMapping = MappingType.Attribute
+ds.Tables["Packages"].Columns.Add(new DataColumn("ShipDate", typeof
+(DateTime), "", MappingType.Attribute));
+ds.Tables["Packages"].Columns["ShipDate"].AllowDBNull = true;
+
+// Add a nullable DataColumn w/ ColumnMapping = MappingType.Attribute
+ds.Tables["Packages"].Columns.Add(new DataColumn("Message", typeof
+(string), "", MappingType.Attribute));
+ds.Tables["Packages"].Columns["Message"].AllowDBNull = true;
+
+// Add a nullable DataColumn w/ ColumnMapping = MappingType.Attribute
+ds.Tables["Packages"].Columns.Add(new DataColumn("Handlers", typeof
+(int), "", MappingType.Attribute));
+ds.Tables["Packages"].Columns["Handlers"].AllowDBNull = true;
+
+// Add a non-null value row
+DataRow newRow = ds.Tables["Packages"].NewRow();
+newRow["ID"] = 0;
+newRow["ShipDate"] = DateTime.Now;
+newRow["Message"] = "Received with no breakage!";
+newRow["Handlers"] = 3;
+ds.Tables["Packages"].Rows.Add(newRow);
+
+// Add a null value row
+newRow = ds.Tables["Packages"].NewRow();
+newRow["ID"] = 1;
+newRow["ShipDate"] = DBNull.Value;
+newRow["Message"] = DBNull.Value;
+newRow["Handlers"] = DBNull.Value;
+ds.Tables["Packages"].Rows.Add(newRow);
+
+ds.AcceptChanges();
+
+// Serialize the DataSet to a file
+string fileName = @"FILENAME_HERE";
+
+XmlTextWriter writer = new XmlTextWriter(fileName,
+System.Text.Encoding.UTF8);
+XmlSerializer serializer = new XmlSerializer(ds.GetType());
+
+serializer.Serialize(writer, ds);
+writer.Close();
+
+
+Actual Results:
+
+See attached file.
+
+
+Expected Results:
+
+See attached file.
+
+
+How often does this happen?
+
+Repeatable with the provided code.
+
+
+Additional Information:
+
+The omission seems inoccuous at first, but when you try to build a
+DataSet based upon a known URI, then serialize it over to a Windows .NET
+platform, Schema compilation can fail. It appears that simply always
+including the attribute xmlns="" on the <xs:schema/> element prevents
+these deserialization exceptions.