-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Breaking on exception should jump to top frame that has source #64193
Comments
@DanTup I agree, we should jump directly to where the exception popup happend. F1 > developer tools > sources Thanks a lot |
@isidorn Apologies, I didn't include a repro because I thought it was a missing feature not a bug :-) I put a breakpoint where you suggested and found that So I guess more stack frames need to be fetched prior to trying to find the first one with sources? Presumably this'll repro with any language, but if you want to repro with Dart (you'll need the Dart extension and a Dart SDK on PATH) just open a folder that has a single main() {
assert(false);
} (FWIW, while testing that just now, I noticed that sometimes when I switch to the |
@DanTup Thanks for the investigation.
The fix would be to try to auto focus the stack fames also when the rest of the call stack comes back as well. |
I think we should fix this in the Jan milestone. |
Instead of focusing twice, couldn't we just delay the loading of the source until we have gotten a frame that has source? |
@DanTup I have pushed a fix for this, please try it out in the insiders after we start updating it again after holidays (in 10 days). |
@isidorn This one, however, doesn't seem to work. If I remove the deemphasize hints, then I'm still breaking on missing source (using the Insiders build from today): This is how I'm sending the source back: data.thread.getScript(scriptRef).then((script: VMScript) => {
if (script.source) {
response.body = { content: script.source };
} else {
response.success = false;
response.message = "<source not available>";
}
this.sendResponse(response); (this is less urgent for me personally though, since deemphasize works now :-)) |
@DanTup thanks for trying it out. Well it seems like in your case the check here Thank you |
@isidorn I'm a little confused trying to add a breakpoint there, as the debugService file seems completely different (only a few hundred lines) for me: However if it helps, I made a repro from the mock debug here: https://github.com/DanTup/vscode-repro-64193 I changed the code to simulate an exception at the start, changed the stack request to return sourceReferences based on the stack frame index, and added a sourceReference that returned an error for the first frame, and source for the other frames. If you open this and hit F5 to run on a (I tested in latest insiders) |
@DanTup thanks for the great steps and that you modified mock debug. I really like this process, let's continue doing this. As for the issue, the problem here is timing.
As a workaround I suggest that if the adapter know in advance that a source is not available it should return a stackFrame without a source, or with a source.presentationHint === 'deemphasize' An alternative on the vscode side is that once we do 3. from abaove that we try to refocus, which would visually be a bit ugly. So a better way would be for the adapter to somehow notify vscode that the stackframe is not good as I suggest above. |
Sounds good to me :-)
I didn't realise it was valid to send a stack frame without a source, though I am already using |
Yup, I recommend deemphasize and will not fix this. Thanks for understanding. |
This is slightly related to #25104. The exception peek dialog has been moved to "the top frame that has source" which is great, but the user is still dumped in the frame without source.
Example:
The top two frames in the call stack here (
_AssertionError
) do not have source and the user ends up looking at a rather useless message.If you manually navigate to the third stack frame (
main.<...>
) you'll get the exception popup:It seems to place the exception popup in the correct place but not to take the user to it when the exception occurs. Jumping directly to where the exception popup would be displayed seems like the ideal thing to do.
The text was updated successfully, but these errors were encountered: