Error while Run Code Analysis from Azure DevOps on C# project

SonarQube Version: 8.4.1.35646
Platform: Azure DevOps
Task: Run Code Analysis
Task Version: 4.11.0

Task Error:

2020-09-14T17:07:53.4451148Z ##[error]ERROR: Error during SonarScanner execution
2020-09-14T17:07:53.4452136Z ERROR: Error during SonarScanner execution
2020-09-14T17:07:53.4459913Z ##[error]java.lang.IllegalArgumentException: 40 is not a valid line offset for pointer. File WebAppService/WebAppService/Properties/AssemblyInfo.cs has 38 character(s) at line 34
	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:339)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:288)
	at org.sonarsource.dotnet.shared.plugins.SensorContextUtils.toTextRange(SensorContextUtils.java:43)
	at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:48)
	at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:34)
	at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:74)
	at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:104)
	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:75)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.executeInternal(DotNetSensor.java:95)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:73)
2020-09-14T17:07:53.4464777Z java.lang.IllegalArgumentException: 40 is not a valid line offset for pointer. File WebAppService/WebAppService/Properties/AssemblyInfo.cs has 38 character(s) at line 34
2020-09-14T17:07:53.4465488Z 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
2020-09-14T17:07:53.4466057Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:339)
2020-09-14T17:07:53.4467383Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
2020-09-14T17:07:53.4468094Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:288)
2020-09-14T17:07:53.4468704Z 	at org.sonarsource.dotnet.shared.plugins.SensorContextUtils.toTextRange(SensorContextUtils.java:43)
2020-09-14T17:07:53.4469328Z 	at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:48)
2020-09-14T17:07:53.4469984Z 	at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:34)
2020-09-14T17:07:53.4470598Z 	at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:74)
2020-09-14T17:07:53.4471243Z 	at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
2020-09-14T17:07:53.4471904Z 	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:104)
2020-09-14T17:07:53.4472539Z 	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:75)
2020-09-14T17:07:53.4473163Z 	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.executeInternal(DotNetSensor.java:95)
2020-09-14T17:07:53.4473716Z 	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:73)
2020-09-14T17:07:53.4476445Z ##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4478688Z 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
2020-09-14T17:07:53.4479292Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
2020-09-14T17:07:53.4479850Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
2020-09-14T17:07:53.4480515Z 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
2020-09-14T17:07:53.4481084Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4482056Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2020-09-14T17:07:53.4483111Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2020-09-14T17:07:53.4484509Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:388)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:384)
2020-09-14T17:07:53.4485651Z 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:388)
2020-09-14T17:07:53.4486209Z 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:384)
2020-09-14T17:07:53.4487637Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:353)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4488743Z 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:353)
2020-09-14T17:07:53.4489332Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4490648Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
2020-09-14T17:07:53.4491738Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2020-09-14T17:07:53.4492276Z 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
2020-09-14T17:07:53.4493407Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4494324Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2020-09-14T17:07:53.4495573Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2020-09-14T17:07:53.4496592Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2020-09-14T17:07:53.4497104Z 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2020-09-14T17:07:53.4498368Z ##[error]at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2020-09-14T17:07:53.4499423Z 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2020-09-14T17:07:53.4499966Z 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2020-09-14T17:07:53.4500806Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-09-14T17:07:53.4501527Z 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-09-14T17:07:53.4502352Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-09-14T17:07:53.4503248Z 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-09-14T17:07:53.4504436Z ##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
2020-09-14T17:07:53.4505567Z 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-09-14T17:07:53.4506038Z 	at java.lang.reflect.Method.invoke(Method.java:498)
2020-09-14T17:07:53.4507252Z ##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2020-09-14T17:07:53.4508245Z 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2020-09-14T17:07:53.4509586Z ##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2020-09-14T17:07:53.4510462Z 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
2020-09-14T17:07:53.4510922Z 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2020-09-14T17:07:53.4512090Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2020-09-14T17:07:53.4513119Z 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2020-09-14T17:07:53.4513585Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2020-09-14T17:07:53.4514337Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2020-09-14T17:07:53.4515136Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2020-09-14T17:07:53.4515899Z ##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
2020-09-14T17:07:53.4516693Z 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
2020-09-14T17:07:53.4516979Z ERROR: 
2020-09-14T17:07:53.4738697Z ##[error]The SonarQube Scanner did not complete successfully
2020-09-14T17:07:53.4739808Z The SonarQube Scanner did not complete successfully
2020-09-14T17:07:53.4789066Z ##[error]20:07:53.474  Post-processing failed. Exit code: 1
2020-09-14T17:07:53.4790986Z 20:07:53.474  Post-processing failed. Exit code: 1
2020-09-14T17:07:53.4950988Z ##[error]The process 'C:\ag02\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.11.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1

I checked the file AssemblyInfo.cs and it looks fine.

Hi @TomerL,

Welcome to the community! This error happens when there’s a mismatch between the file itself (during this end step) and the metadata generated for the file (during the build itself).

Can you check if you have some prebuild/postbuild events in your build that are modifying the file? The guess would be that you’re changing version or signing information on the file.

Cheers
Pavel