gpt4 book ai didi

.net - CLR 异常系统中的故障子句是什么?

转载 作者:行者123 更新时间:2023-12-01 09:40:07 25 4
gpt4 key购买 nike

我正在阅读 this article在处理损坏的状态异常时,我遇到了令我困惑的事情。

什么是过错条款?

请参阅以下文章的引用:

An error condition can only pass from the function containing the unexpected condition to that function's caller. Exceptions have the power to pass the results of a function's execution out of the current function's scope to every frame up the stack until it reaches the frame that knows how to handle the unexpected condition. The CLR's exception system (called a two-pass exception system) delivers the exception to every predecessor on the thread's call stack, beginning with the caller and proceeding until some function says it will handle the exception (this is known as the first pass).

The exception system will then unwind the state of each frame on the call stack between where the exception is raised and where it will be handled (known as the second pass). As the stack unwinds, the CLR will run both finally clauses and fault clauses in each frame as it is unwound. Then, the catch clause in the handling frame is executed.

最佳答案

根据this article :

Another example of a SEH clause not available in the C# language is the fault clause. It is similar to the finally clause except that it's only invoked when an exception has been thrown in the guarded block.

Another article确认:

The fault exception handler is similar to the finally block except that it is invoked only if it’s associated try block is left as a result of an exception. After the fault handler has been given an opportunity to execute, the exception continues on its way in search or a handler that is willing to catch it.

关于.net - CLR 异常系统中的故障子句是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/738189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com