From a9fd9370993c5b6a40d05bdcd2d7c0bf78bc8588 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Nov 2017 12:51:02 +0100 Subject: [PATCH] Fix bug in TransformArrayInitializers.HandleJaggedArrayInitializer --- .../IL/Transforms/TransformArrayInitializers.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs index cda1d926d..aaac03af8 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs @@ -213,8 +213,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms instructionsToRemove += inc; } ILInstruction array; - if (block.Instructions[pos].MatchStLoc(out finalStore, out array)) + // In case there is an extra copy of the store variable + // Remove it and use its value instead. + if (block.Instructions[pos].MatchStLoc(out finalStore, out array)) { + instructionsToRemove++; return array.MatchLdLoc(store); + } finalStore = store; return true; }