locked
Code Analysis doesnt work on in CTP ? RRS feed

  • Question

  • I thoughtI was going to evaluatea the new Code Analysis functions with rule set (and the rulesets ) with a real project.
    Loaded it up, upgraded to vsts2010, changed rule set tom Microsoft Minimal , run code analysis
    CA001 un unexpected error

    This is the build output
    Running Code Analysis...
    C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe  /outputCulture:1033 /out:"bin\Vagverket.Batman.BatMan.dll.CodeAnalysisLog.xml" /file:"bin\Vagverket.Batman.BatMan.dll" /directory:"C:\TFS\BaTMan Dev\WebServiceSupport\bin" /directory:"C:\TFS\BaTMan Dev\DirectoryWrapper\bin" /directory:"C:\TFS\BaTMan Dev\ConfigLayer\bin" /directory:"C:\Windows\Microsoft.NET\Framework\v4.0.11001" /directory:"..\ExternalBinaries" /directory:"C:\TFS\BaTMan Dev\BatControls\bin" /directory:"C:\TFS\BaTMan Dev\MessageHandler\bin" /directory:"C:\TFS\BaTMan Dev\DataLayer\bin" /directory:"C:\TFS\BaTMan Dev\ServicedFramework\bin" /directory:"C:\TFS\BaTMan Dev\ControlLayer\bin" /directory:"C:\TFS\BaTMan Dev\VagNetWrapper\bin" /directory:"C:\TFS\BaTMan Dev\SupportLayer\bin" /directory:"C:\TFS\BaTMan Dev\IntegrationLayer\bin" /directory:"C:\TFS\BaTMan Dev\BusinessLayer\bin" /directory:"bin" /directory:"C:\TFS\BaTMan Dev\BatmanSinks\bin" /ruleSet:"=MinimumRecommendedRules.ruleset" /rulesetdirectory:"C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets" /rule:"-C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules" /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /targetframeworkversion:v4.0 /timeout:120
    MSBUILD : error : CA0001 : An unknown error occurred while running Code Analysis.
    Code Analysis Complete -- 1 error(s), 0 warning(s)

    Anyone runed into this and solved it ?



    Wednesday, February 11, 2009 10:54 PM

Answers

  • This looks like an issue when analysis is trying to perform optimization. Can you try to see the exception would go away if you compile it in release configuration with optimization?

    Brahmnes
    Wednesday, April 1, 2009 10:31 PM

All replies

  •  Can you paste the contents of Vagverket.Batman.BatMan.dll.CodeAnalysisLog.xml?
    Managed Extensibility Framework Team | My Blog: http://davesbox.com
    Thursday, February 12, 2009 1:01 AM
  • Actually the .....dll.CodeAnalysisLog.xml is empty, 0 bytes, but its get touched everytime I run code analysis.

    Thursday, February 12, 2009 11:47 PM
  • Can you copy the complete command line for running fxcopcmd.exe and run it from the command prompt?

    C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe  /outputCulture:1033 /out:"bin\Vagverket.Batman.BatMan.dll.CodeAnalysisLog.xml" /file:"bin\Vagverket.Batman.BatMan.dll" /directory:"C:\TFS\BaTMan Dev\WebServiceSupport\bin" /directory:"C:\TFS\BaTMan Dev\DirectoryWrapper\bin" /directory:"C:\TFS\BaTMan Dev\ConfigLayer\bin" /directory:"C:\Windows\Microsoft.NET\Framework\v4.0.11001" /directory:"..\ExternalBinaries" /directory:"C:\TFS\BaTMan Dev\BatControls\bin" /directory:"C:\TFS\BaTMan Dev\MessageHandler\bin" /directory:"C:\TFS\BaTMan Dev\DataLayer\bin" /directory:"C:\TFS\BaTMan Dev\ServicedFramework\bin" /directory:"C:\TFS\BaTMan Dev\ControlLayer\bin" /directory:"C:\TFS\BaTMan Dev\VagNetWrapper\bin" /directory:"C:\TFS\BaTMan Dev\SupportLayer\bin" /directory:"C:\TFS\BaTMan Dev\IntegrationLayer\bin" /directory:"C:\TFS\BaTMan Dev\BusinessLayer\bin" /directory:"bin" /directory:"C:\TFS\BaTMan Dev\BatmanSinks\bin" /ruleSet:"=MinimumRecommendedRules.ruleset" /rulesetdirectory:"C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets" /rule:"-C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules" /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /targetframeworkversion:v4.0 /timeout:120

    Right after that, you can run
    echo %errorlevel%

    and see what's the error code?


    Brahmnes
    Friday, February 13, 2009 10:51 PM
  • Had to put " " around the command  this is the result.

    Microsoft (R) FxCop Command-Line Tool, Version 1.36 (10.0.11001.1)
    Copyright (C) Microsoft Corporation. All rights reserved.

    Loaded dataflowrules.dll...
    Loaded designrules.dll...
    Loaded globalizationrules.dll...
    Loaded interoperabilityrules.dll...
    Loaded maintainabilityrules.dll...
    Loaded mobilityrules.dll...
    Loaded namingrules.dll...
    Loaded performancerules.dll...
    Loaded portabilityrules.dll...
    Loaded reliabilityrules.dll...
    Loaded securityrules.dll...
    Loaded usagerules.dll...
    Loaded Vagverket.Batman.BatMan.dll...
    Initializing Introspection engine...
    Analyzing...
    Initializing Phoenix engine...
    Analyzing C:\TFS\BaTMan Dev\BatmanWeb\bin\Vagverket.Batman.BatMan.dll...
    System.NullReferenceException: Object reference not set to an instance of an obj
    ect.
       at Microsoft.VisualStudio.CodeAnalysis.Phoenix.Extensibility.SsaIRSimplificat
    ionPhase.FindAllLiteralAssigns(Operand sourceOperand, List`1 literalAssigns, Boo
    lean followPhiSources)
       at Microsoft.VisualStudio.CodeAnalysis.Phoenix.Extensibility.SsaIRSimplificat
    ionPhase.IdentifyOptimizationCandidate(Instruction instruction, List`1 candidate
    s)
       at Microsoft.VisualStudio.CodeAnalysis.Phoenix.Extensibility.SsaIRSimplificat
    ionPhase.Execute(FunctionUnit functionUnit)
       at Microsoft.VisualStudio.CodeAnalysis.Phoenix.Utilities.FunctionUnitPhase.Ex
    ecute(Unit unit)
       at Phx.Phases.Phase.DoPhase(Unit unit)
       at Phx.Phases.PhaseList.Execute(Unit unit)
       at Phx.Phases.Phase.DoPhase(Unit unit)
       at Phx.Phases.PhaseList.Execute(Unit unit)
       at Phx.Phases.Phase.DoPhase(Unit unit)
       at Phx.PEModuleUnit.ProcessGlobalSymbols(UnitListPhaseList unitListPhaseList)

       at Phx.PE.UnitListPhaseList.Execute(Unit unit)
       at Phx.Phases.Phase.DoPhase(Unit unit)
       at Phx.Phases.PhaseList.Execute(Unit unit)
       at Phx.Phases.Phase.DoPhase(Unit unit)
       at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.AnalyzeInternal()
       at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.Analyze()
       at Microsoft.FxCop.Common.EngineManager.Analyze(Project project, Boolean verb
    oseOutput)
       at Microsoft.FxCop.Command.FxCopCommand.Main(String[] args)

    C:\TFS\BaTMan Dev\BatmanWeb>echo %errorlevel%
    16777217


    Saturday, February 14, 2009 10:59 AM
  • This looks like an issue when analysis is trying to perform optimization. Can you try to see the exception would go away if you compile it in release configuration with optimization?

    Brahmnes
    Wednesday, April 1, 2009 10:31 PM
  • Yes ! :), it works in release, thnx
    (Sorry for the time taken to verify this)


    /Mattias
    Sunday, April 5, 2009 11:14 PM