VS 17打破了所有例外 [英] VS 17 breaking on all exceptions

查看:123
本文介绍了VS 17打破了所有例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2017突然出现了 all 异常.这意味着,如果我在例外设置中将它们停用(调试时按CTRL + ALT + E),调试器仍然会在它们上中断.我不知道这只是VS的一个错误,我无法更改,因此必须忍受,或者是否有一个简单的解决方案.

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:

,这是VS中断的异常:

and this the exception VS breaks on:

顺便说一句,我还尝试了漂亮的减号(如果按下它,什么也不会发生)或添加了一个不可能的条件(VS仍然在异常情况下坏了).

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:

我实际上甚至将所有内容放入try catch语句中,但是VS仍然无法运行:

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) { }

它在我的PC上没有出现在其他IDE(如Rider)中,在VS中的其他PC上也没有出现.它并不总是出现在我的PC上,它只是在最近才启动,并且仅在调试模式下启动.如果我继续执行(使用F5),它将继续正常运行.

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.

编辑:当我将try catch放入线程中时,它的行为略有不同(很抱歉在此处放置图片,但我认为在这种情况下它们更具表现力):

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?

编辑 ThreadAbortExceptions在catch语句结束时再次中断似乎是正常的.但是,VS仍然不应该完全打破此异常.

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.

推荐答案

我遇到了类似的问题.

我通过取消选中工具>选项>调试>常规

这篇关于VS 17打破了所有例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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