From 5b7e1b844faf600e0a79107afec87dbb1aca58ea Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 18 Dec 2018 23:50:20 +0100 Subject: [PATCH] Fix #1327: BlockBuilder: ILRange was not set on last block of outer containers, if there were nested containers, such as try/finally. --- ICSharpCode.Decompiler/IL/BlockBuilder.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/IL/BlockBuilder.cs b/ICSharpCode.Decompiler/IL/BlockBuilder.cs index 1a2e69235..3a6edbe7d 100644 --- a/ICSharpCode.Decompiler/IL/BlockBuilder.cs +++ b/ICSharpCode.Decompiler/IL/BlockBuilder.cs @@ -166,7 +166,12 @@ namespace ICSharpCode.Decompiler.IL FinalizeCurrentBlock(inst.ILRange.End, fallthrough: true); } FinalizeCurrentBlock(mainContainer.ILRange.End, fallthrough: false); - containerStack.Clear(); + // Finish up all containers + while (containerStack.Count > 0) { + currentContainer = containerStack.Pop(); + currentBlock = currentContainer.Blocks.Last(); + FinalizeCurrentBlock(mainContainer.ILRange.End, fallthrough: false); + } ConnectBranches(mainContainer, cancellationToken); }