Skip to content

Commit 8d17b3b

Browse files
committed
Fix up wildcard handling
1 parent 6691f08 commit 8d17b3b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ internal class BreakpointService
4848
$Command
4949
)
5050
51+
if ($Script) {
52+
# If using Set-PSBreakpoint we need to escape any wildcard patterns.
53+
$PSBoundParameters['Script'] = [WildcardPattern]::Escape($Script)
54+
}
55+
5156
if ($PSCmdlet.ParameterSetName -eq 'Command') {
5257
$cmdCtor = [System.Management.Automation.CommandBreakpoint].GetConstructor(
5358
[System.Reflection.BindingFlags]'NonPublic, Public, Instance',
@@ -125,7 +130,7 @@ public async Task<IReadOnlyList<Breakpoint>> GetBreakpointsAsync()
125130
.ConfigureAwait(false);
126131
}
127132

128-
public async Task<IReadOnlyList<BreakpointDetails>> SetBreakpointsAsync(string escapedScriptPath, IReadOnlyList<BreakpointDetails> breakpoints)
133+
public async Task<IReadOnlyList<BreakpointDetails>> SetBreakpointsAsync(IReadOnlyList<BreakpointDetails> breakpoints)
129134
{
130135
if (BreakpointApiUtils.SupportsBreakpointApis(_editorServicesHost.CurrentRunspace))
131136
{
@@ -186,7 +191,7 @@ public async Task<IReadOnlyList<BreakpointDetails>> SetBreakpointsAsync(string e
186191
// path which may or may not exist.
187192
psCommand
188193
.AddScript(_setPSBreakpointLegacy, useLocalScope: true)
189-
.AddParameter("Script", escapedScriptPath)
194+
.AddParameter("Script", breakpoint.Source)
190195
.AddParameter("Line", breakpoint.LineNumber);
191196

192197
// Check if the user has specified the column number for the breakpoint.

src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public async Task<IReadOnlyList<BreakpointDetails>> SetLineBreakpointsAsync(
164164
await _breakpointService.RemoveAllBreakpointsAsync(scriptFile.FilePath).ConfigureAwait(false);
165165
}
166166

167-
return await _breakpointService.SetBreakpointsAsync(escapedScriptPath, breakpoints).ConfigureAwait(false);
167+
return await _breakpointService.SetBreakpointsAsync(breakpoints).ConfigureAwait(false);
168168
}
169169

170170
return await dscBreakpoints

0 commit comments

Comments
 (0)