Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modifying the code while debugging in VS 2010

I am new to VS 2010 and am facing problem to Modify the code while debugging..Please help me If there is any setting so achieve this.

like image 624
satyajit Avatar asked May 26 '11 12:05

satyajit


People also ask

Can we edit code while debugging?

- [Instructor] One of the more useful features of Visual Studio debugging tools is called Edit and Continue. This feature allows you to make changes to your code while debugging, then continue stepping through your code without any additional compilation steps from you.

Can you edit code in Visual Studio?

The Visual Studio editor provides many features that make it easier for you to write and manage your code and text. You can expand and collapse different blocks of code by using outlining. You can learn more about the code by using IntelliSense, the Object Browser, and the Call Hierarchy.

Is it possible to change the value of a variable while debugging?

yes ,it is possible to change the value of a variable while debugging in a c# application .


2 Answers

According to http://connect.microsoft.com/VisualStudio/feedback/details/520179/vs2010-sp2-x86-unable-to-edit-and-continue Edit and Continue is supposed to be possible in ASP.NET projects with Visual Studio 2010, but only while you are stopped at a breakpoint.

Here are the steps from the Microsoft answer there to make sure Edit and Continue is turned on, and to see if it's working for you:

  1. File > New Project, select C#, create a new Web Application
  2. Go into the Default.aspx.cs file
  3. Put a breakpoint at the Page_Load function
  4. Open project properties, choose the Web tab, select "Enable Edit and Continue", hit save, close the property pages
  5. Hit F5 on your Default.aspx
  6. When the breakpoint is hit, try to create a new variable inside the Page_Load function by writing the following lines of code:

    int i = 1; i += 5;

  7. Hit F10 (or hit step into)

  8. See the new code get hit, you can hover over variables to get their values.
like image 108
Kate Gregory Avatar answered Oct 19 '22 03:10

Kate Gregory


I was getting this in Visual Studio 2010 while working on a C# project remotely.

The key here is: Tools -> Options -> Debugging -> Edit and Continue -> 'Enable while remote debugging or running under another user name' at the bottom.

like image 21
fIwJlxSzApHEZIl Avatar answered Oct 19 '22 03:10

fIwJlxSzApHEZIl