FxCopCmd 1.35b1 not processing any rules.

When I run FxCopCmd on the command line from an MSBuild script:

C:\Tools\FxCop\FxCopCmd.exe /o:"C:\Projects\Common\trunk\bin\reports\fxcop.xml" /p:"CodeAnalysis.fxcop" /axsl /verbose

I noticed it isn't finding any problems even though opening the CodeAnalysis.fxcop project in the GUI does find at least 10 rules that need to be addressed:

Microsoft FxCopCmd v1.35.51212.0
Copyright (C) 1999-2004 Microsoft Corp.  All rights reserved.

Loading CodeAnalysis.fxcop...
Loaded DesignRules.dll...
Loaded GlobalizationRules.dll...
Loaded InteroperabilityRules.dll...
Loaded MobilityRules.dll...
Loaded NamingRules.dll...
Loaded PerformanceRules.dll...
Loaded PortabilityRules.dll...
Loaded SecurityRules.dll...
Loaded UsageRules.dll...
Loaded Common.dll...
Initializing Introspection engine...
Loading Common.ArgumentFormatException
Loading Common.ArgumentTypeException
Loading Common.ArgumentValidation
Loading Common.StringResources
Loading Rules...
Analyzing...
Analyzing [Common] Common.ArgumentFormatException
Analyzing [Common] Common.ArgumentTypeException
Analyzing [Common] Common.ArgumentValidation
Analyzing [Common] Common.StringResources
Cleaning Up Rules...
Analysis Complete.
No messages written.
Done.

When I run it using the version of FxCopCmd that shipped with VS2005:

Microsoft FxCopCmd v8.0.50727.42
Copyright (C) 1999-2004 Microsoft Corp.  All rights reserved.

Loading codeanalysis.fxcop...
Loaded DesignRules.dll...
Loaded GlobalizationRules.dll...
Loaded InteroperabilityRules.dll...
Loaded MobilityRules.dll...
Loaded NamingRules.dll...
Loaded PerformanceRules.dll...
Loaded PortabilityRules.dll...
Loaded SecurityRules.dll...
Loaded UsageRules.dll...
Loaded Common.dll...
There were non-critical errors loading FxCop project:
* Could not import all messages.
* End of project load errors.
Initializing Introspection engine...
Loading Common.ArgumentFormatException
Loading Common.ArgumentTypeException
Loading Common.ArgumentValidation
Loading Common.StringResources
Loading Rules...
Analyzing...
Analyzing [Common] Common.ArgumentFormatException
Analyzing [Common] Common.ArgumentTypeException
Analyzing [Common] Common.ArgumentValidation
Analyzing [Common] Common.StringResources
Cleaning Up Rules...
Analysis Complete.
Writing report to C:\Projects\Common\trunk\bin\reports\fxcop.xml...
Done.

This doesn't seem right. :)  Is there any place that I should be posting potential bugs   msdn.microsoft.com/productfeedback doesn't appear to have an entry for FxCop.

Thanks!
Colin




Answer this question

FxCopCmd 1.35b1 not processing any rules.

  • Jon Schwartz

    Also check that you are running both the GUI and FxCopCmd on the same machine.

  • neko...

    Hi Colin,

    this is the right place to report fxcop 1.35 beta 1 bugs. When you opened the project in the UI, did you see the 10 messages before or after analyzing the project

    Also can you check if the report generated by fxcopcmd.exe for VS2005 contains any messages this version of fxcopcmd always writes out a report, even if no messages were found.

    Can you try running analysis without the /asxl switch

    Thanks,


    Jeffrey


  • P.GopalaKrishna

    Hi Colin,

    we're changing the spellchecker, I can't give more specific details, but it will be a few months before a version with that work will be available so I would install the Office Proofing Tools for now.

    FxCop 1.35 has a part of the moving to a single version work in it, this is ongoing work however. As I said before, you can expect more details on this on our blog/forums as they become available.

    The binary names and most switches in the binaries that ship with VS2005 look the same indeed. But there are quite a few difference in the code, a good sample is the output report behavior. The code is compiled with different #defines for VS. The output report behavior and a whole set of other code differences will make the fxcop 1.35 bits not work well on VS2005 (We had to make changes in both fxcop and in vs after VS2005 released to move to a single set of binaries). Samples of things that will break if you try updating are:

    -project system won't consider your build complete
    -code analysis policy will never pass
    -rule UI is likely to be broken

    These are the ones I can think of right now, but I'm sure there are plenty of other things that could break.

    Another important thing is that you might risk not being able to get support from PSS after modifying your VS installation this drastically.

    That said, we're currently planning our strategy for future releases, I'll definately take this feedback in consideration and bring it up at our next planning meeting.

    Thanks,

    Jeffrey


  • David Kreps

    I'm having the same problem but on single machine. When I run:

    "C:\Program Files\Microsoft FxCop 1.35\FxCopCmd.exe" /p:AutoBuild.fxcop /c

    I get this result:

    Microsoft FxCopCmd v1.35.60623.0
    Copyright (C) 1999-2006 Microsoft Corp. All rights reserved.

    Loading AutoBuild.fxcop...
    Loaded DesignRules.dll...
    Loaded GlobalizationRules.dll...
    Loaded InteroperabilityRules.dll...
    Loaded MobilityRules.dll...
    Loaded NamingRules.dll...
    Loaded PerformanceRules.dll...
    Loaded PortabilityRules.dll...
    Loaded SecurityRules.dll...
    Loaded UsageRules.dll...
    Initializing Introspection engine...
    Analyzing...
    Analysis Complete.
    No messages written.
    Done.

    But when I run the same project file in FxCop GUI (same binaries, same machine) I get 4920 messages (yes, terribly lot, but I'm testing it on old projects:-). I have MS Office installed. Interesting enough, few days ago it worked! I'm not aware of installing any software or updates since that time.

    I have FxCop version 1.35, build 60623.0 running on 2.0.50727.42 runtime.


  • Graham Heslin

    Hi Jeffrey,

    If you're planning some more work on FxCop does that mean the VS2005 FxCop will become stale It seems a waste to maintain two separate versions because developers will have to contend with multiple rule sets. My take is that the GUI should always have been a Visual Studio add-in as opposed to a standalone program. I could care less about project files versus in-source suppression as long as I can generate a report XML file in an automated build process. In fact it would be nice to see one approach so it's straight forward. It's a fantastic tool and I wouldn't want to see it become unmanagable.

    You are correct in that they are IdentifiersShoudlBeSpelledCorrectly rules showing up. I do not have Office installed on the build server so that is likely the root cause as to why those particular rules aren't showing up. That doesn't, however, explain why there is no report file being generated given that you stated that it should always generate a result file.

    The dependency on the Office Proofing Tools should probably be highlighted in the rule description because the only reference I found was buried in the documentation in a not-so-obvious place.

    When I removed the global suppressions in the source I finally get a report file generated:

    Microsoft FxCopCmd v1.35.51212.0
    Copyright (C) 1999-2004 Microsoft Corp. All rights reserved.
    Loading CodeAnalysis.fxcop...
    Loaded DesignRules.dll...
    Loaded GlobalizationRules.dll...
    Loaded InteroperabilityRules.dll...
    Loaded MobilityRules.dll...
    Loaded NamingRules.dll...
    Loaded PerformanceRules.dll...
    Loaded PortabilityRules.dll...
    Loaded SecurityRules.dll...
    Loaded UsageRules.dll...
    Loaded OfficialCommunity.Common.dll...
    Initializing Introspection engine...
    Analyzing...
    Analysis Complete.
    Writing 5 messages...
    Writing report to C:\Projects\Common\trunk\bin\reports\fxcop.xml...
    Done.
    warning : CA1020 : Microsoft.Design : Consider merging the types defined in 'OfficialCommunity.Common' with another namespace.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (241,): warning : CA1062 : Microsoft.Design : Validate parameter 'variable' passed to externally visible method ArgumentValidation.CheckStringFormat(String, String, String, RegexOptions, Boolean):Void.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (279,): warning : CA1062 : Microsoft.Design : Validate parameter 'regularExpression' passed to externally visible method ArgumentValidation.CheckStringFormat(String, String, Regex, Boolean):Void.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (276,): warning : CA1062 : Microsoft.Design : Validate parameter 'variable' passed to externally visible method ArgumentValidation.CheckStringFormat(String, String, Regex, Boolean):Void.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (342,): warning : CA1021 : Microsoft.Design : Consider a design that does not require that 'returnValue' be an out parameter.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (377,): warning : CA1062 : Microsoft.Design : Validate parameter 'variable' passed to externally visible method ArgumentValidation.IsStringEmpty(String, Boolean):Boolean.
    c:\Projects\Common\trunk\Common\ArgumentValidation.cs (377,): warning : CA1062 : Microsoft.Design : Validate parameter 'variable' passed to externally visible method ArgumentValidation.IsStringEmpty(String, Boolean):Boolean.
    Code Analysis Complete -- 0 error(s), 7 warning(s)

    Cheers,
    Colin



  • Randy D. Smith

    On the build server there is no report file generated for 1.35b1 - that's what tipped me off to a problem in the first place. Running without the /axsl makes no difference.

    The path to all references in the file and the report output is in fact valid. On the same machine with the exact same command line pumped through the version of FxCop that ships with VS2005 does produce a report. The VS2005 version also notes an additional item:

    There were non-critical errors loading FxCop project:
    * Could not import all messages.
    * End of project load errors.

    When I run the GUI for 1.35b1 the messages do show up in the Active category. However on the development machine running another Analyze will leave the messages in tact. On the build server where the command line problems exist the messages disappear as soon as I run an analyze. Note that they are running against the same content compiled with the same settings even though the binary has been compiled on two different machines.

    I've tried recreating the project file in the past thinking it might have become corrupt. I still end up in this scenario of the 1.35b1 version on the build machine not working.

    Is the FxCop project file interoperable with the VS2005 FxCop and the 1.35b1 FxCop

    Thanks,
    Colin



  • StarRrr

    Hi Colin,

    FxCop project files are currently interoperable I believe, this is not likely going to stay this way as we're planning major work for the standalone version of fxcop, also the scenario with passing projects to VS2005 FxCop is not supported, as the official paradigm there is to use in-source-suppressions.

    What messages are in your project on your local machine in the UI Are these spelling messages by any chance IF so, do you have Microsoft Office or another program that installs the microsoft spellchecker installed on your server Without this FxCop can't do spelling analysis.

    If this is not the case, please send a list of messages that are firing locally and not on the server.

    Regards,

    Jeffrey


  • Tianlei

    Hi Colin,

    We're moving to a model where the two versions are one, for VS2005 this was not feasible due to time constraints. When more details on this come available you can expect a blog/forum post.

    We're planning on changing the spellcheck behavior in the near future (we're updating to a newer version of the spellchecker). So you should see improvement there as well.

    for the VS2005 version of we indeed always write out a report as the VS project systems depend on the file being present for marking the project as up-to-date. For the standalone we don't do this as a lot of people use the existence of the xml file to determine new violations are present or not. If you like the report to be always written however, in fxcop 1.35 beta 1 you can pass the /forceoutput switch (this is one of the first signs of the converging codebases as our VS integration now also uses the /forceoutput switch instead of hardcoding having this value written out).

    Regards,

    Jeffrey


  • Amit_MSFT

    Hi Jeffrey,

    Are you moving away from having Office Proofing Tools required I just pulled down the ISO from the MSDN Subscription site and was going to install it. If you're going to move away from it I'll hold off then for now.

    That's great to see the move towards a single version. Will be in scope for the post 1.35 release

    When I look at the FxCop folder in the VS2005 program files I see a subset of the FxCop binaries (basically minus the GUI). Are there any specific dependencies that would prevent us from replacing the rules binaries that ship with VS2005 with the FxCop 1.35 distribution

    I'll give the /forceoutput switch a shot tomorrow when I'm in the office.

    Thanks,
    Colin



  • StaceyG65

    Same problem here. I have the same versions of fxcop and dotNet as Daniel. I run this on our buildserver, without VS or Office installed. Just a plain 2003 server.

    When I write the summary to the console, it says there are multiple messages. Using the /forceoutput switch does result in a log in the right location, but there are no messages in the log.

    Does anybody have a solution yet for this problem It is quite annoying, especially since I can find no information whatsoever besides this thread about this problem.


  • Christian Niehaves

    I eventually found that you must set what to report in your fxcop project file:

    Code Snippet

    ...

    <SaveMessages>

    <Project Status="None" NewOnly="False" />

    <Report Status="Active" NewOnly="False" />

    </SaveMessages>

    ...

    Tag <Report> defines what to include in the resulting file.

  • paritosh

    Hi Jeffrey,

    Just an FYI that the /forceoutput switch isn't supported through the MSBuild task that ships with VS2005. There are a few others that don't appear either such as /aspnet. I guess I'll have to shell out using the Exec task to get that support.

    Thanks,
    Colin



  • FxCopCmd 1.35b1 not processing any rules.