VB.net 编辑并继续:忽略“调试时无法应用此更改”
当使用 VB.Net (2008) 并在调试中暂停时,“编辑并继续”可以节省大量时间。但是,如果您更改任何模块/类级别信息(变量、子/函数签名等),您会收到如下错误消息:
"unable to apply this change while debugging"
虽然我可以理解实现这项工作的技术挑战(以及为什么它会很困难),它让我陷入困境,只有几个选择:
1)重新启动并重新编译并使程序恢复到相同的状态
2) 继续调试而不进行更改,并有忘记的风险
3) 输入提醒注释以进行更改
所有这些都烦人。
现在我知道选项“4) 只是实际进行更改”可能是不可能的。但有人知道如何实现以下“技术上简单”的可能性吗?
4)让我更改代码,用紫色波浪下划线标记它,这样我就可以保存它,但在重新编译之前忽略更改
我已检查了工具|选项|调试|编辑并继续,似乎没有什么能让我这样做。
谢谢!
When using VB.Net (2008) and paused in debugging, Edit-And-Continue is a great time-saver. However if you change any module/class-level information (variable, sub/function signature, etc), you get the error message like this:
"unable to apply this change while debugging"
While I can understand the technical challenge to making this work (and why it would be hard), it leaves me in a tight spot with just a few options:
1) Restart and recompile and get the program back to the same state
2) Continue debugging without making the change, and risk forgetting
3) Type up a reminder note to make the change
All of which are annoying.
Now I know that option '4) Just actually make the change' may not be possible. but does anybody know how to enable the following 'technically easy' possibility?
4) Let me change the code, get it flagged with the purple squiggly underline, so I can save it, but just ignore the change until recompile
I have checked the Tools|options|debug|edit and continue, nothing appears to let me do this.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无法完全按照您想要的方式进行操作,但您可以在另一个 vs 实例中打开解决方案/项目并更改其中的代码。不过,您必须确保没有保存它。
You can't do exactly what you want but you could have the solution/project open in another vs instace and change the code in that. You would have to make sure you didn't save it though.
不幸的是,这是不可能的。
这并不像你想象的那么简单。
至少,您将使所有行编号无效(尽管在正常的 E&C 中也会发生这种情况)。
但是,IDE 需要额外的验证层,以防止您执行诸如更改方法签名或类接口之类的操作,这些操作会导致源代码级调试变得不可能。
此外,对于不了解到底发生了什么的人来说,这会非常令人困惑。
Unfortunately, this is not possible.
It's not as simple as you might think.
At the very least, you will invalidate all of the line numbering (although that happens in normal E&C too).
However, the IDE would need an extra layer of validation to prevent you from doing things like changing method signatures or class interfaces that would make source-level debugging impossible.
In addition, it would be extremely confusing for people who don't understand exactly what's going on.
我认为这是不可能的,当你说这很容易时,我认为你忘记了 Visual Studio 必须跟踪你所做的任何更改与编译时的情况相比,以便它可以显示你在调试器等中的正确行,如果你添加一些行,删除一些其他行并修改一些行可能会变得非常混乱以涵盖所有可能性,并且它也可能非常令人困惑。
I don't think that's possible, and when you say that it's easy, I think you forget that Visual Studio then would have to keep track of any changes you've done compared with what it was like at compile time so that it could show you the correct line you're on in the debugger etc, which if you add some lines, delete some other lines and amend some lines could get quite messy to cover all eventualities, and it might be quite confusing too.