diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs b/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
index 94a957cf9..195d0508b 100644
--- a/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
+++ b/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
@@ -77,7 +77,6 @@ internal class DebugService
///
public Task StackFramesAndVariablesFetched { get; private set; }
-
///
/// Tracks whether we are running Debug-Runspace in an out-of-process runspace.
///
diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs
index 91f5697d5..84d23a8b6 100644
--- a/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs
+++ b/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs
@@ -12,6 +12,7 @@
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
using Microsoft.PowerShell.EditorServices.Services.DebugAdapter;
using System.Linq;
+using OmniSharp.Extensions.JsonRpc;
namespace Microsoft.PowerShell.EditorServices.Handlers;
@@ -26,7 +27,7 @@ public async Task Handle(StackTraceArguments request, Cancel
{
if (!debugService.IsDebuggerStopped)
{
- throw new NotSupportedException("Stacktrace was requested while we are not stopped at a breakpoint.");
+ 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.");
}
// 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 Handle(StackTraceArguments request, Cancel
// We generate a label for the breakpoint and can return that immediately if the client is supporting DelayedStackTraceLoading.
InvocationInfo invocationInfo = debugService.CurrentDebuggerStoppedEventArgs?.OriginalEvent?.InvocationInfo
- ?? throw new NotSupportedException("InvocationInfo was not available on CurrentDebuggerStoppedEvent args. This is a bug.");
+ ?? throw new RpcErrorException(0, null!, "InvocationInfo was not available on CurrentDebuggerStoppedEvent args. This is a bug and you should report it.");
StackFrame breakpointLabel = CreateBreakpointLabel(invocationInfo);
@@ -52,7 +53,7 @@ public async Task Handle(StackTraceArguments request, Cancel
await debugService.StackFramesAndVariablesFetched.ConfigureAwait(false);
StackFrameDetails[] stackFrameDetails = await debugService.GetStackFramesAsync(cancellationToken)
- .ConfigureAwait(false);
+ .ConfigureAwait(false);
// Handle a rare race condition where the adapter requests stack frames before they've
// begun building.
@@ -94,7 +95,7 @@ public static StackFrame CreateStackFrame(StackFrameDetails stackFrame, long id)
// We need to make sure the user can't open the file associated with this stack frame.
// It will generate a VSCode error in this case.
Source? source = null;
- if (!stackFrame.ScriptPath.Contains("<"))
+ if (!stackFrame.ScriptPath.Contains(""))
{
source = new Source
{