-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
Stacktrace view loses focus on stopped thread #34246
Comments
@DatGuyJonathan thanks for the nice steps and for the pointer where you think the fix is. Even though if you are maybe not using the C# adapter the extension you are using is suffering from the same flow I described in that issue. And yes I was first optimistic to try your fix but that did not help. The problem is that when you click step over, the adapter actually contoniues all threads, and then when the stop even comes it comes for the wrong thread making vscode focus wrongly. Closing as duplicate / caused by extension. Please check with the extension for more details |
@isidorn I set a breakpoint in rawDebugSession.ts to see how NextResponse is handled. After receiving a response from the adapter, it calls fireFakeContinued() with allThreadsContinued = false. We can see this in the GIF because the second thread's state is 'running' and the first thread's state is still 'paused'. In debugService.ts, the continued event is handled by trying to focus on a stackframe, but it uses a null stackframe. So, focusStackFrameAndEvaluate() defaults the focus to the first thread's stack. When the stopped event comes for the second thread, it tries to focus that thread's stackframe, but it won't because of that if-statement I mentioned earlier. There's already a focused stackframe, so it won't try to focus again. What if we only default the stack focus for session with only one thread? It would fix the bug I'm experiencing, and also give a smoother debugging experience because the UI won't jump to the first thread before jumping back to the second thread. |
@DatGuyJonathan sounds like you got quite deep in the code. Would you be willing to provide a PR, since it is a bit easier for me to understand your intention by looking at proposed code. When running vscode out of source, you will need to add a debug extension. You can do that by simply dropping a .vsix of the extension you are using. |
Steps to Reproduce:
Reproduces without extensions: Yes
Apologies for the watermark, but you can see the UI remains focused on the first thread after the second thread stops again. I think the UI should refocus on the thread that is most recently stopped.
I suspect the issue is in debugService.tryToAutoFocusStackFrame(). I think that if-statement should be true if there is no callstack or the current focused stack frame is in the same thread as the method parameter. So, something like this:
if (!callStack.length || (this.viewModel.focusedStackFrame && this.viewModel.focusedStackFrame.thread.threadId === thread.threadId)) {
The text was updated successfully, but these errors were encountered: