Where can I get support for SonarQubePrepare@5 task

we have customer report that SonarQubePrepare@5 does not work on macos-12

SonarQubeAnalyze issue on macos images version 3.230.0 · Issue #8873 · actions/runner-images (github.com)

how I can contact developers of that task ?

Hey there.

This is the right place! And probably sending them directly here is the best place for them to get support.

Any updates?
I also have the same issue

Hey @denisyakimov07

There’s no specific issue that has been reported/investigated yet.

I’d suggest sharing your full Azure DevOps YAML pipeline, and logs from the build (not screenshots of logs). I’d also suggest you make sure you’ve checked all 4 suggested reasons this error can occur that are found in the log message.

The SQ scan failed the first time in the image version: ‘20231127.1’ macOS 12, then it was fixed in the image version: ‘20230921.1’.
Fail again in image version: ‘20231128.1’, ‘20231127.1’, ‘20231211.1’, ‘20231216.1’ macOS 12
No source code changes/pipeline between runs

Pipeline steps:

- task: SonarQubePrepare@5
  inputs:
    SonarQube: '$(SQ_ServiceConnectionsName)'
    scannerMode: 'MSBuild'
    projectKey: '$(SQ_ProjectKey)'
    projectName: '$(SQ_ProjectKey)'
    projectVersion: '$(correntVersionBuildNumber)'
    extraProperties: |
      sonar.verbose = true
  continueOnError: true
SonarQubePrepare Logs:

2024-01-02T20:31:49.7579550Z ##[section]Starting: SonarQubePrepare
2024-01-02T20:31:49.7587080Z ==============================================================================
2024-01-02T20:31:49.7587330Z Task : Prepare Analysis Configuration
2024-01-02T20:31:49.7587510Z Description : Prepare SonarQube analysis configuration
2024-01-02T20:31:49.7587700Z Version : 5.18.4
2024-01-02T20:31:49.7587830Z Author : sonarsource
2024-01-02T20:31:49.7589700Z Help : Version: 5.18.4. More Information
2024-01-02T20:31:49.7590260Z ==============================================================================
2024-01-02T20:31:51.5645790Z [command]/usr/local/bin/dotnet /Users/runner/work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.18.4/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll begin /k:*******-iOS
2024-01-02T20:31:52.0021100Z SonarScanner for MSBuild 5.15
2024-01-02T20:31:52.0022280Z Using the .NET Core version of the Scanner for MSBuild
2024-01-02T20:31:52.1634360Z Pre-processing started.
2024-01-02T20:31:52.1673380Z Preparing working directories…
2024-01-02T20:31:52.2538310Z 20:31:52.253 Updating build integration targets…
2024-01-02T20:31:52.9358920Z 20:31:52.935 Fetching analysis configuration settings…
2024-01-02T20:31:53.7545650Z 20:31:53.754 Provisioning analyzer assemblies for cs…
2024-01-02T20:31:53.7549840Z 20:31:53.754 Installing required Roslyn analyzers…
2024-01-02T20:31:53.7553370Z 20:31:53.755 Processing plugin: csharp version 9.13.0.79967
2024-01-02T20:31:54.2294690Z 20:31:54.229 Processing plugin: vbnet version 9.13.0.79967
2024-01-02T20:31:54.4378030Z 20:31:54.437 Processing plugin: securitycsharpfrontend version 10.3.0.27281
2024-01-02T20:31:54.9537710Z 20:31:54.953 Provisioning analyzer assemblies for vbnet…
2024-01-02T20:31:54.9624560Z 20:31:54.953 Installing required Roslyn analyzers…
2024-01-02T20:31:54.9641820Z 20:31:54.953 Processing plugin: csharp version 9.13.0.79967
2024-01-02T20:31:54.9667900Z 20:31:54.955 Processing plugin: vbnet version 9.13.0.79967
2024-01-02T20:31:54.9713200Z 20:31:54.97 Incremental PR analysis: Base branch parameter was not provided.
2024-01-02T20:31:54.9723660Z 20:31:54.97 Cache data is empty. A full analysis will be performed.
2024-01-02T20:31:55.0743580Z 20:31:55.073 Pre-processing succeeded.
2024-01-02T20:31:55.1109400Z ##[section]Finishing: SonarQubePrepare

- task: XamariniOS@2
 displayName: 'XamariniOS build ${{ env.envName }}'
 inputs:
   solutionFile: '$(solutionFileName)'
   configuration: '${{ env.configuration }}'
   buildForSimulator: false
   packageApp: true
 continueOnError: false

- task: SonarQubeAnalyze@5
 retryCountOnTaskFailure: 2
 continueOnError: true
SonarQubeAnalyzeLogs:

2024-01-02T20:41:21.4450100Z ##[section]Starting: SonarQubeAnalyze
2024-01-02T20:41:21.4464600Z ==============================================================================
2024-01-02T20:41:21.4464800Z Task : Run Code Analysis
2024-01-02T20:41:21.4464910Z Description : Run scanner and upload the results to the SonarQube server.
2024-01-02T20:41:21.4465050Z Version : 5.18.4
2024-01-02T20:41:21.4465140Z Author : sonarsource
2024-01-02T20:41:21.4465240Z Help : Version: 5.18.4. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information
2024-01-02T20:41:21.4465580Z ==============================================================================
2024-01-02T20:41:21.8675780Z [command]/usr/local/bin/dotnet /Users/runner/work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.18.4/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll end
2024-01-02T20:41:22.1273500Z SonarScanner for MSBuild 5.15
2024-01-02T20:41:22.1274890Z Using the .NET Core version of the Scanner for MSBuild
2024-01-02T20:41:22.2503320Z Post-processing started.
2024-01-02T20:41:22.3620690Z ##[error]20:41:22.361 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:22.3622350Z 20:41:22.361 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    2024-01-02T20:41:22.3622740Z Possible causes:
    2024-01-02T20:41:22.3623320Z 1. The project has not been built - the project must be built in between the begin and end steps
    2024-01-02T20:41:22.3623770Z 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
    2024-01-02T20:41:22.3624190Z 3. The begin, build and end steps have not all been launched from the same folder
    2024-01-02T20:41:22.3624580Z 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:22.3625090Z 20:41:22.361 Generation of the sonar-properties file failed. Unable to complete the analysis.
    2024-01-02T20:41:22.3664390Z ##[error]20:41:22.365 Post-processing failed. Exit code: 1
    2024-01-02T20:41:22.3665860Z 20:41:22.365 Post-processing failed. Exit code: 1
    2024-01-02T20:41:22.3766650Z ##[error]The process ‘/usr/local/bin/dotnet’ failed with exit code 1
    2024-01-02T20:41:22.3819670Z ##[warning]RetryHelper encountered task failure, will retry (attempt #: 1 out of 2) after 1000 ms
    2024-01-02T20:41:23.6179160Z [command]/usr/local/bin/dotnet /Users/runner/work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.18.4/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll end
    2024-01-02T20:41:23.6709240Z SonarScanner for MSBuild 5.15
    2024-01-02T20:41:23.6710660Z Using the .NET Core version of the Scanner for MSBuild
    2024-01-02T20:41:23.7292670Z Post-processing started.
    2024-01-02T20:41:23.7998100Z ##[error]20:41:23.799 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    Possible causes:
  5. The project has not been built - the project must be built in between the begin and end steps
  6. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  7. The begin, build and end steps have not all been launched from the same folder
  8. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:23.8000730Z 20:41:23.799 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    2024-01-02T20:41:23.8001120Z Possible causes:
    2024-01-02T20:41:23.8001710Z 1. The project has not been built - the project must be built in between the begin and end steps
    2024-01-02T20:41:23.8002160Z 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
    2024-01-02T20:41:23.8002580Z 3. The begin, build and end steps have not all been launched from the same folder
    2024-01-02T20:41:23.8002970Z 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:23.8003470Z 20:41:23.799 Generation of the sonar-properties file failed. Unable to complete the analysis.
    2024-01-02T20:41:23.8112880Z ##[error]20:41:23.81 Post-processing failed. Exit code: 1
    2024-01-02T20:41:23.8114070Z 20:41:23.81 Post-processing failed. Exit code: 1
    2024-01-02T20:41:23.8206100Z ##[error]The process ‘/usr/local/bin/dotnet’ failed with exit code 1
    2024-01-02T20:41:23.8250180Z ##[warning]RetryHelper encountered task failure, will retry (attempt #: 2 out of 2) after 4000 ms
    2024-01-02T20:41:28.0127820Z [command]/usr/local/bin/dotnet /Users/runner/work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.18.4/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll end
    2024-01-02T20:41:28.0660570Z SonarScanner for MSBuild 5.15
    2024-01-02T20:41:28.0661940Z Using the .NET Core version of the Scanner for MSBuild
    2024-01-02T20:41:28.1174860Z Post-processing started.
    2024-01-02T20:41:28.1966250Z ##[error]20:41:28.186 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    Possible causes:
  9. The project has not been built - the project must be built in between the begin and end steps
  10. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  11. The begin, build and end steps have not all been launched from the same folder
  12. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:28.1971040Z 20:41:28.186 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    2024-01-02T20:41:28.1995010Z Possible causes:
    2024-01-02T20:41:28.1997220Z 1. The project has not been built - the project must be built in between the begin and end steps
    2024-01-02T20:41:28.1998660Z 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
    2024-01-02T20:41:28.2000050Z 3. The begin, build and end steps have not all been launched from the same folder
    2024-01-02T20:41:28.2001090Z 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    2024-01-02T20:41:28.2002800Z 20:41:28.186 Generation of the sonar-properties file failed. Unable to complete the analysis.
    2024-01-02T20:41:28.2004410Z ##[error]20:41:28.19 Post-processing failed. Exit code: 1
    2024-01-02T20:41:28.2005870Z 20:41:28.19 Post-processing failed. Exit code: 1
    2024-01-02T20:41:28.2008190Z ##[error]The process ‘/usr/local/bin/dotnet’ failed with exit code 1
    2024-01-02T20:41:28.2055190Z ##[section]Finishing: SonarQubeAnalyze

GitHub issue

Can you share the logs of this task?

A post was split to a new topic: Azure DevOps Pipeline error

Unfortunately, it is against the company policy. If you need specific information from logs, I can share it.
Also, I would like to mention a few more details.
We have more than 30 Xamarin Android/iOS apps. All of iOS start failing SQ scan at the same time.
The first one I’m noting happened:

Fail Scan Nov 29, 2023,

Current agent version: ‘3.230.0’
Operating System
macOS
12.7.1
21G920
Runner Image
Image: macos-12
Version: 20231115.2
Runner Image Provisioner
2.0.321.1
Current image version: ‘20231115.2’
Agent running as: ‘runner’
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DownloadPipelineArtifact (1.230.0)
Downloading task: CmdLine (2.229.0)
Downloading task: PowerShell (2.231.4)
Downloading task: NuGetToolInstaller (1.230.0)
Downloading task: NuGetCommand (2.230.0)
Downloading task: SonarQubePrepare (5.18.4)
Downloading task: InstallAppleCertificate (2.229.3)
Downloading task: InstallAppleProvisioningProfile (1.229.3)
Downloading task: XamariniOS (2.231.0)
Downloading task: SonarQubeAnalyze (5.18.4)
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Success Scan Dec 4, 2023

Agent machine name: ‘Mac-1701716524137’
Current agent version: ‘3.227.2’
Operating System
macOS
12.6.9
21G726
Runner Image
Image: macos-12
Version: 20231017.6
Runner Image Provisioner
2.0.312.1
Current image version: ‘20231017.6’
Agent running as: ‘runner’
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DownloadPipelineArtifact (1.230.0)
Downloading task: CmdLine (2.231.0)
Downloading task: PowerShell (2.231.6)
Downloading task: NuGetToolInstaller (1.231.0)
Downloading task: NuGetCommand (2.231.0)
Downloading task: SonarQubePrepare (5.18.4)
Downloading task: InstallAppleCertificate (2.231.0)
Downloading task: InstallAppleProvisioningProfile (1.231.0)
Downloading task: XamariniOS (2.231.0)
Downloading task: SonarQubeAnalyze (5.18.4)
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Fail Scan Dec 6, 2023

Agent machine name: ‘Mac-1701887752358’
Current agent version: ‘3.230.2’
Operating System
macOS
12.7.1
21G920
Runner Image
Image: macos-12
Version: 20231127.1
Included Software: runner-images/images/macos/macos-12-Readme.md at macOS-12/20231127.1 · actions/runner-images · GitHub
Image Release: Release macOS 12 (20231127) Image Update · actions/runner-images · GitHub
Runner Image Provisioner
2.0.321.1
Current image version: ‘20231127.1’
Agent running as: ‘runner’
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DownloadPipelineArtifact (1.230.0)
Downloading task: CmdLine (2.231.0)
Downloading task: PowerShell (2.231.6)
Downloading task: NuGetToolInstaller (1.231.0)
Downloading task: NuGetCommand (2.231.0)
Downloading task: SonarQubePrepare (5.18.4)
Downloading task: InstallAppleCertificate (2.231.0)
Downloading task: InstallAppleProvisioningProfile (1.231.0)
Downloading task: XamariniOS (2.231.0)
Downloading task: SonarQubeAnalyze (5.18.4)
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Success Scan Dec 7, 2023

Operating System
macOS
12.6.9
21G726
Runner Image
Image: macos-12
Version: 20230921.1
Included Software: https://github.com/actions/runner-images/blob/macOS-12/20230921.1/images/macos/macos-12-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macOS-12%2F20230921.1
Runner Image Provisioner
2.0.321.1
Current image version: ‘20230921.1’
Agent running as: ‘runner’
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DownloadPipelineArtifact (1.230.0)
Downloading task: CmdLine (2.231.0)
Downloading task: PowerShell (2.232.0)
Downloading task: NuGetToolInstaller (1.231.0)
Downloading task: NuGetCommand (2.231.0)
Downloading task: SonarQubePrepare (5.18.4)
Downloading task: InstallAppleCertificate (2.231.0)
Downloading task: InstallAppleProvisioningProfile (1.231.0)
Downloading task: XamariniOS (2.231.0)
Downloading task: SonarQubeAnalyze (5.18.4)
Downloading task: PublishPipelineArtifact (1.199.0)
Downloading task: ArchiveFiles (2.231.0)
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Fail Scan Dec 7, 2023

Current agent version: ‘3.230.2’
Operating System
macOS
12.7.1
21G920
Runner Image
Image: macos-12
Version: 20231128.1
Included Software: https://github.com/actions/runner-images/blob/macOS-12/20231128.1/images/macos/macos-12-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macOS-12%2F20231128.1
Runner Image Provisioner
2.0.321.1
Current image version: ‘20231128.1’
Agent running as: ‘runner’
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DownloadPipelineArtifact (1.230.0)
Downloading task: CmdLine (2.231.0)
Downloading task: PowerShell (2.232.0)
Downloading task: NuGetToolInstaller (1.231.0)
Downloading task: NuGetCommand (2.231.0)
Downloading task: SonarQubePrepare (5.18.4)
Downloading task: InstallAppleCertificate (2.231.0)
Downloading task: InstallAppleProvisioningProfile (1.231.0)
Downloading task: XamariniOS (2.231.0)
Downloading task: SonarQubeAnalyze (5.18.4)
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = /Users/runner/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Starting from 7 December, none of the SQ scans succeeded. (Azure agent "macOS 12.7.1 and macOS 12.7.2)

Some runs have no changes in source code or pipeline between the Success and Failed scans. Only Azure agent version (Dec 7, 2023).

Logs from empty project:
Logs.txt (119.9 KB)

Hey there.

Thanks!

Combing through your initial post (and the GitHub Actions issue), it looks like the macos image release that started causing the issue was one that installed .NET 8.

We had users facing issues with preview versions of .NET 8 that we… expected were fixed in the final release. :thinking:

Could you run dotnet --info in the context of your build using this image and return the results?

dotnet --info

2024-01-05T15:00:01.0721230Z ##[section]Starting: CmdLine
2024-01-05T15:00:01.0728870Z ==============================================================================
2024-01-05T15:00:01.0729040Z Task : Command line
2024-01-05T15:00:01.0729100Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2024-01-05T15:00:01.0729220Z Version : 2.231.0
2024-01-05T15:00:01.0729300Z Author : Microsoft Corporation
2024-01-05T15:00:01.0729370Z Help : CmdLine@2 - Command line v2 task | Microsoft Learn
2024-01-05T15:00:01.0729490Z ==============================================================================
2024-01-05T15:00:01.2699550Z Generating script.
2024-01-05T15:00:01.2701900Z Script contents:
2024-01-05T15:00:01.2702460Z dotnet --info
2024-01-05T15:00:01.2702770Z ========================== Starting Command Output ===========================
2024-01-05T15:00:01.2720970Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/4bf459ec-60e3-4cfc-9bc3-cca584bdcced.sh
2024-01-05T15:00:02.0253940Z .NET SDK:
2024-01-05T15:00:02.0310200Z Version: 8.0.100
2024-01-05T15:00:02.0346850Z Commit: 57efcf1350
2024-01-05T15:00:02.2179240Z Workload version: 8.0.100-manifests.6c33ef20
2024-01-05T15:00:02.2179710Z
2024-01-05T15:00:02.2180490Z Runtime Environment:
2024-01-05T15:00:02.2284260Z OS Name: Mac OS X
2024-01-05T15:00:02.2285210Z OS Version: 12.7
2024-01-05T15:00:02.2308060Z OS Platform: Darwin
2024-01-05T15:00:02.2454130Z RID: osx-x64
2024-01-05T15:00:02.2495130Z Base Path: /Users/runner/.dotnet/sdk/8.0.100/
2024-01-05T15:00:02.2495640Z
2024-01-05T15:00:02.2496140Z .NET workloads installed:
2024-01-05T15:00:02.2624740Z Workload version: 8.0.100-manifests.6c33ef20
2024-01-05T15:00:02.2626290Z There are no installed workloads to display.
2024-01-05T15:00:02.2964410Z
2024-01-05T15:00:02.2968820Z Host:
2024-01-05T15:00:02.2969500Z Version: 8.0.0
2024-01-05T15:00:02.2970810Z Architecture: x64
2024-01-05T15:00:02.2971700Z Commit: 5535e31a71
2024-01-05T15:00:02.2972210Z
2024-01-05T15:00:02.2972730Z .NET SDKs installed:
2024-01-05T15:00:02.2973750Z 6.0.417 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2974380Z 7.0.102 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2974950Z 7.0.202 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2975520Z 7.0.306 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2976110Z 7.0.404 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2976680Z 8.0.100 [/Users/runner/.dotnet/sdk]
2024-01-05T15:00:02.2977080Z
2024-01-05T15:00:02.2977580Z .NET runtimes installed:
2024-01-05T15:00:02.2978180Z Microsoft.AspNetCore.App 6.0.25 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2978820Z Microsoft.AspNetCore.App 7.0.2 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2979510Z Microsoft.AspNetCore.App 7.0.4 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2980230Z Microsoft.AspNetCore.App 7.0.9 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2980880Z Microsoft.AspNetCore.App 7.0.14 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2981540Z Microsoft.AspNetCore.App 8.0.0 [/Users/runner/.dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:00:02.2982220Z Microsoft.NETCore.App 6.0.25 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2982850Z Microsoft.NETCore.App 7.0.2 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2983540Z Microsoft.NETCore.App 7.0.4 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2984170Z Microsoft.NETCore.App 7.0.9 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2984800Z Microsoft.NETCore.App 7.0.14 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2985420Z Microsoft.NETCore.App 8.0.0 [/Users/runner/.dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:00:02.2985880Z
2024-01-05T15:00:02.2986360Z Other architectures found:
2024-01-05T15:00:02.2987720Z None
2024-01-05T15:00:02.2988130Z
2024-01-05T15:00:02.2988620Z Environment variables:
2024-01-05T15:00:02.2989220Z DOTNET_ROOT [/Users/runner/.dotnet]
2024-01-05T15:00:02.2989640Z
2024-01-05T15:00:02.2990170Z global.json file:
2024-01-05T15:00:02.2990710Z Not found
2024-01-05T15:00:02.2991010Z
2024-01-05T15:00:02.2991610Z Learn more:
2024-01-05T15:00:02.2992280Z dotnet command - .NET CLI | Microsoft Learn
2024-01-05T15:00:02.2992690Z
2024-01-05T15:00:02.2993260Z Download .NET:
2024-01-05T15:00:02.2993960Z .NET Downloads (Linux, macOS, and Windows)
2024-01-05T15:00:02.3085410Z ##[section]Finishing: CmdLine

My workaround is to use DotNet 7.0.404.

- task: UseDotNet@2
  inputs:
    version: 7.0.404
  displayName: UseDotNet 7.0.404
dotnet --info

2024-01-05T15:47:05.4150300Z ##[section]Starting: CmdLine
2024-01-05T15:47:05.4186320Z ==============================================================================
2024-01-05T15:47:05.4186680Z Task : Command line
2024-01-05T15:47:05.4187030Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2024-01-05T15:47:05.4187270Z Version : 2.231.0
2024-01-05T15:47:05.4187410Z Author : Microsoft Corporation
2024-01-05T15:47:05.4187860Z Help : CmdLine@2 - Command line v2 task | Microsoft Learn
2024-01-05T15:47:05.4188230Z ==============================================================================
2024-01-05T15:47:06.1108290Z Generating script.
2024-01-05T15:47:06.2953520Z Script contents:
2024-01-05T15:47:06.3042990Z dotnet --info
2024-01-05T15:47:06.3121160Z ========================== Starting Command Output ===========================
2024-01-05T15:47:06.4400940Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/6869d18c-4dff-4bbf-b5f6-27b8ff56d57e.sh
2024-01-05T15:47:06.4773690Z .NET SDK:
2024-01-05T15:47:06.4831000Z Version: 7.0.404
2024-01-05T15:47:06.4879630Z Commit: 22f221a24c
2024-01-05T15:47:06.4888790Z
2024-01-05T15:47:06.4897190Z Runtime Environment:
2024-01-05T15:47:06.5004890Z OS Name: Mac OS X
2024-01-05T15:47:06.5007550Z OS Version: 12.7
2024-01-05T15:47:06.5035110Z OS Platform: Darwin
2024-01-05T15:47:06.5219850Z RID: osx.12-x64
2024-01-05T15:47:06.5221320Z Base Path: /Users/runner/hostedtoolcache/dotnet/sdk/7.0.404/
2024-01-05T15:47:06.5240050Z
2024-01-05T15:47:06.5243920Z Host:
2024-01-05T15:47:06.5244640Z Version: 7.0.14
2024-01-05T15:47:06.5245090Z Architecture: x64
2024-01-05T15:47:06.5245520Z Commit: 808851b07a
2024-01-05T15:47:06.5246010Z
2024-01-05T15:47:06.5246970Z .NET SDKs installed:
2024-01-05T15:47:06.5247530Z 7.0.404 [/Users/runner/hostedtoolcache/dotnet/sdk]
2024-01-05T15:47:06.5247740Z
2024-01-05T15:47:06.5248030Z .NET runtimes installed:
2024-01-05T15:47:06.5248670Z Microsoft.AspNetCore.App 7.0.14 [/Users/runner/hostedtoolcache/dotnet/shared/Microsoft.AspNetCore.App]
2024-01-05T15:47:06.5249320Z Microsoft.NETCore.App 7.0.14 [/Users/runner/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
2024-01-05T15:47:06.5250040Z
2024-01-05T15:47:06.5251200Z Other architectures found:
2024-01-05T15:47:06.5252010Z None
2024-01-05T15:47:06.5252740Z
2024-01-05T15:47:06.5253650Z Environment variables:
2024-01-05T15:47:06.5254420Z DOTNET_ROOT [/Users/runner/hostedtoolcache/dotnet]
2024-01-05T15:47:06.5255120Z
2024-01-05T15:47:06.5256050Z global.json file:
2024-01-05T15:47:06.5257040Z Not found
2024-01-05T15:47:06.5257760Z
2024-01-05T15:47:06.5258610Z Learn more:
2024-01-05T15:47:06.5306740Z dotnet command - .NET CLI | Microsoft Learn
2024-01-05T15:47:06.5307630Z
2024-01-05T15:47:06.5308730Z Download .NET:
2024-01-05T15:47:06.5309470Z .NET Downloads (Linux, macOS, and Windows)
2024-01-05T15:47:06.5378710Z ##[section]Finishing: CmdLine

But my question is still open: How can we run an SQ scan on the latest DotNet?

Hi,

Apologies for the delay. I am following up on this issue.

While I don’t have a full understanding of what is happening yet, I want to give an update on the current state of this investigation.

What I think is now happening is the following:

  • As mentioned in a previous investigation here on the community, .NET 8 introduced a breaking change of LocalApplicationData location, on MacOS exclusively. This is the location used to place the SonarQube.Integration.ImportBefore.targets file necessary to run Sonar analyzers during project build.
  • When the Scanner for .NET is run against .NET 8, it places the targets file at the new location.
  • The build of the MAUI/Xamarin project happens on MSBuild 16.10.1 for Mono.
  • This version of MSBuild for Mono runs on .NET 7 or earlier.
    • I don’t have any evidence of that yet: I am currently testing.
  • MSBuild itself uses the same .NET API that we use to place the targets file.
  • Therefore, it looks in the old location, and it doesn’t find the targets file.
  • As a result, Sonar Analyzers are not executed on the build, resulting in the SonarQubeAnalyze error that we can see from the logs.

I am currently trying to recreate a MacOS environment where the actual build happens on .NET 7, even when .NET 8 is available on the machine.

While I am trying to reproduce that, it would be valuable to add the following target to any of the csproj you build.

<Target Name="DisplayMessages" BeforeTargets="CoreCompile">
    <Message Importance="high" Text="[DEBUG] LocalAppData = $(LocalAppData)" />
    <Message Importance="high" Text="[DEBUG] MSBuildToolsVersion = $(MSBuildToolsVersion)" />
    <Message Importance="high" Text="[DEBUG] TargetFramework = $(TargetFramework)" />
    <Message Importance="high" Text="[DEBUG] MSBuildRuntimeVersion = $([System.Runtime.InteropServices.RuntimeInformation]:: FrameworkDescription.ToString())" />
    <Message Importance="high" Text="[DEBUG] CLRVersion = $([System.Environment]::Version)" />
</Target>

Those will log some variables, that I would like to know the value of.
If the scenario above matches what’s actually happening in your build, we should be able to provide a fix.
That will however require a new release of the Scanner for .NET.

I hope I will soon be able to provide updates.

Best regards,

Antonio

1 Like

Hi there,

Good news! We have released a new version of the Scanner for .NET that should fix the issue.

Can you please try this one out and let us know?

Thanks for your patience,
Antonio