Skip to content

Collecting code coverage prevents all test discovery on net472 only #578

@AArnott

Description

@AArnott

This repros locally and in Azure Pipelines builds.

git clone https://github.com/AArnott/Xunit.StaFact.git
cd Xunit.StaFact\src
git checkout 6d1a5e6023f612ad00d2e00f5204f362dc0a71ce
dotnet test --filter "TestCategory!=FailureExpected" -v n /p:CollectCoverage=true

Notice how net472 runs 0 tests and reports:

+---------------+------+--------+--------+
| Module        | Line | Branch | Method |
+---------------+------+--------+--------+
| Xunit.StaFact | 0%   | 0%     | 0%     |
+---------------+------+--------+--------+

+---------+------+--------+--------+
|         | Line | Branch | Method |
+---------+------+--------+--------+
| Total   | 0%   | 0%     | 0%     |
+---------+------+--------+--------+
| Average | 0%   | 0%     | 0%     |
+---------+------+--------+--------+

While the netcoreapp targets report non-zero results:

+---------------+--------+--------+--------+
| Module        | Line   | Branch | Method |
+---------------+--------+--------+--------+
| Xunit.StaFact | 86.44% | 62.19% | 78.33% |
+---------------+--------+--------+--------+

+---------+--------+--------+--------+
|         | Line   | Branch | Method |
+---------+--------+--------+--------+
| Total   | 86.44% | 62.19% | 78.33% |
+---------+--------+--------+--------+
| Average | 86.44% | 62.19% | 78.33% |
+---------+--------+--------+--------+

In fact simply comparing the output of these two commands shows that the mere collection of code coverage is what blocks test discovery:

 dotnet test --filter "TestCategory!=FailureExpected" /p:CollectCoverage=true -f net472 
 dotnet test --filter "TestCategory!=FailureExpected" -f net472 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnetfxIssue happens only on .NET Framework versionstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions