From 5696aaad30b4090a8495e598e65f175c5a6e7ee5 Mon Sep 17 00:00:00 2001 From: ChristophDeCol Date: Tue, 25 Feb 2025 18:16:11 +0100 Subject: [PATCH] Copy sub scopes to cloned method --- src/MethodBoundaryAspect.Fody/MethodWeaver.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/MethodBoundaryAspect.Fody/MethodWeaver.cs b/src/MethodBoundaryAspect.Fody/MethodWeaver.cs index 206d34c..9e20382 100644 --- a/src/MethodBoundaryAspect.Fody/MethodWeaver.cs +++ b/src/MethodBoundaryAspect.Fody/MethodWeaver.cs @@ -178,6 +178,14 @@ private static MethodDefinition CloneMethod(MethodDefinition method) } } + if (method.DebugInformation?.Scope?.Scopes != null) + { + foreach (var scopeDebugInformation in method.DebugInformation.Scope.Scopes) + { + clonedMethod.DebugInformation.Scope.Scopes.Add(scopeDebugInformation); + } + } + return clonedMethod; }