簡體   English   中英

SonarQube Visual Studio代碼覆蓋率導入錯誤

[英]Error with SonarQube Visual Studio Code Coverage Import

從一種特定的解決方案導入Coverage結果時,我看到錯誤。 其他人似乎工作正常。 我一直在使用5.1版的C#插件,而我剛剛嘗試過5.2 RC,但是仍然看到相同的問題。

該錯誤似乎與源文件的行數少於覆蓋文件所指示的行數有關。 我看過這里提到的類似問題,看起來已經解決了,但對我來說不是。

https://groups.google.com/forum/#!topic/sonarqube/Xju6ichZe_k

您能提供的任何幫助或指導將不勝感激,因為這是我從SonarQube獲得有用信息的最后一步。


錯誤是;

java.lang.IllegalStateException:無法為文件'E:/b/3/_work/25/s/Maples.eServices.UI/Maples.eServices.UI.Services/TodayNotification/AggregatedEmailModels/ContactWithChanges的第12行創建度量。帶有9行的cs

2016-04-25T18:42:08.8051671Z 19:42:08.617信息-傳感器org.sonar.plugins.csharp.CSharpSensor(完成)| 時間= 3703ms
2016-04-25T18:42:08.8051671Z 19:42:08.617信息-傳感器org.sonar.plugins.csharp.CSharpCodeCoverageProvider $ CSharpCoverageReportImportSensor 2016-04-25T18:42:08.8051671Z 19:42:08.617信息-解析Visual Studio覆蓋范圍XML報告E:\\ b \\ 3_work \\ 25 \\ TestResults \\ svctfsbuild_KYTFS15BLD02 2016-04-25 19_38_27 \\ In \\ KYTFS15BLD02 \\ svctfsbuild_KYTFS15BLD02 2016-04-25 19_37_19.coveragexml 2016-04-25T18:42:08.9145352773 19:42:08:18信息-將此代碼覆蓋率報告添加到緩存中以供以后重用:E:\\ b \\ 3_work \\ 25 \\ TestResults \\ svctfsbuild_KYTFS15BLD02 2016-04-25 19_38_27 \\ In \\ KYTFS15BLD02 \\ svctfsbuild_KYTFS15BLD02 2016-04-25 19_37_19.coveragexml 2016-04- 25T18:42:09.5707468Z INFO:

2016-04-25T18:42:09.5707468Z信息:執行失敗
2016-04-25T18:42:09.5707468Z信息:

2016-04-25T18:42:09.5707468Z總時間:1:30.185s
2016-04-25T18:42:09.6801267Z最終內存:10M / 235M
2016-04-25T18:42:09.6801267Z INFO:

2016-04-25T18:42:09.6801267Z ## [錯誤]錯誤:聲納跑步者執行期間出錯2016-04-25T18:42:09.6801267Z ## [錯誤] org.sonar.runner.impl.RunnerException:無法執行聲納2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.impl.BatchLauncher $ 1.delegateExecution(BatchLauncher.java:91)2016-04-25T18:42:09.6801267Z ## [錯誤] org.sonar.runner.impl.BatchLauncher $ 1.run(BatchLauncher.java:75)
2016-04-25T18:42:09.6801267Z ## [error] at java.security.AccessController.doPrivileged(本機方法)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
2016-04-25T18:42:09.6801267Z ## [錯誤]在org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)2016-04-25T18:42:09.6801267Z ## [錯誤]在org.sonar.runner.api.Runner.execute(Runner.java:100)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.Main.executeTask(Main.java:70)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.Main.execute(Main.java:59)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.runner.Main.main(Main.java:53)
2016-04-25T18:42:09.6801267Z ## [error]原因:java.lang.IllegalStateException:無法為文件'E:/ b / 3 / _work / 25 / s / Maples的第12行創建度量。帶有9行的eServices.UI / Maples.eServices.UI.Services / TodayNotification / AggregatedEmailModels / ContactWithChanges.cs'2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.sensor.coverage.CoverageExclusions .validateMaxLine(CoverageExclusions.java:158)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.sensor.coverage.CoverageExclusions.validate(CoverageExclusions.java:129)2016-04-25T18 :42:09.6801267Z ## [error] at org.sonar.batch.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:204)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.plugins .dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:103)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyse(CoverageReportImportSensor。 )2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java: 50)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:102)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java: 120)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:264)2016-04-25T18:42:09.6801267Z ## [錯誤] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:259)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer。 java:257)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:249)2016-04-25T18:42:09.6801267Z ## org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer。 java:135)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127)2016-04-25T18:42:09.6801267Z ## org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)出現[錯誤] 2016-04-25T18:42:09.6801267Z ## org.sonar.batch.task.ScanTask.execute(錯誤) ScanTask.java:55)
2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java: 120)2016-04-25T18:42:09.6801267Z ## [error] at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)2016-04-25T18:42:09.6957435Z ## [錯誤] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
2016-04-25T18:42:09.6957435Z ## [error] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
2016-04-25T18:42:09.6957435Z ## [error] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)2016-04-25T18:42:09.6957435Z ## [error] at sun.reflect.NativeMethodAccessorImpl.invoke0(本機方法)
2016-04-25T18:42:09.6957435Z ## [error] at sun.reflect.NativeMethodAccessorImpl.invoke(未知來源)
2016-04-25T18:42:09.6957435Z ## [error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知來源)
2016-04-25T18:42:09.6957435Z ## [error] at java.lang.reflect.Method.invoke(未知源)
2016-04-25T18:42:09.6957435Z ## [錯誤]在org.sonar.runner.impl.BatchLauncher $ 1.delegateExecution(BatchLauncher.java:87)2016-04-25T18:42:09.6957435Z ## [錯誤] ...另外9個
2016-04-25T18:42:09.6957435Z ## [錯誤]錯誤:
2016-04-25T18:42:09.6957435Z ## [錯誤]錯誤:使用-X開關重新運行SonarQube Runner以啟用完整的調試日志記錄。
2016-04-25T18:42:09.6957435Z ## [錯誤] SonarQube掃描程序未成功完成2016-04-25T18:42:09.6957435Z 19:42:09.617創建摘要降價文件... 2016-04-25T18 :42:09.6957435Z ## [錯誤]后處理失敗。 退出代碼:1 2016-04-25T18:42:09.8207681Z ## [錯誤]從批處理文件收到意外的退出代碼:1

coveragexml文件的相關部分是:

     <function id="215992" token="0x6000cce" name="get_ContactId()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
      <ranges>
        <range source_id="213" covered="no" start_line="5" start_column="26" end_line="5" end_column="27" />
        <range source_id="213" covered="no" start_line="5" start_column="28" end_line="5" end_column="32" />
      </ranges>
    </function>
    <function id="216018" token="0x6000ccf" name="set_ContactId(int)" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
      <ranges>
        <range source_id="213" covered="no" start_line="5" start_column="31" end_line="5" end_column="32" />
        <range source_id="213" covered="no" start_line="5" start_column="33" end_line="5" end_column="37" />
      </ranges>
    </function>
    <function id="216032" token="0x6000cd0" name="get_DisplayName()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
      <ranges>
        <range source_id="213" covered="no" start_line="5" start_column="33" end_line="5" end_column="37" />
      </ranges>
    </function>
    <function id="216058" token="0x6000cd1" name="set_DisplayName(string)" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="14">
      <ranges>
        <range source_id="213" covered="no" start_line="6" start_column="36" end_line="6" end_column="37" />
        <range source_id="213" covered="no" start_line="6" start_column="38" end_line="6" end_column="42" />
        <range source_id="213" covered="no" start_line="14" start_column="7" end_line="20" end_column="10" />
      </ranges>
    </function>
    <function id="216072" token="0x6000cd2" name="ContactWithChanges()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="4" lines_covered="0" lines_partially_covered="0" lines_not_covered="15">
      <ranges>
        <range source_id="213" covered="no" start_line="6" start_column="38" end_line="6" end_column="42" />
        <range source_id="213" covered="no" start_line="12" start_column="5" end_line="12" end_column="41" />
        <range source_id="213" covered="no" start_line="14" start_column="7" end_line="20" end_column="10" />
      </ranges>
    </function>
    <source_file id="213" path="E:\b\3\_work\25\s\Maples.eServices.UI\Maples.eServices.UI.Services\TodayNotification\AggregatedEmailModels\ContactWithChanges.cs">
    </source_file>

源代碼是;

namespace Maples.eServices.UI.Services.TodayNotification.AggregatedEmailModels
{
  public class ContactWithChanges
  {
    public int ContactId { get; set; }
    public string DisplayName { get; set; }
  }
}

升級到聲納古比6.2發生在我的團隊中。 我們正在使用詹金斯來構建和運行分析。 我擦除了工作區,然后重新運行作業,一切都再次成功運行。

隨機猜測:
可能是由於現在覆蓋掃描的效率如何(添加)。 源代碼中取出

/**
 * This class is used to report code coverage on files.
 * 
 * Example:
 * 
 * <pre>
 *   sensorContext.newCoverage().onFile(file)
       .lineHits(1, 2)
       .lineHits(2, 5)
       .lineHits(3, 0)
       . ...
       .conditions(3, 4, 2)
       .conditions(12, 2, 2)
       . ...
       .save();
 *     
 * </pre>
 * 
 * Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy:
 * <ul>
 *   <li>Line hits are cumulated</li>
 *   <li>We keep the max for condition coverage. Examples: 2/4 + 2/4 = 2/4, 2/4 + 3/4 = 3/4</li>
 * </ul>
 * 
 * @since 5.2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM