I am using SonarScanner for Azure DevOps extension and followed this documentation https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-azure-devops/ to setup my first build integration.
I have a MSBuild task that builds a .Net Framework solution and a VsTest (2019) task to run NUnit with code coverage enabled and I see no errors being reported by the build.
The log from the VsTest task includes this:
... Results File: c:\agent\_work\_temp\TestResults\auser_bld-vm_2020-09-21_18_08_09.trx Attachments: c:\agent\_work\_temp\TestResults\ceb8b574-c5a2-4d72-b511-57ceaae237f1\auser_bld-vm 2020-09-21 18_07_54.coverage Test Run Successful. Total tests: 4 Passed: 4 Total time: 16.4561 Seconds Vstest.console.exe exited with code 0. **************** Completed test execution ********************* Test results files: c:\agent\_work\_temp\TestResults\auser_bld-vm_2020-09-21_18_08_09.trx ...
In the Run Code Analysis task I see this in the logs that seems to suggests the coverage report was imported into SonarCloud successfully as I presume the .coveragexml was found (or it would raise an error):
... INFO: Importing 6 Roslyn reports INFO: Sensor C# [csharp] (done) | time=9674ms INFO: Sensor C# Tests Coverage Report Import [csharp] INFO: Parsing the Visual Studio coverage XML report c:\agent\_work\_temp\TestResults\ceb8b574-c5a2-4d72-b511-57ceaae237f1\auser_bld-vm 2020-09-21 18_07_54.coveragexml INFO: Adding this code coverage report to the cache for later reuse: c:\agent\_work\_temp\TestResults\ceb8b574-c5a2-4d72-b511-57ceaae237f1\auser_bld-vm 2020-09-21 18_07_54.coveragexml INFO: Coverage Report Statistics: 174 files, 171 main files, 171 main files with coverage, 3 test files, 0 project excluded files, 0 other language files. INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=1762ms INFO: Sensor Zero Coverage Sensor INFO: Sensor Zero Coverage Sensor (done) | time=114ms INFO: SCM Publisher is disabled ...
I also see in the build summary page the code coverage results file, but in the SonarCloud project I see 0.0% code coverage being reported.
Any advice of what I should check in order to find a resolution to this problem?