diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Set-PSBreakpoint.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Set-PSBreakpoint.cs index 230aed4f604..9b18c6fd4c5 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Set-PSBreakpoint.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Set-PSBreakpoint.cs @@ -81,7 +81,7 @@ protected override void ProcessRecord() else { WriteObject( - Context.Debugger.SetCommandBreakpoint(Command[i], Action)); + Context.Debugger.SetCommandBreakpoint(Command[i], Action, path: null)); } } } @@ -103,7 +103,7 @@ protected override void ProcessRecord() else { WriteObject( - Context.Debugger.SetVariableBreakpoint(Variable[i], Mode, Action)); + Context.Debugger.SetVariableBreakpoint(Variable[i], Mode, Action, path: null)); } } } diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 2da88562221..19a9c5e0995 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -618,89 +618,165 @@ public virtual IEnumerable GetCallStack() return new Collection(); } + /// + /// Get a breakpoint by id in the current runspace, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. + /// + /// Id of the breakpoint you want. + public Breakpoint GetBreakpoint(int id) => + GetBreakpoint(id, runspaceId: null); + /// /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public virtual Breakpoint GetBreakpoint(int id, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public virtual Breakpoint GetBreakpoint(int id, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Adds the provided set of breakpoints to the debugger, in the current runspace. + /// + /// Breakpoints. + public void SetBreakpoints(IEnumerable breakpoints) => + SetBreakpoints(breakpoints, runspaceId: null); + /// /// Adds the provided set of breakpoints to the debugger. /// /// Breakpoints. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public virtual void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with, null being the current runspace. + public virtual void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Returns breakpoints in the current runspace, primarily for the Get-PSBreakpoint cmdlet. + /// + public List GetBreakpoints() => + GetBreakpoints(runspaceId: null); + /// /// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public virtual List GetBreakpoints(int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public virtual List GetBreakpoints(int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Sets a command breakpoint in the current runspace in the debugger. + /// + /// The name of the command that will trigger the breakpoint. This value may not be null. + /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. + /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. + /// The command breakpoint that was set. + public CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path) => + SetCommandBreakpoint(command, action, path, runspaceId: null); + /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A value of null will use the current runspace. /// The command breakpoint that was set. - public virtual CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public virtual CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Sets a line breakpoint in the current runspace in the debugger. + /// + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. + /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. + /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. + /// The line breakpoint that was set. + public LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action) => + SetLineBreakpoint(path, line, column, action, runspaceId: null); + /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public virtual LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) => + public virtual LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Sets a variable breakpoint in the current runspace in the debugger. + /// + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. + /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. + /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. + /// The variable breakpoint that was set. + public VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path) => + SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId: null); + /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public virtual VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public virtual VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Removes a breakpoint from the debugger in the current runspace. + /// + /// The breakpoint to remove from the debugger. This value may not be null. + /// True if the breakpoint was removed from the debugger; false otherwise. + public bool RemoveBreakpoint(Breakpoint breakpoint) => + RemoveBreakpoint(breakpoint, runspaceId: null); + /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public virtual bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public virtual bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Enables a breakpoint in the debugger in the current runspace. + /// + /// The breakpoint to enable in the debugger. This value may not be null. + /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. + public Breakpoint EnableBreakpoint(Breakpoint breakpoint) => + EnableBreakpoint(breakpoint, runspaceId: null); + /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public virtual Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public virtual Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); + /// + /// Disables a breakpoint in the debugger in the current runspace. + /// + /// The breakpoint to enable in the debugger. This value may not be null. + /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. + public Breakpoint DisableBreakpoint(Breakpoint breakpoint) => + DisableBreakpoint(breakpoint, runspaceId: null); + /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public virtual Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public virtual Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); /// @@ -2600,8 +2676,8 @@ internal override UnhandledBreakpointProcessingMode UnhandledBreakpointMode /// Adds the provided set of breakpoints to the debugger. /// /// The breakpoints to set. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) { if (runspaceId.HasValue) { @@ -2632,8 +2708,8 @@ public override void SetBreakpoints(IEnumerable breakpoints, int? ru /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override Breakpoint GetBreakpoint(int id, int? runspaceId) { if (runspaceId.HasValue) { @@ -2647,8 +2723,8 @@ public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) /// /// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override List GetBreakpoints(int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override List GetBreakpoints(int? runspaceId) { if (runspaceId.HasValue) { @@ -2661,12 +2737,12 @@ public override List GetBreakpoints(int? runspaceId = null) /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) { if (runspaceId.HasValue) { @@ -2684,13 +2760,13 @@ public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlo /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A LineBreakpoint - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) { if (runspaceId.HasValue) { @@ -2707,13 +2783,13 @@ public override LineBreakpoint SetLineBreakpoint(string path, int line, int colu /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A VariableBreakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) { if (runspaceId.HasValue) { @@ -2730,8 +2806,8 @@ public override VariableBreakpoint SetVariableBreakpoint(string variableName, Va /// This is the implementation of the Remove-PSBreakpoint cmdlet. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) { if (runspaceId.HasValue) { @@ -2761,8 +2837,8 @@ public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = n /// This is the implementation of the Enable-PSBreakpoint cmdlet. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) { if (runspaceId.HasValue) { @@ -2786,8 +2862,8 @@ public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspace /// This is the implementation of the Disable-PSBreakpoint cmdlet. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) { if (runspaceId.HasValue) { @@ -4171,8 +4247,8 @@ public NestedRunspaceDebugger( /// Adds the provided set of breakpoints to the debugger. /// /// Breakpoints. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => _wrappedDebugger.SetBreakpoints(breakpoints, runspaceId); /// @@ -4215,78 +4291,78 @@ public override DebuggerCommandResults ProcessCommand(PSCommand command, PSDataC /// Get a breakpoint by id. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override Breakpoint GetBreakpoint(int id, int? runspaceId) => _wrappedDebugger.GetBreakpoint(id, runspaceId); /// /// Returns breakpoints on a runspace. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A list of breakpoints in a runspace. - public override List GetBreakpoints(int? runspaceId = null) => + public override List GetBreakpoints(int? runspaceId) => _wrappedDebugger.GetBreakpoints(runspaceId); /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The command breakpoint that was set. - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetCommandBreakpoint(command, action, path, runspaceId); /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) => + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) => _wrappedDebugger.SetLineBreakpoint(path, line, column, action, runspaceId); /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId); /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId); /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId); /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId); /// diff --git a/src/System.Management.Automation/engine/hostifaces/PSTask.cs b/src/System.Management.Automation/engine/hostifaces/PSTask.cs index c68a84a9d07..c52715927b1 100644 --- a/src/System.Management.Automation/engine/hostifaces/PSTask.cs +++ b/src/System.Management.Automation/engine/hostifaces/PSTask.cs @@ -1091,8 +1091,8 @@ public override DebuggerCommandResults ProcessCommand( /// Adds the provided set of breakpoints to the debugger. /// /// List of breakpoints. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => _wrappedDebugger.SetBreakpoints(breakpoints, runspaceId); /// @@ -1108,79 +1108,79 @@ public override void SetDebuggerAction(DebuggerResumeAction resumeAction) /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The breakpoint with the specified id. - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) => + public override Breakpoint GetBreakpoint(int id, int? runspaceId) => _wrappedDebugger.GetBreakpoint(id, runspaceId); /// /// Returns breakpoints on a runspace. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A list of breakpoints in a runspace. - public override List GetBreakpoints(int? runspaceId = null) => + public override List GetBreakpoints(int? runspaceId) => _wrappedDebugger.GetBreakpoints(runspaceId); /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The command breakpoint that was set. - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetCommandBreakpoint(command, action, path, runspaceId); /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId); /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) => + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) => _wrappedDebugger.SetLineBreakpoint(path, line, column, action, runspaceId); /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId); /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId); /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId); /// diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index d01e555d71e..6ff1f9953e1 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -3913,87 +3913,87 @@ public override DebuggerCommandResults ProcessCommand(PSCommand command, PSDataC /// Adds the provided set of breakpoints to the debugger. /// /// Breakpoints to set. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => _wrappedDebugger.SetBreakpoints(breakpoints, runspaceId); /// /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A a breakpoint with the specified id. - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) => + public override Breakpoint GetBreakpoint(int id, int? runspaceId) => _wrappedDebugger.GetBreakpoint(id, runspaceId); /// /// Returns breakpoints on a runspace. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A list of breakpoints in a runspace. - public override List GetBreakpoints(int? runspaceId = null) => + public override List GetBreakpoints(int? runspaceId) => _wrappedDebugger.GetBreakpoints(runspaceId); /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The command breakpoint that was set. - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetCommandBreakpoint(command, action, path, runspaceId); /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) => + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) => _wrappedDebugger.SetLineBreakpoint(path, line, column, action, runspaceId); /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId); /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId); /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId); /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId); /// diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index ce7abd07493..462cc19f926 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -2010,8 +2010,8 @@ public override void StopProcessCommand() /// Adds the provided set of breakpoints to the debugger. /// /// Breakpoints to set. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint); @@ -2033,9 +2033,9 @@ public override void SetBreakpoints(IEnumerable breakpoints, int? ru /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The breakpoint with the specified id. - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) + public override Breakpoint GetBreakpoint(int id, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.GetBreakpoint); @@ -2056,9 +2056,9 @@ public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) /// /// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A list of breakpoints in a runspace. - public override List GetBreakpoints(int? runspaceId = null) + public override List GetBreakpoints(int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.GetBreakpoint); @@ -2096,12 +2096,12 @@ public override List GetBreakpoints(int? runspaceId = null) /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The command breakpoint that was set. - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint); @@ -2123,13 +2123,13 @@ public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlo /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint); @@ -2152,13 +2152,13 @@ public override LineBreakpoint SetLineBreakpoint(string path, int line, int colu /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint); @@ -2181,10 +2181,10 @@ public override VariableBreakpoint SetVariableBreakpoint(string variableName, Va /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.RemoveBreakpoint); @@ -2210,10 +2210,10 @@ public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = n /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.EnableBreakpoint); @@ -2239,10 +2239,10 @@ public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspace /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) { // This is supported only for PowerShell versions >= 7.0 CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.DisableBreakpoint); diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs index 22303acee85..4d17db06453 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs @@ -1889,87 +1889,87 @@ public override bool InBreakpoint /// Adds the provided set of breakpoints to the debugger. /// /// List of breakpoints. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). - public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId = null) => + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. + public override void SetBreakpoints(IEnumerable breakpoints, int? runspaceId) => _wrappedDebugger.Value.SetBreakpoints(breakpoints, runspaceId); /// /// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets. /// /// Id of the breakpoint you want. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The breakpoint with the specified id. - public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) => + public override Breakpoint GetBreakpoint(int id, int? runspaceId) => _wrappedDebugger.Value.GetBreakpoint(id, runspaceId); /// /// Returns breakpoints on a runspace. /// - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// A list of breakpoints in a runspace. - public override List GetBreakpoints(int? runspaceId = null) => + public override List GetBreakpoints(int? runspaceId) => _wrappedDebugger.Value.GetBreakpoints(runspaceId); /// /// Sets a command breakpoint in the debugger. /// - /// The name of the command that will trigger the breakpoint. This value is required and may not be null. + /// The name of the command that will trigger the breakpoint. This value may not be null. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The command breakpoint that was set. - public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.Value.SetCommandBreakpoint(command, action, path, runspaceId); /// /// Sets a line breakpoint in the debugger. /// - /// The path to the script file where the breakpoint may be hit. This value is required and may not be null. - /// The line in the script file where the breakpoint may be hit. This value is required and must be greater than or equal to 1. + /// The path to the script file where the breakpoint may be hit. This value may not be null. + /// The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1. /// The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The line breakpoint that was set. - public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null, int? runspaceId = null) => + public override LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action, int? runspaceId) => _wrappedDebugger.Value.SetLineBreakpoint(path, line, column, action, runspaceId); /// /// Sets a variable breakpoint in the debugger. /// - /// The name of the variable that will trigger the breakpoint. This value is required and may not be null. - /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. + /// The name of the variable that will trigger the breakpoint. This value may not be null. + /// The variable access mode that will trigger the breakpoint. /// The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit. /// The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the variable is accessed using the specified access mode. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The variable breakpoint that was set. - public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null, int? runspaceId = null) => + public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path, int? runspaceId) => _wrappedDebugger.Value.SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId); /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to remove from the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// True if the breakpoint was removed from the debugger; false otherwise. - public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.Value.RemoveBreakpoint(breakpoint, runspaceId); /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.Value.EnableBreakpoint(breakpoint, runspaceId); /// /// Disables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. - /// The runspace id of the runspace you want to interact with. Defaults to null (current runspace). + /// The breakpoint to enable in the debugger. This value may not be null. + /// The runspace id of the runspace you want to interact with. A null value will use the current runspace. /// The updated breakpoint if it was found; null if the breakpoint was not found in the debugger. - public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) => + public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => _wrappedDebugger.Value.DisableBreakpoint(breakpoint, runspaceId); /// diff --git a/test/powershell/SDK/Breakpoint.Tests.ps1 b/test/powershell/SDK/Breakpoint.Tests.ps1 index 9753f999d39..7b6769a4e05 100644 --- a/test/powershell/SDK/Breakpoint.Tests.ps1 +++ b/test/powershell/SDK/Breakpoint.Tests.ps1 @@ -41,11 +41,11 @@ Describe 'Breakpoint SDK Unit Tests' -Tags 'CI' { } It 'Can set command breakpoints' { - $Host.Runspace.Debugger.SetCommandBreakpoint('Test-ThisCommandDoesNotExist') | Should -BeOfType System.Management.Automation.CommandBreakpoint + $Host.Runspace.Debugger.SetCommandBreakpoint('Test-ThisCommandDoesNotExist', $null, $null) | Should -BeOfType System.Management.Automation.CommandBreakpoint } It 'Can set variable breakpoints' { - $Host.Runspace.Debugger.SetVariableBreakpoint('DebugPreference', 'ReadWrite', { continue }) | Should -BeOfType System.Management.Automation.VariableBreakpoint + $Host.Runspace.Debugger.SetVariableBreakpoint('DebugPreference', 'ReadWrite', { continue }, $null) | Should -BeOfType System.Management.Automation.VariableBreakpoint } It 'Can set line breakpoints' { @@ -101,11 +101,11 @@ Describe 'Breakpoint SDK Unit Tests' -Tags 'CI' { } It 'Can set command breakpoints' { - $jobRunspace.Debugger.SetCommandBreakpoint('Write-Verbose', { break }) | Should -BeOfType System.Management.Automation.CommandBreakpoint + $jobRunspace.Debugger.SetCommandBreakpoint('Write-Verbose', { break }, $null) | Should -BeOfType System.Management.Automation.CommandBreakpoint } It 'Can set variable breakpoints' { - $jobRunspace.Debugger.SetVariableBreakpoint('DebugPreference', 'ReadWrite', { break }) | Should -BeOfType System.Management.Automation.VariableBreakpoint + $jobRunspace.Debugger.SetVariableBreakpoint('DebugPreference', 'ReadWrite', { break }, $null) | Should -BeOfType System.Management.Automation.VariableBreakpoint } It 'Can set line breakpoints' { @@ -183,7 +183,7 @@ Describe 'Breakpoint SDK Unit Tests' -Tags 'CI' { Context 'Handling errors while managing breakpoints in a remote runspace via the SDK' { BeforeAll { - $bp = $jobRunspace.Debugger.SetCommandBreakpoint('Test-ThisCommandDoesNotExist') + $bp = $jobRunspace.Debugger.SetCommandBreakpoint('Test-ThisCommandDoesNotExist', $null, $null) $jobRunspace.Debugger.RemoveBreakpoint($bp) > $null }