如何在应用程序处于调试模式时编辑源代码 [英] how to edit the source code while the application is debugging mode

查看:85
本文介绍了如何在应用程序处于调试模式时编辑源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试了一个应用程序然后更改了代码。当应用程序正在调试时,应用程序显示此消息 目前无法在编辑器中修改此文本。

它是只读的
我无法更改应用程序调试时的代码



是否有可能更改代码。而应用程序正在调试

I debugged one application then I change the code. While the application is debugging

that application is showing this message "Cannot currently modify this text in the editor.
It is read-only"
I can't able to change that code while the application is debugging

Is their any possibility to change the code. while the application is debugging

推荐答案

您好,



请参阅:

http://stackoverflow.com/a/5673006 [ ^ ]

Hi,

Please see:
http://stackoverflow.com/a/5673006[^]

是的,在工具|中称为编辑并继续调试下的选项。



编辑:如果您使用的是旧版本(原始VS.Net,而不是VS.Net 2005或更高版本),则关于这一点非常繁琐(或没有它,我不记得了;我只记得感到沮丧)。但是如果您使用VS.Net 2005或更高版本,根据我的经验,它默认启用并且运行良好。暂停执行时(并且你说你遇到了断点,所以...),你可以进行各种各样的更改,环境将很乐意编译它们并继续。确保您要调试的所有项目都在解决方案中。

Yes, it's called "Edit and Continue", in Tools | Options under Debugging.

If you're using a really old version (the original VS.Net, as opposed to VS.Net 2005 or later), it was pretty fiddly about this (or didn't have it, I can't quite recall; I just remember being frustrated). But if you're using VS.Net 2005 or later, in my experience, it's enabled by default and works very well. When execution is paused (and you said you'd hit a breakpoint, so...), you can make quite a variety of changes and the environment will happily compile them and continue. Make sure all of the projects you want to debug are in the solution.


除解决方案#1之外还有两点:

(1)在不同的语言和不同版本的Visual Studio中,对此有不同的支持。这个功能在C ++中已经存在时间最长,并且已经逐渐添加到具有更新版本VS的C#中。 [ProgramFOX几乎说了这个,但并没有完全解决。]

(2)你需要在调试器中停止才能编辑有问题的代码。程序运行时无法编辑代码。如果您在要修改的代码之外的断点处停止,也会获得更多成功。 ...并且您无法修改调用堆栈中已有的代码。
Two points in addition to Solution #1:
(1) There is mixed support for this in different languages and different versions of Visual Studio. This feature has been present the longest in C++, and has been gradually added to C# with more recent versions of VS. [ProgramFOX almost said this but didn't quite get it out.]
(2) You need to be stopped in the debugger to be able to edit the code in question. You can't edit the code while the program is running. You also will have more success if you are stopped at a breakpoint outside the code that you are trying to modify. ... and you can't modify code that is already on the call stack.


这篇关于如何在应用程序处于调试模式时编辑源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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