Terminal v1.5.10271.0 crashes on startup due to settings.json load bug #12344

Closed
opened 2026-01-31 03:12:58 +00:00 by claunia · 7 comments
Owner

Originally created by @BasKiers on GitHub (Feb 1, 2021).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: 10.0.19041.0
Windows Terminal version (if applicable): 1.5.10271.0

Steps to reproduce

Add an empty object to the schemes option list

As an example I've picked the default configuration and only changed "schemes": [] into "schemes": [{}]"

// This file was initially generated by Windows Terminal 1.1.2021.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    "theme": "dark",

    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
        },
        "list":
        [
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl",
                "colorScheme": "Solarized Dark",
                "fontFace": "Droid Sans Mono for Powerline",
                "fontSize": 11,
                "fontWeight": "light",
                "antialiasingMode": "cleartype",
                "startingDirectory": "//wsl$/Ubuntu-20.04/home/baskiers/",
                "historySize": 99001
            },
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [{}],

    // Add custom keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+F to open the search box
        { "command": "find", "keys": "ctrl+f" },

        { "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+t" },
        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "ctrl+shift+d" },

        // Unbound
        { "command": "unbound", "keys": "alt+shift+esc" }
    ]
}

Expected behavior

Terminal starts up.

The schema does validate on the JSON Schema definition (https://aka.ms/terminal-profiles-schema). If this configuration is invalid the schema definition should reflect that.

Actual behavior

The terminal instantly crashes on startup.

I've used this configuration for around half a year without issues.
This issue could be a subset of #8358, although I started experiencing this bug only in the latest version of the Terminal.

Originally created by @BasKiers on GitHub (Feb 1, 2021). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.19041.0 Windows Terminal version (if applicable): 1.5.10271.0 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> Add an empty object to the `schemes` option list As an example I've picked the default configuration and only changed `"schemes": []` into `"schemes": [{}]"` ``` // This file was initially generated by Windows Terminal 1.1.2021.0 // It should still be usable in newer versions, but newer versions might have additional // settings, help text, or changes that you will not see unless you clear this file // and let us generate a new one for you. // To view the default settings, hold "alt" while clicking on the "Settings" button. // For documentation on these settings, see: https://aka.ms/terminal-documentation { "$schema": "https://aka.ms/terminal-profiles-schema", "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", // You can add more global application settings here. // To learn more about global settings, visit https://aka.ms/terminal-global-settings // If enabled, selections are automatically copied to your clipboard. "copyOnSelect": false, // If enabled, formatted data is also copied to your clipboard "copyFormatting": false, "theme": "dark", // A profile specifies a command to execute paired with information about how it should look and feel. // Each one of them will appear in the 'New Tab' dropdown, // and can be invoked from the commandline with `wt.exe -p xxx` // To learn more about profiles, visit https://aka.ms/terminal-profile-settings "profiles": { "defaults": { // Put settings here that you want to apply to all profiles. }, "list": [ { "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "colorScheme": "Solarized Dark", "fontFace": "Droid Sans Mono for Powerline", "fontSize": 11, "fontWeight": "light", "antialiasingMode": "cleartype", "startingDirectory": "//wsl$/Ubuntu-20.04/home/baskiers/", "historySize": 99001 }, { // Make changes here to the powershell.exe profile. "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", "commandline": "powershell.exe", "hidden": false }, { // Make changes here to the cmd.exe profile. "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "Command Prompt", "commandline": "cmd.exe", "hidden": false }, { "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Azure Cloud Shell", "source": "Windows.Terminal.Azure" } ] }, // Add custom color schemes to this array. // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes "schemes": [{}], // Add custom keybindings to this array. // To unbind a key combination from your defaults.json, set the command to "unbound". // To learn more about keybindings, visit https://aka.ms/terminal-keybindings "keybindings": [ // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json. // These two lines additionally bind them to Ctrl+C and Ctrl+V. // To learn more about selection, visit https://aka.ms/terminal-selection { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }, { "command": "paste", "keys": "ctrl+v" }, // Press Ctrl+F to open the search box { "command": "find", "keys": "ctrl+f" }, { "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+t" }, // Press Alt+Shift+D to open a new pane. // - "split": "auto" makes this pane open in the direction that provides the most surface area. // - "splitMode": "duplicate" makes the new pane use the focused pane's profile. // To learn more about panes, visit https://aka.ms/terminal-panes { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "ctrl+shift+d" }, // Unbound { "command": "unbound", "keys": "alt+shift+esc" } ] } ``` # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> Terminal starts up. The schema does validate on the JSON Schema definition (https://aka.ms/terminal-profiles-schema). If this configuration is invalid the schema definition should reflect that. # Actual behavior <!-- What's actually happening? --> The terminal instantly crashes on startup. I've used this configuration for around half a year without issues. This issue could be a subset of #8358, although I started experiencing this bug only in the latest version of the Terminal.
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2021):

Curious. I wouldn't have expected "schemes": [{}]" to crash 1.5. If anything, I'd expect it to crash 1.6, but in reality is shouldn't crash at all.

I'll leave the "should we service this" decision to @DHowett

@zadjii-msft commented on GitHub (Feb 1, 2021): Curious. I wouldn't have expected `"schemes": [{}]"` to crash 1.5. If anything, I'd expect it to crash _1.6_, but in reality is shouldn't crash at all. I'll leave the "should we service this" decision to @DHowett
Author
Owner

@DHowett commented on GitHub (Feb 1, 2021):

We absolutely should. I wonder what changed (1.5? doesn't even have SUI stuff.)

@zadjii-msft could this be Srdjan's issue?

@DHowett commented on GitHub (Feb 1, 2021): We absolutely should. I wonder what changed (1.5? doesn't even have SUI stuff.) @zadjii-msft could this be Srdjan's issue?
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2021):

No idea yet. Spinning up a main build to see if this has a similar stack trace now. Methinks it won't. Srdjan's stack looks like it's in either CalcSnappedDimension or CommandPalette::InitializeComponent - the bug's listed as the first frame, but then is linked to cabs with stacks pointing at the second frame? Maybe I just misclicked somewhere.

@zadjii-msft commented on GitHub (Feb 1, 2021): No idea yet. Spinning up a main build to see if this has a similar stack trace now. Methinks it _won't_. Srdjan's stack looks like it's in either `CalcSnappedDimension` or `CommandPalette::InitializeComponent` - the bug's listed as the first frame, but then is linked to cabs with stacks pointing at the second frame? Maybe I just misclicked somewhere.
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2021):

@miniksa this is the one I was talking about

@zadjii-msft commented on GitHub (Feb 1, 2021): @miniksa this is the one I was talking about
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2021):

Oh no,

    IMap<winrt::hstring, Command> TerminalPage::_ExpandCommands(IMapView<winrt::hstring, Command> commandsToExpand,
                                                                IVectorView<Profile> profiles,
                                                                IMapView<winrt::hstring, ColorScheme> schemes)
    {
        IVector<SettingsLoadWarnings> warnings;

That warnings right there isn't getting initialized to anything. So way later on, when we

0:000> k
 # Child-SP          RetAddr               Call Site
00 000000ae`a334cc10 00007ffc`d6d757f8     Microsoft_Terminal_Settings_Model!winrt::impl::consume_Windows_Foundation_Collections_IVector<winrt::Windows::Foundation::Collections::IVector<enum winrt::TSM::SettingsLoadWarnings>,enum winrt::TSM::SettingsLoadWarnings>::Append+0x4e [...\src\cascadia\TerminalSettingsModel\Generated Files\winrt\Windows.Foundation.Collections.h @ 229] 
01 000000ae`a334cc80 00007ffc`d6d7a2c9     Microsoft_Terminal_Settings_Model!<lambda_cc7baba87b27c426f117a9d5d9b59685>::operator()<enum winrt::TSM::SettingsLoadWarnings>+0x48 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 407] 
02 000000ae`a334ccc0 00007ffc`d6d75747     Microsoft_Terminal_Settings_Model!std::for_each<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<enum winrt::TSM::SettingsLoadWarnings> > >,<lambda_cc7baba87b27c426f117a9d5d9b59685> >+0x99 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\algorithm @ 309] 
03 000000ae`a334cd10 00007ffc`d6d73ed0     Microsoft_Terminal_Settings_Model!<lambda_3786d870fec5f41c63a95b0dcb219203>::operator()<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >+0x357 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 407] 
04 000000ae`a334cf00 00007ffc`d6d72f03     Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::_expandCommand+0x710 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 458] 
05 000000ae`a334d490 00007ffc`d6d73970     Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::ExpandCommands+0x223 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 323] 
06 000000ae`a334d7d0 00007ffc`d6d72f03     Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::_expandCommand+0x1b0 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 378] 
07 000000ae`a334dd60 00007ffc`d6d8576c     Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::ExpandCommands+0x223 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 323] 
08 000000ae`a334e0a0 00007ffc`d6d8582f     Microsoft_Terminal_Settings_Model!winrt::TSM::factory_implementation::CommandT<winrt::TSM::factory_implementation::Command,winrt::TSM::implementation::Command>::ExpandCommands+0x11c [...\src\cascadia\TerminalSettingsModel\Generated Files\Command.g.h @ 41] 
09 000000ae`a334e150 00007ffc`d88c5bec     Microsoft_Terminal_Settings_Model!winrt::impl::produce<winrt::TSM::factory_implementation::Command,winrt::TSM::ICommandStatics>::ExpandCommands+0xaf [...\src\cascadia\TerminalSettingsModel\Generated Files\winrt\Microsoft.Terminal.Settings.Model.h @ 2664] 

we throw a null deref. Probs because the original vector didn't need to be initialized, the default ctor for a std::vector actually makes something. Not so for a winrt::IVector. Oops.

@zadjii-msft commented on GitHub (Feb 1, 2021): Oh no, ```c++ IMap<winrt::hstring, Command> TerminalPage::_ExpandCommands(IMapView<winrt::hstring, Command> commandsToExpand, IVectorView<Profile> profiles, IMapView<winrt::hstring, ColorScheme> schemes) { IVector<SettingsLoadWarnings> warnings; ``` That `warnings` right there isn't getting initialized to anything. So way later on, when we ``` 0:000> k # Child-SP RetAddr Call Site 00 000000ae`a334cc10 00007ffc`d6d757f8 Microsoft_Terminal_Settings_Model!winrt::impl::consume_Windows_Foundation_Collections_IVector<winrt::Windows::Foundation::Collections::IVector<enum winrt::TSM::SettingsLoadWarnings>,enum winrt::TSM::SettingsLoadWarnings>::Append+0x4e [...\src\cascadia\TerminalSettingsModel\Generated Files\winrt\Windows.Foundation.Collections.h @ 229] 01 000000ae`a334cc80 00007ffc`d6d7a2c9 Microsoft_Terminal_Settings_Model!<lambda_cc7baba87b27c426f117a9d5d9b59685>::operator()<enum winrt::TSM::SettingsLoadWarnings>+0x48 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 407] 02 000000ae`a334ccc0 00007ffc`d6d75747 Microsoft_Terminal_Settings_Model!std::for_each<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<enum winrt::TSM::SettingsLoadWarnings> > >,<lambda_cc7baba87b27c426f117a9d5d9b59685> >+0x99 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\algorithm @ 309] 03 000000ae`a334cd10 00007ffc`d6d73ed0 Microsoft_Terminal_Settings_Model!<lambda_3786d870fec5f41c63a95b0dcb219203>::operator()<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >+0x357 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 407] 04 000000ae`a334cf00 00007ffc`d6d72f03 Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::_expandCommand+0x710 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 458] 05 000000ae`a334d490 00007ffc`d6d73970 Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::ExpandCommands+0x223 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 323] 06 000000ae`a334d7d0 00007ffc`d6d72f03 Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::_expandCommand+0x1b0 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 378] 07 000000ae`a334dd60 00007ffc`d6d8576c Microsoft_Terminal_Settings_Model!winrt::TSM::implementation::Command::ExpandCommands+0x223 [...\src\cascadia\TerminalSettingsModel\Command.cpp @ 323] 08 000000ae`a334e0a0 00007ffc`d6d8582f Microsoft_Terminal_Settings_Model!winrt::TSM::factory_implementation::CommandT<winrt::TSM::factory_implementation::Command,winrt::TSM::implementation::Command>::ExpandCommands+0x11c [...\src\cascadia\TerminalSettingsModel\Generated Files\Command.g.h @ 41] 09 000000ae`a334e150 00007ffc`d88c5bec Microsoft_Terminal_Settings_Model!winrt::impl::produce<winrt::TSM::factory_implementation::Command,winrt::TSM::ICommandStatics>::ExpandCommands+0xaf [...\src\cascadia\TerminalSettingsModel\Generated Files\winrt\Microsoft.Terminal.Settings.Model.h @ 2664] ``` we throw a null deref. Probs because the original vector didn't _need_ to be initialized, the default `ctor` for a `std::vector` actually makes something. Not so for a `winrt::IVector`. Oops.
Author
Owner

@ghost commented on GitHub (Feb 11, 2021):

:tada:This issue was addressed in #8995, which has now been successfully released as Windows Terminal v1.5.10411.0.🎉

Handy links:

@ghost commented on GitHub (Feb 11, 2021): :tada:This issue was addressed in #8995, which has now been successfully released as `Windows Terminal v1.5.10411.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.5.10411.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Feb 11, 2021):

:tada:This issue was addressed in #8995, which has now been successfully released as Windows Terminal Preview v1.6.10412.0.🎉

Handy links:

@ghost commented on GitHub (Feb 11, 2021): :tada:This issue was addressed in #8995, which has now been successfully released as `Windows Terminal Preview v1.6.10412.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10412.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12344