Lambdas in a method marked ExcludeForCodeCoverage are showing up in report
See original GitHub issueIssue:
Code that is in a function that has the [ExcludeFromCodeCoverage]
attribute but contains a lambda is getting picked up in the coverage when it should not be due to the attribute.
Toolset:
- .NET Core: 3.1
- Coverlet.Collector: 1.2.0
- ReportGenerator: 4.4.6
- Command:
dotnet test --collect:"XPlat Code Coverage" --settings code-coverage.runsettings
code-coverage.runsettings
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
<SingleHit>false</SingleHit>
<UseSourceLink>true</UseSourceLink>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Lambdas in a method marked ExcludeForCodeCoverage ...
Issue: Code that is in a function that has the [ExcludeFromCodeCoverage] attribute but contains a lambda is getting picked up in the coverage ......
Read more >C# - Exclude lambda expression from code coverage
I have marked the event with [ExcludeFromCodeCoverage] and that seems to exclude the event which in this case is what I wanted.
Read more >Add Test Coverage to your Serverless Applications
This detailed report will show our code (line-by-line) with execution counts and highlights showing us uncovered statements, branches, and ...
Read more >SonarQube for .Net project, code coverage not excluding file ...
Coding example for the question SonarQube for .Net project, code coverage not excluding file marked with "ExcludeFromCodeCoverage"-C#.
Read more >C# static code analysis: Methods without side effects ...
All<TSource> method should be used to determine if all elements satisfy a condition and not to change their state. Exceptions. This rule doesn't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The nightly build does fix the issue.
We should release at end of month https://github.com/tonerdo/coverlet/blob/master/Documentation/ReleasePlan.md#release-calendar