Skip to content

Commit 66fa04f

Browse files
authored
Merge pull request #194 from joj/cctor
Fixed steping on static constructor and methods they call
2 parents 4718645 + c435f5e commit 66fa04f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Mono.Debugging.Soft/SoftDebuggerSession.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ void Step (StepDepth depth, StepSize size)
14181418
var req = vm.CreateStepRequest (current_thread);
14191419
req.Depth = depth;
14201420
req.Size = size;
1421-
req.Filter = StepFilter.StaticCtor | StepFilter.DebuggerHidden | StepFilter.DebuggerStepThrough;
1421+
req.Filter = ShouldFilterStaticCtor() | StepFilter.DebuggerHidden | StepFilter.DebuggerStepThrough;
14221422
if (Options.ProjectAssembliesOnly)
14231423
req.Filter |= StepFilter.DebuggerNonUserCode;
14241424
if (assemblyFilters != null && assemblyFilters.Count > 0)
@@ -1452,7 +1452,14 @@ void Step (StepDepth depth, StepSize size)
14521452
DebuggerLoggingService.LogError ("Step request failed", ex);
14531453
}
14541454
});
1455-
}
1455+
}
1456+
1457+
private StepFilter ShouldFilterStaticCtor()
1458+
{
1459+
var frames = current_thread.GetFrames();
1460+
return (frames.Any(f => f.Method.Name == ".cctor" && f.Method.IsSpecialName && f.Method.IsStatic))
1461+
? StepFilter.None : StepFilter.StaticCtor;
1462+
}
14561463

14571464
void EventHandler ()
14581465
{

0 commit comments

Comments
 (0)