No Coverage information reported in GitHub Comment

I have setup Code Analysis and Code coverage as follows:

.sonar/tools/scanner/dotnet-sonarscanner begin /k:"******" /o:"******" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.projectBaseDir=/home/runner/work/amazon/amazon /d:sonar.exclusions=**/bin/**/*,**/obj/**/*,**/tmp/**/* /d:sonar.cs.dotcover.reportsPaths=/home/runner/work/amazon/amazon/**/*.html /d:sonar.verbose=false
dotnet build ClientPortal.sln --configuration Release
.sonar/tools/dotCover/dotnet-dotcover test -c Release --dcReportType=HTML --dcFilters="-:type=Humanizer.*;-:type=AngleSharpWrappers.*;-:type=FluentValidation.*;-:type=Microsoft.*;-:type=Bunit.*;-:type=Serilog.*" --no-build UnitTests.sln
.sonar/tools/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

Job finishes and says successful. Comment is added to the PR but the comment says No Coverage information

Dashboard shows coverage

I also have the project set to require 80% coverage and its not failing.

Hey there.

It looks like coverage is being read correctly, as the Estimated after merge figure is available in the SonarCloud PR.

If all you have changed in this pull request is configuration to product the coverage, then there are probably no lines that can be covered by tests in this pull request, so there’s no coverage information that can be shown.

Is there other code changed in this pull request, or just pipeline configuration?

Just pipeline. So you are saying that the analysis of the WHOLE project, is only looking at coverage of the code in the PR?

How do I fail if a PR takes overall coverage below a threshold?

In most cases, a PR will fail on New Code conditions preventing new code that is not covered from entering the main branch.

This doesn’t cover the case where a PR removes a bunch of tests, or example, and brings down your project’s overall coverage. We don’t have a good answer for that yet. :confused: