Open
Description
I have a project where I create some static classes to server as extensions for things like app startup configuration (builders)
If a line gets added to one of those static classes defining a private constant and coverlet is called from the command line the resuilting XML/JSON will not contain the code coverage for the entire project (this is a multi project solution, other projects do still show).
Steps to reproduce.
- Create a Project, run tests for a simple class on that project (ensure that tests coverage is in the output files)
- Create a static class in the project that constains a private const (does not need to referenced from anywhere)
public static class SameSiteCookiesServiceExtensions { private const SameSiteMode Unspecified = SameSiteMode.Unspecified; }
- Re run the test coverage
dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
Expected:
- The project that contains the public static class should still show up in the coverage.cobertura.xml and coverage.json outputs
Actual result:
- The project no longer shows in the output xml or json
I have managed to bypass the issue for now by replacing the
private const SameSiteMode Unspecified = SameSiteMode.Unspecified;
with
private static readonly SameSiteMode Unspecified = SameSiteMode.Unspecified;
but this is not ideal