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

Notification

Icon
Error

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

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

Thanks: 1 times
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: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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: Newbie

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

Thanks: 1 times
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: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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: Newbie

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

Thanks: 1 times
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: Newbie

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

Thanks: 1 times
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: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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 01, 2018 8:12:16 AM(UTC)
Rank: Newbie

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

Thanks: 1 times
Ok, will do.

Thanks,

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

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

Thanks: 1 times
It's happening again. I'll submit a bug report.

Cheers,

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

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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 02, 2018 12:53:22 PM(UTC)
Rank: Newbie

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

Thanks: 1 times
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 03, 2018 12:57:09 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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
#13 Posted : Monday, June 04, 2018 2:54:46 PM(UTC)
Rank: Newbie

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

Thanks: 1 times
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
#14 Posted : Monday, June 04, 2018 10:19:50 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,234

Thanks: 691 times
Was thanked: 843 time(s) in 803 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.
Users browsing this topic
Guest
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.071 seconds.