microsoft / microsoft/PowerToys

CmdPal: deadlock during theme reapply while dock bands initialize WinRT event subscriptions

Open
#46,627 0 comments 1 reaction 2 assignees View on GitHub

@MuyuanMS is already working on this.

Since Apr 29, 2026.

  • #47410 by @copilot-swe-agent — closed without merging
Issue-Bug Needs-Triage Product-Command Palette
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

Microsoft PowerToys version

0.99 / main

Installation method

Dev build in Visual Studio

Area(s) with issue?

Command Palette

Steps to reproduce

CmdPal can hang due to a deadlock in WinRT event subscription/unsubscription during concurrent UI theme reapply and dock-band background initialization.

Main thread blocked in:

  • CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Timer_Tick
  • ThemeServiceOnThemeChanged(object?, ThemeChangedEventArgs)
  • remove
  • ReaderWriterLockSlim.TryEnterWriteLockCore and nested TryEnterReadLockCore

Worker threads blocked in:

  • InitializeFromList(IListPage)
  • SlowInitializeProperties()
  • InitializeProperties()
  • create
  • ReaderWriterLockSlim.TryEnterReadLockCore

🔫

CommunityToolkit.WinUI.Extensions.dll!CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Debounce(Microsoft.UI.Dispatching.DispatcherQueueTimer timer, System.Action action, System.TimeSpan interval, bool immediate) Line 36	C#	Non-user code. Decompiled symbols loaded (Embedded Source).

Main thread:

  	[Application execution paused, double-click to view all thread stacks]		Annotated Frame
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck(int millisecondsTimeout, bool useTrivialWaits, object associatedObject, System.Diagnostics.Tracing.NativeRuntimeEventSource.WaitHandleWaitSourceMap waitSource)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.WaitOnEvent(System.Threading.EventWaitHandle waitEvent, ref uint numWaiters, System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout, System.Threading.ReaderWriterLockSlim.EnterLockType enterLockType)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceCache.Create(WinRT.IObjectReference obj, int index, System.WeakReference<object> state)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.Subscribe(Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object> handler)	Unknown	Non-user code. Skipped loading symbols.
>	CommunityToolkit.WinUI.Extensions.dll!CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Debounce(Microsoft.UI.Dispatching.DispatcherQueueTimer timer, System.Action action, System.TimeSpan interval, bool immediate) Line 36	C#	Non-user code. Decompiled symbols loaded (Embedded Source).
 	Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.AppearanceSettingsViewModel.ThemeServiceOnThemeChanged(object sender, Microsoft.CmdPal.UI.ViewModels.Services.ThemeChangedEventArgs e) Line 468	C#	Symbols loaded.
 	Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.Services.ThemeService.Reload() Line 207	C#	Symbols loaded.
 	CommunityToolkit.WinUI.Extensions.dll!CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Timer_Tick(object sender, object e) Line 50	C#	Non-user code. Decompiled symbols loaded (Embedded Source).
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_global__Microsoft_UI_Dispatching_DispatcherQueueTimer__object_.EventState.GetEventInvoke.AnonymousMethod__1_0(Microsoft.UI.Dispatching.DispatcherQueueTimer sender, object args)	Unknown	Non-user code. Skipped loading symbols.
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_Microsoft_UI_Dispatching_DispatcherQueueTimer__object.Do_Abi_Invoke(nint thisPtr, nint sender, nint args)	Unknown	Non-user code. Skipped loading symbols.
 	[Native to Managed Transition]		Non-user code. Annotated Frame
 	[Managed to Native Transition]		Non-user code. Annotated Frame
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck(int millisecondsTimeout, bool useTrivialWaits, object associatedObject, System.Diagnostics.Tracing.NativeRuntimeEventSource.WaitHandleWaitSourceMap waitSource)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.WaitOnEvent(System.Threading.EventWaitHandle waitEvent, ref uint numWaiters, System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout, System.Threading.ReaderWriterLockSlim.EnterLockType enterLockType)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.TryEnterWriteLockCore(System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceCache.Remove(nint thisPtr, int index, System.WeakReference<object> state)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceState<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.Dispose(bool disposing)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.UnsubscribeFromNative(ABI.WinRT.Interop.EventSourceState<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>> state)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.Unsubscribe(Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object> handler)	Unknown	Non-user code. Cannot find or open the PDB file.
 	CommunityToolkit.WinUI.Extensions.dll!CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Timer_Tick(object sender, object e) Line 45	C#	Non-user code. Decompiled symbols loaded (Embedded Source).
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_global__Microsoft_UI_Dispatching_DispatcherQueueTimer__object_.EventState.GetEventInvoke.AnonymousMethod__1_0(Microsoft.UI.Dispatching.DispatcherQueueTimer sender, object args)	Unknown	Non-user code. Skipped loading symbols.
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_Microsoft_UI_Dispatching_DispatcherQueueTimer__object.Do_Abi_Invoke(nint thisPtr, nint sender, nint args)	Unknown	Non-user code. Skipped loading symbols.
 	[Native to Managed Transition]		Non-user code. Annotated Frame
 	[Managed to Native Transition]		Non-user code. Annotated Frame
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck(int millisecondsTimeout, bool useTrivialWaits, object associatedObject, System.Diagnostics.Tracing.NativeRuntimeEventSource.WaitHandleWaitSourceMap waitSource)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.WaitOnEvent(System.Threading.EventWaitHandle waitEvent, ref uint numWaiters, System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout, System.Threading.ReaderWriterLockSlim.EnterLockType enterLockType)	Unknown	Non-user code. Skipped loading symbols.
 	System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.TryEnterWriteLockCore(System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout)	Unknown	Non-user code. Skipped loading symbols.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceCache.Remove(nint thisPtr, int index, System.WeakReference<object> state)	Unknown	Non-user code. Cannot find or open the PDB file.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceState<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.Dispose(bool disposing)	Unknown	Non-user code. Cannot find or open the PDB file.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.UnsubscribeFromNative(ABI.WinRT.Interop.EventSourceState<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>> state)	Unknown	Non-user code. Cannot find or open the PDB file.
 	WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object>>.Unsubscribe(Windows.Foundation.TypedEventHandler<Microsoft.UI.Dispatching.DispatcherQueueTimer, object> handler)	Unknown	Non-user code. Cannot find or open the PDB file.
 	CommunityToolkit.WinUI.Extensions.dll!CommunityToolkit.WinUI.DispatcherQueueTimerExtensions.Timer_Tick(object sender, object e) Line 45	C#	Non-user code. Decompiled symbols loaded (Embedded Source).
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_global__Microsoft_UI_Dispatching_DispatcherQueueTimer__object_.EventState.GetEventInvoke.AnonymousMethod__1_0(Microsoft.UI.Dispatching.DispatcherQueueTimer sender, object args)	Unknown	Non-user code. Skipped loading symbols.
 	Microsoft.InteractiveExperiences.Projection.dll!WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_Microsoft_UI_Dispatching_DispatcherQueueTimer__object.Do_Abi_Invoke(nint thisPtr, nint sender, nint args)	Unknown	Non-user code. Skipped loading symbols.
 	[Native to Managed Transition]		Non-user code. Annotated Frame
 	[Managed to Native Transition]		Non-user code. Annotated Frame
 	Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference _obj, Microsoft.UI.Xaml.ApplicationInitializationCallback callback)	Unknown	Non-user code. Skipped loading symbols.
 	Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback callback)	Unknown	Non-user code. Skipped loading symbols.
 	Microsoft.CmdPal.UI.dll!Microsoft.CmdPal.UI.Program.Main(string[] args) Line 94	C#	Symbols loaded.

Worker thread:

System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck(int millisecondsTimeout, bool useTrivialWaits, object associatedObject, System.Diagnostics.Tracing.NativeRuntimeEventSource.WaitHandleWaitSourceMap waitSource)	Unknown	Non-user code. Skipped loading symbols.
System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout)	Unknown	Non-user code. Skipped loading symbols.
System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.WaitOnEvent(System.Threading.EventWaitHandle waitEvent, ref uint numWaiters, System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout, System.Threading.ReaderWriterLockSlim.EnterLockType enterLockType)	Unknown	Non-user code. Skipped loading symbols.
System.Private.CoreLib.dll!System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(System.Threading.ReaderWriterLockSlim.TimeoutTracker timeout)	Unknown	Non-user code. Skipped loading symbols.
WinRT.Runtime.dll!ABI.WinRT.Interop.EventSourceCache.Create(WinRT.IObjectReference obj, int index, System.WeakReference<object> state)	Unknown	Non-user code. Skipped loading symbols.
WinRT.Runtime.dll!ABI.WinRT.Interop.EventSource<Windows.Foundation.TypedEventHandler<object, Microsoft.CommandPalette.Extensions.IPropChangedEventArgs>>.Subscribe(Windows.Foundation.TypedEventHandler<object, Microsoft.CommandPalette.Extensions.IPropChangedEventArgs> handler)	Unknown	Non-user code. Skipped loading symbols.
Microsoft.CommandPalette.Extensions.Toolkit.dll!ABI.Microsoft.CommandPalette.Extensions.INotifyPropChanged.Microsoft.CommandPalette.Extensions.INotifyPropChanged.PropChanged.add(Windows.Foundation.TypedEventHandler<object, Microsoft.CommandPalette.Extensions.IPropChangedEventArgs> value) Line 6840	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.CommandViewModel.InitializeProperties() Line 99	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.CommandItemViewModel.InitializeProperties() Line 174	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.CommandItemViewModel.SlowInitializeProperties() Line 216	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.Dock.DockBandViewModel.InitializeFromList(Microsoft.CommandPalette.Extensions.IListPage list) Line 190	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.Dock.DockBandViewModel.InitializeProperties() Line 212	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.ExtensionObjectViewModel.SafeInitializePropertiesSynchronous() Line 102	C#	Symbols loaded.
Microsoft.CmdPal.UI.ViewModels.dll!Microsoft.CmdPal.UI.ViewModels.Dock.DockViewModel.SetupBands.AnonymousMethod__1() Line 137	C#	Symbols loaded.
✔️ 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.