-
Notifications
You must be signed in to change notification settings - Fork 386
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
Double-digit losses of coverage using coverlet.msbuild 3.0.0 #1037
Comments
Just tested V3 on my repo and seeing the line coverage drop from 4027 to 2100 (of 4085) using Branch coverage remains the same. This is a private repo, so I cannot share details. I'm looking at the HTML in Some of the methods have "random" missing blocks - I cannot determine a pattern for the lines missed, but this is one generic example: This is fully covered in 1.3.0 |
Looks like line coverage has been affected where the "logical code line" spans over more than one line in the source file, such as a multiple-line constructor initializer: var foo = new Bar()
{
Baz = "qux"
}; |
Thanks for reporting this. We'll take a look asap. |
Yeah, that seems to be the case now you mention it, it is obvious :D |
Weird, we had some guys using nightly and this issue wasn't reported and also strange for UTs. |
cc: @daveMueller is you have some fast idea. |
I've found the same issue in several of my projects, for example, JSkimming/Castle.Core.AsyncInterceptor#119 Here's the coverage report for reference: https://2024-60778941-gh.circle-artifacts.com/0/Report/index.html |
If you can confirm the issue with a small repro could be great(like the above done by Martin) |
@MarcoRossignoli I may have time to create something small later today, though JSkimming/Castle.Core.AsyncInterceptor#119 could be exactly what you're looking for. It's only 5 classes, and it had 100% coverage until this update, so every instance where it's missing coverage is an instance of this issue. There's also a simple bash script (coverage.sh) to execute the tests and produce the coverage report in the root. |
I couldn't reproduce this with the multiple-line constructor initializer. I also tested the multi-line initializer within generated IL methods but this also worked. I will try to look into the repo @JSkimming mentioned later that day. Sorry for not find a fast solution. |
np at all, thx for your invaluable help! |
I created a repo with four reproduction cases using coverlet.msbuild 3.0.0 https://github.com/Malivil/Coverlet300Repro Run the GenerateCoverageReport.bat in Coverlet300ReproTests |
I did also verify it is unrelated to the SkipAutoProps flag and also unrelated to my recent upgrade to .Net 5 (The only two things that I changed other than updating Coverlet) |
@daveMueller pretty sure the regression was introduced with this one #1006 we should try to revert for fast check. |
If it matters, I'm using .NET 5.0.101 SDK and building netcoreapp3.1... |
I tried .Net 5.0.101 SDK and building netcoreapp3.1 as well as net5.0 I did not try with the .Net 3.1.x SDK though |
I actually did run into this with the nightly and meant to report it but was going to try to put a repro sample together first. Sorry about that. |
Oh no problem at all...I'm curious to know, we have some UT's with multiline and lambda etc(like David sample above) so it's weird we didn't catch before. Anyway np we'll fix it. |
@MarcoRossignoli I guess i found the issue and as you assumed it is related to #1006. Here coverlet/src/coverlet.core/Coverage.cs Lines 397 to 404 in d43f83d
we don't consider the
and it seemed to work. I will double check this tomorrow and create a PR. This would also explain why we didn't see this in our UT because there is only one class loaded per test. I hope this is the only issue and I don't find other problems tomorrow. Thanks @Malivil for the great repro. I compiled my 'quick' fix and tested it on the project. |
Glad to be of assistance, more glad that you found the cause =) |
Good catch @daveMueller!
And attach the three packages to this issue? I expect a package with "preview" tag on version.
😢 |
The same issue for .NET 5 after updating coverlet to 3.0.0 - coverage is 20% less than for 2.9.0 (json, opencover, coberture report types). FineCodeCoverage (https://github.com/FortuneN/FineCodeCoverage) shows correct coverage. |
FineCodeCoverage installs an old version by default but will use a newer version if you update the coverlet tool yourself. If you were to update the tool it would show the same coverage problem. |
Sorry for the late response but now here I have attached the packages with the potential fix. Would be cool if someone could test this and give some feedback. 😏 |
@daveMueller I've just tried it on Castle.Core.AsyncInterceptor and it looks like you've fixed the issue: 100% (328 of 328), whereas 3.0.0 counted 89% (196 of 220). Here's the output.
Interestingly, the numbers are now much closer to OpenCover (I used this before coverlet) which counts 100% (333 of 333). |
Thanks @JSkimming for the fast test @daveMueller open the PR that we'll discuss the fix. |
Using the
So that actually improves on the previous coverage in the |
I'm seeing good results with the 3.0.1 preview as well 2.9.0 - 92.2% (1726 of 1871) EDIT: Disregard my previous edit - I'm dumb =) |
Thanks to super @daveMueller this fix tomorrow will be on nightly https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md |
Bug is closed, but update is still not available from nuget package manager in VS - when will it be added? |
Just released new version with fix to nuget.org |
@ulrichb can you open a new issue and provide a small repro? |
Using the Following Packages on my Source Generator Tests produce the following Results:
|
@AraHaan are you using the collector integration? If not that can be the issue as it's a known one https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md |
I discovered the issue, the source generator known as: Microsoft.CodeAnalysis.ResxSourceGenerator generates it's code without the My issue will now be able to be fixed with: dotnet/roslyn-analyzers#5959 |
In multiple projects' dependabot updates to coverlet.msbuild from 2.9.0 to 3.0.0, there is a double-digit loss of apparent code coverage with zero other changes.
This seems to me like a bug of some kind, rather than a bug fix of aberrant data in a previous release, but if it genuinely is a reflection of true metric misreporting in v2 then fair enough.
Here are links to the generated pull requests and their respective drop in coverage for investigation:
The text was updated successfully, but these errors were encountered: