Skip to content

C# record constructors are not covered when SkipAutoProps is true #1561

Closed
@jlawrence

Description

@jlawrence

Describe the bug
C# record constructors are marked as uncovered whenever SkipAutoProps is true. But if SkipAutoProps is false, the coverage is correct.

To Reproduce

  1. Create a file with a simple record
    public record MyRecord(int A);

  2. Create a test that constructs the record
    var myRecord = new MyRecord(1);

Minimal Example: https://github.com/jlawrence/coverlet-missing-line-example/tree/main

Expected behavior
The record constructor should be covered regardless of the value of SkipAutoProps.

Actual behavior
Observed behavior: If SkipAutoProps is true, the record constructor will not be covered. If it is false, the record constructor will be covered.

Configuration:
* Coverlet package: "coverlet.collector" Version="6.0.0"
* .NET 8
* Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwith reproIssue with repro

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions