SonarCloud Coverlet code coverage not parsed

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used: MSBuild with extra options:
    sonar.cs.vscoveragexml.reportsPaths=$(Common.TestResultsDirectory)/**/coverage.opencover.xml
    sonar.sources=s/Backend
    sonar.tests=s/Specs
    sonar.verbose=true
  • Languages of the repository: C# (.NET)
  • SonarCloud project URL: SkalBiocontrole_BioConnect—Relatieregistratie (private)
  • Error observed:
DEBUG: Skipping the file (ID '3', path 'Backend/Skal.BioConnect.Relatieregistratie.Domain/Contracts/KvkApiContracts.cs', NO INDEXED PATH), line '300', visitCount '6' because file is not indexed or does not have the supported language.

[... similar messages repeated for different lines ...]

INFO: Adding this code coverage report to the cache for later reuse: /home/vsts/work/1/TestResults/coverage.opencover.xml
DEBUG: Analyzing coverage after aggregate found '0' coverage files.
DEBUG: The total number of file count statistics is '0'.
  • Steps to reproduce:

    1. Set up a C# project in Azure DevOps
    2. Configure code coverage analysis
    3. Run the build pipeline
    4. Observe that the coverage report is not parsed, despite files being indexed
  • Potential workaround: None identified yet. The file (KvkApiContracts.cs) is listed in the indexed files with a hash, but is still being skipped during coverage analysis. Tried workarround by mathching the filename to the index (s/) with an empty string, or with ‘./’ or just leaving it with the absolute path, non worked.

Additional notes:

  • The coverage tool is generating a report (coverage.opencover.xml), but the analyzer is not processing it correctly. The report is being placed under /TestResults
  • The main issue seems to be that files are being skipped due to being “not indexed or not having the supported language”, despite being in the list of indexed files.

Hey there.

You should never configure these when using the Scanner for .NET. Can you try removing them?