dotnet/runtime

ILVerify fails to verify some catch-to-try leave instructions

开放

#48,250 创建于 2021年2月12日

 (2 条评论) (0 个反应) (1 位负责人)C# (5,445 个派生)batch import
Priority:3area-Tools-ILVerificationhelp wanted

仓库指标

星标
 (17,886 个星标)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

Description

To reproduce: Run ILVerify on the Foo.dll assembly in this zip file. The following output should be produced:

[IL]: Error [LeaveIntoTry]: [...\Foo.dll : .A::m2(int32)][offset 0x00000014] Leave into try block.
1 Error(s) Verifying ...\Foo.dll

If the assembly is executed on .NET 5 (by invoking its Main method), it produces the expected output without any errors.

The assembly contains two static methods A.m1 and A.m2. Both contain leave instructions that jump from a catch block to its associated try block, which is legal according to ECMA-335, section I.12.4.2.8.2.8.

ILVerify correctly verifies the leave in A.m1. In A.m2, the catch block and the try block to which it jumps to are nested in another try block which has a finally block, which triggers the bug.

Configuration

ILVerify version: 5.0.0-rtm.20519.4+cf258a14b70ad9069470a108f13765e0e5988f51

贡献者指南