-
Notifications
You must be signed in to change notification settings - Fork 392
Closed as not planned
Labels
needs reproNeeds repro to be investigated, cannot repro in localNeeds repro to be investigated, cannot repro in localstale
Description
I think there is a regression from #849 bug fix. We are using coverlet 3.1.2 running on .net 6. There is a method declared like this:
[ExcludeFromCodeCoverage]
internal virtual async Task<RedisValue[]> DoRedisExecuteAsync(IRedisClient redisClient, string scriptContents, RedisKey redisKey, long exclusiveUpperBound)
{
var result = await redisClient.ExecuteAsync(async database =>
await database.ScriptEvaluateAsync(scriptContents, keys: new[] { redisKey }, values: new RedisValue[] { exclusiveUpperBound })!
)!;
return (RedisValue[])result;
}When running unit tests and collecting coverage report, this method is still included in the report. Here is the relevant portion of the coverage report in different formats:
<class name="CollectiblesItemService.SerialExecutor.DataLayer.RedisSerialCounterRepository/<>c__DisplayClass10_0/<<DoRedisExecuteAsync>b__0>d" filename="services/collectibles-item-service/src/SerialExecutor/DataLayer/SerialCounter/RedisSerialCounterRepository.cs" line-rate="0" branch-rate="1" complexity="1">
<methods>
<method name="MoveNext" signature="()" line-rate="0" branch-rate="1" complexity="1">
<lines>
<line number="167" hits="0" branch="False" />
</lines>
</method>
</methods>
<lines>
<line number="167" hits="0" branch="False" />
</lines>
</class>FN:166,System.Void CollectiblesItemService.SerialExecutor.DataLayer.RedisSerialCounterRepository/<>c__DisplayClass10_0/<<DoRedisExecuteAsync>b__0>d::MoveNext()
FNDA:0,System.Void CollectiblesItemService.SerialExecutor.DataLayer.RedisSerialCounterRepository/<>c__DisplayClass10_0/<<DoRedisExecuteAsync>b__0>d::MoveNext()
DA:167,0
Line 167 is the await database.ScriptEvaluateAsync line from that method. Somehow that single line is declared as "not covered" instead of being excluded with the rest of the method.
It might have something to do with this line being async lambda which complies into a more complicated state machine.
Metadata
Metadata
Assignees
Labels
needs reproNeeds repro to be investigated, cannot repro in localNeeds repro to be investigated, cannot repro in localstale