Skip to content
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

Node: Prelaunchtask not running on "restart debugging" in June 2020 release #102296

Closed
raufdean opened this issue Jul 12, 2020 · 9 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@raufdean
Copy link

raufdean commented Jul 12, 2020

  • VSCode Version:
  • OS Version:

Steps to Reproduce:

  1. Using this launch config:-

{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/server.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/build/**/*.js"
],
"outputCapture": "std",
},

  1. Run node debugger
    3 Hit "restart debugging", code is not rebuilt
    4 Hit stop, then "start debugging", code is rebuilt
    5 Downgrade to May2020 and repeat
    6 Code is rebuilt on "restart debugging"

Does this issue occur when all extensions are disabled?: Yes/No

@raufdean raufdean changed the title Prelaunchtask not running on restart fro Node Node: Prelaunchtask not running on restart Jul 12, 2020
@raufdean raufdean changed the title Node: Prelaunchtask not running on restart Node: Prelaunchtask not running on "restart debugging" Jul 12, 2020
@raufdean raufdean changed the title Node: Prelaunchtask not running on "restart debugging" Node: Prelaunchtask not running on "restart debugging" in June 2020 release Jul 12, 2020
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jul 12, 2020
@ChesterYue
Copy link

ChesterYue commented Jul 13, 2020

Same in launch chrome debug:

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}",
            "preLaunchTask": "preLaunchTask",
            "postDebugTask": "postDebugTask",
        },
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "preLaunchTask",
            "type": "shell",
            "command": "echo preLaunchTask",
        },
        {
            "label": "postDebugTask",
            "type": "shell",
            "command": "echo postDebugTask",
        },
    ]
}

@connor4312
Copy link
Member

connor4312 commented Jul 15, 2020

The problem with not running tasks is that when a session is restarted we only run tasks associated with that session, if supportsRestartRequest is true

const runTasks: () => Promise<TaskRunResult> = async () => {
if (isAutoRestart) {
// Do not run preLaunch and postDebug tasks for automatic restarts
return Promise.resolve(TaskRunResult.Success);
}
const root = session.root || this.contextService.getWorkspace();
await this.taskRunner.runTask(root, session.configuration.postDebugTask);
return this.taskRunner.runTaskAndCheckErrors(root, session.configuration.preLaunchTask, (msg, actions) => this.showError(msg, actions));
};

This is okay -- I can just copy the preLaunch and postDebug tasks into the child session so that they get run. But unfortunately this then causes the preLaunchTask to be run twice, once for the root session and then again when the child session is created. I see three possible solutions for this:

  1. js-debug runs the tasks manually on restart. Not great since then we don't get problem handling, and it duplicates functionality that might diverge.
  2. We make restart take tasks from the root session so that child sessions don't need to have explicit preLaunch/postDebug tasks
  3. We additionally add a preRestartTask and postRestartTask, called only on the session being restarted, in the order
    • preRestartTask
    • postDebugTask
    • preLaunchTask
    • postRestartTask

cc @weinand Since (3) is non-destructive/breaking, I will make that change in VS Code and implement it in js-debug so that Insiders can take it. I'm fine scrapping it and going with a different approach if you have feedback after vacationing 🙂 If we instead decide to go with (2) that will not be a breaking change for js-debug.

I will hold off adding it to the launch.json schema (and therefore the public eye) pending feedback here.

@connor4312 connor4312 added the bug Issue identified by VS Code Team member as probable bug label Jul 15, 2020
@connor4312 connor4312 added this to the July 2020 milestone Jul 15, 2020
@connor4312
Copy link
Member

connor4312 commented Jul 15, 2020

Users hitting this error -- this requires a change in VS Code itself and therefore is not as simple to get as grabbing the nightly js-debug extension. Instead, you can do one of the following:

  1. Get the next VS Code Insiders build (tomorrow) where this fix will be released https://code.visualstudio.com/insiders/
  2. Set debug.javascript.usePreview: false to use the old debugger until the fix is released in VS Code stable.

@duzenko
Copy link

duzenko commented Jul 20, 2020

Which VSCode version is this supposed to be fixed in?

@connor4312
Copy link
Member

The VS Code Insiders build (https://code.visualstudio.com/insiders/). It will be released to everyone in the July release.

@duzenko
Copy link

duzenko commented Jul 20, 2020

The VS Code Insiders build (https://code.visualstudio.com/insiders/). It will be released to everyone in the July release.

image

Sorry, what is the July release version number?
Is 07/16 a July or June release?

@connor4312
Copy link
Member

connor4312 commented Jul 20, 2020

The July release will be version 1.48.0 and will go out early next month

@alexr00 alexr00 added the verified Verification succeeded label Aug 7, 2020
@duzenko
Copy link

duzenko commented Aug 10, 2020

The July release will be version 1.48.0 and will go out early next month

What do you mean by "early"? It's 10th, there's the 1.47.3 update and no 1.48.0

@connor4312
Copy link
Member

See #103792

@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants