Vscode: Debugger: Add a notification/progress indicator while attaching that can be canceled

Created on 23 Oct 2018  路  13Comments  路  Source: microsoft/vscode

Related to https://github.com/Microsoft/vscode/issues/60810

I desperately want a notification or some sort of cancel-able progress indicator when trying to attach to something. Too often because of the current ux, I end up attaching to nothing, and have to wait until the timeout before I can correct it.

*duplicate debug

Most helpful comment

Thank you for the feedback and for the PR.
For now I decided to just show the debug toolbar while the debug session is inialitising, thus a user can click the stop button to stop the wrong attach request.
I prefer this to showing more ux via notifications. Please try it out and let us know how it goes.

fyi @roblourens

All 13 comments

Thank you for the feedback and for the PR.
For now I decided to just show the debug toolbar while the debug session is inialitising, thus a user can click the stop button to stop the wrong attach request.
I prefer this to showing more ux via notifications. Please try it out and let us know how it goes.

fyi @roblourens

@isidorn Fine, go ahead and implement a better solution, I don't mind really 馃槣

(totally kidding if it wasn't clear -- though that still better count as my hacktoberfest PR :wink:)

Hehe. We should send you a truck load of t-shirts for all the nice bugs you file 馃榿
@auchenberg @pjmeyer can we make that happen?

@isidorn I tried this today, and the toolbar shows up, but the stop button doesn't do anything (or worse it seems if you click it multiple times it stops the timeout from ever happening -- basically requiring a window reload).

@eamodio thanks for trying it out. Can you provide some repro steps for the behavior that you are seeing?
Since for my simple example this works just fine.

attach

@isidorn Strange, that is exactly what I am doing (though was first in a multi-root workspace, but I tried it just from the folder directly and see the same behavior).

Here is my launch config:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Agent",
            "port": 6009,
            "outFiles": ["${workspaceFolder}/dist/**/*.js"],
            "skipFiles": [
                "<node_internals>/**",
                "**/node_modules/**",
                "**/app/out/vs/**",
                "**/extensions/**"
            ],
            "smartStep": true,
            "sourceMaps": true
        }
    ]
}

I'll try it in the debugger a bit later and let you know what I see.

@isidorn I debugged it a bit and found the following:

https://github.com/Microsoft/vscode/blob/a2e96753ee52d6d6ec77404ad68f1cb6b9573c51/src/vs/workbench/parts/debug/browser/debugActions.ts#L324-L331

In here, session comes in as a MouseEvent (which while odd the code seems to handle), and since there is no getId on the MouseEvent then it tries to get the focused session from the debugService's ViewModel -- which is always undefined in my testing.

It looks like this is because in here:
https://github.com/Microsoft/vscode/blob/a2e96753ee52d6d6ec77404ad68f1cb6b9573c51/src/vs/workbench/parts/debug/electron-browser/debugService.ts#L483-L487

It looks like session.launchOrAttach doesn't return until the attach succeeds (which in my case it never will because there is nothing to attach to). So there is never a call to this.focusStackFrame which would ultimately set the focusedSession on the DebugService

I'm not really sure what is the right fix here though 馃槃 but I hope this helps.

@isidorn can this be reopened given the above?

@eamodio absolutely, sorry I had this in my open tabs (to-do list) and forgot to reopen

@eamodio this should work in latest, should be fixed via 9754563ea8117ca2a176eda8f1a48acd03aa56a8

Your analysis was correct, however the debugService.stopSession seems to handle the case when undefined is passed by terminating all sessions. However before the commit the session were not in the model until initialisation is done, this is no longer the case and the terminate should now be properly sent out to all session.
Please let me know if you still see this and I will reopen. Also if you see it it would be great if you could debug a bit more and try to figure out if the terminate / disconnect request do get sent out by stepping in from debugService.stopSession

Seems it is not fixed after all, let's contniue the discussion here https://github.com/Microsoft/vscode/issues/62346

What should be verified here vs the other issue?

Yeah let's remove the verificatino needed, let's just verify that other issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biij5698 picture biij5698  路  3Comments

curtw picture curtw  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments

trstringer picture trstringer  路  3Comments

trstringer picture trstringer  路  3Comments