Home Page

UPDATE: 2010 Developer Action Plan The folks at LearnVisualStudio.NET have created a new Developer Action Plan packed with strategies and advice to help you get that elusive first .NET development job and also become an awesome ASP.NET developer. This action plan is perfect:

  • For those with little or no .NET experience, or...
  • For those with programming experience, but who feel like their skills are deteriorating or becoming stale

If you simply enter your email in the next 15 minutes, you will get:

  • A download link for the 2010 Developer Action Plan
  • 4 hours of free ASP.NET training videos you can watch from the comfort of your computer
==> Click HERE to get your gifts immediately. It's safe and easy. <==


Debugging your C# program consists of monitoring the execution of the source code as the program is running.  Visual Web Developer has a debugger full of useful features.  The main point of debugging your source code is to determine whether or not it is behaving the way that you expected when you programmed it.  Not only can you go through the code to find problems or fix bugs, but you can also use the debugger to validate that the code is behaving exactly as you had intended it.  This is especially useful in more complicated blocks of code or blocks of code that rely on external resources to make a decision.  A good example is with database programming, where you may not have any idea ahead of time what the data will look like ahead of time, or whether certain fields will contain nulls, so you can use the debugger as your program runs to walk through different scenarios.  I want to make the point that the debugger is not just for situations where something is broken and you can use it for so much more than that.

Using the debugger is very easy.  You first need to determine what part of your program you want to examine.  Then you choose a line of code that you want the debugger to stop at and set what is called a “breakpoint”.  A breakpoint is a line of code in your program that the .NET engine knows to stop at when the program is running.  When the program actually runs, the .NET engine will stop the program at the breakpoint, minimize the web browser and open up the code editor window at the line where the breakpoint resides.  The breakpoint line will be highlighted by the debugger so that you know the program has stopped there.

Once the debugger has stopped at the breakpoint, you can use the debugger to do a number of things.  You can look at the values of the variables in your code by placing the cursor directly over the variable in the code.  The debugger also lists all the variables in your code inside the Locals window and you can use the to see the values of the variables as well.

To move to the next line of code you must use the Step Over button in the toolbar or press the F10 key.  You can keep stepping over each line of code and examine how the program is behaving.  If you want to stop debugging and go back to running the program just press the play button which will have the tooltip of “Continue” when the debugger is running.  All of the debugger functions such as Step Over and Continue are also available from the Debug menu.  Click here to see a sample video demonstrating how to use the debugger.

1 Comment »

  1. Thanks Ted, with this stuff, you make me the debugger idea more friendly!

    Comment by gianted — August 27, 2009 @ 6:26 am

RSS feed for comments on this post. TrackBack URL

Leave a comment