8

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?

1
  • 1
    Did you find a solution for this? I'm stuck with the exact same situation.....
    – Roey
    Jul 8, 2009 at 16:56

5 Answers 5

6

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.

2
  • Hell, I have spent lot of time trying to find out what's wrong while debugging an application (using SetWindowsHookEx). Whole system hangs for second or two each debugger step. Disabling the hook call makes the trick (little disadvantage: the hook can't be expected to work while debugging). Thanks for this tip!
    – sharpener
    Nov 18, 2015 at 12:39
  • That would explain it... I've been working with a COM application using WPF for an Excel Add-In. The debugger can take minutes to hit a breakpoint, show a thrown exception, or even stop debugging. Quite frustrating. Jan 6, 2017 at 13:24
3

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.
0

Check hotfixes and service packs. I've seen a bug related to .net programming and debugging hangs. (VS hangs for me when debugging C++ 32-bit apps on 64-bit os:es sometimes.)

0

I just had a very similiar issue (VS fails to break execution), using Debug -> Delete all breakpoints solved the issue.

-1

I'd check the code of the program being debugged, I'm thinking there may be an infinite loop or race condition in the code you're trying to debug. This has been the case for me in the past, especially on a single-core laptop I used to have. Can you give any information about where in the program you think execution is when you try to pause?

1
  • Well I'm using a sortof message-passing paradigm. Each 'complicated to lock correctly' class has a call-queue which other classes must use to ask it to do anything. The program is a small game server. When it locks, there are multiple sockets queuing data-received onto a processing object, which queues displaying some logging info to the UI and also writes data back out to the sockets. That's what confuses me: it shouldn't be blocking the UI, because I try to avoid holding locks. It's not like I get an infinite queue loop either, because my cpu doesn't spike. May 23, 2009 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.