Skip to content

Conversation

@jiripolasek
Copy link
Collaborator

@jiripolasek jiripolasek commented Oct 17, 2025

Summary of the Pull Request

This PR resolves crashes on pages with filters, such as Windows Terminal profiles or Windows Services, when compiled with trimming/AOT.

It removes runtime binding from the FiltersDropDown control, effectively preventing crashes caused by trimming/AOT dropping binding metadata for FilterItemViewModel.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Removes runtime binding from FiltersDropDown control.
@zadjii-msft zadjii-msft added Hot Fix Items we will product an out-of-band release for Product-Command Palette Refers to the Command Palette utility labels Oct 17, 2025
@zadjii-msft
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@michaeljolley michaeljolley merged commit 55e974d into microsoft:main Oct 17, 2025
10 checks passed
khmyznikov pushed a commit that referenced this pull request Oct 20, 2025
## Summary of the Pull Request

This PR resolves crashes on pages with filters, such as Windows Terminal
profiles or Windows Services, when compiled with trimming/AOT.

It removes runtime binding from the FiltersDropDown control, effectively
preventing crashes caused by trimming/AOT dropping binding metadata for
FilterItemViewModel.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #42428
- [x] Closes: #42482
- [x] Related to: #42458
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Niels Laute <[email protected]>
@khmyznikov khmyznikov mentioned this pull request Oct 20, 2025
khmyznikov added a commit that referenced this pull request Oct 21, 2025
Hotfixes #42467 #42434 #42405 #42399

---------

Co-authored-by: Jiří Polášek <[email protected]>
Co-authored-by: Niels Laute <[email protected]>
Co-authored-by: Jaylyn Barbee <[email protected]>
Co-authored-by: Gordon Lam <[email protected]>
Co-authored-by: Dustin L. Howett <[email protected]>
@yeelam-gordon yeelam-gordon requested a review from Copilot November 7, 2025 01:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the filter selection mechanism in the Command Palette to bind directly to filter objects instead of using IDs. The change simplifies the XAML binding by removing the SelectedValuePath property and binding SelectedValue to the new CurrentFilter property instead of CurrentFilterId.

  • Replaced XAML binding from ID-based to object-based selection in FiltersDropDown
  • Added CurrentFilter property to FiltersViewModel to track the selected filter object
  • Refactored BuildFilters method to return both filter items and the selected filter object in a tuple

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/FiltersDropDown.xaml Simplified ComboBox binding to use CurrentFilter object directly instead of CurrentFilterId with SelectedValuePath
src/modules/cmdpal/Core/Microsoft.CmdPal.Core.ViewModels/FiltersViewModel.cs Added CurrentFilter property and refactored BuildFilters to identify and return the selected filter object

})];
}

return (items.ToArray(), selectedFilterItem ?? firstFilterItem);
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When separators are present in the filters list, firstFilterItem might be null if the first item in the filters array is a separator (not an IFilter). This could return null as the selected filter even when there are valid filter items later in the list. Consider finding the first FilterItemViewModel in the items list instead of tracking it during iteration, or ensure firstFilterItem is only set once a valid filter is found.

Copilot uses AI. Check for mistakes.
private (IFilterItemViewModel[] Items, IFilterItemViewModel? Selected) BuildFilters(IFilterItem[] filters, string currentFilterId)
{
return [..filters.Select<IFilterItem, IFilterItemViewModel>(filter =>
if (filters is null || filters.Length == 0)
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null check for filters is redundant since the parameter is already guarded with the null-coalescing operator (filters ?? []) at the call site on line 39. Consider removing the null check and only checking for length.

Suggested change
if (filters is null || filters.Length == 0)
if (filters.Length == 0)

Copilot uses AI. Check for mistakes.
mirmirmirr pushed a commit to mirmirmirr/PowerToys that referenced this pull request Nov 9, 2025
## Summary of the Pull Request

This PR resolves crashes on pages with filters, such as Windows Terminal
profiles or Windows Services, when compiled with trimming/AOT.

It removes runtime binding from the FiltersDropDown control, effectively
preventing crashes caused by trimming/AOT dropping binding metadata for
FilterItemViewModel.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: microsoft#42428
- [x] Closes: microsoft#42482
- [x] Related to: microsoft#42458
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Niels Laute <[email protected]>
@yeelam-gordon yeelam-gordon added this to the PowerToys 0.96 milestone Nov 11, 2025
@jiripolasek jiripolasek deleted the hotfix/cmdpal-filteritemviewmodel-not-bindable branch November 11, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hot Fix Items we will product an out-of-band release for Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Command Palette] my defined shortcut (ws for windows services) broke the application. Command Palette Crashes when opening windows terminal twice.

5 participants