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

Notification

Icon
Error

Save all .cs files when debugging test with NCrunch
DeltaEngine
#1 Posted : Monday, November 9, 2020 3:32:39 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/23/2012(UTC)
Posts: 31
Location: Germany

Thanks: 8 times
Was thanked: 3 time(s) in 3 post(s)
While it is very nice that NCrunch keeps on crunching without having to save any file, it doesn't really work when debugging because once any breakpoints hit or you try to dig into any code, often Visual Studio just stops all the fun with: "This source file has changed. It no longer matches the version of the file used to build the application being debugged" .. dunno if ReSharper's build system has anything to do with that.

Not a hugely important issue as I rarely debug with NCrunch anyway, most of the time ReSharper's unit test debugging saves all files before each build or test run and is good. Most hard to track down issues happen with implementation code (and we use NCrunch mostly with mocked implementations).

A simple Ctrl+Shift+S (save all files) fixes this before a NCrunch debug session, NCrunch doesn't need a rebuild anyway, but I always forget that some files still have some minor changes ^^

Small changes usually don't matter, only after a few minutes of changes this usually happens (so maybe only save all files when debugging was requested and there was no save all for the last few minutes) .. and if no breakpoint hits, this isn't a problem either.
Remco
#2 Posted : Tuesday, November 10, 2020 2:43:39 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)
Hi, thanks for sharing this.

On a stock standard VS2019 installation with no plugins other than NCrunch installed, I cannot reproduce this behaviour. For example, if I change a source file, let NCrunch build it and run tests over it without saving, then try to break into a line by right clicking on a coverage marker, it then works fine without any errors.

Does the above use case behave the same for you? Is there perhaps a VS setting that is different between our environments? I note that the debugger has a number of settings that control this sort of behaviour.
1 user thanked Remco for this useful post.
DeltaEngine on 11/10/2020(UTC)
DeltaEngine
#3 Posted : Tuesday, November 10, 2020 6:04:32 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/23/2012(UTC)
Posts: 31
Location: Germany

Thanks: 8 times
Was thanked: 3 time(s) in 3 post(s)
Same here, just doing this quickly in a fresh VS without plugins, it doesn't happen. Only when writing for a longer time (might be hours of changes, sometimes after a few minutes) the debugger stops working once a breakpoint hits (you can't continue as VS says the source changed).

BTW: Would it be possible to support Edit&Continue, I think this issue would be almost a non-issue then and it would really be nice to inspect and change some logic while debugging. Works fine with any other NUnit runner (ReSharper or NUnit in VS), but not with NCrunch debugging, maybe related to this issue.

I will report back if I find an easy way to reproduce, will ask the employees today if anyone can reproduce this easily.

BTW: Today is .NET 5 RTM release finally, we are still eagerly awaiting NCrunch support: https://forum.ncrunch.ne...ce-to-support--net5.aspx
1 user thanked DeltaEngine for this useful post.
UppSol on 11/10/2020(UTC)
Remco
#4 Posted : Thursday, November 12, 2020 10:13:01 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)
DeltaEngine;15019 wrote:
Same here, just doing this quickly in a fresh VS without plugins, it doesn't happen. Only when writing for a longer time (might be hours of changes, sometimes after a few minutes) the debugger stops working once a breakpoint hits (you can't continue as VS says the source changed).


It's possible there is something in your development patterns that is bringing this up every so often.

VS has a configuration switch called 'Require source files to exactly match the original version' underneath your Debugging options. I recommend turning this off to see if it makes any difference for you.

DeltaEngine;15019 wrote:

BTW: Would it be possible to support Edit&Continue, I think this issue would be almost a non-issue then and it would really be nice to inspect and change some logic while debugging. Works fine with any other NUnit runner (ReSharper or NUnit in VS), but not with NCrunch debugging, maybe related to this issue.


I can't give a straight answer on this without spending several days trawling through this one, but I can say that it is almost certainly too difficult to be worth the implementation/maintenance cost of handling. E&C is an extremely complex feature at platform level.


DeltaEngine;15019 wrote:

BTW: Today is .NET 5 RTM release finally, we are still eagerly awaiting NCrunch support: https://forum.ncrunch.ne...ce-to-support--net5.aspx


We now support this with the new v4.5 release just pushed out the door. We know of a few kinks already so there will be more releases out soon to fix these.
1 user thanked Remco for this useful post.
DeltaEngine on 11/12/2020(UTC)
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.036 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download