Skip to content

Fix sorting of installed-packages column under NativeAOT#5116

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/datagrid-header-sort-aot-5103
Jul 16, 2026
Merged

Fix sorting of installed-packages column under NativeAOT#5116
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/datagrid-header-sort-aot-5103

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request improves sorting functionality for package lists, particularly to ensure compatibility with NativeAOT release builds by avoiding reflection-based sorting. The changes introduce a strongly-typed comparer for both manual and DataGrid column sorting, ensuring consistent and reliable sorting behavior across the UI.

Sorting improvements for package lists:

  • Refactored the ApplyToList method in PackageCollections.cs to use a strongly-typed comparer, ensuring that sorting is consistent and supports semantic version comparison for package versions. This replaces the previous string-based key sorting for version fields.
  • Added a static Compare method and updated GetSortKey to be static and accept a sorter parameter, supporting more flexible and accurate sorting logic.
  • Introduced the GetColumnComparer method to provide a reflection-free comparer for DataGrid's native column sorting, supporting AOT-safe builds.

UI integration for AOT-safe DataGrid sorting:

  • Updated AbstractPackagesPage.axaml.cs to assign a strongly-typed CustomSortComparer to each sortable DataGrid column, and explicitly set CanUserSort to true, ensuring column header clicks trigger sorting even in NativeAOT builds.

General code maintenance:

  • Added a missing using System.Collections; directive in PackageCollections.cs to support the new comparer implementation.

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 0a94aa8 into main Jul 16, 2026
5 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/datagrid-header-sort-aot-5103 branch July 16, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Version 2026.2.4 Can't sort the installed packages list by clicking on column header

2 participants