Hi,
When we upgraded several projects from .NET Core 3.1 to .NET 6, code coverage is no longer shown in SonarQube UI for these upgraded projects.
The coverage reports are generated using coverlet dotnet tool:
Calculating coverage result...
Generating report '/azp/agent/_work/17/s/coverage.opencover.xml'
Generating report '/azp/agent/_work/17/s/coverage.json'
+--------------------------------------+--------+--------+--------+
| Module | Line | Branch | Method |
+--------------------------------------+--------+--------+--------+
| contract | 100% | 100% | 100% |
+--------------------------------------+--------+--------+--------+
| service | 25.43% | 5.43% | 43.28% |
+--------------------------------------+--------+--------+--------+
+---------+--------+--------+--------+
| | Line | Branch | Method |
+---------+--------+--------+--------+
| Total | 25.43% | 5.43% | 43.28% |
+---------+--------+--------+--------+
| Average | 62.71% | 52.71% | 71.64% |
+---------+--------+--------+--------+
Afterward SonarQubeAnalyze@4
task is executed and the logs show this:
INFO: Importing 3 Roslyn reports
INFO: Found 3 MSBuild C# projects: 1 MAIN project. 2 TEST projects.
INFO: Sensor C# [csharp] (done) | time=276ms
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report /azp/agent/_work/17/./s/coverage.opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: /azp/agent/_work/17/./s/coverage.opencover.xml
INFO: Coverage Report Statistics: 114 files, 0 main files, 0 main files with coverage, 114 test files, 0 project excluded files, 0 other language files.
WARN: The Code Coverage report doesn't contain any coverage data for the included files. Troubleshooting guide: https://community.sonarsource.com/t/37151
The confusing part is that the logs show 2 TEST projects and 1 MAIN project, but there is actually 1 MAIN project and 1 TEST project.
Our SQ instance is deployed to AKS using the official Helm chart and has 9.2.4.50792 version.
We are using the official SQ tasks in Azure DevOps YAML pipelines. Exactly the same YAML pipeline template is used both for .NET Core 3.1 and .NET 6 projects.
Please let me know if you need more information.