Visual Studio 2012 high CPU usage and unable to debug - visual-studio

I'm using Visual Studio 2012 Update 3. When I open a project, VS automatically creates a process called <myproject>.vshost.exe, even before starting to debug.
When I start debugging and later close the debug application, most of the times the <myproject>.vshost.exe process closes as well. When this happens, devenv.exe starts taking up 3x more memory than normal and CPU goes up to 25% (on a i7 Quadcore with 8GB ram) for around 1 minute. At the end of 1 minute, a new <myproject>.vshost.exe opens up (even though I'm not debugging), CPU falls back down to 0 and memory drops back down as well.
Trying to start debugging whilst the CPU is at 25% and <myproject>.vshost.exe is not running in the background will results in the solution building but the debug does not start.
If I wait until the CPU falls back down and <myproject>.vshost.exe process is running again then I can start debugging normally.
This happens to me 80% of the times after closing the application I am debugging. The remaining 20% of the times when I stop debugging <myproject>.vshost.exe continues running in the background and I am able to start debugging again immediately after with no delay.
This also happens regardless of code changes in between debugs.
This is a new install of VS2012 U3, I've tried resetting all settings and disabled ReSharper but still no joy.
I don't want to disable vshost debugging because of the features I would lose.
Has anyone else encountered this problem before? Is this a known issue? Are there any solutions/workarounds?
EDIT
I changed the platform from Any CPU to x86 and it appears to work properly, but I still can't understand why I shouldn't be able to debug it as Any CPU. Even though this might be the workaround I'd still be interested in knowing whether this is a known issue and if there are other (better) solutions.
By 'working properly', I mean that when I stop debugging the vshost doesn't close, in fact it never closes, but the CPU of devenv stays at 0% and it allows me to start and stop debugging as many times as I want one right after the other.
EDIT2
Actually it appears that changing the platform to x86 only worked properly for a while, after about 20 rebuilds it is now doing the same as leaving it as Any CPU.
On another note, closing and opening VS makes no difference.

I've ended up formatting the computer again and re-installing everything from scratch. For not it appears to be working fine, let's see how long this lasts for.

I know this is several months old but I'm trying to post this answer in a few places since this is what was causing my ills: I had the Data Sources toolbox open in Visual Studio 2012. Once I closed that, it seemed to eliminate the lengthy delays when switching windows. You may also want to close Server Manager if you don't need it open.

I know this is old Post but, I think I need to share my solution for everyone.
and this is my first post so, please improve the answer if I miss something.
I have the same issue with Visual Studio 2012, When I try to build or debug it will use CPU up to 100%.
So, I try below steps to reduce the CPU usage while debugging:
Please close unnecessary opened file.
Hide unnecessary debugging panels like: breakpoints, auto, local, output, find symbol result, etc.
If still use high CPU then try to hide call stack panel.
Remove unnecessary breakpoints.

Related

Visual studio Ultimate 2013 slow start on debug

I have installed visual studio 2013 Ultimate on Windows 8 enterprise edition.
When I start debugging an mvc project (which pretty empty) : it takes 27 seconds to start the debugging. I assume it's because IIS express 8 is loading symbols and hangs somewhere.
I have tried an empty mvc project and it starts in 10 seconds : which is very unacceptable.
I have tried :
- deleting all breakpoints
- enabling just my code
- unchecking symbols downloading from microsoft servers and downloading them on a local folder on the computer
- disabling intellitrace (was already disabled when i went to see)
- disabling just-in-time (was already disabled when i went to see)
- unplugging the ethernet cable (yes, i am pretty desperate)
- no antivirus is turned on
The first request (when i launch debugging) always take 27 seconds according to glimpse. The controller run under 1 second which is "acceptable". All the next requests are fine.
But I can't work with the 27 seconds each time I launch debugging.
Can someone help me ? I do not know what to do next.
My computer is a dual core 3Ghz with 4 Go of Ram and a 7200 rpm hd. I don't think it's hardware related.
Thank you very much.
UPDATE :
As soon as I start to use NLog in the code, it takes 30 sec to launch the debug mode.
If I comment all the place where I log something, It takes 10 sec. Sometimes less.
How much time you guys take to launch the debug mode ?
It's quit possible you are referencing dead or slow symbol path. For example, you're at home but accessing a symbol path on company's server. Check it under Tools -> Options -> Debug -> Symbol. If it's ok, check your system as follows.
Make sure there is no other process that runs out of your hardware resources.
First check if CPU usage is too high after staring debugging. If CPU usage is too high, use Process Explorer to check what activities VS Is performing. If they are in an extension thread, disable that extension. If they are in VS own thread, it's most likely a VS bug you can report to MS.
Check if memory usage is too high. If VS memory usage is too high, given that you just start simple debugging, it's a VS bug.
If both CPU and memory are ok, it's probably related to IO operation. Use Process Monitor to check which files are being accessed, especially files on remote machine.
This is how I troubleshoot the same problem on my machine. Hope it help you.

Visual Studio 2008 hanging in 64bit Windows 7

I have brand new Win7 64bit machine. Visual Studio 2008 is newly installed, but has started responding more and more slowly, eventually hanging completely and occupying one (virtual) core of the machine completely. After an hour or so of increasingly slow response I close it and start again, whereupon it runs fine at first before gradually slowing down again.
Using Process Explorer I have found that the responsible devenv.exe thread always has a stack which looks something like this when it is pegging the processor:
ntoskrnl.exe!KeWaitForMultipleObjects+0xc0a
ntoskrnl.exe!KeAcquireSpinLockAtDpcLevel+0x732
ntoskrnl.exe!KeWaitForMutexObject+0x19f
ntoskrnl.exe!__misaligned_access+0xba4
msenv.dll!DllCanUnloadNow+0x49b31
with one or more ntoskrnl.exe!__misaligned_access and msenv.dll!DllCanUnloadNow lines; can anyone give me an idea of what might be going wrong? Thanks!
UPDATE:
Having started VS via the command line switch /SafeMode (thanks 0xA3), I find that without Resharper the problem seems to go away... So it looks likely to be a Resharper bug :(
did you check all other threads in the process? (both managed and un-managed) to see if any thread is busy or waiting in non-trivial place with stacks unlike others? Main thread is obviously waiting, most likely on another thread of the same process - I'm curious to know what other callstacks are out there.

Visual Studio 2010 hangs on debug start for a minute or two

VS2010 hangs for several minutes after debug starts, after that debugging continues as usual. I have no idea what it's doing, Process Explorer says the debugged process is in suspended state during that hang and Visual Studio doesn't seem to write anything to disk except a few kB at the end of the hang.
There was no such hang for over eight months in any of my projects, it started yesterday.
UPD: Resetting all settings cured a lot of problems including this hang. I still don't know what it was, but resetting works magic.
I've noticed this as well and have determined that one of the causes is any code that uses interrupts or timers. Allegro 4.x (no comment on 5.x as I have not used it yet) is a big offender. Simply including and calling the global initialization method for the timer routines will cause this to happen.

OpenGL randomly slows down

I'm currently learning OpenGL and I've noticed a rarely occuring performance problem:
My program is rather small so it's not a performance problem with the code itself, but when I'm running the code via Visual Studio I sometimes only get 1-2 FPS instead of the usual 60.
Once this happens I can restart the program as often as I want to (in debug and release mode alike) and it won't go away.
However, when I close my Firefox (or manually shut down the plugin-container.exe though task manager) and restart my program everything is fine again. After that I can start Firefox again (with the same tabs open) and the bug does not reappear.
I use the newest version of Firefox, and I've had this bug with several programs already - both made by me and others and using different versions of OpenGL. However I don't think I've had this problem when starting a compiled exe directly, but only by using the Run feature of Visual Studio.
I've searched the web but I only found a link about the generally bad performance of this plugin-container.
Does anyone else have this problem? Do you know any walkarounds or fixes?
PS: Regarding isti_spl's answer:
The CPU utilisation of the plugin-container.exe jumps to the 50% limit when the problem happens.
I'm working with Visual Studio, but the problem only occurs when I also have Firefox running (it most certainly is because of this plugin-container, so it probably won't happen with other browsers).
It's hard to isolate the problem because I can't replicate it. It might happen 1 out of 50 times.
I'll see if closing flash-related tabs (youtube, blip.tv etc) fixes the problem next time it happens.
Can you isolate the problem?
You first mentioned running visual studio then firefox. Please try to run separately.
Under FF. is it caused by WebGL or flash plugin? Is it caused by visiting specific sites?
Is it FF specific or happens under other browsers too?
Does CPU utilisation jump high? Please verify that too and which process consumes most CPU.
Not sure, but likely gpu driver + flash problems.
If so, the problem is not in your code, other GL program should be affected too.

why is vs2010 so slow lately? Its nearly unusable

Not sure what has happened on my dev machine but I can barely use visual studio 2010 these days. I have a copy of professional edition installed on a win7 pro x64 build running on top of a i5 M430 and 6 gigs of ram.
With only VS2010 open i've seen the process leak away to 600,000k+.
The editor is extremely slow. Every character I type sends the gui into "Not Responding" for 5 seconds and starting/stopping the debugger is a ~30 second operation.
I've done a repair install. No change.
I've removed productivity power tools and installed the perfwatson extension.
When I installed perfwatson the GUI sped up a bit while opening/loading a project. But the text editor still has an awful delay.
What else can I do? Harware rendering is off in my environment options.
an example of the slowness (literally): typing Height="1024" takes about 30 seconds to display in the text editor and do its update flash to go out of not responding. The word "Height=" takes 5 seconds to show. The intellesense and blank " " takes another 5 seconds. Each digit pops in every five seconds after that.
Needless to say even trying to edit existing work is a frustrating experience.
edit: rolled back one version on video driver. No noticeable changes after reboot.
edit: did some winforms projects today. No slow issues with this project type. Must be something with just wpf/sl projects.
edit 8/18/11: Took troublesome project to the production server. VS2010 editor works great there. Very snappy and responsive. Not at all slow. So it's not something inside my project. It's something in my machine. But a full out OS rebuild is something I can't just do now. Probably will start a bounty soon.
Delete the .sdf and .sou that have the same base file name as your solution file.
If your solution file is
c:\MyProject\project.sln
You should delete
c:\MyProject\project.sdf
c:\MyProject\project.sou
This solves 98% of the problems of slow VS.
These files contain intermediate information that is not important for the functionality of the solution and as time goes by they swell up and become bloated and fragmented. VS relies on these files for and if dealing with them is slow, everything is slow.
I know this is an old post but I have just had an issue where my visual studio project has been working fine for about 2 1/2 years and suddenly every time I clicked run I had to wait about 3 minutes and the same when clicking stop. I tried the old windows reboot but to no avail.
I found a post about deleting the projects .suo file (it was only 4MB).
I deleted the .suo file and everything is completely back to normal. I guess the file had corrupted or something.
Having a large number of breakpoints or a large number of files open can cause serious performance problems, but it sounds like your problems are worse than that...
A bios update and a intel chipset update on my machine solved nearly all my performance issues.
The slowness started to creep out into the OS and I was pegging the cpu at idle. I've got 4 cores and 8gb ram. It shouldn't do that. Now its happy at 8% load at idle.
Thanks to those that tried to help.
had the same problem. not sure what causes this ridiculous performance nightmare, but eventually i had to re-install windows. This same issue was posted on Microsoft forums but the best answer was to re-install VS or windows.

Resources