Code Coveage Does not Work! Help!

Hi,

No matter wat i try, i cannot get code coverage to work with latest SonarQube and .Net Core 3

  • I use a Linux based Build Agent.
  • Have the following commands sent in azure-pipeline.yaml
  - task: SonarQubePrepare@4
    condition: eq(variables['Build.SourceBranchName'], 'master')
    inputs:
      SonarQube: 'SonarQube-Services-Demo'
      scannerMode: 'MSBuild'
      configMode: 'manual'
      projectKey: 'SONAR-DEMO'
      extraProperties: | 
        sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/TestResults/Coverage/Reports/coverage.opencover.xml
        sonar.verbose=true
  - task: SonarQubeAnalyze@4
    condition: eq(variables['Build.SourceBranchName'], 'master')
    displayName: "SonarQube Analyze Code"

  - task: DotNetCoreCLI@2
    condition: eq(variables['Build.SourceBranchName'], 'master')
    displayName: "SonarQube Collect Code Coverage using Coverlet Coverage (Linux)"
    inputs:
      command: 'test'
      projects: '**/*/*.csproj'
      arguments: '/p:CollectCoverage=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/Reports/'

  - task: SonarQubePublish@4
    condition: eq(variables['Build.SourceBranchName'], 'master')
    displayName: "SonarQube Publish Report"
    inputs:
     pollingTimeoutSec: '300'

But on run, Coverlet returns:
image

When I look at the files(s) as there are 3 test projects for the 3 main projects in the solution, they are always empty.

Cmd line being executed in Azure:

/usr/bin/dotnet test /azp/agent/_work/10/s/source/demo.Tests/demo.Tests.csproj --logger trx --results-directory /azp/agent/_work/_temp /p:CollectCoverage=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=/azp/agent/_work/10/s/TestResults/Coverage/Reports/

Anyone have any ideas to what I am missing please?

@JayBird have you looked at the code coverage troubleshooting guide?