-
Notifications
You must be signed in to change notification settings - Fork 388
Fix false negative with "/p:MergeWith" async/await branches #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix false negative with "/p:MergeWith" async/await branches #277
Conversation
Codecov Report
@@ Coverage Diff @@
## master #277 +/- ##
=========================================
- Coverage 89.37% 87.5% -1.88%
=========================================
Files 16 16
Lines 1949 2041 +92
=========================================
+ Hits 1742 1786 +44
- Misses 207 255 +48 |
I would extract the logic to a method in a new class not to have duplicated code here and in Coverage.cs :) |
Logic is the same but objects and place are different, Branch vs BranchInfo, different collections objects and different if conditions. I'll try to understand if I can dedup. |
@MarcoRossignoli I slightly modified the project that I sent you earlier in the issue #275 and the same seems to happen. I'll post it in the issue for you to take a look |
EDIT: Skip this message, I changed strategy |
@MarcoRossignoli |
In past I only exposed |
@pape77 have you tried if this fix works? |
@MarcoRossignoli yes! Works for me. I'm using it in my own fork of coverlet ;) |
@pape77 are there any noticeable regressions in other branch related functionality? |
The only regression I could see is more memory pressure due to instrumentedResult.AsyncMachineStateMethod string list(one record for every async/await method more or less), because to avoid to "search" method(too slow to me) I use a memory list cache, another approach could be write to file and check on it(but more plumbing and maybe slower than memory approach).
I'll take a look! |
@tonerdo not that I noticed. We use this for several projects at my work. Everything looks great now |
@MarcoRossignoli seems you need to fix a rebase. Will merge once that's done. Sorry for the delay on this |
Merged
No problem!Thank's again for coverlet! |
Did this change get in the 2.5.1 release on NuGet? I still seem to have missing branch coverage on my await statements |
@topres I think so https://github.com/tonerdo/coverlet/releases https://github.com/tonerdo/coverlet/blob/master/coverlet.msbuild.nuspec#L5 |
fixes #275
Similar issue fixed in #158
If we use merge options we need to remove uncoverable branch of async state machine.
For instance if we have 2 different tests project, and first test project doesn't cover async call but the second one yes we end with this situation:
we call branches b1 and b2 and we have(hints)
for first test b1 = 0 b2 = 0
for second test b1 = 1 and b2 = 0 -> in this case we remove b2 because false negative, it depends on async or sync execution(#158)
So if we merge results we have b1 = 1 and b2 = 0 and we need to remove b2 = 0 because will never be covered, it depends on async/sync execution.
Here you can find repro project(thank's to @pape77) https://github.com/MarcoRossignoli/marcorossignoli.github.io/tree/master/src/coverlet/Issue1
before fix
after fix
/cc @tonerdo @pape77 @kevindqc