How do you determine the value of a return statement that is not stored in a variable?

In the code I'm working in, there are many recursive method calls that return the results of the method directly without storing it in a variable.

public bool foo()
{
  return bar();
}

public bool bar()
{
  return infinitMethodCalls();
}

As a result, debugging is a pain. How to determine the value returned by bar () without using the temp variable or after endless method calls?

temp variable example:

public bool foo()
{
  return result = bar();
}

The code I'm working with is mostly written this way.

+4
source share
2 answers

It depends on the version of VS you are using.

Visual Studio 2013 "", , . Autos : Debug = > Windows = > Autos VS-. ( . )

Visual Studio 2010, , IntelliTraces "Calls View"

+1

. , , .

. trace , , .

:

void Factorial(int n) {

    Trace.WriteLine(n);

    if (n == 0)
       return 1;
    else
       return (n * factorial(n-1));

}
-1

Source: https://habr.com/ru/post/1527573/


All Articles