I am performing SCA and code coverage of .NET core application from Azure Pipeline to SonarQube. Where I am able to generate the Open Cover after executing test cases and able to see the Code Coverage on Azure DevOps. But not able to See the Code Coverage percentage on SonarQube. Where I am able to see the " - " instead of percentage.
I have tried with Coverlet to generate the Code Coverage and added all the properties mentioned over there.
I am performing this for multiple Dot Net Core Applications but facing the issue for one application where I have followed the similar process for all the applications.
NOTE: I am able generate the report with name Opencover.xml having the Coverage data and able to see the result of the file on Azure DevOps Code Coverage tab but not able to see the result to the SonarQube. Where I am able to " - " instead of Numbers.
2025-02-07T06:31:11.4250219Z INFO: Sensor C# Tests Coverage Report Import [csharp]
2025-02-07T06:31:11.4266048Z INFO: Parsing the OpenCover report E:\*****\vsts-agent-win-x64-3.220.5\_work\41\s\Unittest\coverage.opencover.xml
2025-02-07T06:31:11.4930676Z INFO: Adding this code coverage report to the cache for later reuse: E:\*****\vsts-agent-win-x64-3.220.5\_work\41\s\Unittest\coverage.opencover.xml
2025-02-07T06:31:11.4978749Z INFO: Coverage Report Statistics: 20 files, 0 main files, 0 main files with coverage, 20 test files, 0 project excluded files, 0 other language files.
2025-02-07T06:31:11.5000804Z WARN: The Code Coverage report doesn't contain any coverage data for the included files. Troubleshooting guide: https://community.sonarsource.com/t/37151
2025-02-07T06:31:11.5001706Z INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=73ms
I have checked the URL that you have provided for Troubleshooting guide for .NET code coverage import where we have followed all the process which is required by using Open Cover.
Please find the attachment of the Azure Yaml where SonarQube is integrated and let me know the possible solutions for this. Azure.txt (6.2 KB)
extraProperties: "# Additional properties that will be passed to the scanner, \n# Put one key=value per line, example:\n# sonar.exclusions=**/*.bin\n#sonar.cs.opencover.reportsPaths=\"$(Build.SourcesDirectory)\\Unittest\\coverage.opencover.xml\"\nsonar.cs.opencover.reportsPaths=\"$(Build.SourcesDirectory)\\Unittest\\coverage.opencover.xml\"\nsonar.verbose=\"true\""
I’m not sure you’re passing the extra properties you think you are. You’ve double-quoted the whole value including linebreaks and comment markers (#). I suggest you clean that up, if only for your own sanity when you need to edit this later.
Beyond that, posting your yaml file doesn’t really address the problem cited in your log:
The Code Coverage report doesn't contain any coverage data for the included file