Reputation: 2700
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.
Upvotes: 16
Views: 13931
Reputation: 13280
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.
Upvotes: 2
Reputation: 18954
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:
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)
Upvotes: 17
Reputation: 5029
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.
Upvotes: -4