Skip to content

Sometimes windows don't get persisted on a Windows Update #17179

@zadjii-msft

Description

@zadjii-msft
Member

v1.21

I've now had a couple days where I've gotten a Windows Update, and came back to the Terminal not quite in the right state as before:

  • A few times, I've had the buffer restored, but to a previous day's state. As if the buffer didn't get persisted on shutdown, but on launch I did get the buffer from the previous shutdown.
  • Today, I only had one of my two windows persisted across the reboot. The window that was persisted did have all it's buffers restored, but the other window was gone entirely.

I have a theory that this is somehow related to us not handling WM_ENDSESSION post-PMv3 quite right, but that's a guess, not a root cause.

Activity

added
Issue-BugIt either shouldn't be doing this or needs an investigation.
on May 2, 2024
added
Needs-Tag-FixDoesn't match tag requirements
Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
on May 2, 2024
github-actions

github-actions commented on May 2, 2024

@github-actions
zadjii-msft

zadjii-msft commented on May 3, 2024

@zadjii-msft
MemberAuthor

Yea, again today, I got both windows back, but the buffer state was what it was the previous time I had quit the Terminal. So, whatever happened during the update meant that the Terminal didn't actually persist the buffer.

added this to the Terminal v1.22 milestone on May 8, 2024
added
Area-WindowingWindow frame, quake mode, tearout
and removed
Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
Needs-Tag-FixDoesn't match tag requirements
on May 8, 2024
lhecker

lhecker commented on May 13, 2024

@lhecker
Member

I found that this tool can be used for shutdown tests:

C:\Program Files (x86)\Windows Kits\10\App Certification Kit\rmlogotest.exe

For instance:

& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\rmlogotest.exe" (ps -Name WindowsTerminal).Id

I couldn't reproduce any issues on the main branch, even with multiple windows that have multiple tabs, and no matter how I re-launched the app.

lhecker

lhecker commented on May 14, 2024

@lhecker
Member

tl;dr: handoff doesn't assign a SessionId!

I figured out how to reproduce multiple issues (probably even the issue):

  • Launch
  • (Register that version of WT as the default)
  • Close all tabs (Ctrl+Shift+W)
  • Bug: persistedWindowLayouts is non-empty
  • Launch cmd/pwsh via handoff, but use the one that's not your default profile
  • (Known) Bug: You got 2 windows now instead of 1 (this is a consequence of the previous bug)
  • Close the tab with the default profile (= the extra window)
  • Close window with the handoff'd non-default profile (= press red X)
  • Bug: Buffer doesn't get persisted, and no SessionId gets stored
zadjii-msft

zadjii-msft commented on May 15, 2024

@zadjii-msft
MemberAuthor

So yea here's the thing - defterm wasn't involved (to the best of my knowledge) in my scenario. I almost never open things via defterm anymore - pretty sure Stable is set as my defterm handler. Normally quitting the terminal will persist just fine - there's something specific about updates that makes the terminal not persist the current state of the buffer 🤷

12 remaining items

added a commit that references this issue on Aug 20, 2024
b439925
added a commit that references this issue on Aug 21, 2024
8c2c88e
mmseng

mmseng commented on Oct 1, 2024

@mmseng

My understanding is that this shipped with v1.22. Today was the first time that my workstation performed Windows updates while having 1.22 installed, and Terminal successfully restored its state after logging back in, and also respected the change to show some of the restored history without scrolling up. Thanks!

working-name

working-name commented on Apr 29, 2025

@working-name

1.22.10731.0 - still doesn't restore windows if you close terminal, and then reboot the computer with a shutdown -r -t 0. Maybe Terminal needs a couple minutes to write the session file? Not sure what the issue might be.

@lhecker Don't think this fix handles that ^

mmseng

mmseng commented on Apr 29, 2025

@mmseng

Tangentially, I noticed that my tabs/history in my Terminal Preview app didn't get persisted across the last couple of Windows updates. However I was traveling and accessing my usual remote workstation through a much smaller laptop screen and really wasn't paying close enough attention to what I had open when these updates restarted the workstation, so I'm not 100% sure exactly what happened.

added a commit that references this issue on May 23, 2025
26cd15a
added a commit that references this issue on Jun 17, 2025
94a2aa0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-WindowingWindow frame, quake mode, tearoutIn-PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @lhecker@mmseng@carlos-zamora@working-name@zadjii-msft

      Issue actions

        Sometimes windows don't get persisted on a Windows Update · Issue #17179 · microsoft/terminal