Visual Studio 2017 (有点突然)打破了所有异常.这意味着,如果我在异常设置中停用它们(在调试时按 CTRL + ALT + E),调试器仍然会中断它们.我不知道这只是 VS 的一个错误,我无法更改因此必须忍受,或者是否有一个简单的解决方案.
这是异常设置窗口:
这个异常VS中断:
顺便说一句,我还尝试了那个漂亮的减号(如果我按下它什么都不会发生)或添加一个不可能的条件(VS 仍然在异常中中断).
我还测试了其他异常(通过简单地抛出它们),我之前禁用了它们,它们也被抛出,我在其他项目中测试了同样的问题,它也出现了:
实际上我什至把所有的东西都放到了 try catch 语句中,但 VS 还是会中断:
InitializeComponent();尝试{var t = 新线程 (() =>{while (!IsHandleCreated) {}//它在这里中断(类似于屏幕截图)而(真)Invoke (new Action (() => Size = new Size ()));});而(真){t.开始();线程.睡眠(100);t.Abort();}}捕捉(线程中止异常){}
它不会出现在我 PC 上的其他 IDE(如 Rider)中,也不会出现在 VS 中的其他 PC 上.它并不总是发生在我的电脑上,它最近才开始并且仅在调试模式下.如果我继续执行(使用 F5),它就会正常继续.
编辑当我将 try catch 放在线程中时,它的行为有点不同(我很抱歉在这里放了图片,但我认为在这种情况下它们更具表现力):
任何人可以解释这种行为吗?
EDIT ThreadAbortExceptions
在 catch 语句结束时再次中断似乎是正常的.但是,VS 仍然不应该在这个异常上中断.
我遇到了类似的问题.
我通过在工具>选项>调试>常规中取消选中当异常跨越AppDomain或托管/本机边界时中断"来修复它
Visual Studio 2017 is (kind of suddenly) breaking on all exceptions. That means, if I deactivate them in the exceptions settings (pressing CTRL + ALT + E while debugging), the debugger still breaks on them. I don't know wether this is just a bug of VS I can't change and therefore have to live with, or wether there is a simple solution for it.
This is the exception settings window:
and this the exception VS breaks on:
By the way, I also tried that beautiful minus (nothing happens if I press it) or adding a impossible condition (VS still broke on the exception).
I also tested other exceptions (by simply throwing them), which I deactivated before, and they get thrown as well and I tested the same issue in other projects, where it appeared as well:
I actually even put the whole stuff into a try catch statement but VS still breaks:
InitializeComponent ();
try
{
var t = new Thread (() =>
{
while (!IsHandleCreated) {} //It breaks here (similiar to the screenshots)
while (true)
Invoke (new Action (() => Size = new Size ()));
});
while (true)
{
t.Start ();
Thread.Sleep (100);
t.Abort ();
}
}
catch (ThreadAbortException) { }
It doesn't appear in other IDEs (like Rider) on my PC and doesn't occurr on other PCs in VS. It didn't always occurr on my PC, it just started recently and only in debugging mode. And if I continue the execution (with F5) it just continues normally.
EDIT As I put the try catch inside the thread it behaved a little bit different (I'm sorry for putting pictures in here, but I think they're more expressive in that case):
Can anybody explain this behaviour?
EDIT It seems to be normal for ThreadAbortExceptions
to break again at the end of a catch statement. However, VS still shouldn't break on this exception at all.
I was having a similar problem.
I fixed it by unchecking "Break when exceptions cross AppDomain or managed/native boundaries" in Tools > Options > Debugging > General
这篇关于VS 17 打破所有异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!