visual studio edit and continue does not work

折月煮酒 提交于 2020-05-11 04:03:06

问题


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.


回答1:


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....




回答2:


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.




回答3:


The solution of this problem is on the Microsoft Documentation... After you enable tools-> options -> debud -> edit and continue.... There is more to do..

If IntelliTrace is enabled and you collect both IntelliTrace events and call information, Edit and Continue is disabled.

On Visual studios' menu go on Tools>>options - Select "IntelliTrace" tab and let IntelliTrace events only checked.. Save, restart the visual studio and.......

Your Edit and Continue will work again!




回答4:


None of the above worked for me on their own, but once I unchecked "Enable Native Edit and Continue" then it worked: under Tools -> Options -> Debugging -> General.




回答5:


  1. Under Tools -> Options -> Debugging -> General: Check the box for 'Enable Edit and Continue'.
  2. Under Tools -> Options -> Debugging -> Just-In-Time: Check the box for 'Managed Code' Image Checking Managed Code
  3. Save and restart Visual Studio. If you get a warning about elevated permissions, accept the dialog. Your changes are not saved yet. After restart, go again to Tools -> Options -> Debugging -> Just-In-Time: Check the box for 'Managed Code' if not showing checked. Save and restart Visual Studio.



回答6:


Edit & Continue doesn't work - this has fixed it for me - it's for VS2017 and started happening recently (March 2019). It seems like NCover sets the system variable COR_ENABLE_PROFILING=1. Uninstalling it gets rid of it for me.




回答7:


Repairing the VS installation, and upgrading to the current latest VS2017 version: 15.9.19 fixed the issue for me.

h-rai's answer gave me the clues I needed: unchecking the Native checkbox made a warning appear stating that another JIT debugger was registered.

Then, I found more clues in this article here

Perhaps, my issues were caused by having installed the new .NET core 3.1, but not having upgraded VS2017 to VS2019 yet.

Now, when I uncheck the "Native" checkbox, I do not get the warning about another JIT debugger, and I can modify code while debugging once again.



来源:https://stackoverflow.com/questions/18266972/visual-studio-edit-and-continue-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!