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

Switching menubar display position failed with error #205836

Closed
yiliang114 opened this issue Feb 21, 2024 · 7 comments · May be fixed by #205848
Closed

Switching menubar display position failed with error #205836

yiliang114 opened this issue Feb 21, 2024 · 7 comments · May be fixed by #205848
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member insiders-released Patch has been released in VS Code Insiders menus Menu items and widget issues verified Verification succeeded

Comments

@yiliang114
Copy link
Contributor

image

Reproduction steps:

  1. Use vscode.dev to open a project, such as https://insiders.vscode.dev/github/microsoft/vscode
  2. Switch the top menubar from TitleBar to the ActivityBar, or do the opposite.
  3. After switching several times, it was found that the switch failed. If you open the console, you will find an error.

bug32

Version: 1.87.0-insider
Commit: ee69e28
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Embedder: vscode.dev

@yiliang114
Copy link
Contributor Author

ref: #199744, because command with the same name cannot be registered now.

The process of switching menu bars is accompanied by the destruction and initialization of two custom menu bars from A and B respectively, and their destruction execution order cannot be guaranteed. When one of the instances is destroyed and executed, the initialization of the new instance will have this problem, because initialization means registering a command with the same name.

id: `workbench.actions.menubar.focus`,

yiliang114 added a commit to yiliang114/vscode that referenced this issue Feb 21, 2024
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues confirmed Issue has been confirmed by VS Code Team member labels Feb 21, 2024
@bpasero
Copy link
Member

bpasero commented Feb 21, 2024

I think the issue here is that the menu bar control gets disposed in the one place and then created in the other place (title bar, activity bar) but the order is not guaranteed to be dispose first and create later, as such this action gets first registered a second time and then gets disposed:

this._register(registerAction2(class extends Action2 {
constructor() {
super({
id: `workbench.actions.menubar.focus`,
title: localize2('focusMenu', 'Focus Application Menu'),
keybinding: {
primary: KeyMod.Alt | KeyCode.F10,
weight: KeybindingWeight.WorkbenchContrib,
when: IsWebContext
},
f1: true
});
}
async run(): Promise<void> {
that.menubar?.toggleFocus();
}
}));

We only recently changed to throwing an error in this case which now breaks this flow, but the issue was there before already...

@yiliang114
Copy link
Contributor Author

id: workbench.actions.menubar.focus,

Yeah, I found it, too. My original idea was to ensure that it was reasonable to reinstall after the uninstall was completed through some event mechanism, such as use this.titleService.onMenubarVisibilityChange, but that would require listening on both sides.

@yiliang114
Copy link
Contributor Author

We only recently changed to throwing an error in this case which now breaks this flow, but the issue was there before already...

Yes, Previously command with the same name can be overwritten without causing a problem. The exception thrown now causes the handler to not be executed and the switch fails.

yiliang114 added a commit to yiliang114/vscode that referenced this issue Feb 22, 2024
yiliang114 added a commit to yiliang114/vscode that referenced this issue Feb 22, 2024
@bpasero bpasero assigned bpasero and unassigned sbatten Aug 30, 2024
@bpasero bpasero added this to the September 2024 milestone Aug 30, 2024
@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 30, 2024
@vs-code-engineering vs-code-engineering bot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Sep 5, 2024
@bpasero bpasero added the author-verification-requested Issues potentially verifiable by issue author label Sep 5, 2024
Copy link

This bug has been fixed in the latest release of VS Code Insiders!

@yiliang114, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version 4c94dbd of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

@alexr00 alexr00 added verified Verification succeeded and removed verified Verification succeeded labels Sep 26, 2024
@alexr00
Copy link
Member

alexr00 commented Sep 26, 2024

Switch the top menubar from TitleBar to the ActivityBar, or do the opposite.

How can I do this? I'm having trouble understanding how to get the top menu to show at all. I can only get the hamburger menu.

@alexr00 alexr00 added the verification-steps-needed Steps to verify are needed for verification label Sep 26, 2024
@alexr00 alexr00 removed the verification-steps-needed Steps to verify are needed for verification label Sep 26, 2024
@alexr00
Copy link
Member

alexr00 commented Sep 26, 2024

Finally found it. It's window.menuBarVisibility, switched between classic and compact.

@alexr00 alexr00 added the verified Verification succeeded label Sep 26, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member insiders-released Patch has been released in VS Code Insiders menus Menu items and widget issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants