
Here you can do watch autos and locals, and here's where you find call stack. You can find those in the debug window section.
#Visual studio sample code windows#
Then I want to have my call stack and my locals windows pinned to the bottom. Break point by clicking on this first button. All right, first step is to start a debugging session. And then I'll hide solution explorer because that gives us more room on the screen, and then we're ready to start our debug session.

Press F9 to set the break point and close these windows. And I'll put a break point in here, right here on this first line where we're setting a value. We get the number of months, the loan amount and the loan rate and then it calculates your payment and returns that. This is not an accurate financial formula in here, it's very simple. We're going to get the current loan rate, store that here, then we make a call to calculate monthly payment, F12 to take a look at that. Press F12 to look at that, and you see it's just a randomly generated value. There's a method called GetBankRateFromSystem. Now of course we're going to go deeper into the call stack here. And then we get our loan fee and then we build up a value and return our calculated loan rate. And then I go out to another class, and call this method, call it GetCurrentLoanRate and that method, if I press F12, that is using the simulated online services to get the bank rate from the system. We start out declaring some variables to hold values like monthly payment, the current rate, the number of months, the loan amount, our formatted results, then we set the real values for the number of months, the loan amount. We'll start by looking at MainWindow.xaml. Other than that, you can see we got the loan, the interest rate for 10 months, and this is the calculated payment. That's generated by making a call to a simulated online bank service, so every time I click this button, I get a different value, this is a randomly generated interest rate. Now let's look at this interest rate here. Notice how they start with one, two, three? This will be useful when we get into the historical debugging and start looking at multiple iterations of the calls, we'll know within the first, second or third run of the loan calculation. So when you click on this button, it calculates the monthly payments for three loans shown here with these amounts, 1100, 22. The point of saving this value is that we can dig ourselves deep into the call stack and then use historical debugging to move around in our historical call stacks.

Of course in C# we typically call those method calls. In the documentation, Microsoft calls this function call. This will give us the extra call information. Our first stop is to look in tools, options, go to IntelliTrace, and we're going to switch from the default to the second item in this list.
