Skip to content

Relax auto-property skip logic and improve coverage for records - #1941

Merged
Bertk merged 5 commits into
coverlet-coverage:masterfrom
Bertk:issue-1633
Jun 2, 2026
Merged

Bertk merged 5 commits into
coverlet-coverage:masterfrom
Bertk:issue-1633

Conversation

@Bertk

@Bertk Bertk commented May 21, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request addresses an issue with code coverage for C# records that do not have a primary constructor, and updates the logic for skipping auto-property assignments. The main focus is to ensure that records without primary constructors are correctly instrumented and covered, and to simplify the logic for skipping inline assigned auto-properties.

Test coverage improvements for records:

  • Added new test cases in Instrumentation.AutoProps.cs to cover records without primary constructors and abstract records, ensuring these scenarios are now properly handled and covered by instrumentation.

Logic simplification:

  • Simplified the SkipInlineAssignedAutoProperty method in CecilSymbolHelper.cs to only skip generated backing field assignments when skipAutoProps is enabled, removing unnecessary checks and making the logic clearer.

This PR is similar to #1761 but without refactoring.

Resolves issue #1633

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants