I have problems with step-by-step debugging of a multithreaded .NET application in Visual Studio 2008.
With each stepped line, Visual Studio gets slower and slower (it takes more and more time to jump to the next line) and usually hangs after several lines (I get the "Visual Studio is busy" balloon tip), and I need to stop debugging.
I suspect the problem is due to the fact that application has several TCP/IP clients connected, which means that every time I make a breakpoint, their network buffer gets filled until I continue my application. Whenever I use F10
to step over to the next line of code, Visual Studio shortly awakens all other threads for them to handle the input data.
Does anyone have experience with such problems, and suggestions on how to avoid them?
This is not an easy task at all, I believe you understand this.
So very important to have a clear understanding of threading and synchronization mechanisms which are provided by .NET Framework
. Only after doing this you can start designing a thread synchronisation and management.
I would suggest to define clear names for your threads and introduce extensive logging, log4net would be a good choice because provides you a thread safe and robust logging instruments.
Visual Studio tips:
See more here: Debugging Multithreaded Applications
EDIT: Added more tips
Try to identify which application logic states really useful to be debugged manually and use conditional breakpoints if it is possible so you can avoid extra breaks of debugger:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With