16

My Visual Studio seems to be freezing/lagging when I open a existing project. I have added NHibernate framework into my code and it seems to lag my computer (at least that's what I think). When I open other projects, I do not lag or freeze at all. The freeze is about 3- seconds to a minute, then it will open my project and it will just act very slowly, it might take 20+ seconds just to switch classes an 20+ more seconds just to type a single character into visual studios.

I was wondering if anyone has had this problem before. If so how did you fix it?

I can't really work on my code until this is fixed. Oh also, when is save the code, it freezes for a good minute or two also.

Nalaka526
  • 11,278
  • 21
  • 82
  • 116
kevin
  • 161
  • 1
  • 1
  • 3
  • 5
    Mine does this as well. I can tell you from many days of frustration that there is no simple answer to why Visual Studio runs slowly. – Matthew Jones Nov 10 '09 at 19:08
  • What have you been coding? It seems that changing a data structure did mine. I also noticed that if i leave it on for a good 5-10 minutes before working on code, it seems to run a little smoother, but then that is a little annoying. – kevin Nov 10 '09 at 19:10
  • I think that it is the NHibernate plugin. I keep getting an error on this plugin. – monksy Nov 10 '09 at 19:12
  • Maybe, but initially NHibernate hasn't really given me any problems until recently. – kevin Nov 10 '09 at 19:14

10 Answers10

11

You can see exactly what VS is doing at any given moment, if you attach a debugger to the devenv.exe process and hit Break when it hangs. Then load the symbols from Microsoft Symbols server and show the call stack for the VS main thread.

I wrote a very detailed article about how to debug crashes and hangs here: http://blogs.msdn.com/kirillosenkov/archive/2008/12/07/how-to-debug-crashes-and-hangs.aspx

From the call stack it should be obvious what is causing the delay.

Kirill Osenkov
  • 8,786
  • 2
  • 33
  • 37
8

For me, removing the suo file (from the v14 sub directory) solved the problem...

user3193904
  • 131
  • 1
  • 4
7

Had the same problem. Closed Visual Studio 2010, opened again Running as Administrator, went to Extension Manager, uninstalled Nuget Package Manager, restarted Visual Studio 2010 running as regular user, opened problem solution, solution opened fine.

Nuget Package Manager seems to be the cause. My problem solution is using EF 4.3 Code First which interacts heavily with the Package Manager Console, but that may just be a coincidence.

Chris Moschini
  • 36,764
  • 19
  • 160
  • 190
  • 1
    +1 Removing NuGet did the trick for me too. The other thing that worked was opening my web project first, then opening the solution (!) – Jonathan Moffatt Aug 19 '13 at 01:03
  • 1
    +1 This did the trick, I wasted hours removing VS Update 3 and repairing it. Thanks. – patelsan Aug 20 '13 at 11:59
  • +1 Also worked for me, working in C++ without needing NuGet manager for anything. My guess is that NuGet checks for an update without using threading, hanging the devenv.exe process until it is done. I got used to just giving up and waiting the minute or so and doing something else whenever I opened a new solution, but now, thanks to Chris, I no longer seem to have that issue! Bless you, Chris! – allen1 Sep 24 '18 at 00:21
  • Unfortunately, it stopped working, and now I still have to wait the minute. This issue has multiple causes. Fortunately, it doesn't happen more than once after starting VS. – allen1 Oct 01 '18 at 00:17
6

As answer by Visual Studio 2015 Freezing White Loading Solution delete the .vs hidden directory solved the issue for me.

I am using Visual Studio 2017 Community Edition.

Community
  • 1
  • 1
Ido Ran
  • 10,584
  • 17
  • 80
  • 143
5

I had a hunch that something had been corrupted with one of my NuGet packages, and completely deleted the \packages subfolder and its contents. When I reopened the solution, all projects loaded successfully without hanging.

From there, I restored the previously deleted packages from the NuGet Package Manager Console and I was back up and running.

Gary DeReese
  • 173
  • 1
  • 5
  • Seemed to solve my proble.. n.b. You can restore the packages by doing the following. 'Tools' > NuGet Package Manager > Package Manager Console > click the 'Restore' button in the console. – Skarsnik Apr 20 '16 at 03:42
  • Can confirm that this worked for me (after trying many other fixes) – Andrew Milici Mar 26 '17 at 04:56
1

What, if any Add-ins do you have installed?

Edit:

One suggestion I would have then is to systematically disable each of your add-ins and see if performance changes and if it does research the culprit and see if there any updates available.

bytebender
  • 7,371
  • 2
  • 31
  • 54
0

For me, a chkdsk /F /R (which will prompt you to restart) and about 30 minutes of company time fixed this issue.

I think a few improperly closed instances of Visual Studio may have attributed to the issue.

danyim
  • 1,274
  • 10
  • 27
0

Uninstall any MS Enterprise Framework addin's you may have.

Delete the VS temp directory (and the Windows one).

Do you use TFS? Perhaps the server is a bit sleepy, that will make it freeze for a few minutes, but is ok afterwards.

Community
  • 1
  • 1
leppie
  • 115,091
  • 17
  • 196
  • 297
0

I had same problem. Delete following folder. C:\Users\UserName\AppData\Local\Microsoft\VisualStudio

-2

My local files somehow became corrupted for one project, fortunately I didn't have any pending changes so rather than run chkdsk I just deleted the folder and checked out the solution from source control again.

Brent
  • 1,378
  • 2
  • 16
  • 30