Skip to content

Commit

Permalink
Incorporate PR Review Feedback
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Meinecke <[email protected]>
  • Loading branch information
JustinGrote and SeeminglyScience committed Nov 27, 2024
1 parent f052fa5 commit 84b55f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ internal class DebugService
/// </summary>
public Task StackFramesAndVariablesFetched { get; private set; }


/// <summary>
/// Tracks whether we are running <c>Debug-Runspace</c> in an out-of-process runspace.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -26,7 +27,7 @@ public async Task<StackTraceResponse> 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...
Expand All @@ -35,7 +36,7 @@ public async Task<StackTraceResponse> 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);

Expand All @@ -52,7 +53,7 @@ public async Task<StackTraceResponse> 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.
Expand Down Expand Up @@ -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("<No File>"))
{
source = new Source
{
Expand Down

0 comments on commit 84b55f8

Please sign in to comment.