sonar.cs.vstest.reportsPaths does not seem to work Azure Devops

I have the following build definition in my yaml pipeline.

  • task: SonarCloudPrepare@1
    inputs:
    SonarCloud: ‘myorg SonarCloud’
    organization: ‘myorg’
    scannerMode: ‘MSBuild’
    projectKey: ‘my project key’
    projectName: ‘My Project’
    extraProperties: |
    sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx

This does not seem to generate any coverage results. I have verified that the trx file is generated in the directory. On the branch summary it still says.

Coverage
A few extra steps are needed for SonarCloud to analyze your code coverage

Any idea why this does not work? Thanks.

This could also be this issue coming up again. https://community.sonarsource.com/t/re-short-lived-branch-analysis-does-not-work-using-azure-dev-ops/90840/17. When I reverted my build file to use open cover the same thing is happening. It appears that the coverage on the short lived branch may not be getting updated.

After more investigation it appears that neither sonar.cs.vstest.reportsPaths or sonar.cs.opencover.reportsPaths properties are working. I see messages in the build output that looks like it is parsing the file. However there is a warning. This warning appears in previous builds that did show coverage. It appears this is something that was recently broken.

 Parsing the OpenCover report ...
WARN: Invalid data found in the coverage report, please check the debug logs for more details and raise an issue on the coverage tool being used.
INFO: Coverage Report Statistics: 1511 files, 1511 main files, 1511 main files with coverage, 0 test files, 0 project excluded files, 0 other language files.

Hey @groogiam

Are you seeing this only on PRs with 0 new lines? See the post here:

@Colin It looks like this is the case. After running a couple more PR’s through it does appear the coverage is being set when actual code is changed. Thanks for the quick response.

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