coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.93k stars 385 forks source link

No or incorrect coverage on expression body members #1666

Open anddrzejb opened 2 weeks ago

anddrzejb commented 2 weeks ago

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:

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:

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).