-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Status bar can dispose commands that are still in use #165244
Comments
Do we know which command is disposed here that triggers the error? Can we print the ID of the command? |
Unfortunately not - it's one command for all (complex) EH side command |
🤔 wait... maybe I can add some debug info here |
I don't know how useful this information will be, but I've started seeing this error in TypeScript workspaces after upgrading to 1.73. It seems to mostly occur after applying a suggestion from the "lightbulb" menu, but I haven't been able to work out how to reproduce it reliably yet. |
#165805 makes the error message better - but the programming mistake is the same. We dispose a "cached" EH command even though it is still used (referenced) in the UI |
@jrieken This is what it looks like after your commit
|
@sguilliaci what does "spam the status bar button" mean? |
@bpasero By spamming I mean clicking on it multiple times in a row as fast as possible until the problem reproduces It is possible that the status bar item command is updated every time we click on it |
@sguilliaci that is possible if running the command updates the status bar entry... |
@bpasero Some users of our extension do randomly see the error message while using the extension normally. Spamming the status bar item that updates its own command is one way to reliably reproduce the issue, but this is just a way to reproduce and is not the core of this bug report. Since the message comes from VS Code itself, there aren't many options available to us so that our users do not to see the message again. It is not known whether some status bar item clicks are ignored (do not execute the desired command). |
Why do the commands need the |
@bpasero If the question is for me, I don't know. Our extension is not suffixing the commands. Regarding the |
After a 1on1 with Jo, we found that this command disposal might run too early before the UI was updated:
Because the update runs with a
However I think there is more to it because updating the UI needs to communicate with the renderer process which is async by nature. So I think a better way of disposing the command is when we truly know that it is not used anymore from the renderer. @sguillia @sguilliaci is it possible that the command that you register with the status bar itself modifies the status bar entry immediately, i.e. sets the command again to the entry? |
@bpasero It is possible. At the very least I know we update the status bar frequently Thanks for investigating |
@sguilliaci we will need a simple hello world snippet to reproduce. I tried this but cannot trigger this, at least on macOS: export function activate(context: vscode.ExtensionContext) {
let s: vscode.StatusBarItem;
let b = false;
vscode.commands.registerCommand('test-ts.helloWorld', () => {
if (!s) {
s = vscode.window.createStatusBarItem();
s.text = `Command`;
s.show();
}
s.text = `Command`;
s.command = `test-ts.helloWorld2`;
});
vscode.commands.registerCommand('test-ts.helloWorld2', () => {
s.command = `test-ts.helloWorld`;
s.text = `Command Changed`;
});
}
export function deactivate() { } Can you provide a small snippet that reproduces? My snippet above sets the command each time you click. |
@bpasero I can't reproduce using the snippet above either. But with my extension it's easily reproducible. I'm on macOS too. Do you really need a small snippet, or would a VSIX with a kind of self-reproducing issue do the job? Meanwhile, the issue can still be reproduced by repeatedly clicking on the status bar item immediatly after re-running or cancelling a workflow with the CircleCI extension Enregistrement.de.l.ecran.2022-11-25.a.14.28.21.mov |
A standalone snippet would speed this up if you are interested in a fast turnaround. Also I am on macOS, not sure that makes an impact, could be harder to reproduce on macOS. |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
Creating a standalone snippet will take some time. My colleagues or I will do it at some point. You can park this ticket for now. Thanks for investigating |
Type: Bug
The users of our extension do see this error pop-up
![Capture d’écran 2022-11-02 à 15 32 11](https://user-images.githubusercontent.com/100221771/199516938-ec9e31c8-4126-4625-943f-33d335f76278.png)
It's also present in the console
![Capture d’écran 2022-11-02 à 14 41 09](https://user-images.githubusercontent.com/100221771/199505404-5554d1c2-bf54-43b5-85da-a86410f1a6e8.png)
It happens at random, but can 100% be reproduced by spamming a status bar button that runs a command.
It seems like there is a sleeping bug in the vscode codebase, and our extension is triggering it for some reason.
Note that there isn't an expansion triangle on the pop-up, and that the pop-up does not come from the extension.
The status bar button runs a command that focuses an item in a TreeView. The bug seems to happen only when the tree view is being updated: to reproduce you need to spam the button while the treeview is being refreshed. I'm unsure of the correlation but it's a reliable way to reproduce.
Steps to reproduce
Here are some steps to reproduce, for what it's worth. They're a bit annoying since it requires an account with CircleCI, but all it does is provide a status bar button that we can click.
If the root cause cannot be identified, could you please provide us with a way for users to not have this error pop-up? Just a console log would be enough.
Relates to #84153
The error comes from here in the vscode codebase:
vscode/src/vs/workbench/api/common/extHostCommands.ts
Line 411 in a8c16a0
I cannot attempt to reproduce on insiders because of another pending issue.
VS Code version: Code 1.72.2 (Universal) (d045a5e, 2022-10-12T22:16:30.254Z)
OS version: Darwin arm64 21.4.0
Modes:
Sandboxed: No
System Info
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
Extensions (8)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: