debugging thread in vs 2008 enterprise edition--c#
I don't know if the same question is asked before or no:- I have the question that how to debug multithreading in C#.net vs2008(enterprise edition) is there any specia开发者_JAVA百科l technique or tool????
See my application works fine with single thread but when there are two or more threads it behave abnormally...I know there is synchronization issue and so need to fix it and hence need debugger to identify where should i place the lock....
John Robbins's book: Debugging Microsoft .NET 2.0 Applications is an excellent learning resource if you want to become proficient at debugging. His online posts and articles are also excellent. Such as Neat New Multithreaded Debugging Features in VS 2008
Visual Studio 2008 is more than capable of multi-threaded debugging but there is a post SP1 hotfix you might need: Updates for Visual Studio 2008 SP1 debugging and breakpoints.
A tip: Name your threads explicitly when you create them. Makes debugging much easier.
In response to your updated question: You should not need a debugger to figure out where to place the necessary locks. You do this by inspecting code.
very carefully.
Debugging multi-threaded applications is very difficult which is why a lot of application writers avoid multi-threading as much as possible.
Are you asking if there is any special technique or a special tool to help you?
Edit: If it is a locking issue, you could use standard troubleshooting techniques: place a lock everywhere, then remove them one at a time so you can identify which locks are needed. It might seem drastic, but it will work, especially if you do not have any educated guesses on where to add locks in the first place.
精彩评论