Problems and Solutions for Visual Studio High CPU Usage Issues
Howdy readers, Lafe here. About once a month, my partner in crime, Rich Seeley, will be doing technical takeovers of this blog. Here's his latest post, focused on fixing high CPU usage issues in Visual Studio.
The cause of a problem can be obvious.
You spill your coffee into the keyboard of your old laptop and it stops functioning.
But the cause of other problems can be elusive and tricky to troubleshoot.
That's how it is when you start looking for the cause of high CPU usage issues related to Visual Studio.
Consider the dilemma of the Visual Studio coder who has a perfectly operational machine except sometimes for no apparent reason CPU usage spikes.
Your Surface Pro 3 is overheating. But when you check with a Visual Studio guru, who has been working with the IDE for a decade or more, he says, "Never had that problem myself."
Others may say they've heard of the problem but have only a vague idea of what causes it or how to prevent it.
If you do a quick web search, you will find that there are some coders experiencing similar problems. Some are asking for solutions. Some have done serious troubleshooting and believe they have a solution.
VS CPU issues: A two-headed monster
Since nothing is simple in life or coding, there are two different Visual Studio CPU usage issues: the one mentioned above regarding the actual running of Visual Studio, and two, the issue of debugging your app so it does not cause high CPU usage for the end users. Solutions to both these problems can be elusive because it is hard to pin down what exactly is going wrong.
High CPU usage in apps
Debugging high CPU usage in apps appears to be the more common problem and Microsoft offers a tool to help solve it, so let's start there.
Taylor goes on to provide detailed tips for using the CPU usage tool to make sure your app isn't bogging down end users, who might find that annoying and stop using your app.
Further details are offered in Microsoft's Visual Studio 2015 documentation that has a refer to the documentation for the soon-to-be-released Visual Studio 2017 where there is a guide for collecting CPU usage data for apps destined to run on everything from traditional desktops to smart phones. This will be helpful for everyone writing apps for the growing mobile device market.
Also helpful for debugging issues that may bog down an app is How To Do Production Debugging on the Fly by Kamran Bilgrami, a software developer specializing in .NET, CLR internals, security, patterns and debugging. He is a contributor to Visual Studio Magazine. Bilgrami walks the reader through the steps to debug a mission critical app that is bogging down for no apparent reason. He outlines how he used tools from Microsoft and other sources to eventually pinpoint an SQL operation that had been failing for quite some time. It turned out that alerts were misconfigured, so no one was being informed of the problem.
When Visual Studio is too hot to handle
As regards the other CPU usage issue where some coders using Visual Studio say the demands of the IDE are heating up their PC, Bilgrami says he has not encountered that problem with his recently installed VS 2017 RC (Version 15.0.26206.0).
Web searches do find occasional reports of coders complaining of high CPU usage when they are working with Visual Studio. However, these reports are not widespread. Several tech journalists, who cover the Visual Studio space, say they have heard of the problem but are not aware of actual cases of it.
Blog posts such as this one indicate that the Visual Studio CPU usage issue may result from opening excluded files. In that case, a simple solution was found.
Another possible culprit may be GitHub, the web-based version control repository. On a Microsoft Developer Network forum page titled VS 2015 high CPU usage a coder reported: "I have VS 2015 running at very high CPU usage all the time. What do I do with this problem?"
The suggested solution: "You can try to disable git in Source Control if you don’t use it all the time. Sometimes enabled git plug-in can increase your CPU usage."
Instructions for disabling the package that is responsible for loading the Git source control support in Visual Studio is available here. But there is a caveat that goes along with the instructions: "Use at your own risk!"
Perhaps the more prudent route is to ask the Microsoft Visual Studio Team for help. However, they will need more information than just: "Help my CPU usage is spiking while my project is open." Instructions for gathering the data needed to troubleshoot the problem can be found on this Visual Studio Developer Community page.
If you have a similar problem/solution or even one we haven’t heard of, please let us know.
Posted by Lafe Low on 03/06/2017 at 12:26 PM