"编辑无法编辑".在vs2010中检查零错误和启用以及编辑和继续

viv*_*rma 19 c# debugging visual-studio-2010

我能够在调试模式下编辑我的代码,但随后弹出显示"编辑无法编译的错误.执行无法继续单元编译错误已修复"但错误列表为空且我已选中启用编辑并继续.我正在使用vs2010.

清洁和重新启动还没有解决问题.

ru4*_*ert 17

在视觉工作室

Debug --> Options --> Debugging --> General --> uncheck Enable Edit and Continue
Run Code Online (Sandbox Code Playgroud)


Jac*_*ler 7

当您的工作区损坏时,可能会发生此问题。只需关闭Visual Studio,删除(最好先重命名).vs文件夹,然后再次启动Visual Studio。

VS2017甚至可能发生这种情况。

  • VS2019同样的问题 (4认同)

wec*_*cky 5

我遇到了同样的问题(VS2017),对我来说,菜单项Build并单击Clean Solution Then Rebuild Solution就足够了,一切又正常了。


veu*_*ent 5

这可能是由 Visual Studio 的Edit & Continue功能引起的。
解决方法是禁用此功能:

Debug --> Options --> Debugging --> General --> uncheck Enable Edit and Continue
Run Code Online (Sandbox Code Playgroud)

解决方案取自这里

也在这里回答了。


Bil*_*hby 4

我在使用 Visual Studio 2008、2010 和 2013 时遇到过这个问题。当这个问题出现时,我编写了一个批处理文件,保存在每个项目的解决方案文件夹中。扩展 Vijay 所说的内容,这会清除 bin 和 obj 文件夹。有时 Visual Studio 会锁定文件夹,我必须将其关闭,但在清除这些文件夹后,问题就消失了......一段时间。我不确定根本原因,我相信内存中的二进制文件和代码在某种程度上不同步。但这允许快速关闭、干净、开放的解决方案。

@echo off
cls
dir bin /s /AD /b > clean.tmp
dir obj /s /AD /b >> clean.tmp
for /F  "tokens=*" %%A in (clean.tmp) do echo rmdir /S /Q "%%A" 
echo This command will remove ALL BIN and OBJ folders in this tree.
echo To run the commands as listed ...
pause
for /F  "tokens=*" %%A in (clean.tmp) do rmdir /S /Q "%%A" 
del clean.tmp
pause
Run Code Online (Sandbox Code Playgroud)