LCOV report type empty when using C# code coverage JSON file
See original GitHub issueDescribe the bug I am currently having an issue where the produced lcov.info file is empty. The only content it has in it is a single line of text at the top that is TN.
I have a NET 5.0 library that I am running tests for using GitHub actions. Once the tests produce the coverage result in lcov format, I am pointing the reportgenerator to the produced coverage.json file created with the tests from the previous step.
I am trying to use the coverallsapp v1.1.2 GitHub action to pick up the lcov.info file and that is when coveralls reports back to me that it cannot parse the string. Upon investigation, revealed that the lcov.info file was empty.
coveralls error:

This is the unit testing section of my YAML
Run_Unit_Tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Execute Unit Tests
run: dotnet test "${{ github.workspace }}\\Testing\\CASLTests\\CASLTests.csproj" -c Debug-WIN /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOuputFormat=lcov
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.11
with:
reports: "**/TestResults/coverage.json"
targetdir: "${{ github.workspace }}\\Testing\\CASLTests\\TestResults"
reporttypes: lcov
- name: Publish Code Coverage Results
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
path-to-lcov: "${{ github.workspace }}\\Testing\\CASLTests\\TestResults\\lcov.info"
To Reproduce
-
Console output of ReportGenerator

-
Here is a zip with 2 files in it. The coverage.json files is the file produced by the dotnet cli. Of course the lcov.info file is produced by the report generator. GeneratedCoverageFiles.zip
To reproduce this, I simply ran the same commands that is being performed in the YAML file.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
Quick Update
So I was able to get the Cobertura.xml to not be empty by using a different command. I will admit that I do not understand why one works over the other and the reason or true difference between the 2, but it is working.
Old Command:
dotnet test "MyProject.csproj" -c Debug /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOuputFormat=coberturaNew Command:
dotnet test "MyProject.csproj" -c Debug --collect:"XPlat Code Coverage"This means that I did not need to use ReportGenerator at all. The new command simply generated the coverage.cobertura.xml file for me, which I had picked up by codecov.
I am good to go. Thanks for your help!! It led me in the right direction to solve the problem.
I just wanted to update this issue to hopefully help other people out.
Great that you found a solution.