在Visual Studio 2017中处理未处理的异常后启用编辑 [英] Enable editing after an unhandled exception in Visual Studio 2017

查看:204
本文介绍了在Visual Studio 2017中处理未处理的异常后启用编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2017中出现未处理的异常后,如何继续执行?

How can I continue execution after an unhandled exception in Visual Studio 2017?

在2015年及更低版本中,这可以通过单击Enable Editing轻松完成,该操作将调用堆栈展开到异常之前的位置".然后可以编辑执行点,变量和代码.

In version 2015 and below this was easily done by clicking Enable Editing which "unwinds the callstack to the point before the exception". It was then possible to edit the execution point, variables and code.

当库引发异常时,此选项消失:

This option is gone when a library throws the exception:

"".Substring(1);


如果用户代码中发生异常,它仍然可以工作:


In case the exception happens in user code it still works:

int x = 0;
Console.WriteLine(1 / x);

请注意可以拖动的黄色箭头.

Notice the yellow arrow which can be dragged.

我真的希望不要删除此功能,因为挽救崩溃的程序(例如,通过设置x = 1,更改字符串常量或跳过有问题的行)是我做的很多事情.现在,在这种状态下,我已经完成了99%的多小时操作,我真的很想通过抑制一个不重要的错误来挽救它.

I really hope this feature was not removed because salvaging a crashing program (here, by setting x = 1 for example, changing the string constant or by skipping the problematic line) is something I do a lot. Right now I have a multi-hour operation 99% completed in this state and I'd really like to rescue it by suppressing an unimportant error.

这是.NET 4.6.1上的Visual Studio 2017内部版本26228.

This is Visual Studio 2017 build 26228 on .NET 4.6.1.

推荐答案

在VS2017中,旧的启用编辑"被隐藏并自动触发.调试时,如果执行以下操作,则可以在未处理的异常后编辑代码/变量:

In VS2017 the old "Enable Editing" is hidden and triggered automatically. While debugging, I'm able to edit the code / variables after unhandled exception if I do the following:

  1. 单击文档以将焦点移到新的异常帮助器"上
  2. 按空格键(或您最喜欢的键!)

OR

  1. 拖动黄色箭头(库为绿色箭头).

在按下键或移动箭头之前,文件选项卡上有一个挂锁,告诉您它已被编辑锁定.之后,该锁将被删除,就像旧的启用编辑"功能一样.删除编辑锁的第一个按键没有输入到文件中,此后,编辑代码和变量的行为就和以前一样.

Before hitting a key or moving the arrow there is the padlock on the file tab telling you it's edit-locked. After, the lock is removed just like the old "Enable Editing" feature. That first keystroke that removes the edit-lock isn't entered into the file, after that, editing code and variables behaves just as before.

我希望像以前一样使用显式的启用编辑"链接,希望他们能将其重新使用.

I preferred the explicit "Enable Editing" link as it was before, hopefully they bring it back.

这篇关于在Visual Studio 2017中处理未处理的异常后启用编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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