You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Debugging through a PowerShell Host is implemented by registering a handler
19
+
/// for the <see cref="System.Management.Automation.Debugger.DebuggerStop"/> event.
20
+
/// Registering that handler causes debug actions in PowerShell like Set-PSBreakpoint
21
+
/// and Wait-Debugger to drop into the debugger and trigger the handler.
22
+
/// The handler is passed a mutable <see cref="System.Management.Automation.DebuggerStopEventArgs"/> object
23
+
/// and the debugger stop lasts for the duration of the handler call.
24
+
/// The handler sets the <see cref="System.Management.Automation.DebuggerStopEventArgs.ResumeAction"/> property
25
+
/// when after it returns, the PowerShell debugger uses that as the direction on how to proceed.
26
+
/// </para>
27
+
/// <para>
28
+
/// When we handle the <see cref="System.Management.Automation.Debugger.DebuggerStop"/> event,
29
+
/// we drop into a nested debug prompt and execute things in the debugger with <see cref="System.Management.Automation.Debugger.ProcessCommand(PSCommand, PSDataCollection{PSObject})"/>,
30
+
/// which enables debugger commands like <c>l</c>, <c>c</c>, <c>s</c>, etc.
31
+
/// <see cref="Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging.PowerShellDebugContext"/> saves the event args object in its state,
32
+
/// and when one of the debugger commands is used, the result returned is used to set <see cref="System.Management.Automation.DebuggerStopEventArgs.ResumeAction"/>
33
+
/// on the saved event args object so that when the event handler returns, the PowerShell debugger takes the correct action.
// So that error record PSObjects will be rendered in the console properly
30
+
// See https://github.com/PowerShell/PowerShell/blob/946341b2ebe6a61f081f4c9143668dc7be1f9119/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs#L2088-L2091
// These methods are required when running commands remotely.
85
+
// Remote rendering from command output is done asynchronously.
86
+
// So to ensure we wait for output to be rendered,
87
+
// we need these methods to wait for rendering.
88
+
// PowerShell does this in its own implementation: https://github.com/PowerShell/PowerShell/blob/883ca98dd74ea13b3d8c0dd62d301963a40483d6/src/System.Management.Automation/engine/debugger/debugger.cs#L4628-L4652
0 commit comments