@@ -14,13 +14,13 @@ namespace Microsoft.PowerShell.EditorServices
1414{
1515 /// <summary>
1616 /// Provides a high-level service for interacting with the
17- /// PowerShell debugger in the context of a PowerShellSession .
17+ /// PowerShell debugger in the runspace managed by a PowerShellContext .
1818 /// </summary>
1919 public class DebugService
2020 {
2121 #region Fields
2222
23- private PowerShellSession powerShellSession ;
23+ private PowerShellContext powerShellContext ;
2424
2525 // TODO: This needs to be managed per nested session
2626 private Dictionary < string , List < Breakpoint > > breakpointsPerFile =
@@ -36,18 +36,18 @@ public class DebugService
3636
3737 /// <summary>
3838 /// Initializes a new instance of the DebugService class and uses
39- /// the given PowerShellSession for all future operations.
39+ /// the given PowerShellContext for all future operations.
4040 /// </summary>
41- /// <param name="powerShellSession ">
42- /// The PowerShellSession to use for all debugging operations.
41+ /// <param name="powerShellContext ">
42+ /// The PowerShellContext to use for all debugging operations.
4343 /// </param>
44- public DebugService ( PowerShellSession powerShellSession )
44+ public DebugService ( PowerShellContext powerShellContext )
4545 {
46- Validate . IsNotNull ( "powerShellSession " , powerShellSession ) ;
46+ Validate . IsNotNull ( "powerShellContext " , powerShellContext ) ;
4747
48- this . powerShellSession = powerShellSession ;
49- this . powerShellSession . DebuggerStop += this . OnDebuggerStop ;
50- this . powerShellSession . BreakpointUpdated += this . OnBreakpointUpdated ;
48+ this . powerShellContext = powerShellContext ;
49+ this . powerShellContext . DebuggerStop += this . OnDebuggerStop ;
50+ this . powerShellContext . BreakpointUpdated += this . OnBreakpointUpdated ;
5151 }
5252
5353 #endregion
@@ -81,7 +81,7 @@ public async Task<BreakpointDetails[]> SetBreakpoints(
8181 psCommand . AddParameter ( "Line" , lineNumbers . Length > 0 ? lineNumbers : null ) ;
8282
8383 resultBreakpoints =
84- await this . powerShellSession . ExecuteCommand < Breakpoint > (
84+ await this . powerShellContext . ExecuteCommand < Breakpoint > (
8585 psCommand ) ;
8686
8787 return
@@ -98,7 +98,7 @@ await this.powerShellSession.ExecuteCommand<Breakpoint>(
9898 /// </summary>
9999 public void Continue ( )
100100 {
101- this . powerShellSession . ResumeDebugger (
101+ this . powerShellContext . ResumeDebugger (
102102 DebuggerResumeAction . Continue ) ;
103103 }
104104
@@ -107,7 +107,7 @@ public void Continue()
107107 /// </summary>
108108 public void StepOver ( )
109109 {
110- this . powerShellSession . ResumeDebugger (
110+ this . powerShellContext . ResumeDebugger (
111111 DebuggerResumeAction . StepOver ) ;
112112 }
113113
@@ -116,7 +116,7 @@ public void StepOver()
116116 /// </summary>
117117 public void StepIn ( )
118118 {
119- this . powerShellSession . ResumeDebugger (
119+ this . powerShellContext . ResumeDebugger (
120120 DebuggerResumeAction . StepInto ) ;
121121 }
122122
@@ -125,7 +125,7 @@ public void StepIn()
125125 /// </summary>
126126 public void StepOut ( )
127127 {
128- this . powerShellSession . ResumeDebugger (
128+ this . powerShellContext . ResumeDebugger (
129129 DebuggerResumeAction . StepOut ) ;
130130 }
131131
@@ -137,16 +137,16 @@ public void StepOut()
137137 public void Break ( )
138138 {
139139 // Break execution in the debugger
140- this . powerShellSession . BreakExecution ( ) ;
140+ this . powerShellContext . BreakExecution ( ) ;
141141 }
142142
143143 /// <summary>
144144 /// Aborts execution of the debugger while it is running, even while
145- /// it is stopped. Equivalent to calling PowerShellSession .AbortExecution.
145+ /// it is stopped. Equivalent to calling PowerShellContext .AbortExecution.
146146 /// </summary>
147147 public void Abort ( )
148148 {
149- this . powerShellSession . AbortExecution ( ) ;
149+ this . powerShellContext . AbortExecution ( ) ;
150150 }
151151
152152 /// <summary>
@@ -238,15 +238,15 @@ public VariableDetails GetVariableFromExpression(string variableExpression, int
238238 /// <summary>
239239 /// Evaluates an expression in the context of the stopped
240240 /// debugger. This method will execute the specified expression
241- /// PowerShellSession .
241+ /// PowerShellContext .
242242 /// </summary>
243243 /// <param name="expressionString">The expression string to execute.</param>
244244 /// <param name="stackFrameId">The ID of the stack frame in which the expression should be executed.</param>
245245 /// <returns>A VariableDetails object containing the result.</returns>
246246 public async Task < VariableDetails > EvaluateExpression ( string expressionString , int stackFrameId )
247247 {
248248 var results =
249- await this . powerShellSession . ExecuteScriptString (
249+ await this . powerShellContext . ExecuteScriptString (
250250 expressionString ) ;
251251
252252 // Since this method should only be getting invoked in the debugger,
@@ -302,7 +302,7 @@ private async Task ClearBreakpointsInFile(ScriptFile scriptFile)
302302 psCommand . AddCommand ( "Remove-PSBreakpoint" ) ;
303303 psCommand . AddParameter ( "Breakpoint" , breakpoints . ToArray ( ) ) ;
304304
305- await this . powerShellSession . ExecuteCommand < object > ( psCommand ) ;
305+ await this . powerShellContext . ExecuteCommand < object > ( psCommand ) ;
306306
307307 // Clear the existing breakpoints list for the file
308308 breakpoints . Clear ( ) ;
@@ -319,7 +319,7 @@ private async Task FetchVariables()
319319 psCommand . AddCommand ( "Get-Variable" ) ;
320320 psCommand . AddParameter ( "Scope" , "Local" ) ;
321321
322- var results = await this . powerShellSession . ExecuteCommand < PSVariable > ( psCommand ) ;
322+ var results = await this . powerShellContext . ExecuteCommand < PSVariable > ( psCommand ) ;
323323
324324 foreach ( var variable in results )
325325 {
@@ -336,7 +336,7 @@ private async Task FetchStackFrames()
336336 PSCommand psCommand = new PSCommand ( ) ;
337337 psCommand . AddCommand ( "Get-PSCallStack" ) ;
338338
339- var results = await this . powerShellSession . ExecuteCommand < CallStackFrame > ( psCommand ) ;
339+ var results = await this . powerShellContext . ExecuteCommand < CallStackFrame > ( psCommand ) ;
340340
341341 this . callStackFrames =
342342 results
0 commit comments