Hey, I wanted to add the architecture analysis feature to our CI pipeline based on this article: Configuring the architecture analysis | SonarQube Cloud | Sonar Documentation
Once added, the pipeline fails with a NullPointerException and no error message that would help me to fix this problem.
Setup
- Bitbucket Cloud
- Azure DevOps
- C# code base
Error observed
In the SonarCloudAnalyze@3 step, I get the following error after adding adding the architecture.json file to the repository
2025-09-12T10:45:03.2315808Z INFO: Importing results from 8 proto files in 'D:\a\1\.sonarqube\out\64\output-cs'
2025-09-12T10:45:03.2625693Z INFO: Importing results from 8 proto files in 'D:\a\1\.sonarqube\out\55\output-cs'
2025-09-12T10:45:03.2777490Z INFO: Importing results from 8 proto files in 'D:\a\1\.sonarqube\out\51\output-cs'
2025-09-12T10:45:03.7404648Z INFO: Importing 92 Roslyn reports
2025-09-12T10:45:04.2329560Z INFO: Found 92 MSBuild C# projects: 34 MAIN projects. 15 TEST projects. 43 with no MAIN nor TEST files.
2025-09-12T10:45:04.2533987Z INFO: Sensor C# [csharpenterprise] (done) | time=6046ms
2025-09-12T10:45:04.5057279Z INFO: Sensor Analysis Warnings import [csharpenterprise]
2025-09-12T10:45:04.5057987Z INFO: Sensor Analysis Warnings import [csharpenterprise] (done) | time=2ms
2025-09-12T10:45:04.5302708Z INFO: Sensor C# File Caching Sensor [csharpenterprise]
2025-09-12T10:45:04.7430995Z INFO: Sensor C# File Caching Sensor [csharpenterprise] (done) | time=190ms
2025-09-12T10:45:04.9374496Z INFO: Sensor C# Tests Coverage Report Import [csharpenterprise]
2025-09-12T10:45:05.1491431Z INFO: Parsing the Visual Studio coverage XML report D:\a\_temp\TestResults\33f95145-7b3e-4d50-add2-799f45f4bde2\VssAdministrator_runnervmshoy1_2025-09-12.10_40_47.coveragexml
2025-09-12T10:45:05.2979744Z INFO: Adding this code coverage report to the cache for later reuse: D:\a\_temp\TestResults\33f95145-7b3e-4d50-add2-799f45f4bde2\VssAdministrator_runnervmshoy1_2025-09-12.10_40_47.coveragexml
2025-09-12T10:45:05.5578091Z INFO: Coverage Report Statistics: 923 files, 725 main files, 725 main files with coverage, 198 test files, 0 project excluded files, 0 other language files.
2025-09-12T10:45:05.5591039Z INFO: Sensor C# Tests Coverage Report Import [csharpenterprise] (done) | time=1095ms
2025-09-12T10:45:05.5595565Z INFO: Sensor JsSecuritySensorV2 [jasmin]
2025-09-12T10:45:05.5596366Z INFO: 6 additional JS/TS file(s) from other modules detected but not analyzed. Set 'sonar.jasmin.modules.all' to true to include them in the taint analysis.
2025-09-12T10:45:05.5596998Z INFO: No relevant JS/TS files found. Skipping taint analysis.
2025-09-12T10:45:05.5597511Z INFO: Sensor JsSecuritySensorV2 [jasmin] (done) | time=1ms
2025-09-12T10:45:05.5654316Z INFO: Sensor JsArchitectureSensor [architecture]
2025-09-12T10:45:05.5699097Z INFO: * Protobuf reading starting | memory total=570 | free=250 | used=319 (MB)
2025-09-12T10:45:05.5826875Z INFO: * Reading SonarArchitecture IR data from directory "D:\a\1\.sonarqube\out\.sonar\architecture\js"
2025-09-12T10:45:05.6130457Z INFO: * Protobuf reading complete | memory total=570 | free=250 | used=319 (MB)
2025-09-12T10:45:05.6402093Z INFO: * Build architecture.graph.js.file_graph.default_perspective hierarchy graph complete (filtered=true) | memory total=570 | free=250 | used=319 (MB)
2025-09-12T10:45:05.6431727Z INFO: * Slicing complete | memory total=570 | free=249 | used=320 (MB)
2025-09-12T10:45:05.7793087Z INFO: * Writing to "D:\a\1\.sonarqube\out\.sonar\architecture\exports\js\js-default-perspective-by-file.json"
2025-09-12T10:45:05.8439186Z INFO: * Build architecture.graph.js.file_graph.default_perspective hierarchy graph complete (filtered=false) | memory total=570 | free=234 | used=335 (MB)
2025-09-12T10:45:06.1419277Z INFO: ------------------------------------------------------------------------
2025-09-12T10:45:06.1422503Z INFO: EXECUTION FAILURE
2025-09-12T10:45:06.1423143Z INFO: ------------------------------------------------------------------------
2025-09-12T10:45:06.1426983Z INFO: Total time: 1:14.398s
2025-09-12T10:45:06.2800245Z INFO: Final Memory: 98M/330M
2025-09-12T10:45:06.2801033Z INFO: ------------------------------------------------------------------------
2025-09-12T10:45:06.2874500Z ##[error]ERROR: Error during SonarScanner execution
2025-09-12T10:45:06.2876493Z ERROR: Error during SonarScanner execution
2025-09-12T10:45:06.2877776Z ##[error]java.lang.NullPointerException
2025-09-12T10:45:06.2894059Z java.lang.NullPointerException
2025-09-12T10:45:06.2899076Z ##[error]at java.base/java.util.Objects.requireNonNull(Unknown Source)
2025-09-12T10:45:06.2900253Z at java.base/java.util.Objects.requireNonNull(Unknown Source)
2025-09-12T10:45:06.2902378Z ##[error]at com.sonarsource.architecture.config.model.Perspective.getLanguage(na:2758)
2025-09-12T10:45:06.2903215Z at com.sonarsource.architecture.config.model.Perspective.getLanguage(na:2758)
2025-09-12T10:45:06.2905470Z ##[error]at com.sonarsource.architecture.Z.E.B(na:898)
2025-09-12T10:45:06.2906113Z at com.sonarsource.architecture.Z.E.B(na:898)
2025-09-12T10:45:06.2906879Z ##[error]at com.sonarsource.architecture.Z.E.B(na:2878)
2025-09-12T10:45:06.2907498Z at com.sonarsource.architecture.Z.E.B(na:2878)
2025-09-12T10:45:06.2908321Z ##[error]at java.base/java.util.Map.computeIfAbsent(Unknown Source)
2025-09-12T10:45:06.2908983Z at java.base/java.util.Map.computeIfAbsent(Unknown Source)
2025-09-12T10:45:06.2909832Z ##[error]at com.sonarsource.architecture.Z.E.C(na:754)
2025-09-12T10:45:06.2910525Z at com.sonarsource.architecture.Z.E.C(na:754)
2025-09-12T10:45:06.2911353Z ##[error]at com.sonarsource.architecture.Z.E.A(na:3307)
2025-09-12T10:45:06.2912125Z at com.sonarsource.architecture.Z.E.A(na:3307)
2025-09-12T10:45:06.2912958Z ##[error]at com.sonarsource.architecture.U.A.A(na:288)
2025-09-12T10:45:06.2913968Z at com.sonarsource.architecture.U.A.A(na:288)
2025-09-12T10:45:06.2917123Z ##[error]at java.base/java.util.ArrayList.forEach(Unknown Source)
2025-09-12T10:45:06.2917785Z at java.base/java.util.ArrayList.forEach(Unknown Source)
2025-09-12T10:45:06.2918539Z ##[error]at com.sonarsource.architecture.U.A.A(na:2094)
2025-09-12T10:45:06.2919154Z at com.sonarsource.architecture.U.A.A(na:2094)
2025-09-12T10:45:06.2919934Z ##[error]at com.sonarsource.architecture.U.A.A(na:3419)
2025-09-12T10:45:06.2920584Z at com.sonarsource.architecture.U.A.A(na:3419)
2025-09-12T10:45:06.2921376Z ##[error]at java.base/java.util.Map.computeIfAbsent(Unknown Source)
2025-09-12T10:45:06.2922158Z at java.base/java.util.Map.computeIfAbsent(Unknown Source)
2025-09-12T10:45:06.2926025Z ##[error]at com.sonarsource.architecture.U.A.A(na:3419)
2025-09-12T10:45:06.2926665Z at com.sonarsource.architecture.U.A.A(na:3419)
2025-09-12T10:45:06.2927427Z ##[error]at com.sonarsource.architecture.U.F$_A.A(na:3336)
2025-09-12T10:45:06.2928006Z at com.sonarsource.architecture.U.F$_A.A(na:3336)
2025-09-12T10:45:06.2928747Z ##[error]at com.sonarsource.architecture.U.F.B(na:469)
2025-09-12T10:45:06.2929307Z at com.sonarsource.architecture.U.F.B(na:469)
2025-09-12T10:45:06.2930197Z ##[error]at com.sonarsource.architecture.A.A(na:475)
2025-09-12T10:45:06.2930755Z at com.sonarsource.architecture.A.A(na:475)
2025-09-12T10:45:06.2931816Z ##[error]at com.sonarsource.architecture.A.execute(na:831)
2025-09-12T10:45:06.2932421Z at com.sonarsource.architecture.A.execute(na:831)
2025-09-12T10:45:06.2933309Z ##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:68)
2025-09-12T10:45:06.2934009Z at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:68)
2025-09-12T10:45:06.2934937Z ##[error]at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:40)
2025-09-12T10:45:06.2935643Z at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:40)
2025-09-12T10:45:06.2936573Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:173)
2025-09-12T10:45:06.2937288Z at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:173)
2025-09-12T10:45:06.2938227Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2025-09-12T10:45:06.2938922Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2025-09-12T10:45:06.2939834Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2025-09-12T10:45:06.2940503Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2025-09-12T10:45:06.2941669Z ##[error]at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:462)
2025-09-12T10:45:06.2942385Z at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:462)
2025-09-12T10:45:06.2943330Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2025-09-12T10:45:06.2944139Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2025-09-12T10:45:06.2945054Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2025-09-12T10:45:06.2945736Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2025-09-12T10:45:06.2946653Z ##[error]at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
2025-09-12T10:45:06.2947332Z at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
2025-09-12T10:45:06.2951413Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
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(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$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:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:78)
at org.sonarsource.scanner.cli.Main.main(Main.java:59)
ERROR:
2025-09-12T10:45:06.2954460Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
2025-09-12T10:45:06.2954889Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
2025-09-12T10:45:06.2955239Z at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
2025-09-12T10:45:06.2955684Z at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
2025-09-12T10:45:06.2956052Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2025-09-12T10:45:06.2956446Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2025-09-12T10:45:06.2956764Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2025-09-12T10:45:06.2957095Z at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2025-09-12T10:45:06.2957427Z at java.base/java.lang.reflect.Method.invoke(Unknown Source)
2025-09-12T10:45:06.2957804Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2025-09-12T10:45:06.2958208Z at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2025-09-12T10:45:06.2958564Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2025-09-12T10:45:06.2958987Z at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2025-09-12T10:45:06.2959367Z at org.sonarsource.scanner.cli.Main.execute(Main.java:123)
2025-09-12T10:45:06.2959710Z at org.sonarsource.scanner.cli.Main.execute(Main.java:78)
2025-09-12T10:45:06.2960067Z at org.sonarsource.scanner.cli.Main.main(Main.java:59)
2025-09-12T10:45:06.2960343Z ERROR:
2025-09-12T10:45:06.7046578Z ##[error]The SonarScanner did not complete successfully
2025-09-12T10:45:06.7049531Z The SonarScanner did not complete successfully
2025-09-12T10:45:06.7052651Z ##[error]10:45:06.7 Post-processing failed. Exit code: 1
2025-09-12T10:45:06.7055817Z 10:45:06.7 Post-processing failed. Exit code: 1
2025-09-12T10:45:06.7115869Z
2025-09-12T10:45:06.7186032Z ##[error][ERROR] SonarQube Cloud: Error while executing task Analyze: The process 'D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\3.4.1\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
2025-09-12T10:45:06.7188060Z ##[error]The process 'D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\3.4.1\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
2025-09-12T10:45:06.7277020Z ##[section]Finishing: Run SonarCloud
The pipeline steps I am using:
- task: SonarCloudPrepare@3
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: '[REMOVED]'
organization: '[REMOVED]'
scannerMode: 'dotnet'
projectKey: '[REMOVED]'
projectName: '[REMOVED]'
extraProperties: |
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
sonar.verbose=true
sonar.architecture.configpath=architecture.json
- task: MSBuild@1
displayName: 'Build Solution'
inputs:
solution: '$(Solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/m /p:RuntimeIdentifier="$(RuntimeIdentifier)" /restore /t:Rebuild'
- task: VSTest@3
displayName: 'Run Unit Tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*UnitTests.dll
**\*IntegrationTests.dll
!**\obj\**
!**\bin\**\ref\**
codeCoverageEnabled: true
- task: SonarCloudAnalyze@3
displayName: 'Run SonarCloud'
With the following architecture.json file.
{
"perspectives": [
{
"label": "Clean Architecutre",
"description": "",
"groups": [
{
"label": "Entities",
"patterns": [
"[REMOVED].Domain/**",
"[REMOVED].API/**"
]
},
{
"label": "Use Cases",
"patterns": [
"[REMOVED].Interactcors/**",
"[REMOVED].Workflow"
]
},
{
"label": "Interface and Adapters",
"patterns": [
"[REMOVED].Presenters/**",
"[REMOVED].Commands/**",
"[REMOVED].ViewModels/**"
]
},
{
"label": "Frameworks and Drivers",
"patterns": [
"[REMOVED].App/**",
"[REMOVED]UI.**",
"[REMOVED].Persistence/**",
"[REMOVED].Cloud/**",
"[REMOVED].Help/**"
]
}
],
"constraints": [
{
"message": "lets provoke an error!",
"from": [ "Use Cases" ],
"to": [ "Entities" ],
"relation": "deny"
}
]
}
]
}
Steps to reproduce
- Added a
architecture.jsonfile to the repository. - Run the CI pieline
- The
SonarCloudAnalyze@3step fails with the reported exception