2

Since a week back I'm seeing a very annoying behavior from VS2010: As I'm debugging a project and the debugger stops on a breakpoint Windows freezes for almost ten seconds. I say "Windows freezes" because the mouse and keyboard are useless during this time period.

The problem only happens as I debug a specific project and I've tried it on two diffrent machines with the same result. The project is WPF and I do hook the keyboard at one point (not the mouse though) but that code hasn't been touched for months while the problem is just a week old.

I did install Telerik's big suite of everything (trial) just before this started to show so my first suspicion was Telerik's VS integration was the culprit. I uninstalled all Telerik VS integrations (the "JustXXX" products) but the problem remain.

I would be very greatful to anyone being abe to give a hint as to what might be going on here.

Thanks

EDIT 1: I have now tried building a new solution, moving all projects into it but the problem remains.

I then uninstalled everything Telerik, just to make sure, but this also was to no effect.

The next test was to load the exact same solution on a different machine and that did help. That machine has no 3rd party integrations with VS2010 except for reSHarper 6.1.

I have also analyzed the issue bit more and the typical scenario is that the first few times a breakpoint is hit the UI freezes for apeoximately ten seconds. Mouse/keyboard stops responding but the cursor keeps blinking in the code editor. The next few breakpoints does the same and often stepping from one line to another will cause a very long delay (no UI freeze though).

Also, if the first breakpoint is set very early in my application startup code I might not experience the problem. But as I continue to step through the code the debugger becomes more sluggish as the application initializes itself (in separate threads).

As I've said before this happens for a single application so the code is clearly related somehow.

Does anyone have good knowledge of how the debugger operates? Apart from the obvious steps needed whenever a breakpoint is set or the user steps from one line to another (refresh stack trace and watch windows) what is going on in the background that might freeze up everything and how is it possible?

My last hope is a complete reinstall of VS2010 but I hope I can solve this before that option is required.

Jonas Rembratt
  • 1,550
  • 3
  • 17
  • 39
  • I always accept answers when one is given but not all questions do get an answer as it turns out. Unfortunately many members prefer to only comment, even when providing an answer. – Jonas Rembratt May 30 '12 at 13:39
  • 1
    Your suggestion for comment-to-answer elevation is good - you should [request the change on meta](http://meta.stackoverflow.com/). – SliverNinja - MSFT May 30 '12 at 13:57
  • 1
    Yeah, I too am only happy when I get some imaginary reward for helping people... It's sad enough that there has to be a reward system... – Dänu May 30 '12 at 16:45

2 Answers2

4

I have finally found the cause for this weird behavior. As I mentioned in the original post I do hook the keyboard (AND mouse, I had forgotten I did that) during the application's initialization in order to be able to detect user inactivity.

The monitoring takes place in a background thread that simply waits for an AutoResetEvent to discover user activity or inactivity. For some odd reason the AutoResetEvent.WaitOne(...) somehow affects the debugger. My current fix is to just avoid the wait if the debugger is attached.

I still cannot explain why this happens now. It has been working for a year but the cause for the problem is finally found and dealt with.

I have submitted my question to Microsoft, hoping to get a good explanation. If I do I will post it here.

Jonas Rembratt
  • 1,550
  • 3
  • 17
  • 39
-1

If you really have the problem with one Project / Solution you could try to create a new empty solution and add the project there, maybe this helps.

I don't really know much about the inner workings of Visual Studio (after all it must be one of the most complex pieces of software out there). But what I've learned is, that a reinstall often is the best and fastest solution (even if it takes an hour or two). Just make sure you backup any settings you don't want to lose.

Update:

I found this one here, maybe you've already found it too: http://connect.microsoft.com/VisualStudio/feedback/details/260864/visual-studio-debugger-occasionally-locks-up-the-entire-windows-gui

You could give it a try and disable the language bar.

Mike G
  • 4,232
  • 9
  • 40
  • 66
Dänu
  • 5,791
  • 9
  • 43
  • 56
  • I was hopin to avoid that solution for obvious reasons but I'm afraid it will end there soon. I'll give it some more time to see if anyone has any knowledge of what might be the cause of this before I give up. Thanks anyway. – Jonas Rembratt May 30 '12 at 17:01
  • Did the one with the new solution not work? Have you tried asking around in the Telerik forums? I've been using Telerik controls for about two years now and I can say (no I don't work for them or anything like that ;-)) that they have the greatest support I've ever seen. But if it is one of their apps, it is the JustCode thingy, which could throw some error. Have you checked out the Application Errors in the windows event viewer? – Dänu May 30 '12 at 18:02
  • I haven't tried moving it all to a new solution yet. I'm sitting at a customer this week and is pressed to deliver so I'm no taking any risks to be honest. Unless I've managed to solve it I'll try it next week. I should add that I too am very fond of Telerik's products and that I have no real reason to suspect they're causing this behavior other than the fact I installed the Telerik's big suite as a trial on both my computers at aproximately the time my problems began. I'll see if I get the same behavior on a machine without Telerik just to make sure though. – Jonas Rembratt May 31 '12 at 08:35
  • Hm, both your computers. Are you moving your solution back ant forth between these two? I once broke a solution when opening it from dropbox with two different installation of Visual Studio (2008). Oh, and check out the edit on my above answer. Maybe it will help. – Dänu May 31 '12 at 09:07
  • Yes, I sync the solution between two computers (and occasionally more, using SVC). I have done so for almost a year and never seen any problems with it. – Jonas Rembratt May 31 '12 at 14:07
  • Please see my "EDIT 1" in original post. Thank You. – Jonas Rembratt Jun 01 '12 at 16:01
  • Now that is very strange... I can't think of anything else, sorry :-s – Dänu Jun 02 '12 at 09:28