private void HandleDebuggerStopEvent(object sender, DebuggerStopEventArgs args) { Debugger debugger = sender as Debugger; DebuggerResumeAction?resumeAction = null; if (!ShowHelpMessage) { UserIOImpl.PrintMessage("Entering debug mode. Type 'h' to get help.\n"); ShowHelpMessage = true; } CheckVariables(debugger); PrintCurrentCode(args); while (resumeAction == null) { if (CommandCount > 0) { resumeAction = RunDebuggerCommand(debugger, Command)?.ResumeAction; CommandCount--; } else { string commandLine = UserIOImpl.GetInput("PowerShellRunBox>> "); string[] commandArgs = commandLine.Split(' '); if (commandArgs.Length <= 0) { continue; } if (commandArgs[0] == "s") { Command = commandArgs[0]; if (commandArgs.Length > 1) { CommandCount = Convert.ToInt32(commandArgs[1]); } } else { Command = commandLine; } resumeAction = RunDebuggerCommand(debugger, Command)?.ResumeAction; } } // DebuggerStopEventArgs.ResumeAction: // - Continue Continue execution until next breakpoint is hit. // - StepInto Step into function. // - StepOut Step out of function. // - StepOver Step over function. // - Stop Stop debugging. args.ResumeAction = resumeAction.Value; }