Sonar Scanner + Unity CSharp Always Fails

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube: sonarqube-9.4.0.54424
    Sonar Scanner: sonar-scanner-msbuild-4.6.2.2108-net46
  • what are you trying to achieve
    Do CSharp Code Analysis / Scan Csharp files
  • what have you tried so far to achieve this
    Multiple times changed the code encoding to utf8 but no luck.
    Below given is the error
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: 30 is not a valid line offset for pointer. File Assets/Scripts/Somex/SomeY/OhGodPlsWork.cs has 25 character(s) at line 116
	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:287)
	at org.sonarsource.dotnet.shared.plugins.SensorContextUtils.toTextRange(SensorContextUtils.java:60)
	at org.sonarsource.dotnet.shared.plugins.protobuf.HighlightImporter.save(HighlightImporter.java:68)
	at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:82)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:101)
	at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:81)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:49)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:360)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:134)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Process returned exit code 1
The SonarQube Scanner did not complete successfully
Post-processing failed. Exit code: 1

Im running

  1. begin
  2. rebuild
  3. end ->always fails with above error
    Someone please point me in right direction
    Thanks in advance

Hi,

Welcome to the community!

What makes you think this is related to file encoding?

Could you show a few log lines preceding the error?

Can you provide the file analysis is failing on? Or a segment that includes line 112?

 
Thx,
Ann