2
votes

I was searching for answer many hours but I haven't found any solution.

I'm running sonar for C# project, I using Sonar 3.4 and sonar-runner 2.0 and C# plugins:

  • sonar-csharp-core-plugin-1.4
  • sonar-csharp-fxcop-plugin-1.4
  • sonar-csharp-gallio-plugin-1.4
  • sonar-csharp-gendarme-plugin-1.4
  • sonar-csharp-ndeps-plugin-1.4
  • sonar-csharp-squid-plugin-1.4
  • sonar-csharp-stylecop-plugin-1.4

and after running the analysis by sonar-runner I getting that exception

    Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.File@243e2c21[key=ApplicationName.cs,dir=,filename=ApplicationName.cs,language=C#]'
        at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
        at org.sonar.runner.Runner.execute(Runner.java:151)
        at org.sonar.runner.Main.execute(Main.java:84)
        at org.sonar.runner.Main.main(Main.java:56)
    Caused by: org.sonar.api.utils.SonarException: Fail to      decorate'org.sonar.api.resources.File@243e2c21[key=ApplicationName.cs,dir=,filename=ApplicationName.cs,language=C#]'
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:84)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:70)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)
        at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.java:55)
        at org.sonar.batch.phases.Phases.execute(Phases.java:92)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:129)
        at org.sonar.batch.bootstrap.Module.start(Module.java:68)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:147)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:141)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:136)
        at org.sonar.batch.bootstrap.Module.start(Module.java:68)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:83)
        at org.sonar.batch.bootstrap.Module.start(Module.java:68)
        at org.sonar.batch.Batch.execute(Batch.java:106)
        at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:6
        at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.sonar.runner.Runner.delegateExecution(Runner.java:285)
        ... 3 more
    Caused by: org.sonar.api.utils.SonarException: Unknown metric: temp-method-lines
        at org.sonar.batch.index.DefaultIndex.addMeasure(DefaultIndex.java:184)
        at org.sonar.batch.DefaultDecoratorContext.saveMeasure(DefaultDecoratorContext.java:111)
        at org.sonar.plugins.uselesscodetracker.decorator.TempMethodLinesDecorator.computeDistributionFromChildren(TempMethodLinesDecorator.java:58)
        at org.sonar.plugins.uselesscodetracker.decorator.TempMethodLinesDecorator.decorate(TempMethodLinesDecorator.java:49)
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:79)
        ... 24 more
1

1 Answers

1
votes

I don't know what this "temp-method-lines" metric can be, never heard of it...

Please install the latest version of the .NET & C# Plugins Ecosystem: version 2.0. Also, make sure you uninstall any other plugin that could have brought this unknown metric (maybe a custom plugin that you wrote??).

And please upgrade to Sonar 3.4.1 as version 3.4 suffers from a critical bug.