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

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

问题描述

即使我创建了一个干净的 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 和 Windows XP 32 位上运行,但将平台目标设置为 x86 而不是 AnyCpu 没有帮助.
  6. 修复 Visual Studio 安装无济于事.

我还在 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 &快速继续.

Other Applicable Solutions

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

  • 确保您处于调试模式
  • 确保您没有启动混合模式进程
  • 尝试将 CPU 目标设置为 x86 而不是 AnyCPU(在 x64 机器上)
  • 取消选中项目属性->调试
  • 调试模式优化代码复选框
  • 高级编译器设置
  • 中取消选中启用优化
  • (ASP.NET) 检查 nightcoder 的答案 如果是这种情况
  • (ASP.NET) 检查 this answer (by matrixugly) 如果是这样
  • (ASP.NET) 确保您在 Web 选项卡上启用了 Edit and Continue (vs2010)
  • (ASP.NET) 转到 Properties > Web > Servers,并确保在 Use Visual Studio Development Server 下选中 Enable and continueem>.
  • (ASP.NET WebAPI) 在尝试编辑它之前,请确保您已使用断点在控制器的方法中停止.
  • (vs2017)转到工具>选项>调试取消选中(取消选择)编辑并继续".这实际上与传统"建议相反(请参阅本文中的其他一些要点).它不允许您在运行程序中进行实际更改(即它不会热交换您所做的代码更改)-它只是允许您编辑代码(即它可以防止烦人的消息并锁定"您的编辑器).
  • 转到工具>选项>调试>常规并确保要求源文件与原始版本完全匹配未选中.
  • 选中启用 Windows 调试堆分配器(仅限本机)[VS 社区 2017]
  • 您在使用 Microsoft Fakes 吗?它禁止编辑 &继续.
  • 任务管理器中选择结束进程树,杀死所有*.vshost.exe实例.VS 将重新生成正确的实例.
  • 使用调试->删除所有断点
  • 删除所有断点
  • 启用并继续存在于工具>选项>调试菜单和项目设置中.一定要检查两个地方.编辑&扩展 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天全站免登陆