Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
Code Coverage Markers Misaligned
stevehjohn
#1 Posted : Wednesday, May 30, 2018 3:17:01 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I'm experiencing an issue where the code coverage indicators are not aligned with the statements they cover. Has anyone else experienced this and know of a fix? I'm rather suspecting it might be related to CodeLens as that screws with the line spacing...

Can't really figure out how to add an image eaily here, so I tweeted.

Thanks,

Steve.
Remco
#2 Posted : Wednesday, May 30, 2018 9:15:56 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Steve, thanks for sharing this problem.

NCrunch has had this problem come up a few times in its history. I had hoped that we'd seen the last of it, but I guess that's not the case!

Is this a problem that you're seeing often or can reproduce at will?

The first thing we need to do is figure out where the desync is happening. This could be in the instrumentation, the engine, or the UI.

When the problem appears, does closing and re-opening the code window resolve it?
stevehjohn
#3 Posted : Thursday, May 31, 2018 8:14:57 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco,

Closing and re-opening the code window doesn't resolve it. Closing and re-opening the solution does seem to though...

If I can provide any further information to help, please let me know.

Thanks,

Steve.
Remco
#4 Posted : Thursday, May 31, 2018 9:24:25 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Steve,

Can you identify any pattern around what causes it? Does it happen very often?

If you're running the new build (v3.17), it would be really interesting if you could submit a bug report after it happens. The report might yield some clues as to what is going on.

Note that the bug reporter in v3.16 and earlier versions won't work as they don't contain the 'GDPR Checkbox'.
stevehjohn
#5 Posted : Thursday, May 31, 2018 10:09:53 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I'm currently running 3.16.0.1. Ah, good old GDPR...

I'll upgrade and keep you posted.

Thanks,

Steve.
stevehjohn
#6 Posted : Thursday, May 31, 2018 2:58:47 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

Just FYI, the problem has gone away since updating to the latest version. For now anyway.

Thanks,

Steve.
Remco
#7 Posted : Thursday, May 31, 2018 11:29:53 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks Steve. We didn't change anything in v3.17 that I expect would have solved this problem, so probably it will be back. Let me know if you find a way to reproduce it.
stevehjohn
#8 Posted : Friday, June 1, 2018 8:12:16 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Ok, will do.

Thanks,

Steve.
stevehjohn
#9 Posted : Friday, June 1, 2018 9:22:00 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
It's happening again. I'll submit a bug report.

Cheers,

Steve.
Remco
#10 Posted : Saturday, June 2, 2018 12:38:44 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks Steve. The report confirms that this isn't the result of a tragic and obvious malfunction, which is somewhat disappointing as it means this will be very hard to find.

I'll try to share with you the information I have on this problem in the hope that it might help you to narrow down what is causing it on your side.

- The problem happens as a result of an internal desync between the actual code positions and NCrunch's code coverage index
- It is not a visual/UI based issue, which means that this is happening in the engine itself
- It is not likely to be the downstream result of a separate issue (no exceptions appearing in the logs)
- It's been at least a couple of years since we last had a known and reported issue in this area
- The code responsible hasn't been touched for a year or more
- This leads me to believe there is something unique about your solution or environment that is surfacing the issue
- Previously, I have observed this issue appearing with tiny projects that have an unexpectedly fast build time. This was due to MSBuild's filestamp-checking cache system preventing the compiler from working correctly on rapidly repeated builds

Are you running any other 3rd party tools inside your IDE? Is there a particular project that seems to be singled out by this problem? Are you using distributed processing?
stevehjohn
#11 Posted : Saturday, June 2, 2018 12:53:22 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

Thanks for the analysis.

I'm running the latest version of Visual Studio and the only plugins other than NCrunch are ReSharper (with ReSpeller) and PowerMode.
It is quite a small project - it's an AWS Lambda, so essetially just one function with perhaps dependencies on about 3 other classes and the AWS SDK.

Don't know whether this helps you...

Thanks,

Steve.
Remco
#12 Posted : Sunday, June 3, 2018 12:57:09 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
I think that this problem may be related to an optimisation in MSBuild, where it doesn't update files unless they have a timestamp mismatched with the file being updated. I've seen this happen before when using high-end hardware on tiny projects with older versions of MSBuild (i.e. 2008, 2010), because the system runs the build so quickly that two different builds executed in sequence don't have enough of a gap for the timestamp to be separated, so the files don't get copied and the source code falls out of sync with the binaries.

This is all theory at this stage, because such a situation is so hard to reproduce that there isn't likely to be a way that I can confirm that it's happening for you. To be honest, it's been years since I've seen it happen.

However, if it IS the problem, then likely it will go away on it's own as you continue to add code to your project. All you need is the tiniest increase in your build time, and you'll never see it again.
1 user thanked Remco for this useful post.
stevehjohn on 6/3/2018(UTC)
stevehjohn
#15 Posted : Monday, June 4, 2018 2:54:46 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

The project has grown a little and that problem (seems) to have gone away for now.

I have noticed another issue though - the markers line up correctly when I open a file and then Code Lense kicks in adjusting the spacing between lines but the markers don't adjust.

Can tweet you a picture if you like.

Thanks,

Steve.
Remco
#16 Posted : Monday, June 4, 2018 10:19:50 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
There is a known issue where CodeLens changes the vertical size of some lines of code (notably the first line of constructors). This causes the NCrunch markers to look a bit out of place on these lines, as they are aligned with the top of the line rather than the bottom.

I've had a bit of a brainwave today and I think I may have found a way to fix this by aligning the markers to the bottom of the line instead. I'd like to dogfood this for a while before releasing it in case it breaks VS somehow, but I'm hoping that you'll see this out with the next version of NCrunch.
aylwyn
#13 Posted : Thursday, August 16, 2018 10:29:12 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/16/2018(UTC)
Posts: 1
Location: Australia

Remco;12255 wrote:
I think that this problem may be related to an optimisation in MSBuild, where it doesn't update files unless they have a timestamp mismatched with the file being updated. I've seen this happen before when using high-end hardware on tiny projects with older versions of MSBuild (i.e. 2008, 2010), because the system runs the build so quickly that two different builds executed in sequence don't have enough of a gap for the timestamp to be separated, so the files don't get copied and the source code falls out of sync with the binaries.

This is all theory at this stage, because such a situation is so hard to reproduce that there isn't likely to be a way that I can confirm that it's happening for you. To be honest, it's been years since I've seen it happen.

However, if it IS the problem, then likely it will go away on it's own as you continue to add code to your project. All you need is the tiniest increase in your build time, and you'll never see it again.


I'm also experiencing the same issue:

[img]http://www.dropbox.com/s/f9cwa5ti0ugdv94/NCrunchCoverageMarkersAlignment.PNG?raw=1[/img]

Sorry - can't seem to get the image to display - copy paste the URL in another window to view or click this link: screenshot of alignment issue

I also note that my solution, and in particular the project that this test is covering, is rather large so I suspect it's not the timing issue here.

I realise that this is a hard issue to solve for. More than anything just letting you know that there looks like a few of us out here having the issue. It's a bit of a shame as I'm trying to convince my client to purchase NCrunch for the dev team and this issue doesn't help my case. :( Overall though, I've been using NCrunch for years and think it's an awesome tool! #welldone

Cheers,

Paul
Remco
#14 Posted : Thursday, August 16, 2018 11:20:52 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
aylwyn;12547 wrote:

I also note that my solution, and in particular the project that this test is covering, is rather large so I suspect it's not the timing issue here.


This will almost certainly be something else, though probably it will likewise be hard to pin down and fix.

When you see this, would you mind submitting a bug report for me? The log may yield some clues as to what's happening here.

Does the problem disappear when you close and reopen the code window affected by it?

Also, do you have any third party VS extensions installed other than NCrunch?
chonuff
#17 Posted : Wednesday, November 28, 2018 9:48:00 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/28/2018(UTC)
Posts: 3
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I'm seeing the same thing as Remco with the latest build in VS2017 using CodeLens. I noted that the NCrunch markers are lined up properly initially, then the CodeLens information pushes the lines downward. Unfortunately, the NCrunch markers don't follow the lines.

Is it possible to maybe offer a way to refresh the markers on the screen without closing the file? That might get it to line up properly.
Remco
#18 Posted : Wednesday, November 28, 2018 11:55:06 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
chonuff;12859 wrote:
I'm seeing the same thing as Remco with the latest build in VS2017 using CodeLens. I noted that the NCrunch markers are lined up properly initially, then the CodeLens information pushes the lines downward. Unfortunately, the NCrunch markers don't follow the lines.

Is it possible to maybe offer a way to refresh the markers on the screen without closing the file? That might get it to line up properly.


I'm having trouble reproducing this issue. The Codelens 'lines' are usually represented in the IDE as just being a vertical extension to an existing code line (i.e. the code line is just made bigger), so I'm concerned about how this seems to be happening on some systems.

Does this happen consistently for you? Does disabling codelens resolve it? Are you running any other 3rd party VS extensions that might affect VS code rendering?

Technically, scrolling the code up and down should cause the markers to be re-rendered, but this won't rebuild the marker gutter container. Closing and reopening the file is the only way to completely reset things.

Am I correct in my understanding that this is an intermittent issue for you?
chonuff
#19 Posted : Thursday, November 29, 2018 12:05:48 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/28/2018(UTC)
Posts: 3
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Remco;12860 wrote:

I'm having trouble reproducing this issue. The Codelens 'lines' are usually represented in the IDE as just being a vertical extension to an existing code line (i.e. the code line is just made bigger), so I'm concerned about how this seems to be happening on some systems.

Does this happen consistently for you? Does disabling codelens resolve it? Are you running any other 3rd party VS extensions that might affect VS code rendering?

Technically, scrolling the code up and down should cause the markers to be re-rendered, but this won't rebuild the marker gutter container. Closing and reopening the file is the only way to completely reset things.

Am I correct in my understanding that this is an intermittent issue for you?


It happens consistently on certain files (I didn't find any that had issues that weren't repeatable), however you're absolutely right that scrolling seemed to fix the alignment issue. I also tried disabling CodeLens, and it rendered without issue. Upon re-enabling CodeLens, the issue returned.

Great to know simply scrolling with fix the issue. I will update if I find another instance where this doesn't fix things.
Remco
#20 Posted : Thursday, November 29, 2018 12:20:53 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
chonuff;12861 wrote:

It happens consistently on certain files (I didn't find any that had issues that weren't repeatable), however you're absolutely right that scrolling seemed to fix the alignment issue. I also tried disabling CodeLens, and it rendered without issue. Upon re-enabling CodeLens, the issue returned.

Great to know simply scrolling with fix the issue. I will update if I find another instance where this doesn't fix things.


If you have any luck in identifying what is special about these files and why it only happens for them, I'd really like to know. If I can reproduce the issue, maybe I can fix it for good :)

It's suspicious the way this has suddenly come up with a VS update. I wonder if it might be an internal issue inside VS itself. In which case it may even disappear on its own.
Users browsing this topic
Guest (2)
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.122 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download