Skip to content

Conversation

MarcoRossignoli
Copy link
Collaborator

@MarcoRossignoli MarcoRossignoli commented Mar 7, 2020

Fixes #730

The issue is related to lambda cached fields, that triggers another issue on coverage calculation.
I've also refactored a bit GetBranchPoints to keep code flow clear.

cc: @matteoerigozzi can you take a look?

.AssertBranchesCovered(BuildConfiguration.Debug, (16, 0, 0), (16, 1, 1), (43, 0, 3), (43, 1, 1), (43, 2, 1), (43, 3, 1), (43, 4, 0))
// Real branch should be 2, we should try to remove compiler generated branch in method ContinuationNotCalled/ContinuationCalled
// for Continuation state machine
.ExpectedTotalNumberOfBranches(BuildConfiguration.Debug, 2);
Copy link
Collaborator Author

@MarcoRossignoli MarcoRossignoli Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed also this bug(from 4 down to 2 real branches)


// Unexpected branches - generated by compiler to cache delegate instance
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed also this bug

return false;
}

private static bool SkipLambdaCachedField(Instruction instruction)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key method

@MarcoRossignoli MarcoRossignoli added bug Something isn't working tenet-coverage Issue related to possible incorrect coverage labels Mar 7, 2020
Copy link
Contributor

@matteoerigozzi matteoerigozzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MarcoRossignoli MarcoRossignoli merged commit 39e9b10 into coverlet-coverage:master Mar 10, 2020
@MarcoRossignoli MarcoRossignoli deleted the skiplambdacachefield branch March 10, 2020 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tenet-coverage Issue related to possible incorrect coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coverage Incorrect for Async Method using Linq
2 participants