[Mono-bugs] [Bug 439416] New: DataSet.WriteXml() failed when rows has been deleted.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 28 03:26:46 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=439416


           Summary: DataSet.WriteXml() failed when rows has been deleted.
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: xinpei at itechs.iscas.ac.cn
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Run the following code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DataSetTest
{
    class Program
    {
        static void Main(string[] args)
        {
            DataSet ds = new DataSet();
            DataTable table = new DataTable();
            DataColumn column = table.Columns.Add("Test");
            column.ColumnMapping = MappingType.Attribute;
            column = table.Columns.Add("Test2");
            column.ColumnMapping = MappingType.Attribute;

            DataRow row = table.NewRow();
            row[0] = "AAA";
            row[1] = "BBB";
            table.Rows.Add(row);

            row = table.NewRow();
            row[0] = "CCC";
            row[1] = "DDD";
            table.Rows.Add(row);

            ds.Tables.Add(table);
            ds.AcceptChanges();

            table.Rows[0].Delete();

            ds.WriteXml("test.xml", XmlWriteMode.DiffGram);
        }
    }
}

We get these errors:

Unhandled Exception: System.Data.DeletedRowInaccessibleException: Deleted row
information cannot be accessed through the row.
  at System.Data.DataRow.IndexFromVersion (DataRowVersion version) [0x00000] 
  at System.Data.DataRow.get_Item (Int32 columnIndex, DataRowVersion version)
[0x00000] 
  at System.Data.DataRow.get_Item (System.Data.DataColumn column,
DataRowVersion version) [0x00000] 
  at System.Data.DataRow.IsNull (System.Data.DataColumn column, DataRowVersion
version) [0x00000] 
  at System.Data.DataRow.IsNull (System.Data.DataColumn column) [0x00000] 
  at System.Data.DataSet.WriteColumnAsAttribute (System.Xml.XmlWriter writer,
XmlWriteMode mode, System.Data.DataColumn col, System.Data.DataRow row,
DataRowVersion version) [0x00000] 
  at System.Data.DataSet.WriteTable (System.Xml.XmlWriter writer,
System.Data.DataRow[] rows, XmlWriteMode mode, DataRowVersion version, Boolean
skipIfNested) [0x00000] 
  at System.Data.DataSet.WriteTable (System.Xml.XmlWriter writer,
System.Data.DataTable table, XmlWriteMode mode, DataRowVersion version)
[0x00000] 
  at System.Data.DataSet.WriteTables (System.Xml.XmlWriter writer, XmlWriteMode
mode, System.Data.DataTableCollection tableCollection, DataRowVersion version)
[0x00000] 
  at System.Data.DataSet.WriteXml (System.Xml.XmlWriter writer, XmlWriteMode
mode) [0x00000] 
  at System.Data.DataSet.WriteXml (System.String fileName, XmlWriteMode mode)
[0x00000] 
  at DataSetTest.Program.Main (System.String[] args) [0x00000] 

This error only occurs when column.ColumnMapping is set to
MappingType.Attribute.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list