14 votes
VS 2005 IDE consumes 99% CPU when opening large unmanaged solution after installing StyleCop 4.3

Description

 
After installing StyleCop 4.3, Visual Studio 2005 will consume 99% CPU (according to the Task Manager) when opening a large (~41 projects) solution containing mostly unmanaged C/C++ code. The CPU usage will occasionally drop to as low as 80%, but even after waiting several minutes while doing nothing, it did not drop down to an acceptable level.
This behaviour does not occur when opening a solution that consists of one C# project.
The CPU usage is so high it is almost impossible to select text in a source file, select menu items etc.
Uninstalling StyleCop resolves the issue with no other changes required.
Visual Studio is running in a standard user account (i.e. not an administrator account).
This issue is quite reproducible - I have installed and uninstalled StyleCop 4.3 several times to test this.

File Attachments


Comments

most recent at top (show oldest at top)
phildevaney wrote Nov 6 at 8:59 AM
I have come up with a better workaround for this problem.

Enable MSBuild integration, as described here http://blogs.msdn.com/sourceanalysis/pages/source-analysis-msbuild-integration.aspx, then disable the StyleCop VS package by setting the registry key:

[HKCU\Software\Microsoft\VisualStudio\9.0\Packages\{629EB7CC-69C2-43AC-9BC9-482B0F810C4E}]@SkipLoading = 0x1

This will prevent you running StyleCop on demand, but it will still run as part of the build. The menu entries will remain but could probably be removed with a bit more registry hacking. If you want to edit the settings, you need to locate the StyleCop.Settings file in Explorer and open it, or you can add it to your project/solution and choose Open With/StyleCopSettingsEditor.

If you have StyleCop For Resharper installed, you'll even get squiggly lines on most errors even with the package disabled

parky37 wrote Nov 5 at 7:24 AM
If this problem is still being looked into, here is a call stack on the main thread of devenv.exe. Hopefully, this will make more sense to you than it does to me:

Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.GetProjectItemPath(EnvDTE.ProjectItem item = {System.__ComObject}) + 0x63 bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.EnumerateProjectItem(EnvDTE.ProjectItem item = {System.__ComObject}, string name = "nameofaprojectinalargesolution", Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectInvoker projectCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectItemInvoker projectItemCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, object projectContext, object fileContext) + 0x100 bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.EnumerateProjectItems(EnvDTE.ProjectItems items, string name = "nameofaprojectinalargesolution", Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectInvoker projectCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectItemInvoker projectItemCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, object projectContext = {Microsoft.StyleCop.VisualStudio.AnalysisHelper}, object fileContext = null) + 0x63 bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.EnumerateProjectItem(EnvDTE.ProjectItem item, string name, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectInvoker projectCallback, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectItemInvoker projectItemCallback, object projectContext, object fileContext) + 0xcf bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.EnumerateProjectItems(EnvDTE.ProjectItems items, string name = "nameofaprojectinalargesolution", Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectInvoker projectCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectItemInvoker projectItemCallback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, object projectContext = {Microsoft.StyleCop.VisualStudio.AnalysisHelper}, object fileContext = null) + 0x63 bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.EnumerateProject(EnvDTE.Project project, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectInvoker projectCallback, Microsoft.StyleCop.VisualStudio.ProjectUtilities.ProjectItemInvoker projectItemCallback, object projectContext, object fileContext) + 0x149 bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.ProjectUtilities.SupportsStyleCop(Microsoft.StyleCop.VisualStudio.AnalysisHelper helper = {Microsoft.StyleCop.VisualStudio.AnalysisHelper}, Microsoft.StyleCop.VisualStudio.AnalysisType type) + 0x10f bytes
Microsoft.StyleCop.VSPackage.dll!Microsoft.StyleCop.VisualStudio.PackageCommandSet.StatusAnalyzeSolution(object sender = {Microsoft.VisualStudio.Shell.OleMenuCommand}, System.EventArgs eventArgs) + 0x15 bytes
Microsoft.VisualStudio.Shell.dll!Microsoft.VisualStudio.Shell.OleMenuCommand.OleStatus.get() + 0x29 bytes
Microsoft.VisualStudio.Shell.dll!Microsoft.VisualStudio.Shell.OleMenuCommandService.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(ref System.Guid guidGroup = {System.Guid}, uint nCmdId, Microsoft.VisualStudio.OLE.Interop.OLECMD[] oleCmd = {Microsoft.VisualStudio.OLE.Interop.OLECMD[1]}, System.IntPtr oleText = 45349544) + 0x166 bytes
Microsoft.VisualStudio.Shell.dll!Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(ref System.Guid guidGroup, uint nCmdId, Microsoft.VisualStudio.OLE.Interop.OLECMD[] oleCmd, System.IntPtr oleText) + 0x47 bytes

I'd really like to be able to use StyleCop again. Unfortunately, my company's main product is a large game composed of C++ projects so having nicely formatted source code files for the little tools I write isn't worth the suffering.

phildevaney wrote Nov 4 at 8:45 AM
This definitely does happen in 2008, and I provided the team with a solution that demonstrates the problem. The problem does seem to have improved somewhat with the latest build, but it is still noticeably slower for unmanaged solutions than without StyleCop installed. However, I have come up with a workaround, which is to run VS from a batch file that first disables the StyleCop package, e.g.:

@echo off

reg add HKCU\Software\Microsoft\VisualStudio\9.0\Packages\{629EB7CC-69C2-43AC-9BC9-482B0F810C4E} /v SkipLoading /t REG_DWORD /d 1 /f
cd /d "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\ide\"
start devenv.exe
exit

Plus a similar batch file to enable the package again (/d 0). Then I start VS with the appropriate batch file depending on whether I want to open a managed or unmanaged solution.

DRieman wrote Oct 21 at 10:59 PM
Contrary to the last comment, this IS verified by many to occur in VS2008 (as well as VS2005). As for the supposed deficiencies, this isn't the forum to discuss why both points are false.

taarheel wrote Oct 13 at 4:59 PM
The problem doesn't seem to exist in VS2008 in a solution with 99 unmanaged-C++ projects, although it definitely does exist in the same (almost) solution in VS2005. Given the history of this problem, it's apparent that no fix is planned. Hopefully we can stop supporting our VS2005-based products sometime in the next couple of years. Until then, our developers can't install StyleCop. Of course by then StyleCop might be dead. Too bad, but frankly, par for the course. There are so many other deficiencies in StyleCop as to make it barely useful anyway. Shall I mention a couple? (1) Can't enable it to run by default whenever you build in Visual Studio. Developers have to run it manually, and they will forget. (2) No way to exclude files in Visual Studio builds. Therefore if a developer happens to remember to run it on an legacy project, he's going to get hundreds (or thousands) of warnings.

phildevaney wrote Sep 24 at 10:14 AM
Can we get a comment on whether this is ever likely to be fixed, and if so when? It makes StyleCop completely unusable for those of use who have to work with unmanaged code as well as managed.

rockeye wrote Aug 27 at 10:06 AM
Same performance drop in a solution with 37 projects : 9 C# projects, 3 C++ managed, and 25 native projects.

Cpu consumption peak every 2 second, making visual unresponsive.

StyleCop 4.3.2.1

Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP2

Installed Edition: Professional

Microsoft Visual Basic 2005 77626-009-0000007-41775
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77626-009-0000007-41775
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77626-009-0000007-41775
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77626-009-0000007-41775
Microsoft Visual J# 2005

Microsoft Visual Web Developer 2005 77626-009-0000007-41775
Microsoft Visual Web Developer 2005

Microsoft Web Application Projects 2005 77626-009-0000007-41775
Microsoft Web Application Projects 2005
Version 8.0.50727.762

Crystal Reports AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005

Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)
Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB937061)
Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB947738)
Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB971090)
Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB973673)
Visual Assist X

Stefan0073 wrote Aug 25 at 5:33 PM
I've now tried several of my projects, and only one shows this problem. Since this project is open source, you might be able to use this to reproduce the problem.
The project is TortoiseSVN, the sourcecode is available from the Subversion repository at http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/ (username: guest, leave password empty).

Stefan0073 wrote Aug 25 at 5:27 PM
This also happens for me with VS2008SP1.
* only happens for solutions with purely native projects (C++, no .NET/CLI)
* does not happen for .NET projects (C#, WPF, ...)

I've uninstalled all plugins and macros. Then installed StyleCop, i.e. StyleCop was the only plugin which was active. Just to make sure it's not something that happens due to some conflict with another plugin. And this issue still exists.

Since my primary project is pure C++ and only a few smaller projects are in .NET, I have to uninstall StyleCop since VS2008 is completely unusable this way (even typing in the text editor is way too slow, scrolling a single page takes 5 seconds, ...)

DRieman wrote Jun 25 at 5:33 PM
Oops, somehow I worded my comments incorrectly. The last comments meant to read "...more pronounced in larger UNmanaged..." and "...remove large UNmanaged projects..."

DRieman wrote Jun 22 at 11:09 PM
This affects me quite heavily (in 4.3.1.3). The delay is indeed more pronounced in larger managed (or mixed) solutions (IE the problem lessens as I temporarily remove large managed projects from the large solution, but devenv still remains mostly unusable unless StyleCop is uninstalled). No problems in my C# only solutions. I have verified this crippling bug occurs in both 2005 pro and 2008 pro dev environments. Let me know if an additional reproducing solution is needed (as I can't ask my team to consider using StyleCop until this is resolved).

phildevaney wrote Mar 13 at 8:46 AM
I have managed to reproduce the problem by created a solution with a few wizard-generated MFC & Win32 Apps, then copy/pasting some of the source files a few hundred times and adding them to the projects. Note these projects will NOT build! The problem is not as pronounced as in my real solutions, which are larger, but there is a definite noticeable delay when right-clicking in Solution Explorer, and scrolling around files seems sluggish. If StyleCop is uninstalled, then right-clicking in Solution Explorer displays the menu instantaneously.

My PC is a Q6600 with 8GB RAM, running Vista Business x64 SP1 with all latest patches. My Visual Studio version is:

Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Enterprise

Microsoft Visual Basic 2008 91904-270-7587492-60537
Microsoft Visual Basic 2008

Microsoft Visual C# 2008 91904-270-7587492-60537
Microsoft Visual C# 2008

Microsoft Visual C++ 2008 91904-270-7587492-60537
Microsoft Visual C++ 2008

Microsoft Visual Studio 2008 Team Explorer 91904-270-7587492-60537
Microsoft Visual Studio 2008 Team Explorer
Version 9.0.30729.1

Microsoft Visual Studio 2008 Tools for Office 91904-270-7587492-60537
Microsoft Visual Studio 2008 Tools for Office

Microsoft Visual Studio Team System 2008 Development Edition 91904-270-7587492-60537
Microsoft Visual Studio Team System 2008 Development Edition

Microsoft Visual Web Developer 2008 91904-270-7587492-60537
Microsoft Visual Web Developer 2008

Hotfix for Microsoft Visual Studio 2008 Team Explorer - ENU (KB946260) KB946260
Hotfix for Microsoft Visual Studio 2008 Team Explorer - ENU (KB946458) KB946458
Hotfix for Microsoft Visual Studio 2008 Team Explorer - ENU (KB947171) KB947171
Hotfix for Microsoft Visual Studio 2008 Team Explorer - ENU (KB947180) KB947180
Hotfix for Microsoft Visual Studio 2008 Team Explorer - ENU (KB948816) KB948816
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB944899) KB944899
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB945282) KB945282
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB946040) KB946040
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB946308) KB946308
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB946344) KB946344
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB946581) KB946581
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB947173) KB947173
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB947540) KB947540
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB947789) KB947789
Hotfix for Microsoft Visual Studio Team System 2008 Development Edition - ENU (KB948127) KB948127
Microsoft Visual Studio 2008 Team Explorer - ENU Service Pack 1 (KB945140) KB945140
Microsoft Visual Studio Team System 2008 Development Edition - ENU Service Pack 1 (KB947888) KB947888
Microsoft Visual Studio Team System 2008 Development Edition - ENU Service Pack 1 (KB948484) KB948484
Microsoft Visual Studio Team System 2008 Development Edition - ENU Service Pack 1 (KB948560) KB948560

jasonall wrote Mar 12 at 4:17 PM
This issue is not fixed in 4.3.1.3 (the bug report is still active). We've been unable to reproduce the error internally and we're still trying to identify the right set of repro steps. If you have a project you can send us which will reliably reproduce this issue, we'd love to see it.

phildevaney wrote Mar 12 at 9:55 AM
Is this supposed to be fixed in 4.3.1.3? I have just tried installing this release and the problem still occurs for me (using Visual Studio 2008 SP1).

RobertGoerss wrote Feb 13 at 3:03 PM
What is the status of the fix that was being tested in November? A hotfix for this issue is warranted as it makes StyleCop unusable for developers who work in both managed and unmanaged code.

jasonall wrote Nov 8 2008 at 4:36 AM
We are currently testing a fix for this issue. The fix will be included in the next update of StyleCop 4.3, which will be released onto this site.

jasonall wrote Oct 13 2008 at 4:58 PM
On a large (native Windows) C++ solution with hundreds of files and 13 projects I experienced extremely poor performance in Visual Studio 2005.
The poor performance was markedly worse in the debugger with a single step taking maybe 10 seconds on a simple line of code when previously it was very fast. However the poor performance was also evident in the text editor without the debugger running, making Visual Studio almost unusable.

Uninstalling StyleCop fixed the problem 100% instantly.

Visual Studio Installation information (from the about box)
--------------------------------------------------------------------
Microsoft Visual Studio 2005
Version 8.0.50727.806 (QFE.050727-8000)
Microsoft .NET Framework
Version 2.0.50727 SP1


Installed Edition: Professional


Microsoft Visual Basic 2005 77626-009-0000007-41479
Microsoft Visual Basic 2005


Microsoft Visual C# 2005 77626-009-0000007-41479
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77626-009-0000007-41479
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77626-009-0000007-41479
Microsoft Visual J# 2005


Microsoft Visual Web Developer 2005 77626-009-0000007-41479
Microsoft Visual Web Developer 2005

Microsoft Web Application Projects 2005 77626-009-0000007-41479
Microsoft Web Application Projects 2005
Version 8.0.50727.762


Crystal Reports AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005



Hotfix for Microsoft Visual Studio 2005 Professional Edition - ENU (KB930859)
This Hotfix is for Microsoft Visual Studio 2005 Professional Edition - ENU.
If you later install a more recent service pack, this Hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/930859


Hotfix for Microsoft Visual Studio 2005 Professional Edition - ENU (KB933054)
This Hotfix is for Microsoft Visual Studio 2005 Professional Edition - ENU.
If you later install a more recent service pack, this Hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/933054


Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)
This service pack is for Microsoft Visual Studio 2005 Professional Edition - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/926601



Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB937061)
This Security Update is for Microsoft Visual Studio 2005 Professional Edition - ENU.
If you later install a more recent service pack, this Security Update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/937061


Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB947738)
This Security Update is for Microsoft Visual Studio 2005 Professional Edition - ENU.
If you later install a more recent service pack, this Security Update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947738



Xbox 360 Extensions for Visual Studio 2.0.7645.0
The Xbox 360 Extensions for Visual Studio add the ability to develop, build, debug and deploy game projects for Microsoft Xbox 360. Version 2.0.7645.0

Xoreax IncrediBuild 3.31 (build 894)
Xoreax IncrediBuild 3.31 (build 894)



ProDG VSI
ProDG Visual Studio Integration
Version 1.8.0
Copyright © 2003-2008 Sony Computer Entertainment Inc. / SN Systems Limited
See http://www.snsys.com

phildevaney wrote Sep 17 2008 at 11:11 AM
I have also experienced this issue on a smaller solution (14 projects) consisting entirely of unmanaged C++ projects. Visual Studio would max out one core and even something as simple as changing the selection in Solution Explorer would lock the IDE for a couple of seconds. Uninstalling StyleCop fixed the problem immediately. This is of high priority for me as my time is split between managed and unmanaged development.

RichardDrysdall wrote Sep 2 2008 at 5:51 AM
The problem also does not occur when opening a large solution (~53 projects) that consists of entirely C# and VB projects, suggesting it is the presence of unmanaged code/projects that is significant.


Updating...
Page view tracker