24

I've got a relatively small project written in ASP.NET MVC3. After working a while, Visual Studio 2010 becomes very slow in Razor views (other file types work fine). With "slow" I mean "every keystroke takes around 1 second to register". It doesn't matter what that keystroke was - typing a single letter is as slow as pasting a screenful of markup. During this slowdown VS2010 consumes 1 CPU core to 100%. After I restart VS2010, everything goes smoothly again for a small while. This happens in any and all Razor views.

My PC isn't the best, but it should be enough: Core 2 Duo 6700, 4GB of RAM (currently only 75% filled with VS2010 being slow and all, so it's not a RAM shortage), Windows 7 x64.

The project is close to an end, and I remember that for most time there were no problems. This has started only recently, although I cannot imagine what could have caused it.

Does anyone have any ideas about what could be wrong and what could be done to fix it?

19
  • 3
    Are you using Resharper? I have had it cause extreme slowness. Commented Aug 31, 2011 at 8:22
  • I'm using AnkhSVN, although TFS client is also installed. I'm not using Resharper or any other such addons. Though I am using a few small addons, good idea, I'll try disabling those and see what happens. Commented Aug 31, 2011 at 8:25
  • Try disabling AnkhSVN and see if that makes any difference. I've had similar problems with other SVN integrations. Commented Aug 31, 2011 at 8:27
  • Sounds unlikely to me. AnkhSVN works fine in VS2008, and no other file type is affected - only Razor views. Commented Aug 31, 2011 at 8:36
  • Is you are using MVC 3 Tools Update? install it if not. Commented Aug 31, 2011 at 9:01

9 Answers 9

6

It is plugins - TFS/AnkvSVN and ReSharper have all caused problems for me.

Turn them off one by one, to discern which one (if only one) is causing you grief.

When you find the culprit, make sure you keep up on any patches with it.

In extreme cases, turn if off if you have a long development session and don't need it the whole time (SVN for instance could be turned on when you are ready to do commits and check ins, etc.)

Sign up to request clarification or add additional context in comments.

5 Comments

Actually I'm 99% certain now that it was the Jira plugin.
I don't know Jira at all, but I still have to dump VS now and then when ReSharper bogs it down. It usually takes a good week or two of leaving it open though so i don't mind... i should reboot more often anyway. :)
+1 for resharper, 6.1 being the culprit in my slow razor editing
I also just uninstalled the atlassian connector and it sped things up. Another thing to look at, especially at work, is make sure you're not autosaving to a network drive.
I thought it was some extension causing the issue, so I uninstalled Team Foundation Sidekicks and everything looked good.. until the CPU hogging came back. Deleting the .suo also seemed to solve it, but eventually, devenv.exe used 25% of my CPU. So I did this: stackoverflow.com/questions/4963464/… and finally got rid of the performance issues. Hope this helps :)
2

The issue is resolved for me, by installing the Mvc Html5 Templates.

After the installation, I picked XHTML5 and then back HTML5 from the "Target schema" combo box. After that, the paste was instant!

Edit: I uninstalled "Mvc Html5 Templates" and the issue didn't reappear. Perhaps it has something to do with the "HTML 5 Intellisense"

Comments

1

Have you installed sp 1 it fixed some performance related issues when loading IntelliSense for markup

Comments

1

Run the Resource Monitor (CTRL+SHIFT+ESC, click Performance tab then Resource Monitor button at the bottom). Pay special attention to disk I/O and perhaps CPU usage. Sort disk I/O by Total B/Sec descending. As you type, see if it can identify a process which is causing the issue. Hopefully it's a virus scanner or some other famous performance destroyer and not the Visual Studio process itself, which wouldn't be very helpful.

3 Comments

I'll try, but I already checked in standard Task Manager. I'm pretty certain that it was the VS2010 process which suddenly spiked in CPU usage, and that HDD was not touched during that. Also, if it was something else, it wouldn't manifest itself ONLY when working with Razor views. I mean, literally, I can Ctrl+Tab to a .CS file an everything runs smooth. Then switch back, and wham - lag again.
I wish I could be more help, but that is a very unusual problem. At this point, I'd be killing unnecessary VS2010 plugins and, failing that, re-install VS2010. I know that's tantamount to the Windows universal "try rebooting" response, but sometimes it does work. Please post the cause if you do find it -- I am curious about this one.
Well, I already killed all that I could, short of /SafeMode. And yes, it's definately devenv.exe who's is eating CPU like there's no tomorrow. It doesn't touch the disk though. And I don't have any antivirus installed or any other traditional performance killer.
0

Have you tried opening the same project on a different machine? This will give you an idea whether issue is in the project or VS install. Quite obvious, but is there anything in the event viewer. Are you connected to a domain while this is happening?

1 Comment

Different machine - it's an idea, but it'll be a bit difficult organize. Maybe I'll try it, if all else fails. I'll check Event Viewer, but I'm 99% certain that it's clean. And yes, I'm in a domain.
0

Well, for me the problem has turned out to be anti virus - we use (or are made to suffer) Sunbelt Vipre on our workstations and as soon as I switch off active protection (so that's basically disabling AV completely) all of a sudden all the performance issues in all windows are gone.

4 Comments

As I said, I don't have one of those, and running with /SafeMode helps. Though that made me wonder - does your antivirus have anything to do with DEP?
Well I put my answer up because it seems different people are coming up with different problems and there's nothing else on the net, and equally no answer has been accepted; equally this SO is coming up quite high for google results for searches (it's how I found it). Don't think it's anything to do with DEP; it's switched on for essential only and being 2008 R2; therefore 64 bit; it's hardware DEP.
Well, yes, but antiviruses sometimes take the liberty of adding their own imperfect layer of software DEP for everything. Also, I've got it turned on for everything, though I'm also on x64 with hardware DEP. Just a wild idea.
Yeah fair point; in a way with this problem; it just feels like we're all swinging in the breeze!
0

Sorry for adding another answer, but there seem to be lots of different causes, so - lets list all possible fixes here.

I tried disabling ReSharper and other addons - did not work. What did work - is reapplying the SP1 again.

PS. Weird, I know. Don't ask, no idea... My guess is - VS was "repairing" itself silently at some point and restored some non-SP1 components.

PPS. You might also want to try disabling "Productivity Power Tools" addon. If you have ReSharper installed - almost all the PPT features are already there, in ReSharper.

PPPS. I have a blog post with several performance tips for Visual Studio & ReSharper, might come handy..

Comments

0

Have you tried Cleaning the solution?

In my case, high CPU usage started out of nowhere (WPF project). Restarts of Visual Studio didn't help, neither disabling/uninstalling addons. But Cleaning the solution did help!

1 Comment

I regularly rebuild the project, which (as I understand it) is a Clean + Build.
0

I was experiencing a very similar issue on a large cshtml file in VS 2015 and was solved for me by turning off all of the automatic formatting options in Options > Text Editor > C# > Formatting > General:

Automatic Formatting Options Off

I then use the "Control+K,D" key combination to format the page once I have finished making the necessary code changes.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.