编辑并继续:“在...时不允许更改." [英] Edit and Continue: "Changes are not allowed when..."

查看:554
本文介绍了编辑并继续:“在...时不允许更改."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使我创建了一个干净的WinForms项目,编辑并继续"也不起作用,并显示了以下错误消息:

Even if I create a clean WinForms project, Edit and Continue doesn't work and gives me the error:

当调试器已附加到已经在运行的进程中,或者在构建或运行时对要调试的代码进行了优化时,不允许进行更改.

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.

    在工具→选项→调试中选中
  1. 编辑并继续选项.
  2. 未启用优化.
  3. 似乎没有设置任何托管的探查器.
  4. 我正在调试模式下运行
  5. 我在x64 CPU和32位Windows XP上运行,但是将平台目标设置为x86而不是AnyCpu并没有帮助.
  6. 修复Visual Studio安装无济于事.
  1. Edit and Continue option is checked in Tools → Options → Debugging.
  2. Optimization is not enabled.
  3. Seems like there is no any managed profiler set up.
  4. I am running in Debug mode
  5. I am running on x64 CPU and Windows XP 32-bit, but setting platform target to x86 rather than AnyCpu doesn't help.
  6. Repairing Visual Studio installation doesn't help.

我还在MSDN上找到了这篇文章网站:

I also found this article on MSDN website:

不支持的方案

在以下调试方案中,编辑并继续"不可用:

Edit and Continue is not available in the following debugging scenarios:

  • 在Windows 98上进行调试.

  • Debugging on Windows 98.

混合模式(本机/托管)调试.

Mixed-mode (native/managed) debugging.

SQL调试.

调试Dr.Watson转储.

Debugging a Dr. Watson dump.

在未处理的异常之后编辑代码,当在未处理的异常上展开调用堆栈"时,选项未选中.

Editing code after an unhandled exception, when the "Unwind the call stack on unhandled exceptions" option is not selected.

调试嵌入式运行时应用程序.

Debugging an embedded runtime application.

使用附加到"来调试应用程序,而不是通过调试"菜单中的启动"来运行应用程序.

Debugging an application with Attach to rather than running the application with Start from the Debug menu.

调试优化的代码.

当目标是64位应用程序时调试托管代码.如果要使用编辑并继续",则必须将目标设置为x86. (项目属性",编译"选项卡,高级编译器"设置.).

Debugging managed code when the target is a 64-bit application. If you want to use Edit and Continue, you must set the target to x86. (Project Properties, Compile tab, Advanced Compiler setting.).

在由于构建错误而无法构建新版本之后,调试旧版本的代码.

Debugging an old version of your code after a new version failed to build due to build errors.

但是我可以回答否".到此列表中的每个项目.

But I can answer "No" to every item in this list.

它曾经工作过,但是几天前它停止工作了,我不知道可能是什么原因.

It worked before, but several days ago it stopped working, and I don't know what could be the reason.

推荐答案

其他适用的解决方案

以下是不完整的,无序的可能解决方案列表,如果您*正在尝试修复Edit& amp;快速继续.

Other Applicable Solutions

Below is an incomplete, unordered list of possible solutions to try if you* are trying to fix Edit & Continue quickly.

  • 确保您处于 Debug模式
  • 确保您没有启动混合模式进程
  • 尝试将CPU目标设置为 x86 ,而不是 AnyCPU (在x64计算机上)
  • Project Properties-> Debug
  • 中取消选中 Debug Mode Optimize Code 复选框.
  • 取消选中高级编译器设置
  • 中的启用优化
  • (ASP.NET)检查如果是这种情况,(通过矩阵)
  • (ASP.NET)确保已在 Web 选项卡(vs2010)中启用了编辑并继续
  • (ASP.NET)转到属性> Web>服务器,并确保在 Use Visual Studio Development Server 下选中了 Enable and Continue . em>.
  • (ASP.NET WebAPI)确保在尝试编辑断点之前已停止使用Controller的方法.
  • (vs2017)转到工具">选项">调试" ,然后取消选中(取消选择)编辑并继续".这实际上与常规"建议相反(请参阅本文中的其他要点).它不允许您在正在运行的程序中实际进行更改(即,它不会热交换您所做的代码更改)-它仅允许您编辑代码(即,它可以避免烦人的操作)消息并锁定"您的编辑器).
  • 转到工具>选项>调试>常规,并确保未选中要求源文件与原始版本完全匹配.
  • 选中启用Windows调试堆分配器"(仅限本机)[VS Community 2017]
  • 您是否正在使用Microsoft假货?它禁止Edit&继续.
  • 通过在 Task Manager 中选择 End Process Tree ,杀死所有 *.vshost.exe 实例. VS将重新生成正确的实例.
  • 使用 Debug-> Delete All Breakpoints
  • 删除所有断点
  • 启用并继续同时存在于工具>选项>调试菜单和项目设置中.确保检查两个地方.编辑和扩展的Intellitrace设置不支持继续.
  • 确保将项目属性>构建>高级>输出>调试信息中的调试信息设置为完整
  • 某些插件可能会造成干扰.通过禁用/卸载进行检查,然后重试其他解决方案.
  • 如果您没有引起足够的重视,则在尝试解决此错误时遇到的错误可能会变为易于诊断的其他错误.例如.包含lambda表达式的方法不支持编辑并继续.
  • 确保系统变量COR_ENABLE_PROFILING未设置为1.一些探查器在安装时进行设置,并在卸载后保持原样.打开命令提示符,然后键入set快速检查您的系统是否受到影响,如果这样,请删除该变量或将其设置为0:

  • Make sure you are in Debug Mode
  • Make sure you're not launching a mixed mode process
  • Try to set the CPU target to x86 rather than AnyCPU (on x64 machines)
  • Uncheck the Optimize Code checkbox for Debug Mode in Project Properties->Debug
  • Uncheck Enable Optimizations in Advanced Compiler Settings
  • (ASP.NET) Check nightcoder's answer if it is the case
  • (ASP.NET) Check this answer (by matrixugly) if it is the case
  • (ASP.NET) Ensure you have Edit and Continue enabled on the Web tab (vs2010)
  • (ASP.NET) Go to Properties > Web > Servers, and make sure that Enable and continue is checked under Use Visual Studio Development Server.
  • (ASP.NET WebAPI) Make sure you've stopped in the Controller's method using a breakpoint, before trying to edit it.
  • (vs2017) Go to Tools > Options > Debugging and uncheck (deselect) 'Edit and Continue'. This is actually the opposite of the 'conventional' advice (see some other points in this post). It does not allow you to actually make changes in your running program (i.e. it does not hot-swap the code changes that you make) - it simply allows you to edit your code (i.e. it prevents that annoying message and "locking" your editor).
  • Go to Tools > Options > Debugging > General and make sure Require source files to exactly match the original version is unchecked.
  • Check Enable Windows debug heap allocator (Native only) [VS Community 2017]
  • Are you using Microsoft Fakes? It inhibits Edit & Continue.
  • Kill all the *.vshost.exe instances by selecting End Process Tree in the Task Manager. VS will regenerate a correct instance.
  • Remove all the breakpoints with Debug->Delete All Breakpoints
  • Enable and Continue exists in both the Tools > Options > Debugging menu and also in the Project Settings. Be sure to check both places. edit & Continue is not supported with the extended Intellitrace setting.
  • Be sure Debug Info in Project Properties > Build > Advanced > Output > Debug Info is set to Full
  • Some plugin may be interfering. Check by disabling/uninstalling and then trying again the other solutions.
  • If you're not paying enough attention, the error you get while trying to fix this may change to something else that is easier to diagnose. E.g. A method containing a lambda expression cannot support edit and continue.
  • Make sure the System variable COR_ENABLE_PROFILING is not set to 1. Some profilers set this when installing and leave it like that after uninstalling. Open a command prompt and type set to quickly check it your system is affected, if so remove the variable or set it to 0:

  • 在Windows 8及更高版本中,搜索系统(控制面板).
  • 点击高级系统设置链接.
  • 点击环境变量.
  • 删除COR_ENABLE_PROFILING
  • In Windows 8 and above, search for System (Control Panel).
  • Click the Advanced system settings link.
  • Click Environment Variables.
  • Remove COR_ENABLE_PROFILING

请注意

Be aware of unsupported scenarios (as reported in the question) and that unsupported edits.

*是您",我是指页面的访问者正在用键盘敲击键盘以找到解决方案.

如果此处未列出,请随时编辑此答案以添加您的解决方法!

这篇关于编辑并继续:“在...时不允许更改."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆