Sonar Execution Error with c# 2.0 - Failed to decorate org.sonar.api.resources.project

StackOverflow https://stackoverflow.com/questions/21628166

  •  08-10-2022
  •  | 
  •  

Question

I´m new to Sonar and I´m still trying to understand it. So first I executed sonar-runner on the sample project for csharp and it worked fine, then I tried to run it on an old project on a .net c# 2.0 framework and i get the following error:

13:54:45.552 DEBUG - Reload the data measure: dsm, id=93775
13:54:45.553 DEBUG - Flush 1 data measures from memory:
13:54:45.563 DEBUG - Decorator time:
        ManualMeasureDecorator: 110ms
        org.sonar.plugins.csharp.ndeps.decorators.CSharpDsmDecorator@33d873e7: 1
41ms
        org.sonar.plugins.csharp.ndeps.decorators.CouplingDecorator@47a15d48: 7m
s
        SumDuplicationsDecorator: 8ms
        org.sonar.plugins.core.issue.IssueTrackingDecorator@32f346b5: 1035ms
        UnitTestDecorator: 2ms
        org.sonar.plugins.core.security.ApplyProjectRolesDecorator@1a72f35: 2ms
        org.sonar.plugins.core.sensors.DirectoriesDecorator@178e750: 1ms
        org.sonar.plugins.core.sensors.FilesDecorator@289a35f1: 1ms
        org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister@7ed
f52a6: 1ms
        org.sonar.plugins.core.timemachine.NewCoverageAggregator@244b760a: 1ms
        org.sonar.plugins.design.batch.ProjectDsmDecorator@77ab515c: 1ms
        FileTangleIndexDecorator: 1ms
        f(lines): 0ms
        f(generated_lines): 0ms
        f(ncloc): 0ms
        f(generated_ncloc): 0ms
        f(classes): 1ms
        f(packages): 0ms
        f(functions): 1ms
        f(accessors): 0ms
        f(statements): 0ms
        f(public_api): 0ms
        f(comment_lines): 0ms
        f(comment_blank_lines): 0ms
        f(public_undocumented_api): 0ms
        f(commented_out_code_lines): 0ms
        f(complexity): 0ms
        f(complexity_in_classes): 0ms
        f(complexity_in_functions): 1ms
        f(class_complexity_distribution): 0ms
        f(function_complexity_distribution): 5ms
        f(file_complexity_distribution): 5ms
        f(lines_to_cover): 0ms
        f(uncovered_lines): 1ms
        f(conditions_to_cover): 1ms
        f(uncovered_conditions): 0ms
        f(it_lines_to_cover): 0ms
        f(it_uncovered_lines): 0ms
        f(it_conditions_to_cover): 0ms
        f(it_uncovered_conditions): 0ms
        f(overall_lines_to_cover): 0ms
        f(overall_uncovered_lines): 0ms
        f(overall_conditions_to_cover): 1ms
        f(overall_uncovered_conditions): 0ms
        f(rfc): 1ms
        f(rfc_distribution): 6ms
        f(lcom4_distribution): 3ms
        f(package_cycles): 0ms
        f(package_tangles): 0ms
        f(package_feedback_edges): 0ms
        f(package_edges_weight): 0ms
        f(count_asserts): 6ms
        f(eloc): 2ms
        f(new_lines_to_cover): 0ms
        f(new_uncovered_lines): 0ms
        f(new_conditions_to_cover): 0ms
        f(new_uncovered_conditions): 1ms
        f(new_it_lines_to_cover): 0ms
        f(new_it_uncovered_lines): 1ms
        f(new_it_conditions_to_cover): 1ms
        f(new_it_uncovered_conditions): 1ms
        f(new_overall_lines_to_cover): 0ms
        f(new_overall_uncovered_lines): 0ms
        f(new_overall_conditions_to_cover): 1ms
        f(new_overall_uncovered_conditions): 1ms
        org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator@2de646ab: 5
ms
        CountUnresolvedIssuesDecorator: 128ms
        CountFalsePositivesDecorator: 43ms
        org.sonar.plugins.core.technicaldebt.TechnicalDebtDecorator@1d0be010: 58
3ms
        org.sonar.plugins.core.technicaldebt.NewTechnicalDebtDecorator@76a34955:
 57ms
        CommentDensityDecorator: 3ms
        PackageTangleIndexDecorator: 0ms
        f(file_complexity): 0ms
        f(class_complexity): 3ms
        f(function_complexity): 3ms
        f(assert_per_test): 1ms
        org.sonar.plugins.core.sensors.CoverageDecorator@272d400: 0ms
        org.sonar.plugins.core.sensors.LineCoverageDecorator@40bc4d41: 3ms
        org.sonar.plugins.core.sensors.BranchCoverageDecorator@a74079b: 2ms
        org.sonar.plugins.core.sensors.ItLineCoverageDecorator@5afe43cf: 0ms
        org.sonar.plugins.core.sensors.ItCoverageDecorator@6b15f9b4: 0ms
        org.sonar.plugins.core.sensors.ItBranchCoverageDecorator@6fbccf58: 2ms
        org.sonar.plugins.core.sensors.OverallLineCoverageDecorator@54d0d3b7: 2m
s
        org.sonar.plugins.core.sensors.OverallCoverageDecorator@59fbbee1: 1ms
        org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator@1eb0d3ee:
0ms
        org.sonar.plugins.core.issue.WeightedIssuesDecorator@204e82e2: 10ms
        IssuesDensityDecorator: 5ms
        org.sonar.plugins.core.timemachine.TendencyDecorator@359b1d11: 7ms
        VariationDecorator: 0ms

13:54:45.566 DEBUG - 14926 measures to dump
13:54:47.024 INFO  - -------------  Scan MyProject
13:54:47.024 INFO  - Load module settings
13:54:47.026 DEBUG - Download: http://<localhost>:9000/batch_bootstrap/properties?
project=MyProject&amp;dryRun=false (no proxy)
13:54:47.060 DEBUG - Available languages:
13:54:47.061 DEBUG -   * Java => "java"
13:54:47.061 DEBUG -   * C# => "cs"
13:54:47.199 INFO  - Quality profile : [name=Sonar way,language=cs]
13:54:47.199 INFO  - Excluded tests:
13:54:47.199 INFO  -   **/package-info.java
13:54:47.205 INFO  - Index files
13:54:47.205 INFO  - 0 files indexed
13:54:47.222 DEBUG - ooo Using Connection [jdbc:h2:tcp://<localhost>/sonar, UserNa
me=SONAR, H2 JDBC Driver]
13:54:47.222 DEBUG - ==>  Preparing: select * from projects where id=?
13:54:47.222 DEBUG - ==> Parameters: 1(Long)
13:54:47.224 DEBUG - ooo Using Connection [jdbc:h2:tcp://<localhost>/sonar, UserNa
me=SONAR, H2 JDBC Driver]
13:54:47.224 DEBUG - ==>  Preparing: update projects set name=?, long_name=?, de
scription=?, scope=?, qualifier=?, kee=?, language=?, root_id=?, copy_resource_i
d=?, person_id=?, enabled=? where id=?
13:54:47.224 DEBUG - ==> Parameters: MyProject(String), MyProject(String), (String), P
RJ(String), TRK(String), MyProject(String), cs(String), null, null, null, true(Bool
ean), 1(Long)
13:54:47.225 INFO  - Configure Maven plugins
13:54:47.246 DEBUG - Initializers : CSharpProjectInitializer
13:54:47.247 INFO  - Initializer CSharpProjectInitializer...
13:54:47.247 INFO  - Initializer CSharpProjectInitializer done: 0 ms
13:54:47.247 INFO  - Index files
13:54:47.247 INFO  - 0 files indexed
13:54:47.247 INFO  - Base dir: C:\<MyDir>\MyProject
13:54:47.248 INFO  - Working dir: C:\<MyDir>\MyProject\.sonar
13:54:47.248 INFO  - Source encoding: UTF-8, default locale: pt_BR
13:54:47.248 INFO  - Gallio won't execute as there are no test projects.
13:54:47.249 DEBUG - Sensors : CpdSensor -> InitialOpenIssuesSensor -> ProfileSe
nsor -> ProfileEventsSensor -> ProjectLinksSensor -> VersionEventsSensor -> File
HashSensor
13:54:47.249 INFO  - Sensor CpdSensor...
13:54:47.249 INFO  - SonarBridgeEngine is used
13:54:47.249 INFO  - Sensor CpdSensor done: 0 ms
13:54:47.249 INFO  - Sensor InitialOpenIssuesSensor...
13:54:47.252 INFO  - Sensor InitialOpenIssuesSensor done: 3 ms
13:54:47.252 INFO  - Sensor ProfileSensor...
13:54:47.384 INFO  - Sensor ProfileSensor done: 132 ms
13:54:47.384 INFO  - Sensor ProfileEventsSensor...
13:54:47.385 INFO  - Sensor ProfileEventsSensor done: 1 ms
13:54:47.385 INFO  - Sensor ProjectLinksSensor...
13:54:47.387 INFO  - Sensor ProjectLinksSensor done: 2 ms
13:54:47.387 INFO  - Sensor VersionEventsSensor...
13:54:47.389 INFO  - Sensor VersionEventsSensor done: 2 ms
13:54:47.389 INFO  - Sensor FileHashSensor...
13:54:47.389 INFO  - Sensor FileHashSensor done: 0 ms
13:54:47.460 INFO  - Execute decorators...
13:54:47.460 DEBUG - Decorators: ManualMeasureDecorator -> SumDuplicationsDecora
tor -> org.sonar.plugins.core.issue.IssueTrackingDecorator@23e69628 -> UnitTestD
ecorator -> org.sonar.plugins.core.security.ApplyProjectRolesDecorator@778c2e81
-> org.sonar.plugins.core.sensors.DirectoriesDecorator@6749f0b3 -> org.sonar.plu
gins.core.sensors.FilesDecorator@2759acbf -> org.sonar.plugins.core.timemachine.
TimeMachineConfigurationPersister@13749d3 -> org.sonar.plugins.core.timemachine.
NewCoverageAggregator@705c43c7 -> org.sonar.plugins.design.batch.ProjectDsmDecor
ator@54cfbc44 -> FileTangleIndexDecorator -> f(lines) -> f(generated_lines) -> f
(ncloc) -> f(generated_ncloc) -> f(classes) -> f(packages) -> f(functions) -> f(
accessors) -> f(statements) -> f(public_api) -> f(comment_lines) -> f(comment_bl
ank_lines) -> f(public_undocumented_api) -> f(commented_out_code_lines) -> f(com
plexity) -> f(complexity_in_classes) -> f(complexity_in_functions) -> f(class_co
mplexity_distribution) -> f(function_complexity_distribution) -> f(file_complexi
ty_distribution) -> f(lines_to_cover) -> f(uncovered_lines) -> f(conditions_to_c
over) -> f(uncovered_conditions) -> f(it_lines_to_cover) -> f(it_uncovered_lines
) -> f(it_conditions_to_cover) -> f(it_uncovered_conditions) -> f(overall_lines_
to_cover) -> f(overall_uncovered_lines) -> f(overall_conditions_to_cover) -> f(o
verall_uncovered_conditions) -> f(rfc) -> f(rfc_distribution) -> f(lcom4_distrib
ution) -> f(package_cycles) -> f(package_tangles) -> f(package_feedback_edges) -
> f(package_edges_weight) -> f(count_asserts) -> f(eloc) -> f(new_lines_to_cover
) -> f(new_uncovered_lines) -> f(new_conditions_to_cover) -> f(new_uncovered_con
ditions) -> f(new_it_lines_to_cover) -> f(new_it_uncovered_lines) -> f(new_it_co
nditions_to_cover) -> f(new_it_uncovered_conditions) -> f(new_overall_lines_to_c
over) -> f(new_overall_uncovered_lines) -> f(new_overall_conditions_to_cover) ->
 f(new_overall_uncovered_conditions) -> org.sonar.plugins.cpd.decorators.Duplica
tionDensityDecorator@4e7fc133 -> CountUnresolvedIssuesDecorator -> CountFalsePos
itivesDecorator -> org.sonar.plugins.core.technicaldebt.TechnicalDebtDecorator@2
9140206 -> org.sonar.plugins.core.technicaldebt.NewTechnicalDebtDecorator@6090ec
fb -> CommentDensityDecorator -> PackageTangleIndexDecorator -> f(file_complexit
y) -> f(class_complexity) -> f(function_complexity) -> f(assert_per_test) -> org
.sonar.plugins.core.sensors.CoverageDecorator@6390378a -> org.sonar.plugins.core
.sensors.LineCoverageDecorator@112e7817 -> org.sonar.plugins.core.sensors.Branch
CoverageDecorator@1ce36d1 -> org.sonar.plugins.core.sensors.ItLineCoverageDecora
tor@14a5b2ae -> org.sonar.plugins.core.sensors.ItCoverageDecorator@a75c819 -> or
g.sonar.plugins.core.sensors.ItBranchCoverageDecorator@3aa3e6ac -> org.sonar.plu
gins.core.sensors.OverallLineCoverageDecorator@5e7d4447 -> org.sonar.plugins.cor
e.sensors.OverallCoverageDecorator@720dc1c7 -> org.sonar.plugins.core.sensors.Ov
erallBranchCoverageDecorator@652d2a50 -> org.sonar.plugins.core.issue.WeightedIs
suesDecorator@56149dfc -> IssuesDensityDecorator -> org.sonar.plugins.core.timem
achine.TendencyDecorator@4d109cab -> VariationDecorator
13:54:47.467 DEBUG - Release semaphore on project : org.sonar.api.resources.Proj
ect@2bf81efb[id=1,key=MyProject,qualifier=TRK], with key batch-MyProject
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 31.976s
Final Memory: 14M/386M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:91)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102
)
        at org.sonar.runner.api.Runner.execute(Runner.java:90)
        at org.sonar.runner.Main.executeTask(Main.java:70)
        at org.sonar.runner.Main.execute(Main.java:59)
        at org.sonar.runner.Main.main(Main.java:41)
Caused by: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.r
esources.Project@2bf81efb[id=1,key=MyProject,qualifier=TRK]'
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(Decorators
Executor.java:93)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(Decorators
Executor.java:76)
        at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.
java:61)
        at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:118)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanConta
iner.java:150)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.j
ava:211)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScan
Container.java:206)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanCon
tainer.java:199)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.ja
va:82)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
        at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapCon
tainer.java:144)
        at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapCo
ntainer.java:132)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
        at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java
:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:87)
        ... 9 more
Caused by: java.lang.IllegalStateException: Can't sort a cyclic graph.
        at org.sonar.graph.DsmTopologicalSorter.sort(DsmTopologicalSorter.java:4
4)
        at org.sonar.plugins.design.batch.ProjectDsmDecorator.getDsm(ProjectDsmD
ecorator.java:80)
        at org.sonar.plugins.design.batch.ProjectDsmDecorator.decorate(ProjectDs
mDecorator.java:60)
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(Decorators
Executor.java:85)
        ... 37 more
Was it helpful?

Solution

It won't help you that much but, for your information, this DSM feature will be removed in the next version of the C# plugin (expected to be released by the end of February). So you shouldn't face this issue anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top