In Visual Studio 2022 17.10 Preview 2, we’re including a small quality-of-life improvement that results in the Watch/Locals window displaying local variables correctly for any arbitrary frames in the call stack in debug builds. To try it out, please install the recently released Preview. For more information, read on.
The problem: missing variables in Watch Window
Have you ever been in this situation? We’re debugging some code, and have a breakpoint we hit in a function, foo. We need to inspect the values of some local variables a bit up the call stack, so we open up the call stack window and click to that frame.
In this case, we want to see the value of the variable y, which is an input to calculate the argument to the function foo we’re inspecting. Unfortunately, it’s not available: