-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger: On stopping event, Code does display any source location if top stack frame does not have source information. #4027
Comments
@chuckries If a stack frame does not have source information, the debugger UI cannot "infer" a location from some other frame by "walking its callstack looking for a frame that has valid source information". That would be too much guessing in a language agnostic UI. From your screenshot I do not really understand what is the problem because I only see the name of the frame? @isidorn could you please look into the issue of "default Source objects sets source available to true" |
I still cannot see the relevant information in your stackframes.
This is not really true. |
@chuckries after having had dinner, I think I understand now what the problem is. You are not talking about the CALL STACK viewlet (as your first screenshot suggested), but you are referring to the stack frame indication in the editor. You are missing the yellow (or green) line where the exception occurs. Yes, that's a bug. |
I apologize for not being clear. It seems like you understand my issue now. Thanks! I simply dug into the code and tried to figure out why the stack frame indication was not being set correctly, and it is from the hard coding of 0 in this.setFocusedStackFrameAndEvaluate(callStack[0]);
this.openOrRevealEditor(callStack[0].source, callStack[0].lineNumber, false, false).done(null, errors.onUnexpectedError); This is where the "call stack walk" must be done. The frame object simply need to be iterated over to find one that has source. I believe this should set the stack frame indication correctly. |
@chuckries nice catch and a good investigation - thanks! Also when you figure out everything on your own like now feel free to submit a PR. |
Excellent! Has the behavior changes regarding a debug adapter providing a stack frame with a null Source field? |
Yes, if the top stack frame has a |
I understand that, but I discovered a secondary issue while investigating this that |
I can confirm that even with this change I am not seeing the current stack frame get set correctly because my debug adapter returns a null Source for the stackframe and code is creating non null default source object. I am having trouble debugging code with code however using current master. |
@isidorn Can this be reopened or should I file another issue? |
@chuckries good catch, I will fix this tomorrow, unless it is urgent then let me know and I can look right away |
any time before next release is fine, but tomorrow is great! thanks! |
Giving to @weinand to verify, also @chuckries let us know if it still does not work for you |
Looks great! Thanks! |
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:
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:
Prior to calling
setFocusedStackFrameAndEvaluate
oropenOrRevealEditor
, the debugService should walk it's callstack looking for a frame that has valid source information. The first frame it finds should be passed tosetFocusedStackFrameAndEvaluate
andopenOrRevealEditor
.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:
This issue is that a default Source objects sets source available to 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.
The text was updated successfully, but these errors were encountered: