зеркало из https://github.com/mono/mail-archives.git
195 строки
7.4 KiB
HTML
195 строки
7.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-bugs] [Bug 650388] New: Superfluous ReadEndElement called after calling column IXmlSerializable.ReadXml
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20650388%5D%20New%3A%20Superfluous%20ReadEndElement%20called%0A%20after%20calling%20column%20IXmlSerializable.ReadXml&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="105673.html">
|
|
<LINK REL="Next" HREF="105675.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-bugs] [Bug 650388] New: Superfluous ReadEndElement called after calling column IXmlSerializable.ReadXml</H1>
|
|
<B>bugzilla_noreply at novell.com</B>
|
|
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20650388%5D%20New%3A%20Superfluous%20ReadEndElement%20called%0A%20after%20calling%20column%20IXmlSerializable.ReadXml&In-Reply-To="
|
|
TITLE="[Mono-bugs] [Bug 650388] New: Superfluous ReadEndElement called after calling column IXmlSerializable.ReadXml">bugzilla_noreply at novell.com
|
|
</A><BR>
|
|
<I>Sun Oct 31 11:10:46 EDT 2010</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="105673.html">[Mono-bugs] [Bug 650385] New: IXmlSerializable columns aren't deserialised correctly when writing a diffgram
|
|
</A></li>
|
|
<LI>Next message: <A HREF="105675.html">[Mono-bugs] [Bug 650389] New: DataSet.Copy doesn't honor the ICloneable interface on column data types.
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#105674">[ date ]</a>
|
|
<a href="thread.html#105674">[ thread ]</a>
|
|
<a href="subject.html#105674">[ subject ]</a>
|
|
<a href="author.html#105674">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
<A HREF="https://bugzilla.novell.com/show_bug.cgi?id=650388">https://bugzilla.novell.com/show_bug.cgi?id=650388</A>
|
|
|
|
<A HREF="https://bugzilla.novell.com/show_bug.cgi?id=650388#c0">https://bugzilla.novell.com/show_bug.cgi?id=650388#c0</A>
|
|
|
|
|
|
Summary: Superfluous ReadEndElement called after calling column
|
|
IXmlSerializable.ReadXml
|
|
Classification: Mono
|
|
Product: Mono: Class Libraries
|
|
Version: 2.6.x
|
|
Platform: x86
|
|
OS/Version: Windows 7
|
|
Status: NEW
|
|
Severity: Normal
|
|
Priority: P5 - None
|
|
Component: Sys.Data
|
|
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
|
|
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">cvolzke at live.com.au</A>
|
|
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
|
|
Found By: ---
|
|
Blocker: ---
|
|
|
|
|
|
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
|
|
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5
|
|
|
|
This line causes a problem:
|
|
|
|
IXmlSerializable obj = (IXmlSerializable) Activator.CreateInstance
|
|
(col.DataType, new object [0]);
|
|
if (!reader.IsEmptyElement) {
|
|
obj.ReadXml (reader);
|
|
reader.ReadEndElement (); // this line shouldn't be there!
|
|
} else {
|
|
|
|
When implementing IXmlSerializable for a column's data type:
|
|
|
|
void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
|
|
{
|
|
reader.ReadStartElement();
|
|
Value = reader.ReadElementString("Value");
|
|
reader.ReadEndElement(); // this line is required when using with an ms.net
|
|
DataSet
|
|
}
|
|
|
|
|
|
Reproducible: Always
|
|
|
|
Steps to Reproduce:
|
|
1. Set up a DataSet with a column that implements IXmlSerializable
|
|
2. Make sure IXmlSerializable.ReadXml is implemented the ms way:
|
|
reader.ReadStartElement();
|
|
Value = reader.ReadElementString("Value");
|
|
reader.ReadEndElement(); // this line is required when using with an ms.net
|
|
3. Call DataSet.ReadXml
|
|
Actual Results:
|
|
An exception is thrown, ultimately causing a string to be placed into the row's
|
|
column instead of an instance of the IXmlSerializable data type.
|
|
|
|
Expected Results:
|
|
The IXmlSerializable type should be deserialized correctly.
|
|
|
|
Test case to reproduce
|
|
----------------------
|
|
|
|
static string ExpectedXml = @"
|
|
<NewDataSet>
|
|
<table>
|
|
<XmlSerializableColumn>
|
|
<Value>Value</Value>
|
|
</XmlSerializableColumn>
|
|
<StringColumn>Value2</StringColumn>
|
|
</table>
|
|
</NewDataSet>
|
|
".Replace("'", "\"");
|
|
|
|
[Test]
|
|
public void Test_ReadXmlSerializable()
|
|
{
|
|
DataSet deserializedDataSet = NewDataSet();
|
|
deserializedDataSet.ReadXml(XmlReader.Create(new
|
|
StringReader(ExpectedXml)));
|
|
string deserializedXml = WriteXml(deserializedDataSet);
|
|
Assert.AreEqual(deserializedXml.Trim(), ExpectedXml.Trim());
|
|
}
|
|
|
|
static DataSet NewDataSet()
|
|
{
|
|
DataSet data = new DataSet();
|
|
DataTable table = new DataTable("table");
|
|
data.Tables.Add(table);
|
|
table.Columns.Add(new DataColumn("XmlSerializableColumn",
|
|
typeof(XmlSerializable)));
|
|
table.Columns.Add(new DataColumn("StringColumn", typeof(string)));
|
|
return data;
|
|
}
|
|
|
|
static string WriteXml(DataSet data)
|
|
{
|
|
var writer = new StringWriter();
|
|
var xmlWriter = new XmlTextWriter(writer);
|
|
xmlWriter.Formatting = Formatting.Indented;
|
|
data.WriteXml(xmlWriter);
|
|
return writer.GetStringBuilder().ToString();
|
|
}
|
|
|
|
public class XmlSerializable : IXmlSerializable
|
|
{
|
|
public string Value { get; set; }
|
|
|
|
public System.Xml.Schema.XmlSchema GetSchema()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public void ReadXml(System.Xml.XmlReader reader)
|
|
{
|
|
reader.ReadStartElement();
|
|
Value = reader.ReadElementString("Value");
|
|
reader.ReadEndElement(); // this line is required when using
|
|
with an ms.net DataSet
|
|
}
|
|
|
|
public void WriteXml(System.Xml.XmlWriter writer)
|
|
{
|
|
writer.WriteElementString("Value", Value);
|
|
}
|
|
}
|
|
|
|
--
|
|
Configure bugmail: <A HREF="https://bugzilla.novell.com/userprefs.cgi?tab=email">https://bugzilla.novell.com/userprefs.cgi?tab=email</A>
|
|
------- You are receiving this mail because: -------
|
|
You are the QA contact for the bug.
|
|
You are the assignee for the bug.
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="105673.html">[Mono-bugs] [Bug 650385] New: IXmlSerializable columns aren't deserialised correctly when writing a diffgram
|
|
</A></li>
|
|
<LI>Next message: <A HREF="105675.html">[Mono-bugs] [Bug 650389] New: DataSet.Copy doesn't honor the ICloneable interface on column data types.
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#105674">[ date ]</a>
|
|
<a href="thread.html#105674">[ thread ]</a>
|
|
<a href="subject.html#105674">[ subject ]</a>
|
|
<a href="author.html#105674">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
|
|
mailing list</a><br>
|
|
</body></html>
|