Closed norbert-groen closed 5 months ago
We encountered the same problem. Our pipeline agents run inside container. Image from 15th of may (after patch tuesday) is fine. But with an image from 22th of may (after Build Event with VS 17.10.) we got the error message described above. Reverting to the previous image restored code coverage functionality.
Sonar is aware of codecoverage.exe deprecating and are migrating away of its using.
But is Microsoft too?
How to fix the code coverage in the CI pipeline? We are using: dotnet test --collect:"Code Coverage"
to collect and this is broken.
Can you please use this in AzDO and collect code coverage? Collect code coverage inside Azure DevOps Pipelines
I'm also seeing this error. All I'm trying to do is to run SonarCloudAnalyze in Azure DevOps pipeline like this:
- task: SonarCloudAnalyze@2
displayName: Sonar Analysis
I’m assuming that behind the scenes this uses the latest available version (17.10.0) But since I’m not using VisualStudioTestPlatformInstaller task or anything like that, I don’t know how to rollback from 17.10.0 to 17.9.0… Any suggestions?
Note that originally I used SonarCloudAnalyze@1 and that generated pipeline output like this:
Executing file C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:C:\a\3\s\TestResults\AzDevOps_aisar90cd000BJK_2024-06-05_13_02_40\In\aisar90cd000BJK\AzDevOps_aisar90cd000BJK_2024-06-05.13_02_41.cobertura.coveragexml C:\a\3\s\TestResults\AzDevOps_aisar90cd000BJK_2024-06-05_13_02_40\In\aisar90cd000BJK\AzDevOps_aisar90cd000BJK_2024-06-05.13_02_41.cobertura.xml
Working directory: C:\a\3\s\TestResults\AzDevOps_aisar90cd000BJK_2024-06-05_13_02_40\In\aisar90cd000BJK
Timeout (ms):60000
Process id: 5500
CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.
Process returned exit code -1
Coverage report conversion completed successfully.
##[error]Failed to convert the binary code coverage reports to XML. No code coverage information will be uploaded to the server (SonarQube/SonarCloud).
Check that the downloaded code coverage file (C:\a\3\s\TestResults\AzDevOps_aisar90cd000BJK_2024-06-05_13_02_40\In\aisar90cd000BJK\AzDevOps_aisar90cd000BJK_2024-06-05.13_02_41.cobertura.xml) is valid by opening it in Visual Studio. If it is not, check that the internet security settings on the build machine allow files to be downloaded from the Team Foundation Server machine.
Failed to convert the binary code coverage reports to XML. No code coverage information will be uploaded to the server (SonarQube/SonarCloud).
Then I switched to v2, which looks a little bit better, but ultimately still fails to upload code coverage to SonarCloud
Converting coverage file 'C:\a\14\s\TestResults\AzDevOps_aisar90cd000BJ6_2024-06-05_13_35_33\In\aisar90cd000BJ6\AzDevOps_aisar90cd000BJ6_2024-06-05.13_35_33.cobertura.xml' to 'C:\a\14\s\TestResults\AzDevOps_aisar90cd000BJ6_2024-06-05_13_35_33\In\aisar90cd000BJ6\AzDevOps_aisar90cd000BJ6_2024-06-05.13_35_33.cobertura.coveragexml'.
Coverage report conversion completed successfully.
##[error]Failed to convert the binary code coverage reports to XML. No code coverage information will be uploaded to the server (SonarQube/SonarCloud).
Check that the downloaded code coverage file (C:\a\14\s\TestResults\AzDevOps_aisar90cd000BJ6_2024-06-05_13_35_33\In\aisar90cd000BJ6\AzDevOps_aisar90cd000BJ6_2024-06-05.13_35_33.cobertura.xml) is valid by opening it in Visual Studio. If it is not, check that the internet security settings on the build machine allow files to be downloaded from the Team Foundation Server machine.
Failed to convert the binary code coverage reports to XML. No code coverage information will be uploaded to the server (SonarQube/SonarCloud).
As you can see it no longer complains about CodeCoverage.exe being deprecated and there is no process exit code -1. There’s even a line saying “Coverage report conversion completed successfully.” But then it fails again.
Any suggestions how to get it running in Azure DevOps pipeline like this?
There are two things here.
dotnet-coverage merge input.coverage --output-format cobertura --output converted.cobertura.xml
I would suggest you to create an issue in SonarCloud repo. They can answer what they are using and which component is failing in your scenario.
The new version (6) of the Sonar extension does not use the CodeCoverage anymore. So this issue can be closed.
Description
In our CI pipeline in Azure Devops (on premise), we use the latest stable Visual Studio test platform (currently 17.10.0): Although CodeCoverage states:
Azure Devops seems to use this tool. The code coverage is broken and does not represent proper coverage anymore. Another tool, that is using this tool, is Sonarqube (our code quality gateway). These errors appears:
and the gateway fails. This results in impossibility to merge code via pull requests, while the gateway is mandatory. Visual studio can interpret the coverage, but it doesn't represent the proper coverage.
Steps to reproduce
Use the latest stable version in a CI pipeline
and compare the code coverage against the same pipeline, but run with configuration:
Expected behavior
Good representation of code coverage. External tools should be able to interpret coverage results.
Actual behavior
Missing parts of coverage and external tools unable to interpret results.
Environment
Running agent on Windows: 10.0.17763 Current agent version: '3.225.2'