Repository navigation
fix regression issue 2045 - #2046
Merged
Bertk merged 1 commit intoOct 3, 2026
Merged
Conversation
InstrumentType now detects local functions via IInstrumentationHelper.IsLocalMethod, and for those methods ignores CompilerGeneratedAttribute/GeneratedCodeAttribute when deciding exclusion (reusing the existing IsCompilerGeneratedOrGeneratedCodeAttribute helper), while still honoring any other user-configured exclude attribute (e.g. ExcludeFromCodeCoverage) applied directly to a local function.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches the reported regression and is adequately covered by the added test.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes issue #2045 by ensuring local functions remain instrumented when compiler-generated attributes are excluded.
Changes:
- Detects local functions before applying attribute exclusions.
- Preserves other explicit exclusion attributes.
- Adds a regression sample and unit test.
| File | Description |
|---|---|
src/coverlet.core/Instrumentation/Instrumenter.cs |
Adjusts local-function exclusion logic. |
test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs |
Adds regression coverage. |
test/coverlet.core.tests/Samples/Samples.cs |
Adds a representative local-function sample. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Bertk
added a commit
to Bertk/coverlet
that referenced
this pull request
Oct 14, 2026
InstrumentType now detects local functions via IInstrumentationHelper.IsLocalMethod, and for those methods ignores CompilerGeneratedAttribute/GeneratedCodeAttribute when deciding exclusion (reusing the existing IsCompilerGeneratedOrGeneratedCodeAttribute helper), while still honoring any other user-configured exclude attribute (e.g. ExcludeFromCodeCoverage) applied directly to a local function.
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InstrumentType now detects local functions via IInstrumentationHelper.IsLocalMethod, and for those methods ignores CompilerGeneratedAttribute/GeneratedCodeAttribute when deciding exclusion (reusing the existing IsCompilerGeneratedOrGeneratedCodeAttribute helper), while still honoring any other user-configured exclude attribute (e.g. ExcludeFromCodeCoverage) applied directly to a local function.