microsoft / vscode

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

Window restores with different bounds each restart #170001

Open ua-knight opened 1 year ago

ua-knight commented 1 year ago

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

Steps to Reproduce:

  1. Put VS Code in a non-maximized size mode.
  2. Resize the main window so that its right and bottom border is near the right and bottom edge of the screen. The top and left edge should have some space between the screen's edges.
  3. Repeatedly open and close the app.
  4. Watch the window slowly increase its size towards the right and bottom edge.
  5. Watch it grow even outside of the screen.
bpasero commented 1 year ago

Some questions around the setup:

Chaos-070799 commented 1 year ago

It reproduces I'm assuming to my google calendar.... what happens I was locked out of my google act! Being states away from home I needed my google act back I had just started my own business and they kept asking for passwords every little bit... to the point I forgot my password! I reached out to Google they had me reach out to my significant other with access to prove my identity and get me back in my act! Since then my phone has cut up but it's cool, on oct ? I texted in calendar help me get my act back and he responded.... since then, this is been going on

Chaos-070799 commented 1 year ago

And no, it appears that I only have access to his phone he does not have access to mine! Total

ua-knight commented 1 year ago

No multi monitor. It's a standalone 17'' laptop (1920 x 1080), pretty much out of the box with no scaling or zooming configured.

Screenshot (71)

bpasero commented 1 year ago

Can you try to reproduce with our nightly insider builds? You can give our preview releases a try from: https://code.visualstudio.com/insiders/

ua-knight commented 1 year ago

Yes, it reproduces. I downloaded and installed and run directly with no extra configuration made. Here's screenshots from before, and after 10 openings. I just clicked the upper right cross and then doubleclicked the desktop icon, 10 times.

Before:

VSCode before

After 10 re-openings:

VSCode after 10 openings

ua-knight commented 1 year ago

Just to make sure that I didn't fumble when clicking the cross, I repeated by closing using Alt+F4, with the same result.

ua-knight commented 1 year ago

Btw, the same happens on Linux, but with the difference that the drifting stops when the right and bottom edges of the screen are reached. Here's the screenshot from my Linux distro Lubuntu, run in VirtualBox, after some re-openings of VS Code:

screen

bpasero commented 1 year ago

Does it reproduce when you configure window.titleBarStyle: native?

ua-knight commented 1 year ago

Yes, unfortunately.

Screenshot (74)

bpasero commented 1 year ago

Since I was not able to reproduce so far, maybe you could record a Gif/Video how you start and how it ends, then I will try to reproduce exactly like that. For example https://gifcap.dev/ allows to record the screen as Gif and then you can attach here.

ua-knight commented 1 year ago

Ok, I've made a recording. Btw, I tested with other apps, like Notepad++, and it doesn't happen with them. Only VS Code.

Recording 2022-12-28 at 09 24 38

bpasero commented 1 year ago

When you run code-insiders --verbose we produce verbose logs that include information for window state (size, position). Can you run the steps from the gif attaching the logs you see from the console? For example, the line that has window#validateWindowState is relevant, as well as [WindowsStateHandler] onBeforeShutdown

ua-knight commented 1 year ago

I couldn't get the gif tool to work in this scenario. It took too long time and the recording kept abort with an error. However, I took screenshots instead of the relevant parts. I opened and closed two times, took 4 screenshots of each. The first 3 in each set is from the beginning of the log file, after VS Code has been opened. You can find "window#validateWindowState" on #3. The last, #4, is from after I have closed it, and contains "onBeforeShutdown". Here's the first set.

vscode-first-1

vscode-first-2

vscode-first-3

vscode-first-4

ua-knight commented 1 year ago

Here's the second:

vscode-second-1

vscode-second-2

vscode-second-3

vscode-second-4

bpasero commented 1 year ago

@tulipan-it thanks this is useful, here is the relevant log extracted and notice how the position but mainly the size of the window seems to change between the restarts:

image image image image

In all these cases I would have expected x, y, width and height to stay the same unless you as a user would resize or move the window.

Is there any special window manager or 3rd party software installed?

ua-knight commented 1 year ago

No, I try to keep it as clean as possible regarding such tools. The only thing I recall is Armoury Crate, which is an optional, advanced low level system manager from ASUS. However, it mostly concerns colors, CPU and memory stuff.

Notice that it also happens on a virtual machine running Linux. And that it doesn't happen for other apps but VS Code. So I draw the conclusion that:

  1. It is VS Code specific
  2. It has something to do with the physical machine, not the OS

It's an 17'' ASUS laptop. Maybe 17'' laptops are a bit uncommon. If you or your team has access to such, it might be interesting to test on that.

Otherwise, this is not really a big deal. I just wanted to report it. I do most of my development on Linux and there the drifting at least stay within the screen and bottom taskbar. If you cannot reproduce and no other reports of this are coming in, I think it must have a low priority.

bpasero commented 1 year ago

Got it, esp. the part about this reproducing on Linux too is very strange.

Curious, does it also happen when the window is maximized?

ua-knight commented 1 year ago

Nope.

bpasero commented 1 year ago

Oh, just found this upstream issue from the UI framework we use: https://github.com/electron/electron/issues/27651

I bet its your issue as well, sounds very much similar.

ua-knight commented 1 year ago

It's probably related somehow. But they talk about multiple screens and different scaling. I have only one and keep it at 100%.

bpasero commented 1 year ago

Marking as upstream: we get different window bounds after setting bounds, so the window moves on the screen. I am not aware of a way for us to fix this and https://github.com/electron/electron/issues/27651 sounds very much related.

jeffpapp commented 1 year ago

Not sure this is related to the same issue but I notice that when I open a second instance of VS Code on Windows it doesn't size the same as the first.

For example:

  1. Open VS Code and maximize the window and then close it
  2. Reopen VS Code and the first instance will be maximized like I would expect since the last instance closed was maximized.
  3. Open a second instance of VS Code and this one will never be maximized. I would expect it to be the same size as the other VS Code window already open
bpasero commented 1 year ago

It is unrelated, that is configurable with window.newWindowDimensions setting.