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

Notification

Icon
Error

does not exist in the current context
tofutim
#1 Posted : Wednesday, January 8, 2014 2:02:48 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/27/2012(UTC)
Posts: 19
Location: California

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Do I need to switch to v2 for better await async support? I recently came across the following - when I tried to look at "words" during an NCrunch Debug I could not.

[img](- BROKEN LINK -)[/img]
Remco
#2 Posted : Wednesday, January 8, 2014 4:46:08 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

At the moment, NCrunch has no way of handling such a debug evaluation.

This is because keywords such as 'await' involve the creation of whole new structures of code at a metadata level. The instrumentation that NCrunch performs on the assembly skews with the 'magic' performed by Visual Studio to allow it to see through these structures, preventing the debugger from working correctly.

The 'yield' statement is also affected by this problem.

I'm sorry to say that I haven't yet found a way to make Visual Studio work with this. This issue affects both V1 and V2.


Cheers,

Remco
tofutim
#3 Posted : Friday, January 17, 2014 5:40:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/27/2012(UTC)
Posts: 19
Location: California

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Does it matter if I use another testing method? Like Microsoft's vs nunit. This is really aggravating.
Remco
#4 Posted : Friday, January 17, 2014 10:41:17 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Sadly not. All test frameworks work with the same compiler and instrumentation, so they all have the same problem.

The only way I'm aware of that can reduce the impact of this is if you try to avoid placing logic within methods that make use of await/yield. For example, moving the assertions above to another method, so that the local variable becomes a method parameter. Sorry, I know it's not ideal. There's a big technical constraint here that I haven't yet found a way around.
paulrogero
#5 Posted : Tuesday, March 25, 2014 2:32:12 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/4/2012(UTC)
Posts: 27

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

Is it possible to have another Debug unit test option in NCrunch, such as, "Debug without NCrunch Instrumentation" and/or "Break into first covering test without instrumentation" that would just launch VS into a debugging session without the instrumentation? With those new options available I'd leave instrumentation on almost all the time, except when I need to debug async/await methods. Unfortunately, for NCrunch use anyway, I seem to find myself writing more async/await methods these days!

As it stands today when I need to debug async/await I have to use Resharper's test runner to launch a debug session. I love 'Break into first covering test', especially with the keyboard shortcut, and use it all the time and its kind of a pain to then have to drop a breakpoint and then find the unit test so that I can launch Resharper's test runner.

Just a thought, let me know what you think.

Thanks,
Paul
Remco
#6 Posted : Tuesday, March 25, 2014 9:44:30 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Paul,

My first preference would be to fix the debugging so that it would work with the instrumentation :) Of course, the technical constraints are such that I don't see this happening any time soon. Your feature makes good sense. Do you want to put some votes towards it at https://ncrunch.uservoice.com?
paulrogero
#7 Posted : Tuesday, March 25, 2014 9:56:44 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/4/2012(UTC)
Posts: 27

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

Thanks for the reply. I added the suggestion to the NCrunch uservoice site.

Thanks,
Paul
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.043 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download