Finding Performance Spikes on Visual Studio - visual-studio

Is it somehow possible to measure the CPU and/or IO requirements for all installed Visual Studio Addins / Extensions (VS 2012 / 2013)?
Concrete Problem: I have quite a lot of Extensions and Addins for Visual Studio 2013 installed and in general it runs smooth, just sometimes i experience ~5-10 sec spikes where VS just freezes. (Without any Addins or Extensions it doesn't happen).
Any idea how to find the problem?

If it reproduces often enough, you can just attach a debugger to Visual Studio and break in when something is going bad. Conveniently, Visual Studio is a debugger, so if you launch two instances in and in one go Debug > Attach to process, you can just attach to the other. When you hit the issue, break in (quickly) in the other and look at the main thread (it's labled in the threads window.) Look at the stack to see if there are any obvious offenders...

When VS freezes you can run ProcDump and then analyze the stack for an offending extension. Alternatively Process Explorer has a nice real time threads and stack monitor.

Related

Visual Studio slowness, possible reason?

Im struggling with extremely slow Visual Studio. I use it to build C++ projects mostly.
Everything could be super slow. Menu's loading, intelIsense tips, builds. I've just tested building simple solution in 1 file, and build took around 5 minutes. But! I found this article about Windows Performance Analyzer which I used to trace this solution build. Despite overall time taking around 5 minutes, WPA report build took only around 0.686 seconds, attaching screenshot:
apparently I press "rebuild" in VS and build itself started ~300 seconds later(timeline).
Currently I use VS2019. Same problem I observed on VS2017. I did removed all VS components and installed VS2019 and problem is not gone. All other programs run fine. No excessive CPU load(intell 6700k), no noticeable harddrive usage(windows and VS components are on m2 ssd, lightning fast), 32 gb ram and enough free space on system disk.
Only VS extension I installed myself is QT extension for VS2019. Which actions can I take next to find the problem?
Things to try:
devenv /safemode from a command line starts the IDE in safe-mode with all plugins disabled.
Visual Studio Installer and repair install
Disable graphics acceleration in Visual Studio (Tools|Options|General ... there are a few "rich client visual experience" related things)
Check paths on your computer. If other apps run fine but one does not, it could be that this app tries to access a network drive or website which is not available.
Run "procmon" and "procexp" (Process Monitor/Process Explorer from Sysinternals) and take a look at what's going on.
Try VS 2022.

serviceHub.Host.CLR.x86 taking a lot of memory and CPC

serviceHub.Host.CLR.x86 taking a lot of memory and CPC in my Visual Studio 2017 solution.
This causes Visual Studio to crash.
Any ideas on what the underlying cause is?
The serviceHub.Host.CLR.x86 is responsible for running some processes in the background for Visual Studio 2017/2019.
Among other features, there are three Visual Studio features that run under this process and, in some cases, cause high CPU/Memory usage. They are:
Full solution analysis.
Live Unit Testing. (only in Visual Studio Enterprise)
Code Lens. (only in Visual Studio Enterprise and Professional)
Disable these features as follows:
Full solution analysis: from Tools\Options\Text Editor\C#\Advanced (please see the remarks section if your Visual Studio 19 version is 16.5 or later)
Live Unit Testing: from Test\Live Unit Test
If the Live Unit Test is running, select Stop.
Go to Tools\Options\Live Unit Testing and disable the option Start unit Testing on solution load.
Code Lens: from Tools\Options\Text Editor\All Languages\CodeLens
This feature has a lot of options. If you like Code Lens and want to keep using it, you can enable/disable each option to check which one is stressing your computer CPU/Memory.
That's it. I hope it helps.
Remarks:
In Visual Studio 2019 version 16.5, Microsoft removed the option to disable the full solution analysis.
However, you still have the option to narrow down the analysis scope to only one document. Select the option Current Document to restrict the analysis to the current document.
This process is also executed when installing Visual Studio with the option "Install and Download" at the same time.
If the computer is not so powerful, it will consume the rest of the CPU power till gets to 100%

Microsoft.VsHub.Server.HttpHostx64.exe consuming loads of resources and crashing Visual Studio 2015

I am experiencing this behavior for some days now.
Microsoft.VsHub.Server.HttpHostx64.exe goes bananas consuming resources and Visual Studio stops responding and crashes when a breakpoint is hit.
I heard this process is related to performance analysis but even if I disable it the problem keeps happening (even though it shouldn't crash VS neither debilitate the user interaction).
Anyone had the same problem and found a solution for this?
VS2015 has a bug which allows the task named Microsoft.VsHub.Server.HttpHost64.exe to consume all the free ram so your computer pages to disk and slows things down. When I killed that task it had no adverse effects on my program, and reduced disk activity from high levels to low levels. The task may restart itself, but instead of consuming 10+ GB of memory, it then consumes about 40MB. The bug only appears when running the GUI / IDE, not your compiled program.
It may be possible to programatically kill that task, haven't tried it.
Also, here is another possible workaround which can be seen at https://connect.microsoft.com/VisualStudio/feedback/details/1610160/microsoft-vshub-server-httphostx64-exe
** The following may require you have administrator privileges on the box ***:
1. close all instances of Visual Studio 2015
2. Locate directory C:\Program Files (x86)\Common Files\Microsoft Shared\VsHub\
3. Rename VsHub to VsHub-Suppressed
Once the above has been performed, Visual Studio 2015 will start noticeably quicker.

Visual Studio 2010 (devenv) Hung Process After Closing

I have problem with Visual Studio 2010 on Windows 7 64-bit. After some time of work VS starts consuming ~50% CPU and UI responding slows down. When I close VS then UI disappear but process stay.
When I forgot to kill those hung processes at the end of day, I will end up with numerous devenv.exe processes.
I have reinstall Visual Studio and reinstall Windows and ended up with the same problem... doesn't change anything. Please help. :/
Remove and/or uninstall all third-party Visual Studio add-ins and extensions. Disabling is not good enough.
Visual Studio 2010 relies heavily on graphics. Therefore:
Update your video driver.
Turn off "Enable rich client visual
experience"
Turn off "Use Hardware graphics acceleration if
available"
There are also temporary files that Visual Studio uses that may need to be cleared out.
Clear out your %temp% folder.
Clear out %AppData%\Local\Microsoft\WebsiteCache
Clear out %AppData%\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies
Your project and solution user settings may be corrupt due to so many "crashes".
Delete .user and .suo files (you will lose the startup project, bookmarks, breakpoints, and other user settings specific to projects and solutions.)
Begin where you began before - it may seem overkill but this is the only way to be sure we are addressing everything short of hardware issues.
Reinstall Windows - make sure you are using a validly licensed copy, and patch the hell out of it before installing Visual Studio.
Note: I doubt it is a GPU driver issue, but it never hurts to use the most up to date driver and this is the place to do it right after a fresh OS install.
Install Visual Studio .Net 2010 but do not start it up. Let it get the frameworks installed fresh.
Use Windows Update to install the VS 2010 SP1 patch, and any/all patches for .Net frameworks.
Make an images for yourself right here so you have something to build from if you need to try this again. It will save you lots of time.
Fire up Visual Studio, and test your closing before installing anything else.
If it does not work here, there's likely some conflict between PC hardware and window OS, and you should try to find this symptom in other applications to get more info.
Here's what i would be looking for:
Does it happen EVERY TIME?
Does it happen after you debug your project ? does it happen for ALL projects?
Does it also happen when you don't load any projects? (simply start the IDE and wait).
Does it happen after a debug session of your application? maybe the application is not closed properly?
Do you have any other apps running at the same time that may cause this? try reproducing with a minimal set of apps/services running.
What are you doing exactly when it starts freezing ? anything in particular?
I would try to get 2-3 memory dumps at the time of hanging, post it here as well as to MSFT people. That would be a good start.

Is there a task manager like application for visual studio?

Sometimes I experience Visual Studio 2010 being very sluggish. I have some plugins, like ReSharper for example, that I think could be the culprit.
It would be nice if I could see the processes under visual studio to see what is using up all the CPU. Basically what I am looking for is a Task Manager just like the one in Google Chrome but for Visual Studio. I searched the internet and came up with nothing.
Unlike Chrome, Visual Studio does not use multiple processes. (Except when debugging applications)
Using Process Explorer you can double click on your devenv.exe process, then under the Threads tab you can inspect, suspend or terminate (I wouldn't recommend the latter) threads belonging to addons, for example, VAssistX threads generally have a start address somewhere in the va_x.dll region.

Resources