FxCop Phoenix分析引擎中的错误 [英] Error in FxCop Phoenix analysis engine

查看:271
本文介绍了FxCop Phoenix分析引擎中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试运行在RuleSet中定义的一堆规则。 RuleSet文件实际上是使用Sonarqube生成的-我在那里绝对选择了所有规则,包括FxCop,ReSharper和StyleCop规则。我像这样开始FxCop:

So I'm trying to run a bunch of rules which are defined in a RuleSet. The RuleSet file is actually generated using Sonarqube - I've selected absolutely all rules in there, including the FxCop, ReSharper and StyleCop rules. I'm kicking off FxCop like this:

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

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

It starts correctly, but I get the following message:


正在初始化自省引擎...
分析...

正在初始化Phoenix引擎...
分析...
分析
完成。

* 1个分析引擎例外。

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

XML输出包含以下内容:

The XML output contains the following:

<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 标志我仍然会遇到相同的错误,但是我也会在XML输出文件中得到实际的消息。

If I run the same command without the /aspnet flag I will still get the same error, but I do get the actual messages in the XML output file as well.

我的最终目标是从Sonarqube(使用TeamCity中的Sonarqube赛跑者),但我在那里也遇到了完全相同的问题。从Teamcity开始此过程,我得到以下信息:

My end goal here is to run this from Sonarqube (using the Sonarqube runner in TeamCity), but I'm getting the exact same issues there as well. Starting the process from Teamcity I'm getting the following:

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

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

This is using FxCop v12 installed on a box where there is no Visual Studio, in case that's of any importance...

编辑

问题肯定与Phoenix分析部分有关-在禁用在此成功。

推荐答案

在Internet上搜索 Phx.FatalError错误,发现此博客文章,其中的作者基本上说是在做

Searching the Internet for the "Phx.FatalError" error, I found this blog post, in which the author basically says that doing a

regsrv32.exe msdia100.dll

(显然是针对VS2010),为他解决了这个问题。

(so apparently for VS2010 in his case), fixed the problem for him.

这使我得到必要的提示,这可能是机器上错误的原因。

That lead me to the necessary hint what could have been the reason for the error on my machine.

我用Visual Studio Standalone Profiler设置[1]在DEV框上弄乱了。我安装了性能分析工具,该内容导致%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\团队工具\性能工具(来自原始VS安装)的内容)被替换,当时我还不知道。但是,该安装程序还会创建(或替换)%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\msdia120.dll 文件。该文件是COM服务器,并且在安装过程中(使用Visual Studio或Standalone Profiler程序包)进行了注册,而我也不知道。

I messed around on my DEV box with the Visual Studio Standalone Profiler setup [1]. I installed the profiling tools, that causes the contents of %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Team Tools\Performance Tools (from the original VS installation) to be replaced, which I was not aware of at the time. However, said setup also creates (or replaces) the %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\msdia120.dll file. That file is a COM server and is registered during setup (of Visual Studio or the Standalone Profiler package), which I also was not aware of.

自然地,卸载该文件所说的Standalone Profiler软件包,从上述目录中卸载文件,然后取消注册msdia1xx.dll

Naturally, an uninstall of said Standalone Profiler package, uninstalls the files from the above directories and also unregisters msdia1xx.dll.

所以,在我看来,最简单的解决方法是重新安装到Standalone Profiler程序包(在我的情况下为x64)中,一切又恢复了。

So, in my case the easiest fix was to reinstall in the Standalone Profiler package (x64 in my case) and everything worked again.

您也可以通过(重新)注册您的msdia1xx.dll版本而成功。 [可能需要以管理员身份运行]:

You might also be successful with just (re)registering your version of msdia1xx.dll [may need to be run as administrator]:

对于 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"

[1]位于VS安装介质上的< drive>:\Standalone Profiler 下或VS安装目录%ProgramFiles(x86)%中\Microsoft Visual Studio< version> \团队工具\性能工具\设置

[1] Located on your VS installation media under <drive>:\Standalone Profiler or in your VS installation directory %ProgramFiles(x86)%\Microsoft Visual Studio <version>\Team Tools\Performance Tools\Setup.

这篇关于FxCop Phoenix分析引擎中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆