Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In Visual Studio 2010 Essential Training, author Walt Ritscher demonstrates how to use Visual Studio 2010 Professional to develop full-featured applications targeting a variety of platforms. Starting with an overview of the integrated developer environment, the course covers working with code editors, navigating and formatting code, and deploying applications. Also included are tutorials on running performance and load tests, and debugging code. Exercise files accompany the course.
Visual Studio has an amazing new debugging feature called IntelliTrace. This feature is only available in the Ultimate edition of Visual Studio. So if you don't have that version, you will not be able to follow along with this demonstration. Now normally, I wouldn't show you features from the Ultimate edition as we are targeting the Premium edition for this series, but this feature is very interesting from a developer's perspective, and I thought it was worth a look. Also, let me add that testers within your organization can use this feature if they have the Microsoft Test and Lab Manager tool.
So, what is IntelliTrace? IntelliTrace acts like a debugging recorder. While you are in a debugging session, it is saving information about the debugger state as you go. Later, you can look back at this historical data and replay the previous debugging session. To demonstrate this, I'm going to use this program called DebuggingWithIntellitrace. And I need to set up a couple of settings inside Visual Studio before I continue. They are over here in Tools > Options, and then in the IntelliTrace section.
First, let's look in the General area. In Visual Studio, by default, IntelliTrace is enabled. Normally, it is set to this IntelliTrace events only. I've changed it to this second option down here. If you change to the second option, you're going to have to restart Visual Studio. If you choose the first option, that means tracing when you enter break mode and storing individual steps while you're debugging. If you choose the second option, you will store information about each function call, including the parameter information and values returned from the call.
The second option we want to look at is in Advanced. This is the location where my recordings are stored. I'm going to copy this information, and then I'm going to click OK. I'm going to go over to my Windows Explorer, and I'm going to navigate to that location. You need to be cautious about storing files here because they are often deleted when you close Visual Studio. You can see there's already one trace in here. I'm going to come back here and copy this trace in a few minutes. Now, let's go do some debugging.
I'm going to switch to Visual Studio, I'm going to open this Program.cs file, and you see I have a normal Visual Studio breakpoint in there. I'm going to press F5 to debug my application, I hit my breakpoint, and immediately you see there's something new happening inside Visual Studio. Over here is a IntelliTrace replay toolbar. So, what I can do is press F11 or F10 to step through a few lines of code, and then I can click on this Go To Previous Call and look at where I was a few seconds ago in my debugging session.
And then I can return to the Live mode by clicking here. Now it's recording these steps in that IntelliTrace file. So let's record a few more steps. I'm going to spawn another worker thread to do some work. I'm going to ask for your name, and we're going to read the line. It's going to prompt me for the name, I'm going to type in "Joe", and I'll come down here and decide that I want to rerun that code. So I'm going to grab this yellow marker and drag it up and rerun those lines of code. Again, I'm pressing F10 to rerun those lines of code. And then I'm going to press F5 to finish the application.
So, at this point, I have a recording in that folder. I'll go back and look in the folder. Here is the file I just created, and I'm going to copy this and paste it to my Desktop. As you can see, I have a few copies here. Now, here's where it becomes powerful. Imagine for a second that you've gone home, had a nice three-day weekend, you come back to work, and there is a bug that you need to look at. It's in this application we've been working on, this debugging with IntelliTrace. So you load that in, and then you go out to your hard drive and you take this recording file and you load it into Visual Studio.
I can just double-click on this iTrace file to do that. What you see is a summary of all the things that were happening inside that application. It shows that I had several threads running, and then I can also get information about the system that was under test. Here is the system information about this computer. I can see I'm on a quad-core machine. And then down here, I can find that information about what was loaded into the memory at the moment. So there's two files down here: mscorlib.dll and DebuggingWithIntellitrace.exe.
Now, let me show you where the power really happens. I can go into this Thread List and pick my Main Thread and then choose Start Debugging. Now realize, I haven't started a debugger yet. I've just been sitting inside Visual Studio. I'm going to click Start Debugging, and it pulls my historical data out of that file and shows what happened, the last step in that debugging session. Now, I'm going to load a new window over here from the Debug menu. It's called IntelliTrace > IntelliTrace Events.
This shows every step that was recorded during that process. So what I can do is double-click on one of these steps to take me back to that location, just a single click. I can look at the Call Stack, the Local variables, a lot of information about what was happening as the tester or the developer is walking through the code. And you remember what I did earlier? I repeated my steps. I went here, and then I went back up to a line of code and re-ran that line of code again. So you can see that rewind happening there. I can also hover over these variables and see the data that was stored in there historically, remember.
So, if I go back here, it's null. I'll run this line of code and then hover over this, and there is the previous version of that variable. This is really an amazing feature. Can you imagine your testers filing a bug and attaching the IntelliTrace file to that report? Now you can run their trace on your computer and see the state of every thread running on their computer at the time of failure. This has to be my favorite debugging feature, and I think its well worth the investment.
Find answers to the most frequently asked questions about Visual Studio 2010 Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.