gpt4 book ai didi

code-analysis - FxCop Phoenix 分析引擎中的错误

转载 作者:行者123 更新时间:2023-12-04 03:35:15 26 4
gpt4 key购买 nike

所以我试图运行一系列在 RuleSet 中定义的规则。 RuleSet 文件实际上是使用 Sonarqube 生成的 - 我已经选择了其中的所有规则,包括 FxCop、ReSharper 和 StyleCop 规则。我正在像这样启动 FxCop:

C:/FxCop/FxCopCmd.exe /file:C:\TestProject\bin\TestProject.dll /ruleset:=C:\TestProject\testproject.ruleset /out:C:\TestProject\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet

它正确启动,但我收到以下消息:

Initializing Introspection engine...
Analyzing...
Initializing Phoenix engine...
Analyzing...
Analysis Complete.
* 1 total analysis engine exceptions.



XML 输出包含以下内容:
<Exception Keyword="CA0001" Kind="Engine">
<Type>Phx.FatalError</Type>
<ExceptionMessage>Exception of type 'Phx.FatalError' was thrown.</ExceptionMessage>
<StackTrace> at Phx.FatalError.Dispatch()
at Phx.Logging.Diagnostics.DiagnosticMessage.LogMessage(Severity severity, DiagnosticInfo diagnosticInfo, SourceContext sourceContext, String descriptionString)
at Phx.PE.PEUtilities.UserError(String infoMessage)
at Phx.Pdb.ReaderImplementation.Open(Boolean loadTypeOnly)
at Phx.PEModuleUnit.LoadPdb()
at Phx.PE.ReaderPhase.CheckSymbolicInformation()
at Phx.PEModuleUnit.LoadGlobalSymbols()
at Phx.PEModuleUnit.LoadEncodedIRUnitList()
at Phx.PEModuleUnit.GetEnumerableContributionUnit(ContributionUnitEnumerationKind contributionUnitEnumerationKind)
at Phx.PEModuleUnit.GetEnumerableContributionUnit()
at Microsoft.FxCop.Engines.Phoenix.PreScanPass.GetFunctionUnits(PEModuleUnit peModuleUnit)
at Microsoft.FxCop.Engines.Phoenix.PreScanPass.Execute(ModuleUnit moduleUnit)
at Phx.Passes.Pass.DoPass(ModuleUnit moduleUnit)
at Phx.Passes.PassList.DoPassList(ModuleUnit moduleUnit)
at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.Host.ExecutePasses(PEModuleUnit peModuleUnit)
at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.AnalyzeInternal()
at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.Analyze()
at Microsoft.FxCop.Common.EngineManager.Analyze(Project project, Boolean verboseOutput)
</StackTrace>
</Exception>

如果我在没有 /aspnet 的情况下运行相同的命令flag 我仍然会得到同样的错误,但我也得到了 XML 输出文件中的实际消息。

我的最终目标是从 Sonarqube 运行它(使用 TeamCity 中的 Sonarqube runner),但我在那里也遇到了完全相同的问题。从 Teamcity 开始这个过程,我得到以下信息:
18:19:46][Step 4/4] INFO: ------------------------------------------------------------------------
[18:19:46][Step 4/4] INFO: EXECUTION FAILURE
[18:19:46][Step 4/4] INFO: ------------------------------------------------------------------------
[18:19:46][Step 4/4] Total time: 24.122s
[18:19:46][Step 4/4] ERROR: Error during Sonar runner execution
[18:19:46][Step 4/4] org.sonar.runner.impl.RunnerException: Unable to execute Sonar
[18:19:46][Step 4/4] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
[18:19:46][Step 4/4] at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
[18:19:46][Step 4/4] at java.security.AccessController.doPrivileged(Native Method)
[18:19:46][Step 4/4] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
[18:19:46][Step 4/4] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
[18:19:46][Step 4/4] at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
[18:19:46][Step 4/4] at org.sonar.runner.api.Runner.execute(Runner.java:90)
[18:19:46][Step 4/4] at org.sonar.runner.Main.executeTask(Main.java:70)
[18:19:46][Step 4/4] at org.sonar.runner.Main.execute(Main.java:59)
[18:19:46][Step 4/4] at org.sonar.runner.Main.main(Main.java:41)
[18:19:46][Step 4/4] Caused by: java.lang.IllegalStateException: The execution of "C:/FxCop/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details.
[18:19:46][Step 4/4] at com.google.common.base.Preconditions.checkState(Preconditions.java:145)
[18:19:46][Step 4/4] at org.sonar.plugins.fxcop.FxCopExecutor.execute(FxCopExecutor.java:63)
[18:19:46][Step 4/4] at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:102)
[18:19:46][Step 4/4] at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:87)
[18:19:46][Step 4/4] at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:59)
[18:19:46][Step 4/4] at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:51)
[18:19:46][Step 4/4] at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:120)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
[18:19:46][Step 4/4] Final Memory: 20M/428M
[18:19:46][Step 4/4] INFO: ------------------------------------------------------------------------
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
[18:19:46][Step 4/4] at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
[18:19:46][Step 4/4] at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[18:19:46][Step 4/4] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[18:19:46][Step 4/4] at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
[18:19:46][Step 4/4] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
[18:19:46][Step 4/4] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
[18:19:46][Step 4/4] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
[18:19:46][Step 4/4] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[18:19:46][Step 4/4] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[18:19:46][Step 4/4] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[18:19:46][Step 4/4] at java.lang.reflect.Method.invoke(Method.java:497)
[18:19:46][Step 4/4] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
[18:19:46][Step 4/4] ... 9 more
[18:19:46][Step 4/4] Process exited with code 1
[18:19:46][Step 4/4] Step SonarQube (SonarQube Runner) failed

这是使用安装在没有 Visual Studio 的盒子上的 FxCop v12,以防万一...

编辑
问题肯定出在 Phoenix 分析部分 - 在禁用描述的 DFA 规则后 here它成功了。

最佳答案

在网上搜索“Phx.FatalError”错误,发现this blog post ,其中作者基本上说做一个

regsrv32.exe msdia100.dll
(在他的情况下显然是 VS2010),为他解决了这个问题。
这使我得到了必要的提示,这可能是我机器上出现错误的原因。
我使用 Visual Studio Standalone Profiler 设置 [1] 在我的 DEV 盒上乱搞。我安装了分析工具,导致 %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Team Tools\Performance Tools 的内容(来自原始 VS 安装)要替换,当时我不知道。但是,所述设置还会创建(或替换) %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\msdia120.dll文件。该文件是一个 COM 服务器,并在安装过程中注册(Visual Studio 或 Standalone Profiler 包),我也不知道。
自然地,卸载所述独立分析器包,从上述目录中卸载文件,并取消注册 msdia1xx.dll。
因此,就我而言,最简单的修复方法是重新安装 Standalone Profiler 包(在我的情况下为 x64),然后一切正常。
您也可以通过(重新)注册您的 msdia1xx.dll 版本 [可能需要以管理员身份运行] 成功:
对于 Visual Studio 2010:
regsvr32 "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\msdia100.dll"
对于 Visual Studio 2012:
regsvr32 "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\Packages\Debugger\msdia110.dll"
对于 Visual Studio 2013:
regsvr32 "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\msdia120.dll"
对于 Visual Studio 2015:
regsvr32 "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\msdia140.dll"
对于 Visual Studio 2019 企业版:
regsvr32 "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Packages\Debugger\msdia140.dll"
[1] 位于您的 VS 安装媒体下 <drive>:\Standalone Profiler或在您的 VS 安装目录中 %ProgramFiles(x86)%\Microsoft Visual Studio <version>\Team Tools\Performance Tools\Setup .

关于code-analysis - FxCop Phoenix 分析引擎中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30490358/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com