Code coverage report for .Net not working on Linux agent

For our build pipeline in Azure DevOps we have switched to using the ubuntu-latest vm-image and since that switch I have noticed we no longer receive code coverage information. I have verified that the problem is due to using a Linux agent by switching back to windows and see that it worked, however due to a problem with the current Windows agents we have to use the Linux agent. Is it possible there is a problem with the default path that sonar checks for the coverage information? I don’t see any problems in the attached log. sonarlog2.txt (296.2 KB)

Below the pipeline:

  vmImage: 'ubuntu-latest'

  - name: solution
    value: '**/*.sln'
  - name: buildPlatform
    value: 'Any CPU'
  - name: buildConfiguration
    value: 'Test'


  - task: DotNetCoreCLI@2
    displayName: 'Restore solution'
      command: 'restore'
      projects: '**/*.sln'
      feedsToUse: 'select'

  - task: SonarCloudPrepare@1
    displayName: 'Prepare analysis configuration'
      SonarCloud: 'SC'
      organization: 'org'
      scannerMode: 'MSBuild'
      projectKey: 'key'
      projectName: 'name'

  - task: DotNetCoreCLI@2
    displayName: 'Build solution'
      command: 'build'
      projects: '**/*.sln'
      arguments: --configuration $(BuildConfiguration)

  - task: DotNetCoreCLI@2
    displayName: 'Execute Unit tests'
      command: 'test'
      projects: '**/*.Tests.csproj'
      arguments: '--collect "Code Coverage"'
  - task: SonarCloudAnalyze@1
    displayName: 'Run SonarCloud analysis'

  - task: SonarCloudPublish@1
    displayName: 'Publish results on build summary'
      pollingTimeoutSec: '300'

Hi Dave

As you have discovered the automatic collection of coverage is only supported on Windows. Microsoft have created a new tool that is cross-platform called dotnet-coverage and we have updated the documentation on how to set it up here

Hope that helps