Thursday, August 5, 2010

Visual Studio hangs after debugging

I have repeatedly since I started working in Visual Studio 2008 been swearing while debugging applications since the whole IDE stops responding for a while when stopping the debug session. No updates, service packs or changes to the preferences has been able to stop this behaviour. I've also seen it on numerous other machines and have never been able to figure out why this is happening.

Yesterday I started investigating the issue again and stumbled upon a discussion I've missed before: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/e9c5da47-a194-4051-a3d5-28b404263b3f

In this discussion, the problem is both found and solutions offered.

The culprit can be many things, but the most common one is that the IDE is trying to contact a server in order to check certificate store validity. If the server can't be reached properly (due to proxies and whatnot), the IDE will hang before timing out.

So, if you have a problem with Visual Studio hanging when stopping a debug, try the following:

First, unplug the network cable (or if you are running wireless, kill the wireless NIC). If this solves the problem, you have an issue with the certificate store. If the IDE still hangs, remove all breakpoints in the code and try again. If there still is a problem, remove the .sou file and retry, this can be corrupt and cause a slowdown.

If you had a snappy IDE with the network cable unplugged, either leave it unplugged, or try one of the following solutions.

Before changing the settings for the certificate store, make sure that all unnecessary protocols are disabled in the network properties. Reports have been made that especially NetWare can interfere. This might solve your problem.

Change the certificate revocation setting in Internet Explorer. Open IE, go to Tools > Internet Options > Advanced > Security > Check for Publisher's Certificate Revocation and uncheck this option. This is a bit unsafe to do though so be aware.

Another solution is to edit the hosts file (\windows\system32\drivers\etc\hosts) to point the URL to your own machine. Add 127.0.0.1 crl.microsoft.com to the file. This is just as unsafe as changing the setting in IE and might end up a change that you forget which can cause grief in the future.


For me, changing the IE settings solved it and I can finally be happy when debugging in Visual Studio.

2 comments:

  1. I had been having this problem for a few days now. Killing the breakpoints did it for me. Many thanks for you made my life how it was a few days prior.

    ReplyDelete
  2. You're welcome!
    I'm happy that I have yet to encounter this annoying feature since that time back in 2010 (knock on wood etc etc).

    ReplyDelete