@@ -14,13 +14,13 @@ namespace Microsoft.PowerShell.EditorServices
14
14
{
15
15
/// <summary>
16
16
/// 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 .
18
18
/// </summary>
19
19
public class DebugService
20
20
{
21
21
#region Fields
22
22
23
- private PowerShellSession powerShellSession ;
23
+ private PowerShellContext powerShellContext ;
24
24
25
25
// TODO: This needs to be managed per nested session
26
26
private Dictionary < string , List < Breakpoint > > breakpointsPerFile =
@@ -36,18 +36,18 @@ public class DebugService
36
36
37
37
/// <summary>
38
38
/// 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.
40
40
/// </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.
43
43
/// </param>
44
- public DebugService ( PowerShellSession powerShellSession )
44
+ public DebugService ( PowerShellContext powerShellContext )
45
45
{
46
- Validate . IsNotNull ( "powerShellSession " , powerShellSession ) ;
46
+ Validate . IsNotNull ( "powerShellContext " , powerShellContext ) ;
47
47
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 ;
51
51
}
52
52
53
53
#endregion
@@ -81,7 +81,7 @@ public async Task<BreakpointDetails[]> SetBreakpoints(
81
81
psCommand . AddParameter ( "Line" , lineNumbers . Length > 0 ? lineNumbers : null ) ;
82
82
83
83
resultBreakpoints =
84
- await this . powerShellSession . ExecuteCommand < Breakpoint > (
84
+ await this . powerShellContext . ExecuteCommand < Breakpoint > (
85
85
psCommand ) ;
86
86
87
87
return
@@ -98,7 +98,7 @@ await this.powerShellSession.ExecuteCommand<Breakpoint>(
98
98
/// </summary>
99
99
public void Continue ( )
100
100
{
101
- this . powerShellSession . ResumeDebugger (
101
+ this . powerShellContext . ResumeDebugger (
102
102
DebuggerResumeAction . Continue ) ;
103
103
}
104
104
@@ -107,7 +107,7 @@ public void Continue()
107
107
/// </summary>
108
108
public void StepOver ( )
109
109
{
110
- this . powerShellSession . ResumeDebugger (
110
+ this . powerShellContext . ResumeDebugger (
111
111
DebuggerResumeAction . StepOver ) ;
112
112
}
113
113
@@ -116,7 +116,7 @@ public void StepOver()
116
116
/// </summary>
117
117
public void StepIn ( )
118
118
{
119
- this . powerShellSession . ResumeDebugger (
119
+ this . powerShellContext . ResumeDebugger (
120
120
DebuggerResumeAction . StepInto ) ;
121
121
}
122
122
@@ -125,7 +125,7 @@ public void StepIn()
125
125
/// </summary>
126
126
public void StepOut ( )
127
127
{
128
- this . powerShellSession . ResumeDebugger (
128
+ this . powerShellContext . ResumeDebugger (
129
129
DebuggerResumeAction . StepOut ) ;
130
130
}
131
131
@@ -137,16 +137,16 @@ public void StepOut()
137
137
public void Break ( )
138
138
{
139
139
// Break execution in the debugger
140
- this . powerShellSession . BreakExecution ( ) ;
140
+ this . powerShellContext . BreakExecution ( ) ;
141
141
}
142
142
143
143
/// <summary>
144
144
/// 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.
146
146
/// </summary>
147
147
public void Abort ( )
148
148
{
149
- this . powerShellSession . AbortExecution ( ) ;
149
+ this . powerShellContext . AbortExecution ( ) ;
150
150
}
151
151
152
152
/// <summary>
@@ -238,15 +238,15 @@ public VariableDetails GetVariableFromExpression(string variableExpression, int
238
238
/// <summary>
239
239
/// Evaluates an expression in the context of the stopped
240
240
/// debugger. This method will execute the specified expression
241
- /// PowerShellSession .
241
+ /// PowerShellContext .
242
242
/// </summary>
243
243
/// <param name="expressionString">The expression string to execute.</param>
244
244
/// <param name="stackFrameId">The ID of the stack frame in which the expression should be executed.</param>
245
245
/// <returns>A VariableDetails object containing the result.</returns>
246
246
public async Task < VariableDetails > EvaluateExpression ( string expressionString , int stackFrameId )
247
247
{
248
248
var results =
249
- await this . powerShellSession . ExecuteScriptString (
249
+ await this . powerShellContext . ExecuteScriptString (
250
250
expressionString ) ;
251
251
252
252
// Since this method should only be getting invoked in the debugger,
@@ -302,7 +302,7 @@ private async Task ClearBreakpointsInFile(ScriptFile scriptFile)
302
302
psCommand . AddCommand ( "Remove-PSBreakpoint" ) ;
303
303
psCommand . AddParameter ( "Breakpoint" , breakpoints . ToArray ( ) ) ;
304
304
305
- await this . powerShellSession . ExecuteCommand < object > ( psCommand ) ;
305
+ await this . powerShellContext . ExecuteCommand < object > ( psCommand ) ;
306
306
307
307
// Clear the existing breakpoints list for the file
308
308
breakpoints . Clear ( ) ;
@@ -319,7 +319,7 @@ private async Task FetchVariables()
319
319
psCommand . AddCommand ( "Get-Variable" ) ;
320
320
psCommand . AddParameter ( "Scope" , "Local" ) ;
321
321
322
- var results = await this . powerShellSession . ExecuteCommand < PSVariable > ( psCommand ) ;
322
+ var results = await this . powerShellContext . ExecuteCommand < PSVariable > ( psCommand ) ;
323
323
324
324
foreach ( var variable in results )
325
325
{
@@ -336,7 +336,7 @@ private async Task FetchStackFrames()
336
336
PSCommand psCommand = new PSCommand ( ) ;
337
337
psCommand . AddCommand ( "Get-PSCallStack" ) ;
338
338
339
- var results = await this . powerShellSession . ExecuteCommand < CallStackFrame > ( psCommand ) ;
339
+ var results = await this . powerShellContext . ExecuteCommand < CallStackFrame > ( psCommand ) ;
340
340
341
341
this . callStackFrames =
342
342
results
0 commit comments