I am working with a .NET WinForms app in C#, running against the 3.5 .NET framework. In this app, I am setting the .Expression member of a DataColumn in a
I've encountered the same issue and this is what fixed it for me: Stack Overflow - internal index is corrupted.
If you are using threads with a dataset, that error will occur.
In my case, I was trying to create a new row for a dataset within a method that was running in threads.
One way was to use SyncLock around the method that creates the row or another way (and probably even better) was to create the rows outside of threads.
Basically my code looks something like this:
Dim elements As New List(Of element)
Dim dataRows As New List(Of MyDataSet.Row)
For i As Integer = 0 To elements.Count - 1
dataRows.Add(Me.Ds.Elements.NewElementsRow)
Next
Parallel.For(0, elements.Count, Sub(i As Integer)
Me.CreateElementRow(elements(i), dataRows(i))
End Sub)
In the CreateElementRow method I'm doing a lot of calculations in threads.
Hope this helps.