Skip to content

Debugger: On stopping event, Code does display any source location if top stack frame does not have source information.  #4027

@chuckries

Description

@chuckries

The issue: If the top stack frame does not have source information, the debugger fails to show a current location (even if another stack frame does have source information).

I came across this issue while using the new C# debugger for .NET Core: https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp

In C#, when stopping on an unhandled exception, the top stack frame is often in "non-user code" and the frame is either "[external code]" or a frame in OS code that the user will not have source info for. Example:
image

In this file, I found that when the debugger receives a stopping event, it is hard coded to set the 0th frame as the current frame:

this.setFocusedStackFrameAndEvaluate(callStack[0]);
this.openOrRevealEditor(callStack[0].source, callStack[0].lineNumber, false, false).done(null, errors.onUnexpectedError);

Prior to calling setFocusedStackFrameAndEvaluate or openOrRevealEditor, the debugService should walk it's callstack looking for a frame that has valid source information. The first frame it finds should be passed to setFocusedStackFrameAndEvaluate and openOrRevealEditor.

Additionally: I found that if a debugAdapter does not provide source information for a frame, VS Code creates a default Source object for the stack frame:

return new StackFrame(data.threadId, rsf.id, rsf.source ? new Source(rsf.source) : new Source({ name: 'unknown' }), rsf.name, rsf.line, rsf.column);

This issue is that a default Source objects sets source available to true:

    constructor(public raw: DebugProtocol.Source) {
        this.uri = raw.path ? uri.file(raw.path) : uri.parse(Source.INTERNAL_URI_PREFIX + raw.name);
        this.available = true;
    }

I believe that if a debugAdapter does not provide source for a frame, VS Code should not mark a stack frame as having source available.

Metadata

Metadata

Assignees

Labels

debugDebug viewlet, configurations, breakpoints, adapter issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions