Shaju Madheena
Shaju Madheena

Reputation: 87

Keys to step back all the debugging points

i want to know the key steps to step back while debugging c sharp code in vs 2017. Example, i put a break point at a function. while debugging, the programme hits at this break point. But from that break point, how i can jump back to all the invoking points in the code ? Something like 'Ctrl' and '-' key. I want to know from where this is called. Track back like that.

Upvotes: 1

Views: 966

Answers (1)

CodingYoshi
CodingYoshi

Reputation: 27049

What you are after is called the Call Stack.

Imagine we have this program:

public static class Program
{
    private static int something;
    public static void Main()
    {
        One();

        Console.Read();
    }

    private static void Three()
    {
        something = 3;
        Four();
    }

    private static void Four()
    {
        something = 4;
    }

    private static void Two()
    {
        something = 2;
        Three();
    }

    private static void One()
    {
        something = 1;
        Two();
    }
}

Imagine we have a breakpoint in Four() and the debugger stops there, if we view the call stack window, it will look like this:

enter image description here

We can click and go to any point in the call stack history. The best part is, when you click One(), it will show the the value something had at that point in the call stack; so although we are in Four() and the value of something is 4, if you jump to One(), the value will show as zero.

For keyboard shortcuts, please refer this thread.

Upvotes: 1

Related Questions