B
Barry Kelly
Bryce K. Nielsen said:Arrgggg, this is killing me. I've tried all sorts of different things and am
STILL getting a problem.
OK. It looks a tough one to crack.
Does it happen on other machines (i.e. it's not some broken install of
the SQL client)?
Have you tried detaching it from your user interface, so it runs only in
the console?
The reasons I'm suggesting this:
1) Remove the UI interaction / cross-thread communication as a possible
source of error.
2) Reduce complexity for the next phase of analysis.
If the problem still occurs on the console, there are some things we can
look into with the SOS debugger extensions (.load sos in Immediate
window or using WinDbg). In particular, I'd be looking for inappropriate
sharing of objects:
!dumpheap -type Sql will find all objects with Sql in the name of the
type
!gcroot <addr> will find what's pointing to the object and keeping it
alive
!dumpobj <addr> will dump the values of dword fields of an object.
Once an object is found, it's easier to work with if you can find it in
the VS debugger, though.
It still sounds like some kind of cross-thread sharing problem; either
that, or some kind of heap corruption that doesn't cause a CLR crash.
I'm wondering: is it that bulk-copy isn't safe for concurrent
operations? That doesn't sound likely to me.
Another idea, to fix your problem without getting too bogged down:
structure the copying operation as a separate application, and run
multiple copies of that application in parallel. You can use
System.Diagnostics.Process for that, along with Process.WaitForExit(),
using a very similar approach to Thread.Join().
-- Barry