Home > OS >  How to watch recursive function variables simultaneously in Visual Studio
How to watch recursive function variables simultaneously in Visual Studio

Time:09-21

When debugging in Visual Studio you can see the local variables for the current function that is running in the Locals window. You can also watch specific variables by right clicking them and clicking Add Watch.

However, when watching a variable in a recursive function, it will only show the value for that variable for the latest iteration of the function call the recursion has progressed to.

Is there a way to view the variable contents of each iteration of a recursive function call and have them displayed together in the Local/Watch windows?

CodePudding user response:

This is not possible in Visual Studio. You may consider other ways, such as logging/outputting(Debug.WriteLine, Trace.WriteLine…) the value of variables in the function, or installing some extensions to help log value of variables.

  • Related