views:

14

answers:

1

I've hit against what I think is a race condition. What options do I have to debug it?

More details: I have a Silverlight application which uses Telerik grid. The columns can be customised by the user by using a column chooser attached to the grid. In a particular case where the list of possible columns are created via the code, when I open the column chooser and close it, the data in the grid (all the rows) disappear!

Symptoms that I see which lead me to believe it is a race condition: - If I put a break point at the columnchooser.close line, and when the break point is hit, just continue, the bug is not visible (all the gird rows remain visible) - If I put a Thread.Sleep(1000) in the code just before columnchooser.close, again the bug disappears - If I keep the "Threads" window in Visual Studio open while debugging, I see a thread momentarily appear and disappear in the Threads window just as I hit the breakpoint at columnchooser.close

So, I tried the following to figure out which threads are running at that point in time - but no joy:

  1. System.Diagnostics.Process is not available in Silverlight, so I can't do System.Diagnostics.Process.Threads to get a list of the threads running programmatically.
  2. I tried a break point with a "When hit" run Macros.Samples.VSDebugger.DumpStacks, but I couldn't figure out where it was dumping all the stack traces to.

Any help or ideas on what I can do to debug this issue?

A: 

Without the code this is necessarily vague, but have you looked into putting a lock on the columns or even the grid itself.

I'm not sure how this would actually work, but if (as you imply) the problem is due to the column chooser and the column creation code trying to access the grid at the same time then this might solve it.

ChrisF