不寻常的异常行为?

发布于 2024-10-06 09:39:31 字数 365 浏览 0 评论 0原文

我以前从未遇到过这种行为,我想知道是否有人能够解释一下此事?

正如您在图片中看到的那样,我捕获了 AccessViolationException 类型的异常,但调试器却抱怨该异常未处理!

怎么可能呢?

alt text

哦,我知道你不应该有一个空的 catch 块,这不是我的问题。

谢谢!

编辑: 现在我得到了这个:

alt text

I have never come across this kind of behaviour before and I wondered if anyone is able to shed some light on the matter?

So as you can see in the picture, I am catching exceptions of type AccessViolationException, and yet the debugger is complaining that the exception is unhandled!

How is it possible?

alt text

Oh, and I know you shouldnt have an empty catch block, that's not my question.

Thanks!

Edit:
Now I am getting this one instead:

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁吢 2024-10-13 09:39:31

处理损坏的状态异常是您必须明确执行的操作,您可以捕获通过将 [HandledProcessCorruptedStateExceptions] 属性添加到函数中...

请注意,这些未处理是有原因的,因为如果忽略或一般处理意外情况,它们仍然可能是有害的。在这两种情况下都不能保证您所做的事情是完全安全的!仅在无法接受仅终止进程的情况下才处理它。

Handling Corrupted State Exceptions is something you have to do explicitly, you can catch those by adding the [HandledProcessCorruptedStateExceptions] attribute to the function...

Please note that these are unhandled with a reason as unexpected conditions can still be harmful if they are ignored or dealt with generically. There is no guarantee in either of these scenarios that what you're doing is completely safe! Only handle it in a scenario where just terminating the process is unacceptable.

坦然微笑 2024-10-13 09:39:31

这种奇怪的事情偶尔会发生在我身上,我会推荐新手IT方法。重新启动计算机。 .NET 中的 CLI 环境有时会出现很多错误,因为我之前曾将代码挂在 foreach 循环中。

Odd things like this happen to me once in a while, I'm going to recommend the newbie IT method. Restart your computer. The CLI Environment in .NET gets really buggy sometimes as I've had my code literally hang inside of a foreach loop before.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文