Restore SetBreakpoints API (#11622)

* Restore SetBreakpoints API

* Remove default values in API methods

* Fix inheriting APIs

* Correct further comments

* Fix breakpoint API use issues

* Fix breakpoint API tests
This commit is contained in:
Robert Holt
2020-01-30 11:27:57 -08:00
committed by GitHub
parent 66912b7428
commit f0fe356553
7 changed files with 262 additions and 186 deletions
@@ -81,7 +81,7 @@ namespace Microsoft.PowerShell.Commands
else
{
WriteObject(
Context.Debugger.SetCommandBreakpoint(Command[i], Action));
Context.Debugger.SetCommandBreakpoint(Command[i], Action, path: null));
}
}
}
@@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands
else
{
WriteObject(
Context.Debugger.SetVariableBreakpoint(Variable[i], Mode, Action));
Context.Debugger.SetVariableBreakpoint(Variable[i], Mode, Action, path: null));
}
}
}
@@ -618,89 +618,165 @@ namespace System.Management.Automation
return new Collection<CallStackFrame>();
}
/// <summary>
/// Get a breakpoint by id in the current runspace, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
public Breakpoint GetBreakpoint(int id) =>
GetBreakpoint(id, runspaceId: null);
/// <summary>
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public virtual Breakpoint GetBreakpoint(int id, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public virtual Breakpoint GetBreakpoint(int id, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
/// Adds the provided set of breakpoints to the debugger, in the current runspace.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
public void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
SetBreakpoints(breakpoints, runspaceId: null);
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public virtual void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with, null being the current runspace.</param>
public virtual void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
/// Returns breakpoints in the current runspace, primarily for the Get-PSBreakpoint cmdlet.
/// </summary>
public List<Breakpoint> GetBreakpoints() =>
GetBreakpoints(runspaceId: null);
/// <summary>
/// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public virtual List<Breakpoint> GetBreakpoints(int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public virtual List<Breakpoint> GetBreakpoints(int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
/// Sets a command breakpoint in the current runspace in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <returns>The command breakpoint that was set.</returns>
public CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action, string path) =>
SetCommandBreakpoint(command, action, path, runspaceId: null);
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A value of null will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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();
/// <summary>
/// Sets a line breakpoint in the current runspace in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <returns>The line breakpoint that was set.</returns>
public LineBreakpoint SetLineBreakpoint(string path, int line, int column, ScriptBlock action) =>
SetLineBreakpoint(path, line, column, action, runspaceId: null);
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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();
/// <summary>
/// Sets a variable breakpoint in the current runspace in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <returns>The variable breakpoint that was set.</returns>
public VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode, ScriptBlock action, string path) =>
SetVariableBreakpoint(variableName, accessMode, action, path, runspaceId: null);
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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();
/// <summary>
/// Removes a breakpoint from the debugger in the current runspace.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public bool RemoveBreakpoint(Breakpoint breakpoint) =>
RemoveBreakpoint(breakpoint, runspaceId: null);
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public virtual bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public virtual bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
/// Enables a breakpoint in the debugger in the current runspace.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public Breakpoint EnableBreakpoint(Breakpoint breakpoint) =>
EnableBreakpoint(breakpoint, runspaceId: null);
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public virtual Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public virtual Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
/// Disables a breakpoint in the debugger in the current runspace.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public Breakpoint DisableBreakpoint(Breakpoint breakpoint) =>
DisableBreakpoint(breakpoint, runspaceId: null);
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public virtual Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public virtual Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
@@ -2600,8 +2676,8 @@ namespace System.Management.Automation
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">The breakpoints to set.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -2632,8 +2708,8 @@ namespace System.Management.Automation
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override Breakpoint GetBreakpoint(int id, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override Breakpoint GetBreakpoint(int id, int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -2647,8 +2723,8 @@ namespace System.Management.Automation
/// <summary>
/// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override List<Breakpoint> GetBreakpoints(int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -2661,12 +2737,12 @@ namespace System.Management.Automation
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns></returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A LineBreakpoint</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A VariableBreakpoint that was set.</returns>
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 @@ namespace System.Management.Automation
/// This is the implementation of the Remove-PSBreakpoint cmdlet.
/// </summary>
/// <param name="breakpoint">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -2761,8 +2837,8 @@ namespace System.Management.Automation
/// This is the implementation of the Enable-PSBreakpoint cmdlet.
/// </summary>
/// <param name="breakpoint">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -2786,8 +2862,8 @@ namespace System.Management.Automation
/// This is the implementation of the Disable-PSBreakpoint cmdlet.
/// </summary>
/// <param name="breakpoint">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId)
{
if (runspaceId.HasValue)
{
@@ -4171,8 +4247,8 @@ namespace System.Management.Automation
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
_wrappedDebugger.SetBreakpoints(breakpoints, runspaceId);
/// <summary>
@@ -4215,78 +4291,78 @@ namespace System.Management.Automation
/// Get a breakpoint by id.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override Breakpoint GetBreakpoint(int id, int? runspaceId) =>
_wrappedDebugger.GetBreakpoint(id, runspaceId);
/// <summary>
/// Returns breakpoints on a runspace.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A list of breakpoints in a runspace.</returns>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null) =>
public override List<Breakpoint> GetBreakpoints(int? runspaceId) =>
_wrappedDebugger.GetBreakpoints(runspaceId);
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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);
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId);
/// <summary>
@@ -1091,8 +1091,8 @@ namespace System.Management.Automation.PSTasks
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">List of breakpoints.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
_wrappedDebugger.SetBreakpoints(breakpoints, runspaceId);
/// <summary>
@@ -1108,79 +1108,79 @@ namespace System.Management.Automation.PSTasks
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The breakpoint with the specified id.</returns>
public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) =>
public override Breakpoint GetBreakpoint(int id, int? runspaceId) =>
_wrappedDebugger.GetBreakpoint(id, runspaceId);
/// <summary>
/// Returns breakpoints on a runspace.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A list of breakpoints in a runspace.</returns>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null) =>
public override List<Breakpoint> GetBreakpoints(int? runspaceId) =>
_wrappedDebugger.GetBreakpoints(runspaceId);
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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);
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId);
/// <summary>
@@ -3913,87 +3913,87 @@ namespace System.Management.Automation
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints to set.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
_wrappedDebugger.SetBreakpoints(breakpoints, runspaceId);
/// <summary>
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A a breakpoint with the specified id.</returns>
public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) =>
public override Breakpoint GetBreakpoint(int id, int? runspaceId) =>
_wrappedDebugger.GetBreakpoint(id, runspaceId);
/// <summary>
/// Returns breakpoints on a runspace.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A list of breakpoints in a runspace.</returns>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null) =>
public override List<Breakpoint> GetBreakpoints(int? runspaceId) =>
_wrappedDebugger.GetBreakpoints(runspaceId);
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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);
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.RemoveBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.EnableBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.DisableBreakpoint(breakpoint, runspaceId);
/// <summary>
@@ -2010,8 +2010,8 @@ namespace System.Management.Automation
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints to set.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null)
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId)
{
// This is supported only for PowerShell versions >= 7.0
CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint);
@@ -2033,9 +2033,9 @@ namespace System.Management.Automation
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The breakpoint with the specified id.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A list of breakpoints in a runspace.</returns>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null)
public override List<Breakpoint> GetBreakpoints(int? runspaceId)
{
// This is supported only for PowerShell versions >= 7.0
CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.GetBreakpoint);
@@ -2096,12 +2096,12 @@ namespace System.Management.Automation
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
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 @@ namespace System.Management.Automation
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
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);
@@ -1889,87 +1889,87 @@ namespace System.Management.Automation
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">List of breakpoints.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId = null) =>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
_wrappedDebugger.Value.SetBreakpoints(breakpoints, runspaceId);
/// <summary>
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
/// <param name="id">Id of the breakpoint you want.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The breakpoint with the specified id.</returns>
public override Breakpoint GetBreakpoint(int id, int? runspaceId = null) =>
public override Breakpoint GetBreakpoint(int id, int? runspaceId) =>
_wrappedDebugger.Value.GetBreakpoint(id, runspaceId);
/// <summary>
/// Returns breakpoints on a runspace.
/// </summary>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>A list of breakpoints in a runspace.</returns>
public override List<Breakpoint> GetBreakpoints(int? runspaceId = null) =>
public override List<Breakpoint> GetBreakpoints(int? runspaceId) =>
_wrappedDebugger.Value.GetBreakpoints(runspaceId);
/// <summary>
/// Sets a command breakpoint in the debugger.
/// </summary>
/// <param name="command">The name of the command that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="command">The name of the command that will trigger the breakpoint. This value may not be null.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. If null, the breakpoint may be hit anywhere the command is invoked.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The command breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a line breakpoint in the debugger.
/// </summary>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value is required and may not be null.</param>
/// <param name="line">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.</param>
/// <param name="path">The path to the script file where the breakpoint may be hit. This value may not be null.</param>
/// <param name="line">The line in the script file where the breakpoint may be hit. This value must be greater than or equal to 1.</param>
/// <param name="column">The column in the script file where the breakpoint may be hit. If 0, the breakpoint will trigger on any statement on the line.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The line breakpoint that was set.</returns>
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);
/// <summary>
/// Sets a variable breakpoint in the debugger.
/// </summary>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value is required and may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint. By default variable breakpoints will trigger only when the variable is updated.</param>
/// <param name="variableName">The name of the variable that will trigger the breakpoint. This value may not be null.</param>
/// <param name="accessMode">The variable access mode that will trigger the breakpoint.</param>
/// <param name="action">The action to take when the breakpoint is hit. If null, PowerShell will break into the debugger when the breakpoint is hit.</param>
/// <param name="path">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.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The variable breakpoint that was set.</returns>
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);
/// <summary>
/// Removes a breakpoint from the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to remove from the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>True if the breakpoint was removed from the debugger; false otherwise.</returns>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override bool RemoveBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.Value.RemoveBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Enables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint EnableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.Value.EnableBreakpoint(breakpoint, runspaceId);
/// <summary>
/// Disables a breakpoint in the debugger.
/// </summary>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value is required and may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. Defaults to null (current runspace).</param>
/// <param name="breakpoint">The breakpoint to enable in the debugger. This value may not be null.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with. A null value will use the current runspace.</param>
/// <returns>The updated breakpoint if it was found; null if the breakpoint was not found in the debugger.</returns>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId = null) =>
public override Breakpoint DisableBreakpoint(Breakpoint breakpoint, int? runspaceId) =>
_wrappedDebugger.Value.DisableBreakpoint(breakpoint, runspaceId);
/// <summary>
+5 -5
View File
@@ -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
}