[CmdPal] Fix context menu command items (#45499)

maintainers: we talked about this at length on Teams

> Seems like adding `IExtendedAttributesProvider` onto `CommandItem` is
what broke this. I don't know why. I'm not gonna pretend to understand
the cswinrt voodoo that's causing it to pick `IEAP` as the leaf
interface instead of `ICommandContextItem`.
 
 
drive by: fix the sample project on ARM

_resurrected from #45329 because spellbot killed that PR_
This commit is contained in:
Mike Griese
2026-02-11 05:51:00 -06:00
committed by GitHub
parent e935faf08c
commit 3f5418132d
5 changed files with 24 additions and 11 deletions

View File

@@ -8,8 +8,14 @@ using WinRT;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class CommandItem : BaseObservable, ICommandItem, IExtendedAttributesProvider
public partial class CommandItem : BaseObservable, ICommandItem
{
// NOTE TO MAINTAINERS: Do NOT implement `IExtendedAttributesProvider` here
// directly. Instead, implement it in derived classes like `ListItem` where
// appropriate.
//
// Putting it directly here will cause out-of-proc extensions to fail to
// load the context menu commands, for unknown CsWinRT reasons.
private readonly PropertySet _extendedAttributes = new();
private ICommand? _command;

View File

@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class FallbackCommandItem : CommandItem, IFallbackCommandItem, IFallbackHandler, IFallbackCommandItem2
public partial class FallbackCommandItem : CommandItem, IFallbackCommandItem, IFallbackHandler, IFallbackCommandItem2, IExtendedAttributesProvider
{
private readonly IFallbackHandler? _fallbackHandler;

View File

@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class ListItem : CommandItem, IListItem
public partial class ListItem : CommandItem, IListItem, IExtendedAttributesProvider
{
public virtual ITag[] Tags { get; set => SetProperty(ref field, value); } = [];