Code Anaylsis broken in VS2008
We have a solution that contains about 100 projects, and we'd really like to
run CA on one of these in particular. But, when migrating from VS2005 to
VS2008, we found some problems. There seemed to be several unrelated
issues, but I think they all boiled down to "CA seemingly corrupts VS2008 in
some manner, in-turn causing other strange behaviors".
First, none of these issues show up *until* I've run CA (either by
right-click/Run Code Analysis or turning CA on in the project settings and
doing a build).
The various issue we see:
===========
1)
The build was aborted because of an internal failure.
Microsoft.Build.Shared.InternalErrorException: Internal MSBuild Error:
Project shouldn't be in ProjectManager already.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(Boolean
showAssert, String unformattedMessage, Object[] args)
at Microsoft.Build.BuildEngine.Engine.StartRootProjectBuild(BuildRequest
buildRequest, Project project)
at
Microsoft.Build.BuildEngine.Engine.BuildProjectInternalInitial(BuildRequest
buildRequest, Project project)
at Microsoft.Build.BuildEngine.Engine.BuildProjectInternal(BuildRequest
buildRequest, ProjectBuildState buildContext, TaskExecutionContext
taskExecutionContext, Boolean initialCall)
at Microsoft.Build.BuildEngine.Engine.EngineBuildLoop(BuildRequest
terminatingBuildRequest)
at
Microsoft.Build.BuildEngine.Engine.PostProjectEvaluationRequests(Project
project, String[] projectFiles, String[][] targetNames, BuildPropertyGroup[]
globalPropertiesPerProject, IDictionary[] targetOutputsPerProject,
BuildSettings buildFlags, String[] toolVersions)
============
2)
When building many projects (81 of them in this solution), the build output
windows *only* displays:
------ Build started: Project: SomeProject, Configuration: Release Any
CPU ------
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
with no indication as to why it failed. A re-build displays the same
non-output.
=============
3)
"Microsoft Incremental Linker has stopped working" (access violation)
============
4)
An error occurred while validating. HRESULT = '80004005'
===========================================================================================
Full disclosure: I'm not completely convinced that 3) and 4) are related to
this issue, but 1) and 2) are very repeatable. I can do 10 builds in a row
without running CA, run CA, and the very next build fails with one of the
above.
Another clue - I happened to notice that when I ran CA, it would stop
displaying warnings at some point, and just give me a 'build failed' line.
In other words, CA didn't complete, and it didn't tell me why. But, if I
ran (in a cmd prompt window) the FxcopCmd command-line that VS2008
displayed, then FxcopCmd would run to completion.
I tracked this down to 4 CA warnings that would cause CA to quit early, and
if I disabled those 4, then CA would run to completion and say that the
project build succeeded. However, VS2008 was still corrupted, and I'd still
see the strange behaviors listed above.
The 4 CA warnings I disabled were:
- CA1504
- CA1702
- CA1704
- CA1815
=============
I've worked around this for now by turning off CA in the project settings,
and running FxCopCmd in a post-build step.
Has anyone else seen anything like this? Any hints on what I might try?
date: Fri, 8 Feb 2008 11:18:18 -0700
author: Arnie