For dotnet: opencover and sonarcloud still working? or should we switch to altcover?

Hello,
Sonarcloud is not detecting our coverage reports for sometime now. I’ve run into this issue where it says sonar-dotnet is switching to altcover? Would switching to altcover in our environment make our coverage processed by sonarcloud?

  • ALM used: Github
  • CI system used: Github Actions (runs-on: windows-latest)
  • Scanner command used: dotnet test test/PanjurUserApi.Tests.Application --settings test/PanjurUserApi.Tests.Application/coverlet.runsettings --configuration Release --verbosity normal -r=TestResults --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
  • Languages of the repository: c#

Hey there.

This ticket specifically relates to what coverage tool the analyzer itself is using (for the analyzer code).

OpenCover is still supported by SonarCloud (see the docs on .NET Test Coverage).

If you’re facing trouble importing your coverage reports, I suggest you start by looking in the logs:

Okay we solved this issue. The issue was with dotnet 7 “-r” is not used for results directory anymore. The new argument is : --results-directory

Since we were using github action yaml with “latest” windows argument, our github action switched to a windows version with dotnet 7.

If anyone else has this problem there are two things you need to do.
Setup a global.json in your .net repo to specify which dotnet version you want your project to be compiled with.

Also, in your github action you will need to get that specific dotnet version:

      - uses: actions/setup-dotnet@v3
        with:
          dotnet-version: 6.0.x
      - name: Check default dotnet version
        run: dotnet --version
1 Like

Thanks a lot for your follow-up!

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