Home
Username:
Password:
Introduction to Microsoft Visual Studio 2008 Tutorials

Debugging Web / Edit & Continue




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

Now let's talk about a really cool function of Debugging that's in Visual Studio 2008. It was actually in Visual Studio 2005 as well, and that is called Edit and Continue. Now what this means is, and let me just kind of throw this thing in here. I'll set up a Breakpoint, start Debugging and now I'll run my program, and once it stops right now it's saying: OK, here you are at this line. What I'd like to do is make a change to this line, OK, and we'll just, we'll make the BackColor yellow, OK, and then we can continue to Debug. Now this is huge because we can change stuff all over the place. Notice I can say: Hello Worlds, I can change that to Hello World, I can do all kinds of stuff. This is a big deal because prior to Visual Studio 2005 in the 2003 and in the regular original Visual Studio .NET release, you couldn't do this. Anytime you wanted to change the code you had to actually break out of Debugging, you had to come up here and click this button and Break Out, change your code and then jump back in, OK? Now, let me say this, OK, you've got Ð to quote Randy Jackson, okay Ð we've got to keep it real here, you do need to be aware that there are a lot of developers out there in the real world who don't like this tool because it can cause Visual Studio to lock up under certain instances. Now, it's affected by humidity, solar flares, who knows what, OK, so just be aware of that. Edit and Continue is cool but some developers are experiencing some lockups with it, so kind of be careful with it, OK? Now, you'll have to decide and play with it. There's another interesting thing that happens and that is, some people find that they can't do Edit and Continue, OK, well I want to show you that under Tools, go down to Options, we can actually turn Edit and Continue on and off. Now, by default when you installed Visual Studio this should have been enabled. But again, these are computers, right, you know where I'm headed, it might not have been, OK. If I don't have Edit and Continue enabled and I go out here and run this, OK, and I try to change this, notice it's, when I try to hit a keystroke it's: Eh, can't do that. You can't modify this, it's Read-only, OK? So again, that's when I would have to come out here and Break it, make the change to red once I get broken out, OK, make my change, and then go back into Debug. So, you want to go to Tools, Options, turn this on and make sure it's on, OK? So, that's Edit and Continue. Now, one other disclaimer. There are certain code changes you cannot make in Edit and Continue. And you can go out to Microsoft's site and see a list of these. If it was a simple little, this particular family, blah, blah, blah I would tell you, but there are some ifs, ands, and buts. The best thing I can tell you is just try. Try to edit your code while you're Debugging and see if it'll let you get away with it. It will yell at you and tell you you can't, if indeed you cannot. OK. Now, there's another part about Debugging that I didn't mention in some of the other Debug videos because I wanted to include it here and it is a really, really cool functionality. When you add this to Edit and Continue it makes Debugging go really quickly, OK. Now, notice what I'm going to do here. I'm going to instead of putting a Breakpoint right here and then having to come back and clear it and so forth I'm going to click anywhere in this line of code, I will right-click, and you will notice down here, Run to Cursor. So I just choose Run to Cursor, you will notice that I am in Debug Mode and it just stopped me right here. I am also Edit and Continue, and I say, you know what I'm going to backspace that out and I'm going to say let's do violet here. Then notice I can continue on and I will simply step through my program until it gives me my Window back. It should be coming here any minute, and notice it has changed it to violet. So, if I just simply click through I can continue to run through my program and get down here and it stopped me right here again, and I can say, you know what I didn't like violet Ð so you see where this is headed, right? We can do this indefinitely, but how cool is this? And so once I've got it the way I like it I can simply stop it, scroll down through my code, and say you know what? This right here. I want to run to right here. So, just right-click, say: Run to Code, it takes me down to here, I can start to step through now, and then I can change things anywhere I'd like. OK, how cool is that? Now, that makes Debugging a little more natural and it makes it easier for you to just simply say, OK, I think I'm OK down to right here. So let's run it to right here and see what happens, OK? That's both Run to Cursor and Edit and Continue. So play with those, they should help your productivity quite a bit.

Tutorial Information

Course: Introduction to Microsoft Visual Studio 2008
Author: Mark Long
SKU: 34008
ISBN: 1-935320-54-8
Release Date: 2009-06-26
Duration: 7 hrs / 72 lessons
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available