From 77cfbf8e7f3f6dd40a7144f6a4b773189a2aa2a3 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Fri, 17 Jan 2020 15:50:18 -0800 Subject: [PATCH 1/6] Restore SetBreakpoints API --- .../engine/debugger/debugger.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 2da88562221..29ff2d15dc7 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -626,12 +626,19 @@ public virtual IEnumerable GetCallStack() public virtual Breakpoint GetBreakpoint(int id, int? runspaceId = null) => throw new PSNotImplementedException(); + /// + /// Adds the provided set of breakpoints to the debugger, in the current runspace. + /// + /// Breakpoints. + public virtual 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(); /// From 92e56c6ffff20bd8d3ac1b377b756df4b0bcef25 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Tue, 28 Jan 2020 13:40:56 -0800 Subject: [PATCH 2/6] Remove default values in API methods --- .../engine/debugger/debugger.cs | 107 ++++++++++++++---- 1 file changed, 88 insertions(+), 19 deletions(-) diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 29ff2d15dc7..3af3f744b53 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -618,19 +618,26 @@ 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) => + 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 virtual void SetBreakpoints(IEnumerable breakpoints) => + public void SetBreakpoints(IEnumerable breakpoints) => SetBreakpoints(breakpoints, runspaceId: null); /// @@ -641,73 +648,135 @@ public virtual void SetBreakpoints(IEnumerable breakpoints) => 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) => + 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 name of the variable that will trigger the breakpoint. This value 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 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 breakpoint to remove from the debugger. This value may not be null. /// The runspace id of the runspace you want to interact with. Defaults to null (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 breakpoint to enable in the debugger. This value may not be null. /// The runspace id of the runspace you want to interact with. Defaults to null (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 breakpoint to enable in the debugger. This value may not be null. /// The runspace id of the runspace you want to interact with. Defaults to null (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(); /// From 461edb724bc1f9e476008a24aee94649910fc8be Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Tue, 28 Jan 2020 14:43:35 -0800 Subject: [PATCH 3/6] Fix inheriting APIs --- .../engine/debugger/debugger.cs | 106 +++++++++--------- .../engine/hostifaces/PSTask.cs | 44 ++++---- .../engine/remoting/client/Job.cs | 52 ++++----- .../engine/remoting/client/remoterunspace.cs | 52 ++++----- .../server/ServerRunspacePoolDriver.cs | 48 ++++---- 5 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 3af3f744b53..d04d79c6f92 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -629,7 +629,7 @@ public Breakpoint GetBreakpoint(int id) => /// 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. public virtual Breakpoint GetBreakpoint(int id, int? runspaceId) => throw new PSNotImplementedException(); @@ -657,7 +657,7 @@ public List GetBreakpoints() => /// /// 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. public virtual List GetBreakpoints(int? runspaceId) => throw new PSNotImplementedException(); @@ -720,7 +720,7 @@ public VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAcc /// Sets a variable breakpoint 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. By default variable breakpoints will trigger only when the variable is updated. + /// 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. A null value will use the current runspace. @@ -740,7 +740,7 @@ public bool RemoveBreakpoint(Breakpoint breakpoint) => /// Removes a breakpoint from the debugger. /// /// The breakpoint to remove from the debugger. This value may not be null. - /// 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. /// True if the breakpoint was removed from the debugger; false otherwise. public virtual bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); @@ -757,7 +757,7 @@ public Breakpoint EnableBreakpoint(Breakpoint breakpoint) => /// Enables a breakpoint in the debugger. /// /// The breakpoint to enable in the debugger. This value may not be null. - /// 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 updated breakpoint if it was found; null if the breakpoint was not found in the debugger. public virtual Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); @@ -774,7 +774,7 @@ public Breakpoint DisableBreakpoint(Breakpoint breakpoint) => /// Disables a breakpoint in the debugger. /// /// The breakpoint to enable in the debugger. This value may not be null. - /// 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 updated breakpoint if it was found; null if the breakpoint was not found in the debugger. public virtual Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) => throw new PSNotImplementedException(); @@ -2676,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) { @@ -2708,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) { @@ -2723,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) { @@ -2737,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) { @@ -2760,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) { @@ -2787,9 +2787,9 @@ public override LineBreakpoint SetLineBreakpoint(string path, int line, int colu /// The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated. /// 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) { @@ -2806,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) { @@ -2837,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) { @@ -2862,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) { @@ -4247,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); /// @@ -4291,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..22a6ca25477 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,61 +1108,61 @@ 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 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); /// @@ -1171,16 +1171,16 @@ public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspace /// 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 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 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..c9071456c16 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 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 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); /// From 6fffccfd88349bf7562ae0d8e37c48e5b5da4ef8 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Tue, 28 Jan 2020 14:57:37 -0800 Subject: [PATCH 4/6] Correct further comments --- .../engine/debugger/debugger.cs | 4 ++-- .../engine/hostifaces/PSTask.cs | 8 ++++---- .../engine/remoting/server/ServerRunspacePoolDriver.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index d04d79c6f92..19a9c5e0995 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -2783,8 +2783,8 @@ 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. A null value will use the current runspace. diff --git a/src/System.Management.Automation/engine/hostifaces/PSTask.cs b/src/System.Management.Automation/engine/hostifaces/PSTask.cs index 22a6ca25477..c52715927b1 100644 --- a/src/System.Management.Automation/engine/hostifaces/PSTask.cs +++ b/src/System.Management.Automation/engine/hostifaces/PSTask.cs @@ -1159,7 +1159,7 @@ public override LineBreakpoint SetLineBreakpoint(string path, int line, int colu /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. + /// 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) => @@ -1168,8 +1168,8 @@ 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) => _wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId); @@ -1177,7 +1177,7 @@ public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspac /// /// Removes a breakpoint from the debugger. /// - /// The breakpoint to remove from the debugger. This value is required and may not be null. + /// 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) => diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs index c9071456c16..4d17db06453 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs @@ -1957,7 +1957,7 @@ public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) => /// /// Enables a breakpoint in the debugger. /// - /// The breakpoint to enable in the debugger. This value is required and may not be null. + /// 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) => @@ -1966,7 +1966,7 @@ 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 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) => From 17708888c7cb58a5c89d031f3bf34b4d65f926e4 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Tue, 28 Jan 2020 15:01:12 -0800 Subject: [PATCH 5/6] Fix breakpoint API use issues --- .../commands/utility/Set-PSBreakpoint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); } } } From b06bbe48d5b33925d222fe2ae68a1cbca9ecee6c Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Tue, 28 Jan 2020 15:40:49 -0800 Subject: [PATCH 6/6] Fix breakpoint API tests --- test/powershell/SDK/Breakpoint.Tests.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 }