Description
I wrote a method in which there was an await
statement in a finally
block. The code was fully covered, but Coverlet reported an uncovered branch at the end of the finally
block. I had a few things going on in that method -- ConfigureAwait
was used in multiple places, there were multiple await
statements in the finally
block, including one in an if
statement -- but I was able to narrow the problem down to something much simpler.
Suppose that we have these methods:
Suppose, also, that we have one test that calls into them, which should fully cover them, since there's no (user-written) branching logic in the code under test:
If I run that test under Coverlet 3.1.0 (in .NET 5 or .NET 6 RC 1), here's what I see:
The missing branch coverage is here (which turns out to be the curly brace closing the finally
block):
This is the IL instruction that's left uncovered:
I will attach a repro solution, as well.
Many thanks!