10
votes

With Visual Studio 2015 I have noticed that if I have multiple solutions open with a common project to all solutions, if I so much as edit and save one .cs file belonging to the common project, all Visual Studio 2015 instances will consume CPU for 10-15 seconds. Note that the common project is fairly large.

I don't recall this happening with Visual Studio 2013. It is common in my workflow to have 8-9 instances of Visual Studio open all with solutions referencing the common project, so I feel as though I would have noticed this behavior with Visual Studio 2013 (my development machine has 32 GB of RAM which makes this type of workflow possible).

I have tried:

  1. Disabling CodeLens
  2. Uninstalling ReSharper
  3. Disabling the four C# Intellisense features found in Tools->Options
  4. Temporarily Disabling Static Code Analysis Solution Wide (for all loaded solutions)

I also launched a separate instance of Visual Studio 2015, enabled Microsoft Symbol Servers and profiled (via Debug-> Profiler-> Performance Explorer -> Attach/Detach) an offending Visual Studio instance while it was consuming High CPU.

This image shows the profiler summary and you can see from the graph high CPU usage between ~12s and ~27s.

Profiler Summary

84.46% of the samples were in Thread::intermediateThreadProc, and the majority were exclusive samples, but of the inclusive samples, it appears as though it was doing some sort of code analysis.

Profiler Call Tree

With this information I assume that some sort of background code analysis is being performed with all Visual Studio 2015 instances (including those in the background). Does anyone know how to disable this? Or if my assumption is incorrect, any other suggestions?

Update 9/12/2015 Interestingly, if I perform the same profiling with ReSharper 9.2 installed, I get a similar result, but with JetBrains.Platform.Satellite.exe at the root of the "Hot Path" (instead of devenv.exe).

Profiler Summary ReSharper

Update 10/11/2015

I believe this is the issue:

How to disable real time compilation in Visual Studio 2015

Is there a way to disable real time compilation on save? Or at least have it not be so intrusive? The operation most likely to follow "Save" is "Build", and because all of the visual studio instances are recompiling their respective solutions (without being asked), the "Build" operation in the active solution is severely hindered.

1
Thread::intermediateThreadProc() is just where all .NET threads start executing. When 85% of the samples are .NET threads but execute only a small percentage of .NET code then you need to suspect the shrinked-wrapped malware that programmers voluntarily install on their machines. Start by disabling your anti-malware. - Hans Passant
I would not imagine CPU usage associated with anti-malware programs would show up in the devenv.exe process, but I disabled Windows Defender (the only anti virus/malware I have installed), and the problem persists. (Are anti-malware programs able to inject code into processes?) - Shea
@Shea Have you solved in some way? I have the same issue. I've found that it happens also with VS 2012, and it has started to happened when I have installed .Net framework 4.6.x - Giox
@Giox I have not been able to solve the issue and have resigned myself to working with one instance of Visual Studio open at at time. There is a Microsoft Connect issue which was opened by Jetbrains: (connect.microsoft.com/VisualStudio/feedback/details/1803007). Recent comments suggest there might be some improvements with Update 2, but I have not tested this yet. - Shea
Visual Studio 2015 Update 2 does not fix this issue. Background Visual Studio 2015 Update 2 processes continue to consume large amounts of CPU when a file in one of their loaded projects is updated on disk. - Shea

1 Answers

0
votes

Found here (http://www.itgo.me/a/x8021838007883560399/how-to-disable-real-time-compilation-in-visual-studio-2015) : "go to tools, options, text editor, C#, Advanced and uncheck Enable full solution analysis. This should stop your problem as the solution won't be checked every time unless you build it."