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

Notification

Icon
Error

v1.37b - Debug variables
rlarno
#1 Posted : Tuesday, February 7, 2012 12:27:59 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 27
Location: Belgium

Thanks: 6 times
Was thanked: 5 time(s) in 5 post(s)
Hi,

I just tried the debug test feature of 1.37b for the first time (little need to debug otherwise). I noticed that the Debug 'Autos' and 'Locals' have some odd key/values in them. Not the local variables one would expect while debugging. I noticed that while in a
Code:
foreach (var item in collection)
the 'item' variable is not known. I was also using some linq and aunonymous types and these were also not available (no debugging tooltips etc.)
Perhaps this is due to the way that you start up the debugging session?
As it is obviously a lot faster to start debugging this way (;-)
Remco
#2 Posted : Tuesday, February 7, 2012 8:41:37 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Interesting ... this is probably caused by the instrumentation. I'll need to take a closer look to figure out why it's happening and if it's preventable. Thanks for letting me know.
otac0n
#3 Posted : Wednesday, February 15, 2012 9:59:34 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
I'm getting these results in iterator blocks (methods with `yield return` in them).
Remco
#4 Posted : Thursday, February 16, 2012 8:23:04 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Thanks - I was having problems with reproducing this. This little piece of information is very helpful to me :)
Remco
#5 Posted : Tuesday, February 28, 2012 12:16:50 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
I've had a good look at this issue in depth, and it seems to be caused by a mismatch between the expectations of the VS debugger and the structure of the code under test.

It appears that Visual Studio has been programmed with some kind of algorithm that infers the local variables of the 'yield return' method by analysing the structure of the generated iterator block. Since the local variables in a 'yield return' method aren't actually variables (they are in fact fields on a nested class generated by the compiler), this is extremely useful for normal situations as otherwise you simply wouldn't be able to see any values at all.

NCrunch needs to manipulate the structure of the generated iterator block in order to perform coverage analysis, and by doing so it changes what the Visual Studio debugger 'sees' in the code and the inference algorithm fails.

Sadly I see no way of easily solving this problem from the side of NCrunch, as the manipulation of the output assembly is required for code coverage analysis. It's highly likely I won't be able to fix this problem in the immediate future.
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.041 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download