FxCop reports incorrect number of errors and warning


We use the FxCop-runner to perform code-analysis for our project. We currently have quite a large number of errors and warnings that we hope to deal with in the coming months and have set the error and warning limits accordingly to keep te build in the green.
However, since a few days the runner consistently fails, because it reports an incorrect number of errors and warnings. When viewing the details of the report, it reports the correct numbers again which are within the set limits.

The build log contains inconsistencies regarding the number of errors.
For instance, the build log of the first failure - a few days ago - reports the following:

  • [10:43:21]: Errors limit reached: found 3445 errors, limit 3100
  • [10:43:21]: Warnings limit reached: found 15308 warnings, limit 11000
  • [10:44:54]: Total: 10964 (+0 -0) Errors: 3048 (+0 -0)

I've compared the fxcop-report with the report from the previous build that still passed and noticed no differences (except for the dates/times).
To my knowledge, there were no changes in the configuration of this buildtask in TeamCity.

Does anyone have an idea why TeamCity suddenly reports these incorrect number and what we can do to fix it?

Comment actions Permalink

Are there any errors in teamcity-agent.log on the agent or in teamcity-server.log on the server?

Comment actions Permalink

The server and agent logs do not contain any errors (just INFO level messages).
The only thing out of the ordinary is that the buildlogs for FxCop contain a handful of warnings like:

Warning: Unrecognized rule category 'Microsoft.Maintainability'.

This is probably due to a difference in the version of FxCop that Visual Studio is using versus the FxCop version that TeamCity is using.
These warnings have been present for a while now so it's unlikely that this is the cause of the issue.

Comment actions Permalink

I've raised the limit of the number of errors and warning to those (incorrect) numbers that are reported by FxCop.
Now the correct numbers are reported again. However, changing the limits back to their original values results in failure again with the incorrect numbers.
It almost looks like some errors/warnings are invisible.

I've got the original fxcop-result.xml file from the artifacts in TeamCity. Is there an XSLT-transformation sheet (or some other tool) that generates a summary of the errors and warnings so I can determine the actual number of errors and warnings?

Comment actions Permalink

Hi Arjen

FxCop and TeamCity interpret inspection results in different ways, and that's a reason of these confusing numbers.
If you have two projects and both of them refer to the same assembly then FxCop counts inspections within this assembly twice, but TeamCity merges the data and counts it just once.
That's why second counter is always lower.

In current version FxCop runner uses first (not merged) counter to set limits. We will change that in next version, so the limits and displayed results will operate the same values.



Please sign in to leave a comment.