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

Notification

Icon
Error

Base class is not showing any code coverage
nCubed
#1 Posted : Sunday, October 29, 2023 3:22:25 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/1/2012(UTC)
Posts: 22
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Win 10 Pro
VS 2022 Enterprise (v17.7.5)
NCrunch 4.18.0.3
.net6.0

I have an abstract base class that is being inherited by two other classes. Everything in the derived classes correctly show the NCrunch code coverage. However, the base class shows zero code coverage.

I've gone through the documentation for missing code coverage. Deleted the NCrunch cache. Rebuilt the project multiple times. Still no go.

Any suggestions?
Remco
#2 Posted : Sunday, October 29, 2023 11:36:17 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

Can you confirm whether the black/white markers are showing on the base class with the missing coverage? (relevant as it determines whether the type is instrumented correctly).

If you run the covering tests under NCrunch with a debugger attached, do breakpoints trigger on the code in the base class?
nCubed
#3 Posted : Monday, October 30, 2023 12:02:49 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/1/2012(UTC)
Posts: 22
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
And just like that the code coverage markers are back again; similar to another user's post a bit ago. FWIW: in the time I had posted the original message, I had done a complete system shutdown and reboot.

To answer your question, there were no markers. Just the standard VS gutter. Thanks!
Remco
#4 Posted : Monday, October 30, 2023 4:58:22 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
nCubed;16897 wrote:
And just like that the code coverage markers are back again; similar to another user's post a bit ago. FWIW: in the time I had posted the original message, I had done a complete system shutdown and reboot.

To answer your question, there were no markers. Just the standard VS gutter. Thanks!


I think this is a UI refresh issue.

If you see this again, can you try closing the source file and re-opening it in VS? This will force the gutter to be rebuilt and re-mounted.

I have seen the above issue before but have yet to track it down.
nCubed
#6 Posted : Tuesday, October 31, 2023 11:40:39 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/1/2012(UTC)
Posts: 22
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Was thinking about this and thought I could provide some additional information that may help you:

  • Engine Mode: Impacted Tests only, with a filter to exclude some projects not referenced by this project
  • Only consider tests 'Out of date' if they are 'impacted' = true
  • Base class did not initially exist
  • Created a new class and refactored an existing class' methods to be used in the new class and existing class w/ the base class
  • Add the base class to the new class and existing class
  • Continued to extract methods off of existing class
  • It was at this point where I noticed the base class was not getting any code coverage

Hope this helps in some way. Thanks!
Remco
#7 Posted : Tuesday, October 31, 2023 11:44:47 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks! Can you confirm whether your refactoring was done manually or with a tool? (i.e. VS built-in refactorings or Resharper)
nCubed
#8 Posted : Wednesday, November 1, 2023 12:16:17 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/1/2012(UTC)
Posts: 22
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Remco;16907 wrote:
Thanks! Can you confirm whether your refactoring was done manually or with a tool? (i.e. VS built-in refactorings or Resharper)


As this was simply moving methods from the original class and into the new base class, most everything was manual. There may have been some minor renaming assistance from R#; but I don't really recall.
1 user thanked nCubed for this useful post.
Remco on 11/1/2023(UTC)
nCubed
#9 Posted : Friday, November 10, 2023 7:35:22 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/1/2012(UTC)
Posts: 22
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Just ran into the same issue. But different scenario. About the best I can recall:
* add new base class
* create new derived class in another project
* in derived class, split the window in VS (pull down from the top of the scroll bar to split horizontall)

The bottom window showed code coverage; not sure if the top did. But I collapsed the bottom split and all the code coverage was gone. I'm thinking this same scenario may have occurred when I first reported it, re: splitting the window horizontally using the scroll bar tool. Does that make sense?
Remco
#10 Posted : Friday, November 10, 2023 10:11:17 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
nCubed;16927 wrote:
Just ran into the same issue. But different scenario. About the best I can recall:
* add new base class
* create new derived class in another project
* in derived class, split the window in VS (pull down from the top of the scroll bar to split horizontall)

The bottom window showed code coverage; not sure if the top did. But I collapsed the bottom split and all the code coverage was gone. I'm thinking this same scenario may have occurred when I first reported it, re: splitting the window horizontally using the scroll bar tool. Does that make sense?


This issue is one that I can explain :)

We don't support the split windows in VS. I know it feels cheap and nasty that we don't do this, but after reviewing what we needed to do to get this to work, it didn't seem worth handling it as it would make our VS integration much more brittle. If you split a window vertically or horizontally, you'll only get the NCrunch markers on one side of the split. When the split is removed, you may need to close and reopen the window for the markers to re-appear.
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.051 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download