Skip to content

Incorrect branch coverage with .NET 472 #1167

Closed
@alessandroste

Description

@alessandroste

I am having issues with the branch coverage on a .NET 472 based project. In particular some awaited methods result in two or more branches in the coverage report. I was able to reproduce on a small scale here. The project on .NET standard looks good, but the project on .NET 472 results in some suspicious behavior.
The class is exactly the same, but the coverage is different.
image
image
The await on the semaphore await this.semaphore.WaitAsync(); results in two branches for .NET 472 and one branch for .NET standard, and the same happens to await Task.Delay(TimeSpan.FromMilliseconds(1));. In the second case, both the branches are visited, but, in the first case, only one is visited. This is probably related to the state machine of the task framework.
Is this something that can be solved on coverlet side? I tested with versions back to 3.0.1 and I see the same behavior.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions