microsoft / microsoft/PowerToys

CmdPal: Crash on summon

Open
#46,158 0 comments 1 reaction 2 assignees Claimed by @MuyuanMS View on GitHub
Issue-Bug Product-Command Palette
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

### Microsoft PowerToys version

0.98

### Installation method

Dev build in Visual Studio

### Area(s) with issue?

Command Palette

### Steps to reproduce

Custom branch (dock-size)

```
[External Code]
WinUIEx.dll!WinUIEx.Messaging.WindowMessageMonitor.NewWindowProc(Windows.Win32.Foundation.HWND hWnd, uint uMsg, Windows.Win32.Foundation.WPARAM wParam, Windows.Win32.Foundation.LPARAM lParam, nuint uIdSubclass, nuint dwRefData) Unknown
[External Code]
> Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.MainWindow.HotKeyPrc(Windows.Win32.Foundation.HWND hwnd, uint uMsg, Windows.Win32.Foundation.WPARAM wParam, Windows.Win32.Foundation.LPARAM lParam) Line 1307 C#
[External Code]
Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.MainWindow.HideWindow() Line 825 C#
Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.MainWindow.HandleSummonCore(string commandId) Line 1264 C#
Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.MainWindow.HandleSummon(string commandId) Line 1220 C#
Microsoft.CmdPal.UI.dll!ABI.CmdPalKeyboardService.ProcessCommand.Do_Abi_Invoke(nint thisPtr, nint id) Line 382 C#
[External Code]
Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference _obj, Microsoft.UI.Xaml.ApplicationInitializationCallback callback) Unknown
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback callback) Unknown
Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.Program.Main(string[] args) Line 94 C#
```

#### Toaster says

Error: the crash is a stowed COMException (0x8001010D, RPC_E_CANTCALLOUT_ININPUTSYNCCALL) that surfaces at CallWindowProc, but it is not caused by CallWindowProc itself.

Root cause: when UseLowLevelGlobalHotkey is enabled, KeyboardListener invokes HandleSummon(string) directly from the low-level keyboard hook callback (WH_KEYBOARD_LL) through the WinRT ProcessCommand delegate. HandleSummon(string) can call HideWindow(), which calls showWindow, triggering nested WM_ACTIVATE/WinUI window processing. During that activation path, WinUI performs an outgoing COM call while the app is still inside an input-synchronous callback, which COM forbids, so the runtime fail-fast occurs.

#### Dump (for reference)
Microsoft.CmdPal.UI.exe.51768.dmp

### ✔️ Expected Behavior

_No response_

### ❌ Actual Behavior

_No response_

### Upload Bug Report ZIP-file

_No response_

### Additional Information

_No response_

### Other Software

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.