locked
FxCop 10 report with absent exclusions in source information RRS feed

  • Question

  • Hi all,

    with FxCop 1.35 we did something like this within

    a FxCop project file:

    <SaveMessages> <Project Status="Active, Excluded" NewOnly="False" /> <Report Status="Active, Excluded, ExcludedInSource" NewOnly="False" /> </SaveMessages>

    So we had all the exclusions in source reported and then we transformed that stuff to html.

    Now we run FxCop 10 with Visual Studio and also Server Builds and we get resultfiles with the naming convention <DLL-Name>.CodeAnalysisLog.xml but the resultfile has only Status="Active", there is no Status="EcludedInSource". But we need a report that contains all the exclusions in source, so how can we achieve that?

    Thanks to any hints and ideas,

    Peter


    Peter

    Tuesday, October 16, 2012 1:27 PM

All replies

  • Hi Peter,

    Just to make this issue clearly, do you mean that the XML report doesn’t show excluded and absent messages?

    Does it have the same issue if you use the FXCop10 in other machine? How about creating a new project?

    Click the Project->options in the FXCop.

    Whether all options are checked?

    Maybe you could get useful information from the David’s suggestion in this thread “XML report doesnot show excluded and absent messages

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us



    Thursday, October 18, 2012 5:56 AM
    Moderator
  • Thanks for your message, Jack. In the meantime i have found out that there is a commandline switch:

     /savemessagestoreport:<Active|Excluded|Absent (default: Active)>

    This will do the job and include excluded issues in the report, even exclusions in source.

    But if i use the msbuild task that does the code analysis by defining <RunCodeAnalysis>true</RunCodeAnalysis> within the csproj-File, i still don't know what to do to get the exclusions in source into the report. Any idea?

    The link you've posted is about FxCop 1.35. The FxCop 1.35 GUI application didn't allow to set the "ExclusionsInSource" to be reported, this was missing in the combobox but we have set it directly in the appropriate fxcop-Project file like this:

    <SaveMessages>
      
    <Project Status="Active, Excluded" NewOnly="False" />
      
    <Report Status="Active, Excluded, ExcludedInSource" NewOnly="False" />
    </SaveMessages>

    With FxCop v10 there seems to be no difference between "Excluded" and "ExcludedInSource". When we run the code analysis with VS we do not have any FxCop Project, just a ruleset. So there are no "Exclusions in Project", just "Exclusions in Source".

    Kind regards,

    Peter


    Peter

    Thursday, October 18, 2012 11:54 AM
  • Hi Peter,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 19, 2012 5:35 AM
    Moderator
  • hi Jack,

    thanks for your reply and help. If you have any news, please let us know. In the meantime we have found out that we can set a property within a csproj-file:

    <CodeAnalysisSaveMessagesToReport>Active,Excluded</CodeAnalysisSaveMessagesToReport>

    This results in having exclusion information reported in the resultfile, but we get a serious abort of the build process.

    Kind regards,

    Peter


    Peter

    Friday, October 19, 2012 10:34 AM
  • As far as purpose of  " ExcludedInSource" and "Excluded".  ExcludedInSource means you used a suppress message attribute in your code to suppress the message.  Excluded on its own means you just excluded the violation in your FxCop project file.    As far as the abort of the build process you may want to enable logging to determine the cause of the abort.

    Thursday, November 1, 2012 4:31 PM
  • hi Fernando,

    thanks for your message. Yes, we only use exclusions in source (suppress message attributes). I am trying to find out why the build aborts, this may take a while.

    Does it abort too when you run it?

    regards


    Peter

    Monday, November 5, 2012 12:52 PM
  • hi all,

    we now have tried to reproduce the behaviour and this is what we have found out so far:

    1. Be sure to have a rule violation within c# code
    2. Exclude the violation using a suppression attribute
    3. Set the severity of the appropriate rule to "error"
    4. Tell the report that you need exclusions to be reported like this: <CodeAnalysisSaveMessagesToReport>Active,Excluded</CodeAnalysisSaveMessagesToReport>
    5. Run msbuild with CodeAnalysis checked

    The errorlevel msbuild returns is 1 instead of 0

    Any idea, hint or link highly appreciated.

    Kind regards


    Peter

    Monday, November 5, 2012 3:00 PM
  • Can you enable diagnostic logging on MSBUILD.   What does the log error say ?
    Tuesday, November 13, 2012 6:37 PM
  • Can you enable diagnostic logging on MSBUILD.   What does the log error say ?

    I have used verbosity level 'diagnostic' but i didn't find anything special, no error at all. Even the code analysis report contains the desired "ExcludedInSource" issues. But the return value of MSBUILD is 1 instead of 0. 

    Peter

    Thursday, November 15, 2012 1:39 PM
  • If it is possible for you.   You could remove FxCop and use Visual Studio and CodeAnalysis on thier own we would be able to support this.   Consider opening a support case with us.  Visit this link to see the various support options that are available to better meet your needs:

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Wednesday, November 21, 2012 10:15 PM
  • Hi Fernando,

    thanks for your reply and msg. We already use Visual Studio and CodeAnalysis (without FxCop) and also run server side builds with the built-in CodeAnalysis.

    As far as i know a support case is already opened with PSfD of Microsoft. Thank you.

    kind regards.


    Peter

    Monday, November 26, 2012 9:23 AM