coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

No or incorrect coverage on expression body members

Open anddrzejb opened this issue 1 year ago • 0 comments

Describe the bug Seems to me there is a problem with covering expression body members. When I try to run coverage for them, there are often false partially covered lines, instead of all lines covered.

To Reproduce In the repro code there is a static class Mapper that contains 2 methods that are tested:

  • Mapper.MapConcise - uses expression body members
  • Mapper.MapVerbose - uses step-by-step approach

Both methods have exactly the same set of tests.

Expected behavior Both methods should generate 100% code coverage.

Actual behavior Only Mapper.MapVerbose produces 100%. The Mapper.MapConcise produces a lot of partially not covered lines: image

Configuration (please complete the following information): Please provide more information on your .NET configuration: * Which coverlet package and version was used? 6.0.2. * Which version of .NET is the code running on? .net8 * What OS and version, and what distro if applicable? Windows 11 10.0.22631 Build 22631 * What is the architecture (x64, x86, ARM, ARM64)? x64 * Do you know whether it is specific to that configuration? It is not specific to my configuration.

Additional context I have a very similar code run on azure devops with the same problem. The verbose code goes through without any problem, the concise is breaking my builds (I have 70% code coverage set with evaluation on changes only and it often blocks my CI).

anddrzejb avatar Jun 14 '24 20:06 anddrzejb