Welcome Guest! To enable all features please Login or Register.



ExcludeFromCodeCoverage not working
#1 Posted : Monday, May 18, 2020 2:43:40 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/27/2020(UTC)
Posts: 6
Location: Brazil

Thanks: 1 times

I'm using ExcludeFromCodeCoverage over method and continue showing in NCrunchMetrics

public async Task<IActionResult> executemigration()
await _mongoDbContext.EnsureIndex();
return Ok();
#2 Posted : Monday, May 18, 2020 11:05:11 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,140

Thanks: 795 times
Was thanked: 1050 time(s) in 1000 post(s)
Hi, thanks for sharing this issue.

ExcludeFromCodeCoverage doesn't work here because at a physical level, the attribute doesn't get applied to the compiler-generated IL structure that comprises the async code block.

It is possible for us to fix this. However, we can't find a way of doing so that doesn't massively impact performance of the instrumentation .. such that the fix is worse than the problem.

VSTest has the same issue. I'm not aware of this attribute working in such a scenario with any other runner either.

I recommend using code coverage suppression comments instead.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.188 seconds.