Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can cause Visual Studio 2008 to hang while debugging?

I have a vb.net project which sometimes, when running in the IDE, suddenly hangs. Normally this wouldn't be a problem. Just hit 'pause', look at the currently running threads, and find the deadlock (or whatever else).

But now I'm running into a situation where not only does the program hang, but trying to pause it causes visual studio itself to hang. In order to get control back, I have to kill the program-being-debugged's process, at which point visual studio comes back to life and says it was unable to pause execution. This is frustrating, because killing the process means the program state is lost (of course), so I don't know where the hang is.

So are there any common causes for this behavior? What should I be looking for?

like image 433
Craig Gidney Avatar asked May 23 '09 19:05

Craig Gidney


2 Answers

if your program installs global hooks (which communicate with app) - this might be the case. A hook tries to communicate with your app (which is paused by debugger) and gets locked. And debugger is unable to receive its window messages: classic deadlock between hooked debugger (with hook dll) and a hooking app.

like image 110
Andrey Avatar answered Oct 15 '22 02:10

Andrey


Finding a specific fix for a Visual Studio problem can be tricky: http://social.msdn.microsoft.com/Search/en-US/?query=visual%20studio%202008%20hang&ac=3

Additionally, not all hotfixes from Microsoft get released directly to the public. Some are only given out to customers whose systems are exhibiting a specific problem. So you have to contact Microsoft to the get the fix. They do this to limit the potential downside of releasing a hotfix that may break something else. So if all else fails, give them a call.

Here are some other things that I like to do when Visual Studio starts acting up:

  1. Delete old breakpoints and watch variables.
  2. With visual studio not running, delete the intellisense file (.ncb)
  3. Clean the solution and then do a rebuild of all of the code.
like image 23
onedozenbagels Avatar answered Oct 15 '22 02:10

onedozenbagels