Skip to content

ILVerify Failure: TryFinally_YieldBreakInDisposeMode #79124

@333fred

Description

@333fred

Version Used: c8b5f30

public void TryFinally_YieldBreakInDisposeMode(int iterations, string expectedOutput)
{
string source = @"
using static System.Console;
public class C
{
public static async System.Collections.Generic.IAsyncEnumerable<int> M()
{
yield return 1;
await System.Threading.Tasks.Task.CompletedTask;
try
{
try
{
Write(""Break "");
yield break;
}
finally
{
Write(""Throw "");
throw null;
}
}
catch
{
Write(""Caught "");
yield break;
}
finally
{
Write(""Finally "");
}
}
}";
var comp = CreateCompilationWithAsyncIterator(new[] { Run(iterations), source }, options: TestOptions.DebugExe);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: expectedOutput);
}

When this test is run on .NET with ILVerify, the following warning is produced:

[MoveNext]: Leave into try block. { Offset = 0x11a }

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions