Assembly marked as ExcludeFromCodeCoverage is not excluded
See original GitHub issueDescription When an assembly decorated with ExcludeFromCodeCoverage attribute, it is not excluded from coverage report.
Repro steps Example code:
using System.Diagnostics.CodeAnalysis;
using System
[assembly: ExcludeFromCodeCoverage]
namespace ExampleNs
{
public class ExampleClass:
{
public Guid Id { get; set; }
}
}
Expected behavior Assembly is excluded from the coverage report
Actual behavior Assembly is included in the coverage report
Known workarounds Passing the assembly with --exclude “[Assembly]*” works
Related information Cross platform .NET Core code coverage tool version 1.3.0.0 Visual Studio Version: Visual Studio Professional 2017 Microsoft ® Test Execution Command Line Tool Version 15.9.0 Test project build with .Net Core 2.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:15
Top Results From Across the Web
How to specify ExcludeFromCodeCoverage at assembly ...
This works in at least .NET 6 and .NET Standard 2.1. It definitely doesn't work in .NET Standard 2.0 as the [ExcludeFromCodeCoverage] attribute ......
Read more >ExcludeFromCodeCoverageAttri...
Initializes a new instance of the ExcludeFromCodeCoverageAttribute class. Properties. Justification. Gets or sets the justification for excluding the member ...
Read more >Code Coverage doesn't take into account the ...
Currently I have a class under test where the whole class is marked with [ExcludeFromCodeCoverage]. i do have a couple of unit tests...
Read more >C# static code analysis: "ExcludeFromCodeCoverage" ...
The ExcludeFromCodeCoverageAttribute is used to exclude portions of code from code ... It is a bad practice to retain code that is not...
Read more >How to exclude code from code coverage
The easiest way to exclude code from code coverage analysis is to use ExcludeFromCodeCoverage attribute. This attribute tells tooling that class ...
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
@tonerdo I re-opened this issue, I think we should support this behaviour because it’s a default for most coverage tools. If you don’t agree please let me know. @petli what do you think?
@tonerdo it’s a pity. I want to define all my exclusions in code, so that different code coverage tools can reuse them.