Skip to content

Fragments with more than one "updates" profile may fail to load with a duplicate GUID warning #11597

@lhecker

Description

@lhecker

Windows Terminal version (or Windows build number)

1.12.2931.0

Steps to reproduce

As reported at #11325 (comment)

  • Create this file at %LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments\jan-config\wsl.json:
    {
        "$schema": "https://aka.ms/terminal-profiles-schema",
        "profiles": [
            {
                "updates": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
                //"name": "Debian",
                "colorScheme": "Nord",
                "hidden": false,
                "cursorShape": "underscore",
                "fontFace": "FantasqueSansMono Nerd Font",
                "fontSize": 16,
                "backgroundImage": "C:/Users/jantari/Openlogo-debianV2.svg - Kopie.png",
                "backgroundImageStretchMode": "none",
                "backgroundImageOpacity": 0.3,
                "backgroundImageAlignment": "bottomRight",
                "useAcrylic": false,
                "acrylicOpacity": 0.86,
                "source": "Windows.Terminal.Wsl"
            },
            {
                "updates": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                //"name": "Ubuntu 20.04",
                "colorScheme": "Nord",
                "hidden": false,
                "cursorShape": "underscore",
                "fontFace": "FantasqueSansMono Nerd Font",
                "fontSize": 16,
                "backgroundImage": "%LOCALAPPDATA%/WSL_ICONS/wt-wsl-ubuntu-logo.png",
                "backgroundImageStretchMode": "none",
                "backgroundImageOpacity": 0.3,
                "backgroundImageAlignment": "bottomRight",
                "useAcrylic": true,
                "acrylicOpacity": 0.86,
                "source": "Windows.Terminal.Wsl"
            }
        ]
    }

Expected Behavior

Settings load successfully.

Actual Behavior

image


Cause & Solution

The "updates" key is an alternative "guid" key for fragment profiles.
But SettingsLoader::_appendProfile stores and deduplicates profiles according to their "guid" only. We need to modify the function to optionally store profiles by their "updates" key instead, otherwise multiple fragment profile without "guid" might collide as they produce the same default GUID.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-SettingsIssues related to settings and customizability, for console or terminalIssue-BugIt either shouldn't be doing this or needs an investigation.Priority-1A description (P1)Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions