-
Notifications
You must be signed in to change notification settings - Fork 385
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
Negative sequence point coverage when line executions exceed int.MaxValue #1266
Comments
Thanks for reporting and thanks for the repro. 🙏 |
Mhh, we could change the tracker to stop tracking hits when public static void RecordHit(int hitLocationIndex)
{
if(HitsArray[hitLocationIndex] < int.MaxValue)
Interlocked.Increment(ref HitsArray[hitLocationIndex]);
} I just tested it with the repro provided by @Malivil and it would work. What do you think, @MarcoRossignoli @petli @tonerdo? Any other ideas for solutions? |
I prefer to avoid a new branch on the tracker...we're injecting it to probe and we'll slow down more tests, maybe we can try to move to |
An alternative is to translate negative numbers to |
Yep, if we're ok with int.MaxValue, @Malivil from your perspective does it make sense have "correct very huge value" there? I mean are you paying attention to that? |
I think that if you hit 31 bits you may be likely to hit 32 bits too, and then the only real solution would be to go to |
We're not paying attention to the number, specifically. As long as it's positive and it makes sense with the surrounding lines we wouldn't even notice. Keeping it at |
Then should we go with this solution? I could prepare a PR in the next days. |
@daveMueller looks like we're all in agreement for the translation, feel free to tackle it if you want! Thanks a lot! |
Package: coverlet.msbuild
Version: 3.1.0
Format: opencover
In a project where a particular line of code gets called a lot, the sequence point coverage value for that line can become negative if the line is hit more than
int.MaxValue
times. The value in the XML is negative and shows in the generated report as uncovered.I created a simple repro of this because I cannot show the actual code that caused the problem (it's from my job).
XML:
Report:
Repro code: https://github.com/Malivil/Coverlet1266Repro
The text was updated successfully, but these errors were encountered: