Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Pin features while debugging in Visual Studio 2010.

DZone's Guide to

Pin features while debugging in Visual Studio 2010.

·
Free Resource

Visual Studio 2010 is one of most awesome tools used to debug Microsoft.NET related code. I have found one more interesting feature with the Visual studio 2010m, the Pin Data Tip feature. This feature can be very useful when you are debugging code with loops. Normally, when you debug the code, you have to put your curser on the variable if you want know the value of that variable.  Then, the tool tip will show the values of that variable.  The pin feature will pin that tool tip and you don’t have to put mouse over it again. Let’s take a simple example to examine the feature further. Code for the example is shown below. I have created a simple for loop and I am printing a variable value with Response. Write on the asp.net page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Blogging
{
  public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          for (int i = 1; i <= 20; i++)
          {
              Response.Write(i.ToString());
          }
        
      }
  }
}


Now let’s put the break point on for loop as follows, and then start debugging by pressing F5.

BreakPoint

Now I have started debugging, and the first time code execution came to my break point. Now you can see when I put mouse pointer on that value it will show a variable I want. Here's an example:

VaraibleValue

Now as you can see there is one Icon in above code so once you click on that pin Icon that it will pin the DataTip for that variable like following.

Pindatatip

So now whatever you debug in that loop you can see the the value of variable I at any time like following.

VaraibleValue

So, that’s it. Life is easy thanks to the new debugging features in Visual Studio 2010. Hope you enjoyed the tutorial! Stay tuned for more. Happy Programming!
Topics:

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}