繁体   English   中英

调试时无法在visual studio中编写代码

[英]Cannot write code in visual studio while debugging

嗨我现在已经从VS 2013转到2015 所以我对深度规范不太熟悉。

我喜欢VS 2015,因为它允许我评估lambda表达式,并且它允许我更改值运行时。

场景:

在一些应用程序(仅测试winforms)中,我能够在调试时编辑代码,并且始终执行是最新代码,即我不需要再次停止并运行程序并且againe。 是的,它是非常出色的功能。

但是,如果我第一次体验MVC中的控制器,我无法编辑代码,它显示了我背后的多个原因。

在此输入图像描述

有人可以解释在调试时我可以添加/删除代码的场景吗?

提前致谢!

在visual studio中,转到Tools-> Options-> expand debugging - >选择Edit并继续,然后选中Enable edit并继续。 这是图像: 见截图

如果您附加到已经运行的进程,通常无法编辑和继续,如果您附加到正在运行的MVC Web项目,则可能是您的情况。 如果使用Reflection加载某些内容,您也无法对其进行编辑。

我还看到有时在调试期间出现类似的消息。 我在MSDN中找到了以下有关调试期间代码更改的内容:

The following changes cannot be applied to C# code during a debugging session:

- Changes to the current statement or any other active statement.

- Active statements include any statements, in functions on the call stack, that were called to get to the current statement.

- The current statement is marked by a yellow background in the source window. Other active statements are  marked by a shaded background and are read-only. These default colors can be changed in the Options dialog box.

- Changing the signature of a type.

- Adding an anonymous method that captures a variable that hasn’t been captured before.

- Adding, removing, or changing attributes.

- Adding, removing, or changing using directives.

- Adding a foreach, using, or lock around the active statement.

更多信息: https//msdn.microsoft.com/en-us/library/ms164927.aspx

所以,经过大量的研发后我才知道编辑和继续不适用于Asp.net 它将在Visual Studio 15的最终版本中发布。

来源: https//blogs.msdn.microsoft.com/visualstudioalm/2015/04/29/net-enc-support-for-lambdas-and-other-improvements-in-visual-studio-2015/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM