[Mono-devel-list] bug #66838 : System.Data.DataRow: SetParentRow

Ankit Jain radical at gmail.com
Fri Jan 7 16:49:55 EST 2005


Hi,

While tracing for this bug in System.Data.DataRow.SetParentRow I found
two things:

1. It checks whether it (DataRow)'s RowState is Detached or not.. and
throws the exception "RowNotInTableException" if its not. The default
RowState for a newly instantiated DataRow object is "Detached", and
SetParentRow can be called validly on it, as is demonstrated by the
test case attached with the bug report (for ms.net).
Also, the exception mesage sayz:

This row has been removed from a table and does not have any data. 
BeginEdit() will allow creation of new data in this row.

BeginEdit() is called by SetParentRow itself after 2 lines.. 

2. After removing the check for the RowState, I found that it throws a
null ref exception.. That occurs because it tries to access
relation.ChildKeyConstraint (relation was the 2nd param to
SetParentRow)  which is null for any newly created DataRow object..

Fixing these two things fixes the bug 'symptom' atleast, but i'm not
sure whether this is the correct fix or the correct behaviour. Could
other people shed some light on this?

If this is fine, then i'll make a patch and post it.

Regards,
Ankit



More information about the Mono-devel-list mailing list