terminal: Windows Terminal crashes when emptying settings.json with settings window open

Windows Terminal version

1.14.1962.0

Windows build number

10.0.19043.0

Other Software

N/A

Steps to reproduce

  1. Open Terminal
  2. Open Settings
  3. Open JSON file
  4. In external editor, CTRL+A to select the contents of the settings.json and press delete
  5. Save

Expected Behavior

No crash.

Actual Behavior

Windows Terminal repopulates the settings.json file with defaults and then crashes with:

Unhandled exception at 0x00007FFCE568FB62 (KernelBase.dll) in WindowsTerminal.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000002CDCB9A0970, 0x000000000000000A).

Which is being triggered from TerminalApp.dll!winrt::TerminalApp::implementation::AppLogic::_ApplyStartupTaskStateChange$_ResumeCoro$1() Line 1004.

Edit: Feedback Hub URL: https://aka.ms/AAhm2q3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@chingucoding Okay, I’m way out on a limb here. But I was looking at https://github.com/microsoft/microsoft-ui-xaml/pull/3138, which was the fix for https://github.com/microsoft/microsoft-ui-xaml/issues/2818, and thought you might have an idea here.

TL;DR: we’re calling IVector<>::ReplaceAll() on our NavigationView’s MenuItems to replace the list when the settings reloads (demonstrated above by just deleting your existing settings, forcing us to generate a fresh set). However, when the list decreases in length[1], it seems like the NavView just crashes.

You think if I somehow converted our std::vector<MUX::Controls::NavigationViewItem> into something that could be used as a MenuItemSource, that I could swap out the entries that way?

[1]: it’s not totally clear what triggers the crash, but that seems close enough to the truth.

EDIT

Yes that absolutely works. It’s horrifying but it works.

Nah, this one’s got a consistent repro. Just need someone to take the time to look into it at this point.

Nah, I think we can repro this pretty readily. This is probably just more fallout from doing weird stuff to our nav view. Doing this a few times seemed like I would get a friggen wild set of items in the nave view, until eventually the app would crash.

I’ll triage this as a separate bug for now, but cross my fingers and hope that it’s the root cause of #12333. dmps loading now…