diff --git a/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs b/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs index a7db95ae8..9ca261116 100644 --- a/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs @@ -390,6 +390,15 @@ namespace ICSharpCode.Decompiler.CSharp if (!endContainerLabels.TryGetValue(inst.TargetContainer, out string label)) { label = "end_" + inst.TargetLabel; + if (!duplicateLabels.TryGetValue(label, out int count)) + { + duplicateLabels.Add(label, 1); + } + else + { + duplicateLabels[label]++; + label += "_" + (count + 1); + } endContainerLabels.Add(inst.TargetContainer, label); } return new GotoStatement(label).WithILInstruction(inst);