From 8cad67020fd94d66006b1d17ae8b958a1054fe90 Mon Sep 17 00:00:00 2001 From: sagarbhure-dev Date: Tue, 10 Mar 2026 22:33:15 +0530 Subject: [PATCH] Fix GenerateSettingsIndex using element name instead of x:Name (#19945) Use GetAttribute('x:Name') instead of .Name in GenerateSettingsIndex.ps1 to avoid PowerShell's XML integration returning the element tag name (e.g. 'local:SettingContainer') when x:Name is absent. Also add missing x:Name attributes to: - Compatibility.xaml: AmbiguousWidth SettingContainer - NewTabMenu.xaml: AddRemainingProfiles and CurrentFolderIcon containers ## Summary of the Pull Request Fix GenerateSettingsIndex.ps1 emitting "local:SettingContainer" as the element name in the generated index when a SettingContainer has no x:Name attribute. ## References and Relevant Issues Per DHowett's comment - the root cause is PowerShell's XML integration: $element.Name returns the XML element tag name (e.g. local:SettingContainer) when no x:Name attribute exists. ## Detailed Description of the Pull Request / Additional comments Two changes: - GenerateSettingsIndex.ps1: Replace $settingContainer.Name with $settingContainer.GetAttribute("x:Name"), which correctly returns an empty string when the attribute is absent instead of the element tag name. - Add missing x:Name attributes to three SettingContainer elements: - Compatibility.xaml: AmbiguousWidth (Globals_AmbiguousWidth) - NewTabMenu.xaml: AddRemainingProfiles (NewTabMenu_AddRemainingProfiles) - NewTabMenu.xaml: CurrentFolderIcon (NewTabMenu_CurrentFolderIcon) - This fixes four incorrect IndexEntry lines in the generated output that previously contained L"local:SettingContainer" as the element name. ## Validation Steps Performed Ran GenerateSettingsIndex.ps1 before and after - confirmed the four incorrect entries with L"local:SettingContainer" are now generated with the correct x:Name values (or empty string where appropriate). ## PR Checklist Closes #19929 Co-authored-by: Sagar Bhure --- src/cascadia/TerminalSettingsEditor/Compatibility.xaml | 3 ++- src/cascadia/TerminalSettingsEditor/NewTabMenu.xaml | 6 ++++-- tools/GenerateSettingsIndex.ps1 | 9 +++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Compatibility.xaml b/src/cascadia/TerminalSettingsEditor/Compatibility.xaml index ebeacba5c8..2180322638 100644 --- a/src/cascadia/TerminalSettingsEditor/Compatibility.xaml +++ b/src/cascadia/TerminalSettingsEditor/Compatibility.xaml @@ -43,7 +43,8 @@ - + - @@ -497,7 +498,8 @@ -