Sonar scan error after moving from .net 6 to .net 8

Sonar scan error after moving from net6 to net8

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Languages of the repository - C#, typescript, javascript
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
##[error]ERROR: Error: No inputs were found in config file 'C:\agent-aws\_work\18\s\Jsproject1\bin\Release\net8.0\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
ERROR: Error: No inputs were found in config file 'C:\agent-aws\_work\18\s\Jsproject1\bin\Release\net8.0\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
##[error]ERROR:     at createProgramOptions (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:96:15)
ERROR:     at createProgram (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:127:28)
ERROR:     at createAndSaveProgram (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:188:21)
ERROR:     at MessagePort.<anonymous> (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:92:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
ERROR:     at createProgramOptions (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:96:15)
ERROR:     at createProgram (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:127:28)
ERROR:     at createAndSaveProgram (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:188:21)
ERROR:     at MessagePort.<anonymous> (C:\agent-aws\_work\18\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:92:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)

  • Potential workaround
    No workaround so far.

Hey there.

That’s odd – since it seems to be throwing an error from the Javascript analyzer. Can you tell me what version of the SonarScanner for .NET you’re using?

Hello Colin,
We use the SonarCloud.io version that gets pulled by the SonarCloud Azure DevOps task.
This is the log from that task:

Starting: Prepare analysis on SonarCloud
==============================================================================
Task         : Prepare Analysis Configuration
Description  : Prepare SonarCloud analysis configuration
Version      : 1.40.2
Author       : sonarsource
Help         : Version: 1.40.2. [More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
==============================================================================
C:\agent-aws\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.40.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:project_Key /o:project
SonarScanner for MSBuild 5.14
Using the .NET Framework version of the Scanner for MSBuild

Alain.

Thanks.

Can you share:

  • Your Azure DevOps Pipeline YAML
  • A printout (cat or what have you) of C:\agent-aws_work\18\s\Jsproject1\bin\Release\net8.0\tsconfig.json during your pipeline?

I think with this info I can hand this off to the relevant team.

Hello Colin,
Attached you can find the pipeline YAML.
Sample Pipeline.yml.txt (18.1 KB)

Also, here is the content of the tsconfig.json file

{
  "compileOnSave": false,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": true,
    "target": "es5",
    "lib": [ "dom", "es5", "es6", "es2015.promise" ],
    "jsx": "react",
    "module": "commonjs",
    "baseUrl": ".",
    "paths": {
      "@library/*": [ "Library/*" ]
    },
    "skipLibCheck": true
  },
  "exclude": [ "node_modules" ]
}

This is the first error we get

ERROR:     at createAndSaveProgram (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:187:21)
##[error]ERROR:     at MessagePort.<anonymous> (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:101:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
ERROR:     at MessagePort.<anonymous> (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:101:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
##[error]ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
##[error]ERROR: Failed to create program: No inputs were found in config file 'C:\agent2-aws\_work\91\s\Testing\Sample.Tests.Core\bin\Release\net8.0\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
ERROR: Failed to create program: No inputs were found in config file 'C:\agent2-aws\_work\91\s\Testing\Sample.Tests.Core\bin\Release\net8.0\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
INFO: Creating TypeScript program
INFO: TypeScript configuration file C:\agent2-aws\_work\91\s\Sample.IdentityServer\obj\Release\net8.0\PubTmp\Out\tsconfig.json
##[error]ERROR: Error: No inputs were found in config file 'C:\agent2-aws\_work\91\s\Sample.IdentityServer\obj\Release\net8.0\PubTmp\Out\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
ERROR: Error: No inputs were found in config file 'C:\agent2-aws\_work\91\s\Sample.IdentityServer\obj\Release\net8.0\PubTmp\Out\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.
##[error]ERROR:     at createProgramOptions (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:96:15)
ERROR:     at createProgram (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:126:28)
ERROR:     at createProgramOptions (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:96:15)
ERROR:     at createProgram (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:126:28)
##[error]ERROR:     at createAndSaveProgram (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:187:21)
ERROR:     at createAndSaveProgram (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\jsts\src\program\program.js:187:21)
##[error]ERROR:     at MessagePort.<anonymous> (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:101:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
ERROR:     at MessagePort.<anonymous> (C:\agent2-aws\_work\91\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:101:86)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
##[error]ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
##[error]ERROR: Failed to create program: No inputs were found in config file 'C:\agent2-aws\_work\91\s\Sample.IdentityServer\obj\Release\net8.0\PubTmp\Out\tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules"]'.

and at the end, we get a heap space error.

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 7:18.836s
INFO: Final Memory: 48M/164M
##[error]ERROR: Error during SonarScanner execution
ERROR: Error during SonarScanner execution
INFO: ------------------------------------------------------------------------
##[error]java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
##[error]at com.sonar.security.C.A.A$_B.<init>(na:1271)
	at com.sonar.security.C.A.A$_B.<init>(na:1271)
##[error]at com.sonar.security.C.A.A.A(na:1426)
	at com.sonar.security.C.A.A.A(na:1426)
##[error]at com.sonar.security.C.A.B.A(na:427)
	at com.sonar.security.C.A.B.A(na:427)
##[error]at com.sonar.security.C.A.B.A(na:2662)
	at com.sonar.security.C.A.B.A(na:2662)
##[error]at com.sonar.security.C.A.B$$Lambda/0x000001ee54640480.accept(Unknown Source)
	at com.sonar.security.C.A.B$$Lambda/0x000001ee54640480.accept(Unknown Source)
##[error]at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
##[error]at com.sonar.security.C.A.B.A(na:3456)
	at com.sonar.security.C.A.B.A(na:3456)
##[error]at com.sonar.security.C.A.D.A(na:350)
	at com.sonar.security.C.A.D.A(na:350)
##[error]at com.sonar.security.C.A.D.A(na:1633)
	at com.sonar.security.C.A.D.A(na:1633)
##[error]at com.sonar.security.C.A.D.A(na:2124)
	at com.sonar.security.C.A.D.A(na:2124)
##[error]at com.sonar.security.C.A.D$$Lambda/0x000001ee54642470.accept(Unknown Source)
	at com.sonar.security.C.A.D$$Lambda/0x000001ee54642470.accept(Unknown Source)
##[error]at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
##[error]at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
##[error]at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
##[error]at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
##[error]at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
##[error]at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
##[error]at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
##[error]at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
##[error]at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sonar.security.C.A.D.A(na:2124)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sonar.security.C.A.D.A(na:2124)
##[error]at com.sonar.security.C.A.B.A(na:2654)
	at com.sonar.security.C.A.D.<init>(na:2917)
	at com.sonar.security.C.A.C.A(na:902)
	at com.sonar.security.C.A.C.<init>(na:3556)
	at com.sonar.security.C.A.C.<init>(na:1134)
	at com.sonar.security.C.B.E.A(na:285)
	at com.sonar.security.C.B.E.A(na:2341)
	at com.sonar.security.C.B.E.A(na:3010)
	at com.sonar.security.E.createCallGraph(na:1106)
ERROR:
	at com.sonar.security.C.A.B.A(na:2654)
	at com.sonar.security.C.A.D.<init>(na:2917)
	at com.sonar.security.C.A.C.A(na:902)
	at com.sonar.security.C.A.C.<init>(na:3556)
	at com.sonar.security.C.A.C.<init>(na:1134)
	at com.sonar.security.C.B.E.A(na:285)
	at com.sonar.security.C.B.E.A(na:2341)
	at com.sonar.security.C.B.E.A(na:3010)
	at com.sonar.security.E.createCallGraph(na:1106)
ERROR: 
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]11:37:24.956  Post-processing failed. Exit code: 1
11:37:24.956  Post-processing failed. Exit code: 1
##[error]The process 'C:\agent2-aws\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.41.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
Finishing: Run Code Analysis

Thanks!
Alain

Hey @acardenas

Sorry for the very late response. Are you still facing an issue with this project?

It seems this error gets thrown by the Typescript compiler when it fails to find any Typescript files as pointed to by the tsconfig.json file.

It’s possible you were getting this error before you moved to .NET 8, but it wasn’t failing the analysis.

This error, however:

Can be addressed by allocating additional memory to the scanner. A good value to start would be SONAR_SCANNER_JAVA_OPTS="-Xmx2G" (configured as a variable in your build)