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.
- possible duplicate of Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"Cees Timmerman– Cees Timmerman2015-02-03 16:04:32 +00:00Commented Feb 3, 2015 at 16:04
3 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:
- File > New Project, select C#, create a new Web Application
- Go into the Default.aspx.cs file
- Put a breakpoint at the Page_Load function
- Open project properties, choose the Web tab, select "Enable Edit and Continue", hit save, close the property pages
- Hit F5 on your Default.aspx
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;
Hit F10 (or hit step into)
- See the new code get hit, you can hover over variables to get their values.
7 Comments
VS2010 has a nice error message that says:
Changes are not allowed while code is running or if the option 'Break all processes when one process breaks' is disabled. The option can be enabled in Tools, Options, Debugging.
Changes are not allowed while code is running is pretty clear. The reason for this is that your code needs to be compiled before running. To make any changes you need to stop execution, make your change and recompile the code again.
If you want to run ad hoc code to check variables etc. use the "QuickWatch" option in your context menu, or the "Immediate" window.