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

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%

Related

Visual Studio 2013/2015 Idle CPU usage

I'm currently evaluating Visual Studio 2015 RC. I've noticed when running the IDE, The Visual Studio 2015 process is constantly at around 25% CPU usage. Even without a project loaded and without the welcome page it is gobbling up 25% CPU usage at a constant rate. No other applications running other than background services. All other running processes use around an additional 2 to 4 percent CPU overall.
This behavior has also been noticed in Visual Studio 2013.
Is anyone else seeing this behavior? Is this normal? Any suggestions?
Had this same problem. Processor constantly at 45-50% even when the IDE is completely idle.
Turns out the problem is the Microsoft Git Source Code provider.
I turned that off and processor dropped to 0 and the IDE became much more usable.
In my case disabling Telerik ASP.NET MVC Extension solved high CPU issue.
High CPU load started on solution load and didn't drop (40% with one, 80% with two solutions) until VS was closed or even sometimes after (had to kill the process).
Tools->Extensions and Updates->Installed, find the extension and click 'Disable'.
In my case all reference counts tried to update every time when I edit code.
I have just turned them off. You can do it this way.
It’s not to be expected that Visual Studio should chew up continuous CPU time.
I am running Visual Studio 2015 Community RTM right now with a medium sized project open, and am not seeing any ongoing CPU usage (according to Process Hacker 2, which shows usage as small as 0.01 percent). It’s just blank, which means not even 0.01% CPU usage is registering.
Keep in mind that IntelliSense scans your project files in the background to build the database for popping up its suggestions, etc.
Choosing Project > Rescan Solution from the menus will result in that process being done over, which will cause the CPU to be used for a time. But it should ultimately go quiet.
Seemingly forever, there have been times when deleting the Intellisense Database files and doing a full rescan solves “odd behavior” type problems. I don’t know if it’s the “prescribed” method, but if I suspect an IntelliSense problem I just delete the .sdf file in the project folder if I want to make sure Visual Studio starts with a clean slate. This isn’t necessary very often.
I also had this problem, constant 20-40% CPU when idling (Visual Studio 2015 update 1). I noticed that other local repositories of the same code did not have this problem.
I deleted the problematic local repository and took a new checkout, this solved the issue for me. Why this worked, I unfortunately cannot explain...
I run resharper, turned that off and turned off the Microsoft Git provider and still had high CPU issues, devenv.exe would also run after close... until recently.
It appears VS 2015 Update 2 has resolved these issues!
https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx
In my case; "Visual Studio 2015 Update 1" gone crazy editing JS files regarless of the length of the source. It used high CPU and the editor is even freezed. I fixed the issue by disabling the 3rd party add-ons by one-by-to detect the buggy one causing VS 2015 malfunctioning.
Hope it works.
In my case, the culprit was Node.js tools for Visual Studio. I had v1.1.2 installed and the cpu was constantly around 25-40%.
A switch to Node.js Tools v1.2 RC resolved the problem completely after an initial high load that went away in a couple of minutes.
In my case it was either the Roaming Extention Manager or most probably the azure worker role project in my solution. If you have one of these try unloading it and restart visual studio. I can reproduce it but I don't know why it happens.
I've noticed also that when running and stopping a debug episode on the local server, if the page is still open in the browser, VS will continue to run at high CPU. Closing the browser page stops this.
I want to share my experience,
In my case I had to diable all extensions and updates and code analysis c#.
1-For extensions and updates :
Tools => Extensions and updates
2-For the code analysis
Solution explorer => right click on the project => Properties =>Click on the tab "Code analysis" => click on the "Open" bouton => Uncheck the checkbox "Microsoft.CodeAnalysis.CSharp" => save and exit.
Cpu usage descended to 1 %.
In my case, The .suo file in Visual Studio was the culprit. Deleting it fixed my issue.
Refer below link for more details.
https://shemeerns.com/2014/04/04/the-solution-user-options-suo-file-in-visual-studio/

Finding Performance Spikes on 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.

Reuse Testconfigurations from VS 2008 in VS 2010?

I'm currently investigating my options to run automated tests from within Visual Studio 2008 Professional. I noticed that the MSDN page documenting the integrated funcionality is only available for VS 2008 and VS 2005. This kind of makes me suspcious. Since we are planning to upgrade to VS 2010 I'm wondering whether I will able to continue to use my configurations and knowledge with VS 2010? Does anyone here have made any experience with this?
TIA, Thomas
No need to be nervous, the terminology around the test configuration has merely changed in VS 2010. Most of what you know is the same but resides under different product branding which causes some versioning problems in the documentation.
Most notably, "test configuration" is often referred to as "test settings" under 2010.
Microsoft moved away from silo-ed "Team Test" terminology of VS 2005/2008 to a more holistic big picture known as Microsoft Application Lifetime Management, where testing is an integrated component for delivery of successful applications. Keep in mind that most of the documentation you'll find for testing refers to the Test Manager, which ship with the Ultimate and Test editions of Visual Studio. The Test Manager ties Tests to Use Cases and Requirements and is part of that big picture.
If you're not going down the ALM big picture, the focused view of just running tests hasn't changed much at all, with the exception of some new features like Test Impact which are pretty cool.
The following links may be useful to you, as it sounds like you're interested in how the tests can be used by developers or part of your build process:
Running Automated Tests within Visual Studio
Running Automated Tests from the Command-line
Hope that helps!

Has anyone integrated NUnit with Visual Studio 2010?

Has anyone integrated NUnit with Visual Studio? I'm trying to set up a build pipeline like this one. But, I'm pretty new to .NET and I'm still understanding how things work. There are many resources in the internet on NUnit + VS, and I'm confused.
I'd recommend you to use Resharper.
As some say, "It just works".
Disadvantages/side effects of this choice in your case could be:
1. Resharper is not free;
2. Running unit-tests is minor part of Resharper - it also includes tons of other features, which you maybe do not need for now(but you can disable most of them in setttings).
Free solution is - Visual Nunit 2010 Visual studio extension. Free and does exactly what you want.
UPDATE
How to add NUnit to your project.
I've found this tutorial. Follow it step-by-step, I've found it helpful and complete for .NET novices.
The only difference is that in Running Unit-Tests section for running tests author uses test runner tool that is distributed within NUnit itself, but you can use ReSharper runner as described in JetBrains' docs
I'm using this:
http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099
Which works quite well for me. You can access it within VS2010 from View->Other Windows->Visual NUnit
I used TestDriven until it was no longer free, I used Resharper but felt it slowed down my machine too much, I tried the VisualNUnit extension but it appeared to spawn multiple processes of itself that would keep a hold on some of my DLLs, I added NUnit itself as a command under Visual Studio Tools (and also with a toolbar button and some macros in Visual Studio to start the current test and attach) but that cost some effort to set up and didn't feel smooth enough after being spoiled with tools like TestDriven. Eventually I tried NCrunch... I am hooked ever since, and I have even started to favor it over TestDriven! the next tool on my "NUnit bucket list" will be the NUnit extension for Visual Studio 11.
PS: NCrunch should work on your Visual Studio 2010 and the homepage has a very decent demo video.
First download and install the NUnit
Step 1: Open Visual studio
Step 2: Open your project
Step 3: Select Properties from Solution Explorer
Step 4: Select Debug option in the properties window
step 5: select 'Start external program' under the section 'Start Action'
Step 6: Select the path of the NUnit file
Step 7: Save it.
After that when you debug your project NUnit will open.
Setting up Visual C#2010 Express with NUnit
The original and still quite ok test runner.
Test Driven .net
Used to be free, but now costs a small fee unless you're a student or open source developer.
Visual Studio 2011(BETA) is compatible with 2010 and provides test runners out of the box. Refer to Visual Studio 11 Beta Unit Testing – What’s New and Visual Studio 11 Beta - Unit Testing Plugins List. For continuous integration (CI) server U can use TeamCity and also run those test on the server.

Visual Studio 2010 - How to optimize

I am using the 2010 version of Visual Studio, but am having many problems with delays - my computer has a good configuration of RAM, and processor - especially when saving files.
Currently I am carrying a medium-sized project, only one open file (ASP.NET page) using a single suite of components from third party, the Telerik. And yet, in time to save, or modify the tab, the entire IDE is slow. I know there may be several factors for this problem, but I'm not carrying the computer (the problem apparently is the memory management on behalf of the IDE).
Does anyone know any way to improve it? Change settings, Windows services. Oh yes, I'm using a plugin to modify the color of the IDE and another to find (Ctrl-click) the object reference.
Memory Initialization:
Memory: 280000K
Virtual Memory: 350000K
Have you tried disabling all the plugins and make sure that it is VS that actually causes the slowdown?
I have Resharper installed and VS can be slow sometimes. I turned it off (suspend on v5), and VS is back to blazing speed. Of course, inversely coding productivity is impaired by not having Resharper.
There are many causes and circumstances that can lead to what you're describing. So I'd better recommend you to check the links bellow...
VS.Net 2010 IDE Very Slow
VS 2010 very slow
VS 2010 slow for edit of first file in project with many web references
VS2010 C#: Delay when opening a file inside IDE

Resources