K
Koji Ishii
Hello,
I'm using a single DataTable in multi-threaded scenario. The DataTable is
not connected to any database, just created and filled in from local XML
file.
Since multiple threads can modify this single DataTable, I use C# lock
statements whenever I make changes to the DataTable, but sometimes, where
repro-steps are not exactly clear, ADO.NET causes NullReferenceException.
Here's stack trace:
at System.Data.DataTable.get_LiveIndexes()
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMerge)
at System.Data.DataRow.EndEdit()
at System.Data.DataRow.set_Item(DataColumn column, Object value)
I don't remember where but I remember I read notes saying ADO.NET supports
multi-thread only in DataSet/DataTable, so my understanding is that as long
as I serialize modify-operations (new, add, delete, change), it should work.
But since the exception occurs deep inside of the ADO.NET, I'm guessing this
is ADO.NET bug.
Has anyone experienced errors like this? Any pointers to workarounds are
greatly appreciated.
Note that similar errors were seen since .NET Framework 1.0, but stack
traces were different. This is from .NET Framework 1.1.
Thanks,
Koji Ishii
I'm using a single DataTable in multi-threaded scenario. The DataTable is
not connected to any database, just created and filled in from local XML
file.
Since multiple threads can modify this single DataTable, I use C# lock
statements whenever I make changes to the DataTable, but sometimes, where
repro-steps are not exactly clear, ADO.NET causes NullReferenceException.
Here's stack trace:
at System.Data.DataTable.get_LiveIndexes()
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMerge)
at System.Data.DataRow.EndEdit()
at System.Data.DataRow.set_Item(DataColumn column, Object value)
I don't remember where but I remember I read notes saying ADO.NET supports
multi-thread only in DataSet/DataTable, so my understanding is that as long
as I serialize modify-operations (new, add, delete, change), it should work.
But since the exception occurs deep inside of the ADO.NET, I'm guessing this
is ADO.NET bug.
Has anyone experienced errors like this? Any pointers to workarounds are
greatly appreciated.
Note that similar errors were seen since .NET Framework 1.0, but stack
traces were different. This is from .NET Framework 1.1.
Thanks,
Koji Ishii