coverlet: lcov file is empty when using C# source generator

I’ve been using Coverlet with Coveralls on my project for a long time. I don’t know when it started happening but now the report only includes methods from a dependent project.

I’m using the latest versions of xunit, Microsoft.NET.Test.Sdk, and coverlet.collector. I’m using net5. 0.

In the command line I’m typing: dotnet test ./NetFabric.Hyperlinq.UnitTests/NetFabric.Hyperlinq.UnitTests.csproj -f:net5.0 -c:Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings --diag:log.txt

The coverlet.runsettings file only has the following:

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat code coverage">
        <Configuration>
          <Format>lcov</Format>
          <!-- <Include>[NetFabric.Hyperlinq]*</Include> -->
          <!-- <Exclude>[NetFabric.Assertive]*</Exclude> -->
          <UseSourceLink>true</UseSourceLink>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

In the generated logs I can see references to the classes of my main project but they keep not showing up in the coverage.info file.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22

Most upvoted comments

Glad it worked, @potatopeelings! Those files end up in the obj directory so they can be inspected to aid in tracking down issues with the generated code.

Sorry for delay @aalmada super busy period, anyway should work also with vstest, I’ll keep this open for future investigation