OpCodes.Endfinally 字段

定义

将控制从异常块的 faultfinally 子句转移回公共语言结构 (CLI) 异常处理程序。Transfers control from the fault or finally clause of an exception block back to the Common Language Infrastructure (CLI) exception handler.

public: static initonly System::Reflection::Emit::OpCode Endfinally;
public static readonly System.Reflection.Emit.OpCode Endfinally;
 staticval mutable Endfinally : System.Reflection.Emit.OpCode
Public Shared ReadOnly Endfinally As OpCode 

字段值

注解

下表列出了指令的十六进制和 Microsoft 中间语言(MSIL)程序集格式以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 程序集格式Assembly Format 说明Description
DCDC 执行 endfinallyendfinally

endfaultendfault
结束异常块的 @no__t 0 或 @no__t 子句。Ends the finally or fault clause of an exception block.

此指令没有堆栈转换行为。There are no stack transition behaviors for this instruction.

Endfinallyendfault @no__t @no__t 信号,指示在调用异常处理程序之前,堆栈展开可以继续。Endfinally and endfault signal the end of the finally or fault clause so that stack unwinding can continue until the exception handler is invoked. @No__t 0 或 @no__t 1 指令将控制转移回 CLI 异常机制。The endfinally or endfault instruction transfers control back to the CLI exception mechanism. 然后,该机制会搜索链中的下一个 finally 子句(如果使用 leave 指令退出了受保护的块)。The mechanism then searches for the next finally clause in the chain if the protected block was exited with a leave instruction. 如果受保护的块退出但出现异常,则 CLI 将搜索下一个 finallyfault,或输入在第一次异常处理过程中选择的异常处理程序。If the protected block was exited with an exception, the CLI will search for the next finally or fault, or enter the exception handler chosen during the first pass of exception handling.

@No__t-0 指令只能在 @no__t 块中以词法方式出现。An endfinally instruction might only appear lexically within a finally block. 与 @no__t 0 指令不同,块不要求块以 @no__t 指令结束,并且在所需的块中可以有尽可能多的 endfinally 指令。Unlike the endfilter instruction, there is no requirement that the block end with an endfinally instruction, and there can be as many endfinally instructions within the block as required. 这些相同的限制适用于 @no__t 0 指令和 fault 块。These same restrictions apply to the endfault instruction and the fault block.

不能将控件传输到 finally (或 @no__t)块中,除非通过异常机制。Control cannot be transferred into a finally (or fault) block except through the exception mechanism. 除了通过使用 throw 指令或执行 endfinally (或 @no__t)指令以外,不能将控件从 @no__t 0 (或 fault)块中转移。Control cannot be transferred out of a finally (or fault) block except through the use of a throw instruction or executing the endfinally (or endfault) instruction. 特别是,不能 "超出" finally (或 fault)块,也不能在 @no__t (或 @no__t)块中执行 @no__t 或 @no__t 指令。In particular, you cannot "fall out" of a finally (or fault) block or to execute a Ret or Leave instruction within a finally (or fault) block.

请注意,@no__t 0 和 @no__t 1 说明是别名,它们对应于相同的操作码。Note that the endfault and endfinally instructions are aliases - they correspond to the same opcode.

以下 Emit 方法重载可以使用 endfinallyendfault)操作码,并使用 EndExceptionBlock 的 @no__t 方法。The following Emit method overload can use the endfinally (endfault) opcode, as well as the ILGenerator method EndExceptionBlock.

  • ILGenerator.Emit(OpCode)ILGenerator.Emit(OpCode)

  • ILGenerator.EndExceptionBlock()ILGenerator.EndExceptionBlock()

适用于