Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio edit and continue does not work

In my project which is a hybrid project (in previous it was a web forms project that then we modified to use mvc pattern).

Now I want that in debug mode, I want to change something in my cs file, and then I want the changed code to run.

I've tried enabling and disabling tools -> options -> debug -> edit and continue checkbox part.

When it is enabled I can't change code in my project while debugging. When it is disabled I can change code but it does not affect on running part. for example.

  int i = 0;   if(i == 1)     return 1;   else     return 2; 

In debug mode I changed i to 1 but it stil returned 2, in the following code, only when I stop and re-run the debugger it takes affects.

 int i = 1;   if(i == 1)     return 1;   else     return 2; 

BTW I am using Visual Studio 2010 version.

like image 224
brtb Avatar asked Aug 16 '13 06:08

brtb


People also ask

How edit and continue works?

For those who don't know about it, it allows you to edit code while you are debugging a running process, re-compile the code while the binary is still running and continue using the application seamlessly with the new code, without the need to restart it.

How do I disable Debug mode in Visual Studio?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.


2 Answers

This wasn't my problem; running VS2017 RC2, I found that under Tools -> Options -> Debugging -> Just-In-Time - my "Managed Code" was deselected.

There was a warning "Another debugger has registered itself as the Just-In-Time debugger. Fix by enabling Just-In-Time debugging or running Visual Studio repair".

I had not registered any other debugging tools! So no idea why it unticked...

So the fix was simply to tick the "Managed" box....

like image 123
James Joyce Avatar answered Sep 23 '22 11:09

James Joyce


None of the given answers worked. Here's what I did.

  • I repaired the VS installation. I had 2017 version.
  • I unticked the Native code checkbox.

enter image description here

like image 43
h-rai Avatar answered Sep 22 '22 11:09

h-rai