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
Debug launching before preLaunchTask ready when dependsOn task defined #54397
Comments
(Experimental duplicate detection) |
I should also add that the only issue for me is just that the debugging browser launches before the website is ready: there is no actual problem with attaching or debugging, it just results in a "page could not be loaded" and having to manually refresh the browser. If the preLaunchTask was already running prior to debug, then everything is fine too. |
The issue here is that the |
No your assumption is correct. |
We're running into this as well for the functions extension. Here's our scenario: We provide a task {
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"host": "localhost",
"preLaunchTask": "func: host start"
}
]
} But a lot of times users will want to run a task before they start the functions host. For example, Python users might want to do {
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-watch",
"dependsOn": "pipInstall"
},
{
"label": "pipInstall",
"type": "shell",
"command": ". func_env/bin/activate && pip install -r requirements.txt"
}
]
} @dbaeumer Any updates on this issue? Or do you see any workarounds for us? Again - it's running all tasks as expected, but it's ignoring the |
I looked into this and it is actually something debug needs to fix. @isidorn and my assumption was incorrect. The thing here is that two tasks are started but debug reacts in task inactive event without checking if the task it started is signalling the inactive event. The event listener has an argument that event which has information about the task signalling the event @isidorn The event has either a Moving back to debug. @isidorn sorry for putting you onto the wrong path here. |
@dbaeumer thanks a lot for the investigation and for the fix |
@isidorn I'm getting this every time I try to debug: I created a simple VS Code extension that replicates the bug when you F5: VS Code version: Code - Insiders 1.30.0-insider (9e62a05, 2018-12-03T06:12:08.874Z) System Info
Extensions (7)
|
Thanks for the repro steps, reopening and I plan to investigate later today / tomorrow |
I can repro by cloning your repository. @dbaeumer @alexr00 the task ids that I am getting from the task service are not matching and so I can not detect that a task is started. Assigning to @alexr00 and december to investigate than why the task ids are not matching. To repro
|
@alexr00 I quickly looked into this and there is something wired here. In this setup the terminal doesn't give us any |
It does work if we give each task a dedicated panel {
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"panel": "dedicated"
},
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": "npm: lint"
},
{
"type": "npm",
"script": "lint",
"problemMatcher": "$tsc",
"presentation": {
"reveal": "never",
"panel": "dedicated"
},
}
]
} |
And the IDs look stable to me. @isidorn I looked at your change and you still used a once listener. However if this starts n tasks like in the above example you need to listen until the one you started signals. The first one that signals in the above example is the |
@alexr00 can you look into this: #54397 (comment) . The terminal doesn't give us the right events so this might still not work |
Looked into it, and not having the right events is a duplicate of #64226, which is in turn a duplicate of #57803. The initial tsc compile lines simply never make it to the terminal which means our watching problem matcher can't fire the events we need. Until #57803 is fixed there is no good work around. Once you see the tsc compile start you can save a source file to cause the missing lines to print to the terminal. |
@alexr00 I'm a little confused on if this is fixed or not. If it's not fixed - which issue should I track going forward? |
There are two issues that contribute to what you're seeing: #64865 was causing the terminal to not sent an onExit event. This issue is now fixed. |
Steps to verify? |
On Windows:
You can use the Launch VS Code configuration for this. Or a launch extension configuration if you want to test with an extension instead
Use the Build VS Code task or if you're testing with an extension use the npm run watch task as the preLaunchTask. Give it a
Confirm that the Build VS Code task or the npm run watch task says that compilation was successful before launching. |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
Taking out the dependsOn task from the preLaunchTask definition results in the expected behavior: the debugger waits to launch at the point that the preLaunchTask prints a message matching the endsPattern.
Also, making the preLaunchTask a non-background task seems to have the expected behavior: the dependsOn task executes before the preLaunchTask before the launch configuration.
There is no difficulty outside of the launch: the tasks defined execute in the expected sequence and match problems whether they were started directly, or via the launch. It's just that the debugger starts too early under these circumstances. It also does not seem to be specific to any one launch extension.
Thanks,
Alex
launch.json:
tasks.json:
The text was updated successfully, but these errors were encountered: