Skip to content
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

Lambda expressions cause method to show null coverage #8

Closed
cabal95 opened this issue Jul 4, 2020 · 4 comments
Closed

Lambda expressions cause method to show null coverage #8

cabal95 opened this issue Jul 4, 2020 · 4 comments

Comments

@cabal95
Copy link

cabal95 commented Jul 4, 2020

First, thanks for the great tool! Not to put you out of business, but I hope Microsoft eventually builds something like this into VS for Mac directly. Until then, this has been great. Really helps when writing the tests to know that I'm not missing something in the method I'm testing.

Now for the issue. I'm not sure what to call it other than "null coverage". The method basically shows that the coverage tool doesn't really know about it. Nearly all lines are marked as neither red nor green. I've attached a small solution that demonstrates the problem.

If I comment out the indicated line with the lambda expression (in this case a Select() call), then everything works normally. I also tested with a simple Where() call instead and get the same results, so it doesn't seem to be the Select() call itself, but rather the lambda expression.

That said, I do have another method with a lamba/Where() call that does work - but it's also extremely simple method, only 3 lines, so this might be in combination with something else going on in this method, like the fact it's an async call.

Screen Shot 2020-07-04 at 2 18 46 PM

As you can see, the only line that the tool seems to think is actual code, is the one that causes the problem.

CoverageTest.zip

@ademanuele
Copy link
Owner

Hi.

Thanks for the issue and all the detail.

I will look into this at some point. However, it sounds like its probably an issue with the coverage gathering library itself, rather than my extension.

I have recently released a new version of the extension with the latest version of the coverage gathering library in.
That may fix the issue you are seeing.

@cabal95
Copy link
Author

cabal95 commented Jan 29, 2021

Thanks Arthur. I'll see if I can pull the latest version down and re-test and report back. It's been a while since I worked on the project where I first came across that.

Didn't realize you were using an internal library. If I can reproduce I'll see if I can get it reported on their tracker too.

@ademanuele
Copy link
Owner

Yeah the library that actually gathers the code coverage is Coverlet.

@cabal95
Copy link
Author

cabal95 commented Feb 5, 2021

@ademanuele The updated version of the plugin solved the issue. I did see on the Coverlet repo that there were lots of fixed issues related to Lambdas so they must have got it sorted in the library itself. Thanks again!

@cabal95 cabal95 closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants