Error with net 8 on Azure DevOps: Overlapping symbol declaration and reference for symbol at Range

  • Version: 10.3
  • Edition: Developer
  • Scanner: MSBuild on Azure DevOps Server 2022
  • Deployment: Docker

If I analyze my project on NET7, it works fine with the new version (10.3), it even includes the razor files. If I upgrade my project to NET8 and rerun my pipeline (without using new language features), the step “SonarQubeAnalyze@5” fails with the following error message:

##[error]08:09:03.765 ERROR: Error during SonarScanner execution
08:09:03.765 ERROR: Error during SonarScanner execution
##[error]java.lang.IllegalArgumentException: Overlapping symbol declaration and reference for symbol at Range[from [line=10, lineOffset=0] to [line=10, lineOffset=14]]
java.lang.IllegalArgumentException: Overlapping symbol declaration and reference for symbol at Range[from [line=10, lineOffset=0] to [line=10, lineOffset=14]]
##[error]at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
##[error]at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable$DefaultSymbol.newReference(DefaultSymbolTable.java:110)
	at org.sonarsource.dotnet.shared.plugins.protobuf.SymbolRefsImporter.addReferences(SymbolRefsImporter.java:84)
	at org.sonarsource.dotnet.shared.plugins.protobuf.SymbolRefsImporter.save(SymbolRefsImporter.java:65)
	at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable$DefaultSymbol.newReference(DefaultSymbolTable.java:110)
	at org.sonarsource.dotnet.shared.plugins.protobuf.SymbolRefsImporter.addReferences(SymbolRefsImporter.java:84)
	at org.sonarsource.dotnet.shared.plugins.protobuf.SymbolRefsImporter.save(SymbolRefsImporter.java:65)
##[error]at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:88)
	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:88)
##[error]at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:104)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:82)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:104)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:82)
##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:52)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:52)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
##[error]at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
##[error]at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
##[error]at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
##[error]08:09:03.765 ERROR:
08:09:03.765 ERROR: 
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]08:09:04.335  Post-processing failed. Exit code: 1
08:09:04.335  Post-processing failed. Exit code: 1
##[error]The process 'C:\agent2\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.13.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
Finishing: SonarQubeAnalyze

There is no specific file pointed out and I haven’t done any special code changes.
Is this issue known and is there some workaround?

Thank you for your help

Hi,

Maybe it’s related to Java version? I have not yet tried 10.3 version but in 10.2.1 I see something like this:
image

Doc link
Scanner environment (sonarsource.com)

Best Regards
Marcin

Hi again,

I can confirm I have the same problem when running dotnet-scanner.
Same source code scan works on 10.2.1 but doesn’t work on 10.3

sonarqube community 10.3
dotnet-scanner version 5.15.0
source code C# .NET 8
Java Java 21.0.1 Microsoft (64-bit) (also tested with open jdk ver 17)
Node 20.10

Interesting fact, making exclusion on razor files (**/*.razor) helped

Hi,

Thank you for your inputs, very interesting.
So we unfortunatley won’t yet get the advantage of analyzing razor files.
I hope they will fix it in the next release or with a bugfix.

Hello @steve123,

We tried to reproduce the problem on our side but could not do so. A bug on our side swallows the file name in the error message. We will fix that in an upcoming release.
Can you try to provide us with a reproducer by any chance? In the past, we had some trouble with the location mapping of Razor files, but we seem to have missed a particular coding pattern here.

Interesting fact, making exclusion on razor files (**/*.razor) helped

To turn off Razor file analysis, disable “Analyze Razor code” via the settings dialog or the sonar.cs.analyzseRazorCode = false property.

1 Like

Hello Martin

I was able to reduce my project to a few lines and I attached it as Repro.zip (1.1 KB)

You can unterstand the project as sort of the rest of a MVVM-Implementation, where TestComponent would be some kind of grid, and state is the viewmodel backing it.

The problem seems to be something around type parameters or constraints.

I hope this helps to identify the problem.

1 Like

Thank you @steve123 for the re-producer! I was able to identify the root cause of the problem with your help and created a ticket in our GitHub repo:

1 Like