【问题标题】:Xamarin and SonarQubeXamarin 和 SonarQube
【发布时间】:2016-05-27 14:59:16
【问题描述】:

我目前正在开发 Xamarin 移动应用程序,并尝试使用 SonarQube 作为 CI 流程的一部分来加强代码质量。

有人有这方面的经验吗?

到目前为止,通过我的实验,我在使用 SonarLint for Visual Studio 和 StyleCop 时遇到了问题,我不知道这是否是因为这些项目是使用 xbuild 而不是 Visual Studio 或 MSBuild 构建的。

我看到的分类或错误是

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

这似乎发生在调用 Visual Studio 的 SonarLint 之后。

编辑:

14:59:19.350 INFO  - SonarLint for Visual Studio version 1.3.0.0
14:59:20.154 ERROR - 
14:59:20.337 ERROR - Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
14:59:20.338 ERROR -    at System.Collections.Immutable.ImmutableDictionary`2.get_Item(TKey key)
14:59:20.340 ERROR -    at SonarLint.Runner.Configuration.AddAnalyzerCommentRegularExpression(Builder builder)
14:59:20.341 ERROR -    at SonarLint.Runner.Configuration.Analyzers()
14:59:20.341 ERROR -    at SonarLint.Runner.Program.Main(String[] args)

【问题讨论】:

  • SonarQube Scanner for MSBuild 不支持 xbuild
  • 感谢@Dinesh-SonarSourceTeam,您能否解释一下错误消息的含义,以便我思考我们可以做些什么来让某些东西正常工作?
  • 除了你看到的,我什么也不能告诉你。如果您可以添加异常的堆栈跟踪,也许我可以为您提供更多详细信息
  • @Dinesh-SonarSourceTeam 添加了堆栈跟踪。
  • 我设法找到了这个stackoverflow.com/questions/36013409/…的答案

标签: xamarin sonarqube stylecop sonarlint


【解决方案1】:

SonarQube Scanner for MSBuild 不支持 xbuild:如果您仍然尝试使用它,预计会遇到一些困难。

您使用的 SonarQube C# 插件版本似乎早于 4.4。可用的最新版本是 4.5,并删除了此代码的 AddAnalyzerCommentRegularExpression 部分,根据您的堆栈跟踪,该部分当前正在失败。

【讨论】:

  • 经过更多调查后,我不确定这是否与 xbuild 相关,因为分析似乎在其他机器上有效,您是否无法说明该异常的含义?它也指的是什么键?
【解决方案2】:

我终于找到了问题的根源。

SonarLint KeyNotFoundException

【讨论】:

    猜你喜欢
    • 2017-04-14
    • 2021-11-24
    • 2016-01-10
    • 2017-10-31
    • 2018-09-21
    • 2018-04-17
    • 2017-02-20
    • 1970-01-01
    • 2019-02-06
    相关资源
    最近更新 更多