Repository: microsoft/terminal (language: cpp)

Issue:
We need to actually fix our UpdateWhileInUse manifest (was: Terminal closes itself unexpectedly from time to time)
### Windows Terminal version

1.21.2911.0

### Windows build number

10.0.22631.3880

### Other Software

_No response_

### Steps to reproduce

1. Start the terminal app
2. Let it run with one or two tabs open running console applications

### Expected Behavior

Terminal should stay open until I close it.

### Actual Behavior

Terminal closes itself from time to time, also stopping all running console applications. Last time was last night at 2024-10-28 01:50 +0100. I have no event log of this but it could be once in a few months. All other applications are still running, nothing else stops unexpectedly.


Discussion / hints:
We've found some similar issues:


- #9889 , similarity score: 81%
  

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

> Note: You can give me feedback by 👍 or 👎 this comment.
If it's an auto-update situation and the Store app force-closes the Terminal, then there's a serious problem here. The Store must not have the power to randomly kill other apps whenever it wants. If that's what it does, I'll have to force-disable those updates. I expect it to be at least so cooperative and inform me that it wants to install an update and requires the Terminal to close. If I can't afford to stop all currently running console apps (which might do long-running work), I must have the ability to defer this for arbitrary time.

I'd appreciate it doing its updates when I also let Windows Update run. Then I'm aware that a reboot is needed and all apps are closed, so I'll only do that when possible. IIRC, PowerShell (the new one) is also only updated along with Windows Updates, so Terminal should do just the same.
Alas, this actually came up in a mail thread while I was out. For my own reference: "**Subject**: RE: UpdateWhileInUse issue follow-up"

tldr of that thread is that we didn't update our manifest entirely correctly. Sounds like just adding the new property (`<uap17:UpdateWhileInUse>defer</>`) wasn't good enough. We'll also need to set our `MaxVersionTested` to `10.0.26100.0`.

This alas will have other, unexpected consequences (apparently), so we will need to do quite a bit of validation on our side. 

(originally presumed fixed in #16250)
Good to hear that you know what's happening and what might fix it.

Until this is fixed, can I selectively prevent Terminal from being updated automatically? Without disabling all app updates altogether? Or can I only shut down the whole thing all at once? I remember Android has auto-update settings per app (not that auto-update would actually reliably do anything there, but at least the option is there). Couldn't find that in Windows or the Store app now.
Still happening.

> Until this is fixed, can I selectively prevent Terminal from being updated automatically? Without disabling all app updates altogether? Or can I only shut down the whole thing all at once? I remember Android has auto-update settings per app (not that auto-update would actually reliably do anything there, but at least the option is there). Couldn't find that in Windows or the Store app now.

I would also like to know this.
No info yet. I've disabled the automatic updates in Windows Store. Like I already did for Windows altogether. Considering Microsoft's ever-decreasing updates quality, extra carefulness is due. Never let it update when it wants to interrupt your work. Do it shortly before new updates appear. By then most issues should be sorted out.
Alas, not that I'm aware of. This has been one of rougher edges with the Store as long as I can remember. Updating our manifest is the only way I know how to fix this. Just a bummer that the magic keyword here needed a _second_ magic keyword that we didn't know about, and has other possibly unexpected consequences 😕 

Fix patch:
diff --git a/scratch/ScratchIslandApp/Package/Package.appxmanifest b/scratch/ScratchIslandApp/Package/Package.appxmanifest
index 4fbd2b16bae..727debd1603 100644
--- a/scratch/ScratchIslandApp/Package/Package.appxmanifest
+++ b/scratch/ScratchIslandApp/Package/Package.appxmanifest
@@ -27,7 +27,7 @@
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
   </Dependencies>
 
   <Resources>
diff --git a/src/cascadia/CascadiaPackage/Package-Can.appxmanifest b/src/cascadia/CascadiaPackage/Package-Can.appxmanifest
index e8ff744104b..8335a59f420 100644
--- a/src/cascadia/CascadiaPackage/Package-Can.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package-Can.appxmanifest
@@ -38,7 +38,7 @@
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
   </Dependencies>
 
   <Resources>
diff --git a/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest b/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
index 9f68b6f3e4f..4a3153076c8 100644
--- a/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
@@ -38,7 +38,7 @@
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
   </Dependencies>
 
   <Resources>
diff --git a/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest b/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
index 665b5b7dde6..18d195efb13 100644
--- a/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
@@ -39,7 +39,7 @@
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
   </Dependencies>
 
   <Resources>
diff --git a/src/cascadia/CascadiaPackage/Package.appxmanifest b/src/cascadia/CascadiaPackage/Package.appxmanifest
index c7ed197075a..c679a959bcd 100644
--- a/src/cascadia/CascadiaPackage/Package.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package.appxmanifest
@@ -39,7 +39,7 @@
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
   </Dependencies>
 
   <Resources>
diff --git a/src/cascadia/WindowsTerminal/WindowsTerminal.manifest b/src/cascadia/WindowsTerminal/WindowsTerminal.manifest
index 3be6f3c7bf9..f48f0e43cd5 100644
--- a/src/cascadia/WindowsTerminal/WindowsTerminal.manifest
+++ b/src/cascadia/WindowsTerminal/WindowsTerminal.manifest
@@ -20,6 +20,7 @@
         UI Variable, GH #12452 -->
         <maxversiontested Id="10.0.22000.0"/>
         <maxversiontested Id="10.0.22621.0"/>
+        <maxversiontested Id="10.0.26100.0"/>
         <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
     </application>
   </compatibility>


Test patch:
diff --git a/doc/cascadia/Unittesting-CppWinRT-Xaml.md b/doc/cascadia/Unittesting-CppWinRT-Xaml.md
index c52f4abe498..682fdb451a8 100644
--- a/doc/cascadia/Unittesting-CppWinRT-Xaml.md
+++ b/doc/cascadia/Unittesting-CppWinRT-Xaml.md
@@ -380,7 +380,7 @@ Here's the AppxManifest we're using:
   </Properties>
 
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.26100.0" />
     <PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
     <PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
   </Dependencies>
@@ -517,7 +517,7 @@ This is because of a few key lines we already put in the appxmanifest:
 
 ```xml
   <Dependencies>
-    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
+    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.26100.0" />
     <PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
     <PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
   </Dependencies>