Coverage report cannot be located, despite existing

  • ALM used : Azure DevOps

  • CI system used : Azure DevOps - Bash script running on Ubuntu

  • Scanner command used : dotnet sonarscanner begin -o:"****" -k:WindwardAdapter.API -d:sonar.host.url="https://sonarcloud.io" -d:sonar.token="****" -d:sonar.projectBaseDir="$(pwd)/" -d:sonar.cs.vscoveragexml.reportsPaths="WindwardAdapter.UnitTests/TestResults/**/*.coverage"

  • Languages of the repository : C#

  • Error observed : WARN: Could not find any coverage report file matching the pattern 'WindwardAdapter.UnitTests/TestResults/**/*.coverage'

I cannot get sonar to detect my coverage file, despite trying all conceivable options to provide its location.

its actual location (guid is variable):
“/home/ben/buildagents/agent1/_work/1001/s/Softsure.Microservices/Communication/Microservices.WindwardAdapter/WindwardAdapter/WindwardAdapter.UnitTests/TestResults/e96bd7e2-7a95-47c1-b87a-d684f1264544/IntegrationTests.coverage.coverage”

the directory of the sonar execution is :
/home/ben/buildagents/agent1/_work/1001/s/Softsure.Microservices/Communication/Microservices.WindwardAdapter/WindwardAdapter

The format of the coverage file is VS Coverage XML , despite the file extension being .coverage (it is not binary)

I’ve tried Four different options for the vscoveragexml.reportsPaths , all without success

Could not find any coverage report file matching the pattern 'WindwardAdapter.UnitTests/TestResults/**/*.coverage'.

Could not find any coverage report file matching the pattern '**/WindwardAdapter.UnitTests/TestResults/**/*.coverage'.

Could not find any coverage report file matching the pattern '/WindwardAdapter.UnitTests/TestResults/**/*.coverage'

Could not find any coverage report file matching the pattern '/home/ben/buildagents/agent1/_work/1001/s/Softsure.Microservices/Communication/Microservices.WindwardAdapter/WindwardAdapter/WindwardAdapter.UnitTests/TestResults/**/*.coverage'.
its worth adding that some of the options do work when running on Windows Subsystem for linux , but not on Ubuntu.

Hi,

I’ve seen in some other threads recently that explicit specification of sonar.projectBaseDir can throw things off. Since you’re specifying the default value, can you try again without that parameter?

And if that still doesn’t work, can you give us the full, debug log, please?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Thx,
Ann

Thank you Ann.

I resolved the issue by wildcarding everything beside the file extension.

sonar.cs.vscoveragexml.reportsPaths=“**/*.coverage”

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.