SonarCloud Code Coverage Drops to Zero

Hi,

as of today, I do see a drop to 0% code coverage. Is anyone else seeing this too?

Best regards
Norbert

4 Likes

@norberth I have the same issue on most of the build pipelines I am using. I noticed the MSBuild version changed from 4.10 and Using the .NET Framework version of the Scanner for MSBuild to 5.0 Using the .NET Core version of the Scanner for MSBuild.

We are using the built-in .NET Core task with the Command set to test and the arguments set to
--configuration $(BuildConfiguration) -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=$(Common.TestResultsDirectory) --logger:trx --results-directory $(Common.TestResultsDirectory) --collect "Code coverage"

Seems like the SonarScanner is not Fetching code coverage report information from TFS or Attempting to locate a test results (.trx) file eventhough multiple trx files are generated from the .NET Core test task

I also have the same issue after SonarScanner for MSBuild updated to 5.0.
In logs I cannot find anymore lines about Sensor C# Tests Coverage Report Import [csharp]

Same issue here. Code coverage dropped to zero overnight with Run Code Analysis task now reporting SonarScanner for MSBuild 5.0 instead of 4.10.

Are there any known workarounds?

Exactly the same issue here, once the sonar extension auto updated to 1.17.0, 0% code coverage.

Hi there,

Thanks for the feedback, iā€™m currently fixing this issue.

Sorry for the incovenience.

Mickaƫl

5 Likes

Hi there,

The extension has been updated (last version of the Prepare analysis configuration task should be 1.15.0), this should normally be fixed.

Can you please let me know if everything is back to normal for you ?
Thank you.
Mickaƫl

3 Likes

All seems good now, many thanks.

Hi,

The issue is now fixed for me with versions:

Version      : 1.15.0
SonarScanner for MSBuild 5.0.2

Thanks for the speedy response,
Seb

(Correct output now returned)

Attempting to locate the CodeCoverage.exe tool...
Attempting to locate the CodeCoverage.exe tool using setup configuration...
Attempting to locate the CodeCoverage.exe tool using registry...
Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Fetching code coverage report information from TFS...
Attempting to locate a test results (.trx) file...
Looking for TRX files in: F:\Azagent\A1\_work\153\TestResults, F:\Azagent\A1\_work\153\a\TestResults
The following test results files were found: F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35.trx
Absolute path to coverage file: F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35\In\[server]\[svc_acc]_[server] 2020-11-06 10_44_22.coverage
The following code coverage attachments were found from the trx files: F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35\In\[server]\[svc_acc]_[server] 2020-11-06 10_44_22.coverage
Not using the fallback mechanism to detect binary coverage files.
Executing file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35\In\[server]\[svc_acc]_[server] 2020-11-06 10_44_22.coveragexml F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35\In\[server]\[svc_acc]_[server] 2020-11-06 10_44_22.coverage
Working directory: F:\Azagent\A1\_work\153\a\TestResults\[svc_acc]_[server] 2020-11-06 10_44_35\In\[server]
Timeout (ms):60000
Process id: 12172
1 Like

Confirmed working with SonarCloudPrepare@1:

  • SonarCloudPrepare 1.15.0
  • SonarScanner for MSBuild 5.0.2

The issue was present when using:

  • SonarCloudPrepare 1.13.0
  • SonarScanner for MSBuild 5.0.0
1 Like

Working for me too. Thanks @mickaelcaro

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