Repository: microsoft/terminal (language: cpp)

Issue:
Terminal 1.13 doesn't work on N SKU
### Windows Terminal version

1.13.10336.0

### Windows build number

10.0.19044.1466

### Other Software

_No response_

### Steps to reproduce

Upgrading to the 1.13 terminal preview led to a situation where it seems to crash(?) on start.  This occurs even after fully removing the app from the store and re-installing.

There is nothing in the eventlog. The window briefly flashes and then disappears.

The older, 1.12 terminal still seems to work.

### Expected Behavior

_No response_

### Actual Behavior

Crash on start.


Discussion / hints:
Could you share your [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)?

Also, can you capture the crash with the feedback hub? /feedback

Hi there!<br><br>Can you please send us feedback with the [Feedback Hub](https://support.microsoft.com/en-us/windows/send-feedback-to-microsoft-with-the-feedback-hub-app-f59187f8-8739-22d6-ba93-f66612949332) with this issue? Make sure to click the "Start recording" button, then reproduce the issue before submitting the feedback. Once it's submitted, paste the link here so we can more easily find your crash information on the back end?<br><br>Thanks!<br><br>![image](https://user-images.githubusercontent.com/18356694/140811502-a068f78b-89d2-4587-925a-73e19652b830.png)<br><br>![image](https://user-images.githubusercontent.com/18356694/140811557-cdc22a0f-fa6a-4f6a-953e-73b51f5548a3.png)<br><br>![image](https://user-images.githubusercontent.com/18221333/62478649-6de55400-b760-11e9-806e-5aab7e085a9f.png)
@zadjii-msft Here you go: https://aka.ms/AAfnb8c

The settings file is the default since I re-installed but here goes that too:  [settings_and_state.zip](https://github.com/microsoft/terminal/files/8007132/settings_and_state.zip)

I'm having issues with it crashing on startup for 10.0.19044

![image](https://user-images.githubusercontent.com/8129778/152629045-16873594-a8c6-4d91-8e44-6b4067fee55e.png)

I also tried installing update KB5009596 but that didn't fix anything

Switching back to Windows Terminal Preview 1.12.3472.0 works for me
I too face this issue a fter updating to windows terminal latest Version: 1.12.10334.0, it doesn't launches on startup and windows terminal wasn't found on taskmanager startup programs and windows settings startup apps, even though startOnUserLogin set to true, in the settings.json file.
@ManikandanMani I'm gonna refer you over to #12384. The two threads sound the same, but this one seems more like a crash on boot, while the other is about the startup task not working anymore. 
Huh. There is a logged message from

```c++
        else if (const auto& realArgs = args.ActionArgs().try_as<NewTabArgs>())
        {
            LOG_IF_FAILED(_OpenNewTab(realArgs.TerminalArgs()));
            args.Handled(true);
        }
```

in `TerminalPage::_HandleNewTab`. That shouldn't be able to fail...


<details>
<summary>settings</summary>

```jsonc
{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "profiles": 
    {
        "defaults": {},
        "list": 
        [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{a3a2e83a-884a-5379-baa8-16f193a13b21}",
                "hidden": false,
                "name": "PowerShell 7 Preview",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{dd2c8db1-96b9-5984-82c0-572177b833eb}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2022 [Preview]",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{a0e54c6f-fb32-5de3-b356-7abf3a404ec3}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2022 [Preview]",
                "source": "Windows.Terminal.VisualStudio"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ]
}
```


</details>


<details>
<summary>state</summary>

```jsonc
{
	"generatedProfiles" : 
	[
		"{574e775e-4f2a-5b96-ac1e-a2962a402336}",
		"{a3a2e83a-884a-5379-baa8-16f193a13b21}",
		"{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
		"{dd2c8db1-96b9-5984-82c0-572177b833eb}",
		"{a0e54c6f-fb32-5de3-b356-7abf3a404ec3}"
	]
}
```

</details>

There's nothing out of place for the settings...

Error was `ERROR_MOD_NOT_FOUND`. HMMM. I think I have a theory. I think this is the torn app package bug. Lemme whip up a one liner to confirm
I'm pretty confident that this is some variation on #10243. I forget how to see where the app execution alias is pointing, but I bet it's trying to launch the `windowsterminal.exe` from version 1.abc, but load the dlls from 1.xyz. 
In CMD: 
```bat
powershell -command get-childitem %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe
```

or in powershell:
```powershell
get-childitem ${env:USERPROFILE}\AppData\Local\Microsoft\WindowsApps\wt.exe
```

you should get output like 
```
    Directory: C:\Users\migrie\AppData\Local\Microsoft\WindowsApps

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
la---            2/7/2022  8:54 AM              0 wt.exe -> C:\Program
                                                  Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.13.10333.0_x64__8wekyb3d8bbwe\wt.exe

```

If that doesn't point at 1.13, that would seem to indicate that the alias got torn during upgrade. 

It might also be helpful to have the output of 

```powershell
gci "C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.1*" | gci
```
 
(in powershell).

REGARDLESS, Repairing the app, and/or restarting your PC should fix this. I'm pretty confident the app is just in a torn state. 
Hmmm, a repair and a reboot didn't fix it. 

I don't see exactly what you're seeing for those arrows though:
```
get-childitem ${env:USERPROFILE}\AppData\Local\Microsoft\WindowsApps

    Directory: C:\Users\fxgltf\AppData\Local\Microsoft\WindowsApps

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----            2/8/2022  6:39 PM                Backup
d----          12/15/2021  1:42 AM                Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
d----           6/10/2021  8:20 AM                Microsoft.MicrosoftEdge_8wekyb3d8bbwe
d----            2/8/2022  6:39 PM                Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe
la---           4/14/2021  5:58 PM              0 MicrosoftEdge.exe ->
la---          12/15/2021  1:42 AM              0 winget.exe ->
la---            2/8/2022  6:39 PM              0 wt.exe ->
```

Here's the output of WindowsApps:
```
gci "C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.1*" | gci

    Directory: C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.13.10336.0_x64__8wekyb3d8bbwe

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----            2/8/2022  6:34 PM                AppxMetadata
d----            2/8/2022  6:34 PM                Images
d----            2/8/2022  6:34 PM                Microsoft.Terminal.Control
d----            2/8/2022  6:34 PM                Microsoft.Terminal.Settings.Editor
d----            2/8/2022  6:34 PM                Microsoft.UI.Xaml
d----            2/8/2022  6:34 PM                ProfileIcons
d----            2/8/2022  6:34 PM                TerminalApp
-a---            2/8/2022  6:34 PM          92423 AppxBlockMap.xml
-a---            2/8/2022  6:34 PM          42396 AppxManifest.xml
-a---            2/8/2022  6:34 PM          11023 AppxSignature.p7x
-a---            2/8/2022  6:34 PM            390 BuildInfo.xml
-a---            2/8/2022  6:34 PM         648732 CascadiaCode.ttf
-a---            2/8/2022  6:34 PM         443804 CascadiaCodeItalic.ttf
-a---            2/8/2022  6:34 PM         624892 CascadiaMono.ttf
-a---            2/8/2022  6:34 PM         427072 CascadiaMonoItalic.ttf
-a---            2/8/2022  6:34 PM          49152 concrt140_app.dll
-a---            2/8/2022  6:34 PM         317864 concrt140.dll
-a---            2/8/2022  6:34 PM        1072640 cpprest142_2_10.dll
-a---            2/8/2022  6:34 PM          20272 defaults.json
-a---            2/8/2022  6:34 PM          94208 elevate-shim.exe
-a---            2/8/2022  6:34 PM        1308672 Microsoft.Terminal.Control.dll
-a---            2/8/2022  6:34 PM          36352 Microsoft.Terminal.Control.winmd
-a---            2/8/2022  6:34 PM         246784 Microsoft.Terminal.Remoting.dll
-a---            2/8/2022  6:34 PM          18432 Microsoft.Terminal.Remoting.winmd
-a---            2/8/2022  6:34 PM        1643520 Microsoft.Terminal.Settings.Editor.dll
-a---            2/8/2022  6:34 PM          57344 Microsoft.Terminal.Settings.Editor.winmd
-a---            2/8/2022  6:34 PM        1541120 Microsoft.Terminal.Settings.Model.dll
-a---            2/8/2022  6:34 PM          95744 Microsoft.Terminal.Settings.Model.winmd
-a---            2/8/2022  6:34 PM           7168 Microsoft.Terminal.TerminalConnection.winmd
-a---            2/8/2022  6:34 PM         110800 Microsoft.Toolkit.Win32.UI.XamlHost.dll
-a---            2/8/2022  6:34 PM          11984 Microsoft.Toolkit.Win32.UI.XamlHost.winmd
-a---            2/8/2022  6:34 PM        6329232 Microsoft.UI.Xaml.dll
-a---            2/8/2022  6:34 PM         412552 Microsoft.UI.Xaml.winmd
-a---            2/8/2022  6:34 PM          10240 msvcp140_1_app.dll
-a---            2/8/2022  6:34 PM          23944 msvcp140_1.dll
-a---            2/8/2022  6:34 PM          12288 msvcp140_2_app.dll
-a---            2/8/2022  6:34 PM         186800 msvcp140_2.dll
-a---            2/8/2022  6:34 PM         250880 msvcp140_app.dll
-a---            2/8/2022  6:34 PM          57264 msvcp140_atomic_wait.dll
-a---            2/8/2022  6:34 PM          21424 msvcp140_codecvt_ids.dll
-a---            2/8/2022  6:34 PM         566704 msvcp140.dll
-a---            2/8/2022  6:34 PM          16534 NOTICE.html
-a---            2/8/2022  6:34 PM        1147392 OpenConsole.exe
-a---            2/8/2022  6:34 PM           9216 OpenConsoleProxy.dll
-a---            2/8/2022  6:34 PM       19398232 resources.pri
-a---            2/8/2022  6:34 PM        3205632 TerminalApp.dll
-a---            2/8/2022  6:34 PM          52224 TerminalApp.winmd
-a---            2/8/2022  6:34 PM          67072 TerminalAzBridge.exe
-a---            2/8/2022  6:34 PM         432640 TerminalConnection.dll
-a---            2/8/2022  6:34 PM          16384 TerminalThemeHelpers.dll
-a---            2/8/2022  6:34 PM          37888 vcamp140_app.dll
-a---            2/8/2022  6:34 PM          41984 vccorlib140_app.dll
-a---            2/8/2022  6:34 PM         335792 vccorlib140.dll
-a---            2/8/2022  6:34 PM          16384 vcomp140_app.dll
-a---            2/8/2022  6:34 PM           9728 vcruntime140_1_app.dll
-a---            2/8/2022  6:34 PM          37256 vcruntime140_1.dll
-a---            2/8/2022  6:34 PM          13824 vcruntime140_app.dll
-a---            2/8/2022  6:34 PM          98224 vcruntime140.dll
-a---            2/8/2022  6:34 PM         506880 WindowsTerminal.exe
-a---            2/8/2022  6:34 PM          82432 WindowsTerminalShellExt.dll
-a---            2/8/2022  6:34 PM          96256 wt.exe
```


@jessey-git `wt.exe ->` is just a link to `wt.exe` in
`C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.13.10336.0_x64__8wekyb3d8bbwe`

You can check the link with `fsutil`:

`C:\Users\fxgltf\AppData\Local\Microsoft\WindowsApps> fsutil reparsepoint query .\wt.exe`

and the output should look like:

```
Reparse Tag Value : 0x8000001b
Tag value: Microsoft

Reparse Data Length: 0x196
Reparse Data:
0000:  03 00 00 00 4d 00 69 00  63 00 72 00 6f 00 73 00  ....M.i.c.r.o.s.
0010:  6f 00 66 00 74 00 2e 00  57 00 69 00 6e 00 64 00  o.f.t...W.i.n.d.
0020:  6f 00 77 00 73 00 54 00  65 00 72 00 6d 00 69 00  o.w.s.T.e.r.m.i.
0030:  6e 00 61 00 6c 00 50 00  72 00 65 00 76 00 69 00  n.a.l.P.r.e.v.i.
0040:  65 00 77 00 5f 00 38 00  77 00 65 00 6b 00 79 00  e.w._.8.w.e.k.y.
0050:  62 00 33 00 64 00 38 00  62 00 62 00 77 00 65 00  b.3.d.8.b.b.w.e.
0060:  00 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  ..M.i.c.r.o.s.o.
0070:  66 00 74 00 2e 00 57 00  69 00 6e 00 64 00 6f 00  f.t...W.i.n.d.o.
0080:  77 00 73 00 54 00 65 00  72 00 6d 00 69 00 6e 00  w.s.T.e.r.m.i.n.
0090:  61 00 6c 00 50 00 72 00  65 00 76 00 69 00 65 00  a.l.P.r.e.v.i.e.
00a0:  77 00 5f 00 38 00 77 00  65 00 6b 00 79 00 62 00  w._.8.w.e.k.y.b.
00b0:  33 00 64 00 38 00 62 00  62 00 77 00 65 00 21 00  3.d.8.b.b.w.e.!.
00c0:  41 00 70 00 70 00 00 00  43 00 3a 00 5c 00 50 00  A.p.p...C.:.\.P.
00d0:  72 00 6f 00 67 00 72 00  61 00 6d 00 20 00 46 00  r.o.g.r.a.m. .F.
00e0:  69 00 6c 00 65 00 73 00  5c 00 57 00 69 00 6e 00  i.l.e.s.\.W.i.n.
00f0:  64 00 6f 00 77 00 73 00  41 00 70 00 70 00 73 00  d.o.w.s.A.p.p.s.
0100:  5c 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  \.M.i.c.r.o.s.o.
0110:  66 00 74 00 2e 00 57 00  69 00 6e 00 64 00 6f 00  f.t...W.i.n.d.o.
0120:  77 00 73 00 54 00 65 00  72 00 6d 00 69 00 6e 00  w.s.T.e.r.m.i.n.
0130:  61 00 6c 00 50 00 72 00  65 00 76 00 69 00 65 00  a.l.P.r.e.v.i.e.
0140:  77 00 5f 00 31 00 2e 00  31 00 33 00 2e 00 31 00  w._.1...1.3...1.
0150:  30 00 33 00 33 00 36 00  2e 00 30 00 5f 00 78 00  0.3.3.6...0._.x.
0160:  36 00 34 00 5f 00 5f 00  38 00 77 00 65 00 6b 00  6.4._._.8.w.e.k.
0170:  79 00 62 00 33 00 64 00  38 00 62 00 62 00 77 00  y.b.3.d.8.b.b.w.
0180:  65 00 5c 00 77 00 74 00  2e 00 65 00 78 00 65 00  e.\.w.t...e.x.e.
0190:  00 00 30 00 00 00                                 ..0...
```
Looks like it's pointing to the correct exe at least.
```
fsutil reparsepoint query .\wt.exe
Reparse Tag Value : 0x8000001b
Tag value: Microsoft

Reparse Data Length: 0x196
Reparse Data:
0000:  03 00 00 00 4d 00 69 00  63 00 72 00 6f 00 73 00  ....M.i.c.r.o.s.
0010:  6f 00 66 00 74 00 2e 00  57 00 69 00 6e 00 64 00  o.f.t...W.i.n.d.
0020:  6f 00 77 00 73 00 54 00  65 00 72 00 6d 00 69 00  o.w.s.T.e.r.m.i.
0030:  6e 00 61 00 6c 00 50 00  72 00 65 00 76 00 69 00  n.a.l.P.r.e.v.i.
0040:  65 00 77 00 5f 00 38 00  77 00 65 00 6b 00 79 00  e.w._.8.w.e.k.y.
0050:  62 00 33 00 64 00 38 00  62 00 62 00 77 00 65 00  b.3.d.8.b.b.w.e.
0060:  00 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  ..M.i.c.r.o.s.o.
0070:  66 00 74 00 2e 00 57 00  69 00 6e 00 64 00 6f 00  f.t...W.i.n.d.o.
0080:  77 00 73 00 54 00 65 00  72 00 6d 00 69 00 6e 00  w.s.T.e.r.m.i.n.
0090:  61 00 6c 00 50 00 72 00  65 00 76 00 69 00 65 00  a.l.P.r.e.v.i.e.
00a0:  77 00 5f 00 38 00 77 00  65 00 6b 00 79 00 62 00  w._.8.w.e.k.y.b.
00b0:  33 00 64 00 38 00 62 00  62 00 77 00 65 00 21 00  3.d.8.b.b.w.e.!.
00c0:  41 00 70 00 70 00 00 00  43 00 3a 00 5c 00 50 00  A.p.p...C.:.\.P.
00d0:  72 00 6f 00 67 00 72 00  61 00 6d 00 20 00 46 00  r.o.g.r.a.m. .F.
00e0:  69 00 6c 00 65 00 73 00  5c 00 57 00 69 00 6e 00  i.l.e.s.\.W.i.n.
00f0:  64 00 6f 00 77 00 73 00  41 00 70 00 70 00 73 00  d.o.w.s.A.p.p.s.
0100:  5c 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  \.M.i.c.r.o.s.o.
0110:  66 00 74 00 2e 00 57 00  69 00 6e 00 64 00 6f 00  f.t...W.i.n.d.o.
0120:  77 00 73 00 54 00 65 00  72 00 6d 00 69 00 6e 00  w.s.T.e.r.m.i.n.
0130:  61 00 6c 00 50 00 72 00  65 00 76 00 69 00 65 00  a.l.P.r.e.v.i.e.
0140:  77 00 5f 00 31 00 2e 00  31 00 33 00 2e 00 31 00  w._.1...1.3...1.
0150:  30 00 33 00 33 00 36 00  2e 00 30 00 5f 00 78 00  0.3.3.6...0._.x.
0160:  36 00 34 00 5f 00 5f 00  38 00 77 00 65 00 6b 00  6.4._._.8.w.e.k.
0170:  79 00 62 00 33 00 64 00  38 00 62 00 62 00 77 00  y.b.3.d.8.b.b.w.
0180:  65 00 5c 00 77 00 74 00  2e 00 65 00 78 00 65 00  e.\.w.t...e.x.e.
0190:  00 00 30 00 00 00                                 ..0...
```
You know what, when I originally wrote that helper script, I was testing with `pwsh` and assumed it would work the same way for powershell. I WAS WRONG. Apparently only powershell core added support for examining where an execution alias points ¯\\\_(ツ)_/¯

<hr>

If the repair/reinstall didn't work, then I'm very lost. The `ERROR_MOD_NOT_FOUND`'s seemed like they were being raised in a place they absolutely shouldn't be. Like, it couldn't find the TerminalApp classes in the COM catalog at all. It obviously should be able to, since the dll is right there next to it...

This is gonna sound super extra, but might be a viable workaround while we investigate. Can you try:
* Downloading the `msixbundle` off our releases page
* rename the extension to .zip
* unzip it
* find the `msix` in there that matches your architecture
* rename the extension on that on to .zip
* unzip it
* run `windowsterminal.exe` in that unzipped directory

That should work, even if the package catalog is bugged. It'll use a different settings location, but feel free to just copy-paste your settings to the new location. 
Still doesn't work.  But perhaps there's a hint below.  This is a Windows 10 Education N SKU.  Is _something_ attempting to load system modules that aren't present?

Windows 10 Education N debug output:
```
C:\a\_work\1\s\src\cascadia\TerminalSettingsModel\CascadiaSettings.cpp(991)\Microsoft.Terminal.Settings.Model.dll!00007FFE2CFB8185: (caller: 00007FFE2CF9271B) LogHr(5) tid(5b4) 80073D54 The process has no package identity.
    Msg:[winrt::hresult_error: The process has no package identity.] 
ModLoad: 00007ffe`25950000 00007ffe`25a30000   C:\Windows\System32\Windows.Media.Playback.MediaPlayer.dll
onecore\com\combase\objact\dllcache.cxx(2127)\combase.dll!00007FFE6AC83A4E: (caller: 00007FFE6AB4BBA9) ReturnHr(1) tid(123c) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4671)\combase.dll!00007FFE6AC59CC0: (caller: 00007FFE6AB4E0F5) ReturnHr(2) tid(123c) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4803)\combase.dll!00007FFE6AC59CE3: (caller: 00007FFE6AB4E0F5) ReturnHr(3) tid(123c) 8007007E The specified module could not be found.
TerminalApp.dll!00007FFE2B84B338: LogHr(3) tid(123c) 8007007E The specified module could not be found.
(223c.123c): C++ EH exception - code e06d7363 (first chance)
(223c.123c): C++ EH exception - code e06d7363 (first chance)
C:\a\_work\1\s\src\cascadia\TerminalApp\TabManagement.cpp(112)\TerminalApp.dll!00007FFE2B88CEDD: (caller: 00007FFE2B83F304) ReturnHr(1) tid(123c) 8007007E The specified module could not be found.
    Msg:[winrt::hresult_error: The specified module could not be found.] 
C:\a\_work\1\s\src\cascadia\TerminalApp\AppActionHandlers.cpp(308)\TerminalApp.dll!00007FFE2B8A3E0B: (caller: 00007FFE2B86F48B) LogHr(4) tid(123c) 8007007E The specified module could not be found.

```

Standard Windows 10 Enterprise output:
```
C:\a\_work\1\s\src\cascadia\TerminalSettingsModel\CascadiaSettings.cpp(991)\Microsoft.Terminal.Settings.Model.dll!00007FFC2EF28185: (caller: 00007FFC2EF0271B) LogHr(8) tid(4c28) 80073D54 The process has no package identity.
    Msg:[winrt::hresult_error: The process has no package identity.] 
ModLoad: 00007ffc`7dc10000 00007ffc`7dcf0000   C:\Windows\System32\Windows.Media.Playback.MediaPlayer.dll
ModLoad: 00007ffc`7c920000 00007ffc`7cadc000   C:\Windows\System32\MFPlat.DLL
ModLoad: 00007ffc`8a040000 00007ffc`8a076000   C:\Windows\System32\RTWorkQ.DLL
ModLoad: 00007ffc`7d0a0000 00007ffc`7d12a000   C:\Windows\System32\Windows.Media.MediaControl.dll
ModLoad: 00007ffc`a7860000 00007ffc`a78e5000   C:\Windows\System32\MMDevAPI.DLL
ModLoad: 00007ffc`ad000000 00007ffc`ad034000   C:\Windows\System32\DEVOBJ.dll
ModLoad: 00007ffc`36f90000 00007ffc`373b5000   C:\Windows\System32\MFMediaEngine.dll
ModLoad: 00007ffc`acb50000 00007ffc`acb9b000   C:\WINDOWS\SYSTEM32\powrprof.dll
ModLoad: 00007ffc`a6c60000 00007ffc`a6c96000   C:\Windows\System32\XmlLite.dll
ModLoad: 000002b7`d21a0000 000002b7`d21eb000   C:\WINDOWS\SYSTEM32\powrprof.dll
ModLoad: 00007ffc`a78f0000 00007ffc`a7a74000   C:\WINDOWS\SYSTEM32\AUDIOSES.DLL
ModLoad: 00007ffc`8da90000 00007ffc`8daad000   C:\Windows\System32\Windows.Shell.ServiceHostBuilder.dll
```

**Hint:** On N SKU's that "C:\Windows\System32\MFPlat.DLL" is not present...

Full N SKU windbg output:
[full-output-NSKU.txt](https://github.com/microsoft/terminal/files/8043948/full-output-NSKU.txt)

Hilarious anecdote: Yeah, I even just tried installing the "Media Feature Pack for N versions of Windows 10"  but the installer says "The update is not applicable to your computer"

oh _no_. Did just including `MediaPlayer` pull in a dynamic dependency on `MFPlat.DLL`, even if we try/catch the access to the MediaPlayer?



....oh my god I'm the murderer

I accidentally got rid of the `try`/`catch` around the `MediaPlayer` instantiation.


Wait, no, that's not right. If it was on instantiation of the `MediaPlayer`, then that would fail when you actually tried belling, not just when we try instantiating a `Pane`. Damn. Gonna need to look into this more. How do we safely access a `MediaPlayer`?
https://github.com/microsoft/terminal/blob/10c963a7dbdd0d9e71dd0596e96fa26ab88a76f5/src/cascadia/TerminalApp/Pane.h#L244

omfg I'm still the murderer. That should be 

```
winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr }; 
```

Fix patch:
diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp
index 4bf0a57015b..2bef061af7a 100644
--- a/src/cascadia/TerminalApp/Pane.cpp
+++ b/src/cascadia/TerminalApp/Pane.cpp
@@ -1044,7 +1044,12 @@ winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri)
 
         if (!_bellPlayer)
         {
-            _bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
+            // The MediaPlayer might not exist on Windows N SKU.
+            try
+            {
+                _bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
+            }
+            CATCH_LOG();
         }
         if (_bellPlayer)
         {
diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h
index 1a1da354ea6..67f03d1b0bc 100644
--- a/src/cascadia/TerminalApp/Pane.h
+++ b/src/cascadia/TerminalApp/Pane.h
@@ -241,7 +241,7 @@ class Pane : public std::enable_shared_from_this<Pane>
 
     bool _zoomed{ false };
 
-    winrt::Windows::Media::Playback::MediaPlayer _bellPlayer;
+    winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr };
     winrt::Windows::Media::Playback::MediaPlayer::MediaEnded_revoker _mediaEndedRevoker;
 
     bool _IsLeaf() const noexcept;


Test patch: