diff --git a/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs b/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs index f00fc48b0..523d6e68c 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs @@ -658,6 +658,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms switch (useSite) { case CallInstruction call: + if (DelegateConstruction.MatchDelegateConstruction(useSite, out _, out _, out _)) + { + // if this is a delegate construction, skip the use-site, because the capture scope + // was already determined when analyzing "this". + break; + } int firstArgumentIndex = info.Definition.Method.IsStatic ? 0 : 1; for (int i = call.Arguments.Count - 1; i >= firstArgumentIndex; i--) {