Sonar Cloud Analyze Broken in Azure Dev Ops

The Azure Dev Ops Sonar Cloud Analyze task appears to be broken.

Our configuration is the same as documented in this post SonarCloudAnalyze Azure Dev Ops Error: ENOENT: no such file or directory, open - #5 by ilia

This appears to be related to a change of sonar cloud as builds of our main branch which passed this morning are currently failing and there has been no updates this branch or to our build infrastructure.

This is a critical severity issue and is preventing us from completing any pull requests.

2023-09-07T00:28:01.9745236Z ##[error]ERROR: Error during SonarScanner execution
2023-09-07T00:28:01.9745893Z ERROR: Error during SonarScanner execution
2023-09-07T00:28:01.9746524Z INFO: ------------------------------------------------------------------------
2023-09-07T00:28:01.9747296Z ##[error]java.lang.IllegalStateException: Line 46 is out of range in the file src/Generated/Screens/Ui_Agreement_AgreementExplorer.razor (lines: 45)
2023-09-07T00:28:01.9747900Z java.lang.IllegalStateException: Line 46 is out of range in the file src//Generated/Screens/Ui_Agreement_AgreementExplorer.razor (lines: 45)
2023-09-07T00:28:01.9748444Z ##[error]at org.sonar.api.utils.Preconditions.checkState(Preconditions.java:61)
2023-09-07T00:28:01.9748923Z 	at org.sonar.api.utils.Preconditions.checkState(Preconditions.java:61)
2023-09-07T00:28:01.9749673Z ##[error]at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.validateLine(DefaultCoverage.java:67)
	at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.lineHits(DefaultCoverage.java:55)
2023-09-07T00:28:01.9750237Z 	at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.validateLine(DefaultCoverage.java:67)
2023-09-07T00:28:01.9750528Z 	at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.lineHits(DefaultCoverage.java:55)
2023-09-07T00:28:01.9753058Z ##[error]at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyzeCoverage(CoverageReportImportSensor.java:140)
	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:117)
2023-09-07T00:28:01.9753917Z 	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyzeCoverage(CoverageReportImportSensor.java:140)
2023-09-07T00:28:01.9754275Z 	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:117)
2023-09-07T00:28:01.9755222Z ##[error]at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.execute(CoverageReportImportSensor.java:86)
2023-09-07T00:28:01.9755839Z 	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.execute(CoverageReportImportSensor.java:86)
2023-09-07T00:28:01.9756512Z ##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
	at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:40)
2023-09-07T00:28:01.9757318Z 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
2023-09-07T00:28:01.9757624Z 	at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:40)
2023-09-07T00:28:01.9758169Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:423)
2023-09-07T00:28:01.9758794Z 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:423)
2023-09-07T00:28:01.9759494Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2023-09-07T00:28:01.9760042Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2023-09-07T00:28:01.9760212Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2023-09-07T00:28:01.9760596Z ##[error]at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
2023-09-07T00:28:01.9760900Z 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
2023-09-07T00:28:01.9761305Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2023-09-07T00:28:01.9761655Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2023-09-07T00:28:01.9761823Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2023-09-07T00:28:01.9762095Z ##[error]at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
2023-09-07T00:28:01.9762349Z 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
2023-09-07T00:28:01.9762726Z ##[error]at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2023-09-07T00:28:01.9763043Z 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
2023-09-07T00:28:01.9763208Z 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2023-09-07T00:28:01.9763530Z ##[error]at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
2023-09-07T00:28:01.9763821Z 	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
2023-09-07T00:28:01.9764097Z ##[error]at java.base/java.lang.reflect.Method.invoke(Method.java:578)
2023-09-07T00:28:01.9764352Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
2023-09-07T00:28:01.9764716Z ##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2023-09-07T00:28:01.9765032Z 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2023-09-07T00:28:01.9765183Z 	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2023-09-07T00:28:01.9765457Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2023-09-07T00:28:01.9765728Z 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2023-09-07T00:28:01.9766017Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2023-09-07T00:28:01.9766283Z 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2023-09-07T00:28:01.9766706Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2023-09-07T00:28:01.9766994Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2023-09-07T00:28:01.9767123Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2023-09-07T00:28:01.9767369Z ##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2023-09-07T00:28:01.9767621Z 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2023-09-07T00:28:01.9767798Z ##[error]ERROR:
2023-09-07T00:28:01.9767984Z ERROR: 
2023-09-07T00:28:02.3126295Z ##[error]The SonarScanner did not complete successfully
1 Like

Hey @groogiam

Thanks for the report. I’ve flagged this to the relevant team.

My team is experiencing this issue as well.

##[error]ERROR: Error during SonarScanner execution
ERROR: Error during SonarScanner execution
##[error]java.lang.IllegalStateException: Line 19 is out of range in the file XXXXXX.razor (lines: 18)
java.lang.IllegalStateException: Line 19 is out of range in the file XXXXXX.razor (lines: 18)
##[error]at org.sonar.api.utils.Preconditions.checkState(Preconditions.java:61)

Hey all.

I don’t have the right environment to reproduce this right now, but I think I know a workaround. Can you try one of the following:

  • Setting sonar.exclusions=**/*.razor
    - Setting SONAR_DOTNET_ENABLE_RAZOR_ANALYSIS environment variable to false

It’s after working hours in Geneva (and it’s a public holiday, go figure), so this is probably as close as we’ll get to progress tonight.

1 Like

I tested out both solutions - this one did bypass the issue for me:

  • Setting sonar.exclusions=**/*.razor

Using the environment variable did not work for me.

Thanks for the suggestion! If we really need to get something through, we can use this short term. We have quite a few razor components so trying to limit the number of un-analyzed components we let through.

Thanks. In fact – we’re very close to bringing real support for .razor files and some preliminary work seems to be causing this issue. You shouldn’t lose anything you didn’t have before by excluding these files for now.

Hey again!

We managed to mitigate the issue by adding an exclusion for .razor files (which weren’t being analyzed before this update) to all projects. You can remove the exclusion from your own project, and we will fix the issue you reported before turning analysis of those files back on.

Sorry for the inconvenience.

Thanks for the update!

Ditto!

Hi @groogiam and @Jesse! May I ask which coverage tool are you using?

@cristian.ambrosini We are using coverlet.collector

Ditto - we use coverlet

Hi everyone,

we are pleased to announce that the latest release of our analyzer (version 9.10) has resolved this issue. You can now benefit from the Razor and Blazor analysis, please don’t hesitate to share any thoughts or suggestions that can further improve this feature!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.