microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.33k stars 28.9k forks source link

Debug with f5 never starts and caused extraneous extension activation #175202

Open mjbvz opened 1 year ago

mjbvz commented 1 year ago

Type: Bug

  1. In a TypeScript vscode extension
  2. Have the launch.json:
// A launch configuration that compiles the extension and then opens it inside a new window
{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceRoot}"
            ],
            "preLaunchTask": "npm: compile-ext",
            "sourceMaps": true
        }
    ]
}
  1. Press F5 to debug with Launch extension active

Bug Debugging never starts. I see a progress bar in the debug view but even if I wait a few minutes, nothing happens. I also get a random error popup from Java

I also see a bunch of extra extensions getting activated too on F5, such as c++, docker, and Java

Screenshot 2023-02-22 at 10 43 48 PM

Removing the preLaunchTask allows me to debug again

The hang may be caused by a misbehaving extension but it's still odd to me that these extensions are being activated. There's also not good feedback about why debugging has not yet started. All I see is an infinite progress bar in the debug view:

Screenshot 2023-02-22 at 10 45 21 PM

VS Code version: Code - Insiders 1.76.0-insider (Universal) (7b6b6869e8f5b71b5e9cdbd3f590b10964f89607, 2023-02-22T05:24:36.668Z) OS version: Darwin x64 22.3.0 Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|3, 3, 3| |Memory (System)|32.00GB (5.70GB free)| |Process Argv|--crash-reporter-id 48781ca2-1705-4f64-9bab-325055aab55d| |Screen Reader|no| |VM|0%|
DanTup commented 1 year ago

I also see a bunch of extra extensions getting activated too on F5, such as c++, docker, and Java

Maybe https://github.com/microsoft/vscode/issues/88617?

Activation is something I've raised (complained about? 🙃) a few of times before. VS Code seems to try hard to not have extensions activated until they're required, but there are a few places like this (and previously things like https://github.com/microsoft/vscode/issues/126238, https://github.com/microsoft/vscode/issues/75284, https://github.com/microsoft/vscode/issues/73656) where extensions will be "unexpectedly" activated.

This creates a dilemma for extensions. When we activate, should we assume the user has a project open and do things like register our providers, search for SDKs, start language servers, etc. or should we do our own search (repeating work VS Code has already done for things like workspaceContains potentially for ever impacted extension) to try and figure out if we were really wanted?

Another issue I raised that's similar to this (but for "Create launch json") was the C# extension downloading an SDK in activate which was blocking VS Code from continuing:

https://github.com/microsoft/vscode/issues/110386

Again, there's not a load of guidance here. How much work should an extension do in activate? In Dart, we do a lot of things here (including searching for SDKs) assuming that if we fail, we want "activation" to fail but perhaps that's not the right choice (for this exact reason), in which case there should be guidelines on what things we should do in activate (presumably for things like onDebugInitialConfigurations to work, we need to at least register some providers).

meganrogge commented 1 year ago

maybe same root cause as #176006