Skip to content

Wrong coverage for "await foreach" when method is generic #1210

@msallin

Description

@msallin

I'm using coverlet.msbuild v3.1.0 (and tried also with the current nightly build) and there is an uncovered statement reported.
image

I tried to reproduce it but I didn't managed to get an reproduction.
Any ideas what the problem could be and how I can provide an reproduction?

public class AsyncForeachReproduction { private static async IAsyncEnumerable<int> RangeAsync(int start, int count) { for (int i = 0; i < count; i++) { await Task.Delay(i); yield return start + i; } } public async Task Execute() { await foreach (var a in RangeAsync(1, 5)) { Console.WriteLine(a); await Task.CompletedTask; } await Task.CompletedTask; } }

Metadata

Metadata

Assignees

Labels

tenet-coverageIssue related to possible incorrect coveragewith reproIssue with repro

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions