Search code examples
.netmsbuildsonarqubesonarscanner

Sonarscanner command is failing abruptly


we are using gitlab pipeline where Sonarscanner is used to scan the code. the codebase is .NET and all unit test cases along with codebase builds and executes fine.

recently after integrating sonarqube, it is failing abruptly with below error. the command is :

 - dotnet sonarscanner end -d:sonar.login="$SONAR_TOKEN"

ERROR: Error during SonarScanner execution java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: c???out at

java.base/sun.nio.fs.UnixPath.encode(UnixPath.java:145) at java.base/sun.nio.fs.UnixPath.(UnixPath.java:69) at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:279) at java.base/java.nio.file.Path.resolve(Path.java:515) at org.sonar.scm.git.IncludedFilesRepository.indexFiles(IncludedFilesRepository.java:65) at org.sonar.scm.git.IncludedFilesRepository.(IncludedFilesRepository.java:40) at org.sonar.scm.git.GitIgnoreCommand.init(GitIgnoreCommand.java:37) at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(ProjectFileIndexer.java:104) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:352) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:149) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) 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:189) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) at org.sonarsource.scanner.cli.Main.execute(Main.java:112) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61)

ERROR: The

SonarQube Scanner did not complete successfully

actually, till couple of days , everything was working fine. SonarQube also did not change anything. not able to understand where is the problem.

without sonarqube, everything works fine . can someone please suggest ?


Solution

  • Have you added any files to the codebase, which have a special character in their file name or in their content?

    It could also be a problem with encoding. Make sure the encoding with which you start the sonarscanner is also the same encoding of your file.

    Unfortunatly I do not know how to define this in dotnet. In Java/Maven you can set this with following property in your pom.xml

    <properties>
        <sonar.sourceEncoding>Cp1252</sonar.sourceEncoding>
    </properties>