Friday 17 January 2014

Painfully Slow Debugging in Visual Studio 2013 and Internet Explorer

I’ve been researching an issue today with debugging on VS2013 and IE. It’s a really weird one as the symptoms don’t make a great deal of sense, however I have found a cause and a temporary cure.

I have a simple website that I am debugging. If I startup the application and put a breakpoint within some code that gets called before any web requests are made all is fine.

I then click something on a page which drops me into the debugger. I was debugging some code as shown below…

Code Snippet
public ActionResult Login(string id)
    var ctx = Request.GetOwinContext();

    var props = new AuthenticationProperties
        RedirectUri = Url.Action("Callback")

    ctx.Authentication.Challenge(props, id);

    return new HttpUnauthorizedResult();

My breakpoint was on the first line, I was then stepping through the code and here’s the problem.

Stepping through took *ages*. The first click of F10 took about 9 seconds. Subsequent keypresses were 5 seconds or so. I had to figure this out.

As usual I turned to the internet and found a bunch of useless stuff, and then I found this which led me to this and so I download xPerf, ran some tests and came up with a graph that showed me it was Internet Explorer that was waiting which was strange – as I was inside Visual Studio, admittedly debugging something in IE. I then tried debugging with Chrome & Firefox, both were OK.

Whilst I debug I mostly use the keyboard, however during one of my sessions I used the mouse and clicked on the step commands on the toolbar, and strangely enough these worked as usual, it was single stepping with the keyboard that was causing the problem.

Unlike Bruce (the two links above) I couldn’t get any further with analysing the data (the graphs he drilled down to don’t seem to be available in the version I just downloaded), so I went back to the Net and asked again and this article popped up. LastPass – yep, I’m using it and yep, disabling it did the trick.

Now don’t get me wrong – I love LastPass and I wouldn’t be without it, but for the moment it’s off limits to Internet Explorer on my machine.

Hope this helps someone else!