2016-04-25 89 views
0

從一個特定解決方案導入覆蓋率結果時,我看到錯誤。其他人似乎工作正常。我一直在使用5.1版的C#插件,我剛剛嘗試過5.2 RC,但我仍然看到同樣的問題。SonarQube Visual Studio代碼覆蓋率導入錯誤

該錯誤似乎與覆蓋文件似乎指示的行數少的源文件相關。我在這裏看到過類似的問題,看起來已經解決了,但不適合我......;

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

任何幫助或指導,你可以提供將非常感激,因爲這是最後一步我走出SonarQube的有用的信息。


錯誤是;

java.lang.IllegalStateException: Can't create measure for line 12 for file 'E:/b/3/_work/25/s/Maples.eServices.UI/Maples.eServices.UI.Services/TodayNotification/AggregatedEmailModels/ContactWithChanges.cs' with 9 lines

2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - Sensor org.sonar.plugins.csharp.CSharpSensor (done) | time=3703ms
2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor 2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - Parsing the Visual Studio coverage XML report 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.9145352Z 19:42:08.773 INFO - Adding this code coverage report to the cache for later reuse: 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 INFO: EXECUTION FAILURE
2016-04-25T18:42:09.5707468Z INFO:

2016-04-25T18:42:09.5707468Z Total time: 1:30.185s
2016-04-25T18:42:09.6801267Z Final Memory: 10M/235M
2016-04-25T18:42:09.6801267Z INFO:

2016-04-25T18:42:09.6801267Z ##[error]ERROR: Error during Sonar runner execution 2016-04-25T18:42:09.6801267Z ##[error]org.sonar.runner.impl.RunnerException: Unable to execute Sonar 2016-04-25T18:42:09.6801267Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) 2016-04-25T18:42:09.6801267Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
2016-04-25T18:42:09.6801267Z ##[error]at java.security.AccessController.doPrivileged(Native Method)
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 ##[error]at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 2016-04-25T18:42:09.6801267Z ##[error]at 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]Caused by: java.lang.IllegalStateException: Can't create measure for line 12 for file 'E:/b/3/_work/25/s/Maples.eServices.UI/Maples.eServices.UI.Services/TodayNotification/AggregatedEmailModels/ContactWithChanges.cs' with 9 lines 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.java:74) 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 ##[error]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 ##[error]at 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 ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120) 2016-04-25T18:42:09.6801267Z ##[error]at 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 ##[error]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(Native Method)
2016-04-25T18:42:09.6957435Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2016-04-25T18:42:09.6957435Z ##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2016-04-25T18:42:09.6957435Z ##[error]at java.lang.reflect.Method.invoke(Unknown Source)
2016-04-25T18:42:09.6957435Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) 2016-04-25T18:42:09.6957435Z ##[error]... 9 more
2016-04-25T18:42:09.6957435Z ##[error]ERROR:
2016-04-25T18:42:09.6957435Z ##[error]ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
2016-04-25T18:42:09.6957435Z ##[error]The SonarQube Scanner did not complete successfully 2016-04-25T18:42:09.6957435Z 19:42:09.617 Creating a summary markdown file... 2016-04-25T18:42:09.6957435Z ##[error]Post-processing failed. Exit code: 1 2016-04-25T18:42:09.8207681Z ##[error]Unexpected exit code received from batch file: 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; } 
    } 
} 

回答

0

發生在我的團隊與升級到sonarqube 6.2。 我們使用Jenkins構建和運行分析。 我擦掉了工作空間並重新運行了工作,所有事情都再次成功。

隨機猜測:
可能是由於如何覆蓋掃描流利(加法)。 取出source code

/** 
* 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 
相關問題