Closed
Description
I have this C# code:
internal static class PolicyNames
{
public const string Read = nameof(Read);
public const string Write = nameof(Write);
[ExcludeFromCodeCoverage]
public static IEnumerable<string> All()
{
yield return Read;
yield return Write;
}
}
I use the NuGet package coverlet.collector
3.2.0, and I use dotnet test -c Release --collect="XPlat Code Coverage"
to generate the coverage reports.
Apparently my method All()
is still covered. If I move [ExcludeFromCodeCoverage]
over to the static class, then All()
is excluded (but also is the whole class).
Note: I opened this issue after writing this comment on another closed issue.