Can we debug multithreading application RRS feed

  • Question



    i have an application with 20 threads spawns from main thread and each is supposed to execute a method. Can we debug a multithreading application and go through the execution path( i mean step through)   as in normal application...?


    thanks in advance.


    Wednesday, September 19, 2007 11:52 AM


  • Hi akjal,

    John Robbins’ book Debugging Microsoft® .NET 2.0 Applications has some excellent strategies, you can check it out.

    Based on my experience, while debugging in VS.NET, we could open the Threads window (Debug -> Windows -> Threads), select your threads (be careful to not select the framework threads), right-click and pick "freeze". Step through the active thread as much as you'd like. Frozen threads are not scheduled until you right-click and pick "thaw," which makes following one thread all the way through an operation much easier.

    Adding a bunch of debug conditional logging and asserts to your code is also a good way, we could also write to event log for debugging and tracing usage. For more details, please visit: Debugging a multithreaded app in C#.

    And there are several references on this issue:

    Hope this helps!


    Friday, September 21, 2007 2:27 AM