调试时无法在 visual studio 中编写代码
Cannot write code in visual studio while debugging
您好,我目前已从 VS 2013 转移到 2015。所以我对深度规范不是很熟悉。
我喜欢 VS 2015,因为它允许我计算 lambda 表达式,还允许我更改值 运行time.
场景:
在某些应用程序中(仅测试过 winforms),我可以在调试时编辑代码,是的,最新的代码总是被执行,即我不需要一次又一次地停止和 运行 程序。是的,这是非常出色的功能。
但是如果我第一次体验 MVC 中的控制器,我无法编辑代码,它向我展示了这背后的多种原因。
谁能解释一下在什么情况下我可以在调试时 add/delete 编码?
提前致谢!
在您的 visual studio 中,转到工具-> 选项-> 展开调试 -> select 编辑并继续,然后选中启用编辑并继续。
这是图片:
see screenshot
我有时也看到在调试过程中出现类似的消息。我从 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.
如果您附加到一个已经 运行 的进程,您通常无法编辑和继续,如果您附加到一个 运行 MVC 网络项目,这可能就是您的情况。如果某些内容是使用反射加载的,您将无法对其进行编辑。
因此,经过大量研发后,我才知道 Asp.net 还无法使用“编辑并继续”。它将在 Visual studio 15.
的最终版本中发布
您好,我目前已从 VS 2013 转移到 2015。所以我对深度规范不是很熟悉。
我喜欢 VS 2015,因为它允许我计算 lambda 表达式,还允许我更改值 运行time.
场景:
在某些应用程序中(仅测试过 winforms),我可以在调试时编辑代码,是的,最新的代码总是被执行,即我不需要一次又一次地停止和 运行 程序。是的,这是非常出色的功能。
但是如果我第一次体验 MVC 中的控制器,我无法编辑代码,它向我展示了这背后的多种原因。
谁能解释一下在什么情况下我可以在调试时 add/delete 编码?
提前致谢!
在您的 visual studio 中,转到工具-> 选项-> 展开调试 -> select 编辑并继续,然后选中启用编辑并继续。 这是图片: see screenshot
我有时也看到在调试过程中出现类似的消息。我从 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.
如果您附加到一个已经 运行 的进程,您通常无法编辑和继续,如果您附加到一个 运行 MVC 网络项目,这可能就是您的情况。如果某些内容是使用反射加载的,您将无法对其进行编辑。
因此,经过大量研发后,我才知道 Asp.net 还无法使用“编辑并继续”。它将在 Visual studio 15.
的最终版本中发布