Skip to content

Commit 84b55f8

Browse files
Incorporate PR Review Feedback
Co-authored-by: Patrick Meinecke <[email protected]>
1 parent f052fa5 commit 84b55f8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ internal class DebugService
7777
/// </summary>
7878
public Task StackFramesAndVariablesFetched { get; private set; }
7979

80-
8180
/// <summary>
8281
/// Tracks whether we are running <c>Debug-Runspace</c> in an out-of-process runspace.
8382
/// </summary>

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
1313
using Microsoft.PowerShell.EditorServices.Services.DebugAdapter;
1414
using System.Linq;
15+
using OmniSharp.Extensions.JsonRpc;
1516

1617
namespace Microsoft.PowerShell.EditorServices.Handlers;
1718

@@ -26,7 +27,7 @@ public async Task<StackTraceResponse> Handle(StackTraceArguments request, Cancel
2627
{
2728
if (!debugService.IsDebuggerStopped)
2829
{
29-
throw new NotSupportedException("Stacktrace was requested while we are not stopped at a breakpoint.");
30+
throw new RpcErrorException(0, null!, "Stacktrace was requested while we are not stopped at a breakpoint. This is a violation of the DAP protocol, and is probably a bug.");
3031
}
3132

3233
// Adapting to int to let us use LINQ, realistically if you have a stacktrace larger than this that the client is requesting, you have bigger problems...
@@ -35,7 +36,7 @@ public async Task<StackTraceResponse> Handle(StackTraceArguments request, Cancel
3536

3637
// We generate a label for the breakpoint and can return that immediately if the client is supporting DelayedStackTraceLoading.
3738
InvocationInfo invocationInfo = debugService.CurrentDebuggerStoppedEventArgs?.OriginalEvent?.InvocationInfo
38-
?? throw new NotSupportedException("InvocationInfo was not available on CurrentDebuggerStoppedEvent args. This is a bug.");
39+
?? throw new RpcErrorException(0, null!, "InvocationInfo was not available on CurrentDebuggerStoppedEvent args. This is a bug and you should report it.");
3940

4041
StackFrame breakpointLabel = CreateBreakpointLabel(invocationInfo);
4142

@@ -52,7 +53,7 @@ public async Task<StackTraceResponse> Handle(StackTraceArguments request, Cancel
5253
await debugService.StackFramesAndVariablesFetched.ConfigureAwait(false);
5354

5455
StackFrameDetails[] stackFrameDetails = await debugService.GetStackFramesAsync(cancellationToken)
55-
.ConfigureAwait(false);
56+
.ConfigureAwait(false);
5657

5758
// Handle a rare race condition where the adapter requests stack frames before they've
5859
// begun building.
@@ -94,7 +95,7 @@ public static StackFrame CreateStackFrame(StackFrameDetails stackFrame, long id)
9495
// We need to make sure the user can't open the file associated with this stack frame.
9596
// It will generate a VSCode error in this case.
9697
Source? source = null;
97-
if (!stackFrame.ScriptPath.Contains("<"))
98+
if (!stackFrame.ScriptPath.Contains("<No File>"))
9899
{
99100
source = new Source
100101
{

0 commit comments

Comments
 (0)