Debugging a C# MultiThreaded Code
-
Hi All , I have an application written in C# , that has multi threading , While I am debugging the code the process flow suddenly jumps to an unknown position in the solution. I am sure that the current method it is in now is not called by the previous one I was debugging. But I am close to sure that a thread is running parallel to the current thread I am debugging, Is there a way in Visual Studio or is there a 3rd party tool that will help me visualise the threads parallely or is there a way that we can debug the 2 threads on same go simultaneously? If I put more time and effort and a lot of jotting down on the paper I can figure out what is happening but wouldnt it be good if I know of a better way to do my job! Hoping for the best , Thank You Nikhil Pagidala
Happy Programming! Regards, Nikhil Pagidala
-
Hi All , I have an application written in C# , that has multi threading , While I am debugging the code the process flow suddenly jumps to an unknown position in the solution. I am sure that the current method it is in now is not called by the previous one I was debugging. But I am close to sure that a thread is running parallel to the current thread I am debugging, Is there a way in Visual Studio or is there a 3rd party tool that will help me visualise the threads parallely or is there a way that we can debug the 2 threads on same go simultaneously? If I put more time and effort and a lot of jotting down on the paper I can figure out what is happening but wouldnt it be good if I know of a better way to do my job! Hoping for the best , Thank You Nikhil Pagidala
Happy Programming! Regards, Nikhil Pagidala
My answer is that I don't know, but I can offer a couple of tips: you can set breakpoints and see the executing thread to see if things are going like expected. You can also use a log (with Debug.Print) to see things as they are happening (use a timestamp).
Nikhil Pagidala wrote:
If I put more time and effort
Multithreading debugging has always been *very* hard. If you multithreading bugs, you will spend a lot of time tracking them down. Good luck :)
Luis Alonso Ramos Intelectix Chihuahua, Mexico
-
Hi All , I have an application written in C# , that has multi threading , While I am debugging the code the process flow suddenly jumps to an unknown position in the solution. I am sure that the current method it is in now is not called by the previous one I was debugging. But I am close to sure that a thread is running parallel to the current thread I am debugging, Is there a way in Visual Studio or is there a 3rd party tool that will help me visualise the threads parallely or is there a way that we can debug the 2 threads on same go simultaneously? If I put more time and effort and a lot of jotting down on the paper I can figure out what is happening but wouldnt it be good if I know of a better way to do my job! Hoping for the best , Thank You Nikhil Pagidala
Happy Programming! Regards, Nikhil Pagidala
I had that happen many times to me. The problem is that the compiler has not compiled your changes into the executable. I saw this happen many times with Visual Studio .Net 2003. The solution to this is to shutdown Visual Studio, start it back up again, then compile and start your debug information. Phil
-
Hi All , I have an application written in C# , that has multi threading , While I am debugging the code the process flow suddenly jumps to an unknown position in the solution. I am sure that the current method it is in now is not called by the previous one I was debugging. But I am close to sure that a thread is running parallel to the current thread I am debugging, Is there a way in Visual Studio or is there a 3rd party tool that will help me visualise the threads parallely or is there a way that we can debug the 2 threads on same go simultaneously? If I put more time and effort and a lot of jotting down on the paper I can figure out what is happening but wouldnt it be good if I know of a better way to do my job! Hoping for the best , Thank You Nikhil Pagidala
Happy Programming! Regards, Nikhil Pagidala