不寻常的异常行为?
我以前从未遇到过这种行为,我想知道是否有人能够解释一下此事?
正如您在图片中看到的那样,我捕获了 AccessViolationException 类型的异常,但调试器却抱怨该异常未处理!
怎么可能呢?
哦,我知道你不应该有一个空的 catch
块,这不是我的问题。
谢谢!
编辑: 现在我得到了这个:
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?
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:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理损坏的状态异常是您必须明确执行的操作,您可以捕获通过将
[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.
这种奇怪的事情偶尔会发生在我身上,我会推荐新手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.