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

Notification

Icon
Error

Variables not in Context while debugging
alexpolajenko
#1 Posted : Tuesday, June 20, 2017 3:30:19 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/31/2017(UTC)
Posts: 8
Location: United States of America

Thanks: 1 times
This worked yesterday but ...

Today when I debug locally, some variables are not visible when I place my mouse over them. When I Watch them, VS2015 says they are not in context.

What is going on?
Remco
#2 Posted : Tuesday, June 20, 2017 11:30:44 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
When NCrunch instruments assemblies output from your build system, it needs to reconstruct the PDB files containing debug information for these assemblies. The VS debugger then reads these PDB files to obtain debug information during the test run.

Over the last few years, MS have made the compiler considerably more complex with structures like async, where large amounts of code is generated and then masked by the PDB to appear to you as though your code is being debugged directly. If at any stage the data in the PDB doesn't match the structure expected by the VS debugger, the debugger may silently fail to evaluate certain values inside the method.

It's important to note that there is no published structure for any of this debug data. The VS debugger works by its own internal rules and seems to run its own guesswork. There were a number of these cases that came up after the VS2015 release and were later fixed. It's possible you've found a new one.

Are you able to reconstruct a method that can make the debugger behave in this way? If I can get some code that reproduces the issue, I stand a chance of being able to fix it.
fourpastmidnight
#3 Posted : Wednesday, August 2, 2017 5:59:36 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/21/2017(UTC)
Posts: 9
Location: United States of America

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
I'm sorry that I can't be more helpful other than to say that "this happened to me, too". Because of the (needlessly) complex nature of my organization's code, I wouldn't know how to trigger this behavior in a simplified fashion, but I can confirm that this does happen. I thought it was my VS getting buggy on me, so I restarted VS. But alas, upon debugging the same test method, I was not able to view any information about local variables during debugging a unit test.

For what it's worth, we do use NUnit 3 (latest) and FakeItEasy.

Maybe I should have instructed NCrunch to rebuild the test project over again--maybe something got all out of whack in the caches/incremental build outputs?
Remco
#4 Posted : Wednesday, August 2, 2017 10:55:01 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
fourpastmidnight;10915 wrote:

Maybe I should have instructed NCrunch to rebuild the test project over again--maybe something got all out of whack in the caches/incremental build outputs?


Every time I've seen this problem before, it has been triggered by either bugs/inconsistencies in the MS debugger, or the structure of the code being debugged. So I expect that nothing will be solved by rebuilding the project or clearing your NCrunch cache. To troubleshoot this, I'll need a self-contained and compilable project containing a method that demonstrates the problem, after which I then need to spend several days guessing at different reasons for why the debugger is acting the way it is :( PDB/Debug issues tend to be hard problems to solve.
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.048 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download