fix(common): handle packaged context menu servicing shutdown - #50218
Open
Clint Rutkas (crutkas) wants to merge 1 commit into
Open
fix(common): handle packaged context menu servicing shutdown#50218Clint Rutkas (crutkas) wants to merge 1 commit into
Clint Rutkas (crutkas) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5be3824-61fb-4110-b87e-7c8f73cdcfe2
|
Thank you for contributing to PowerToys. We've detected that this PR might include a new or modified telemetry event. Please ensure the following before merging:
|
github-actions
Bot
requested a review
from Jessica Dene Earley-Cha (chatasweetie)
August 28, 2026 21:21
🧭 PR intakeVisual evidence: Not needed — The changed files do not indicate a visible UI change. No visual evidence is expected. Recommendation
✅ Ready for reviewThis PR passed the automated intake checks and is ready for maintainer review. Automated PR intake; PowerToys maintainers make final decisions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Fixes packaged context-menu
HANG_QUIESCEfailures during PowerToys update/uninstall for File Locksmith, PowerRename, Image Resizer, and New+.These commands run in package-dedicated
dllhost.exeCOM surrogates. The surrogates have no top-level window, so packaged Win32 servicing has noWM_CLOSEtarget and waits for its timeout before force-terminating them. The Watson stack consequently shows the normal surrogate wait:dllhost!wWinMain -> combase!CoRegisterSurrogateEx -> CSurrogateProcessActivator::WaitForSurrogateTimeoutThis adds a shared lifecycle monitor in
src/common/utils/context_menu_lifecycle.hand wires it into all four packaged context-menu DLLs.PR Checklist
Detailed Description of the Pull Request / Additional comments
The shared helper:
WS_POPUPwindow on a dedicated message-pump thread, outsideDllMain.TRUEforWM_QUERYENDSESSION.WM_CLOSEor confirmedWM_ENDSESSION, waits for already-admitted work, then terminates the stateless package-dedicated surrogate before servicing's timeout.Module policy:
DllCanUnloadNowremains based on the existing COM object/worker counts. No package manifest, registration, IPC contract, or user-facing command behavior changes.A focused test in
src/modules/FileLocksmith/Tests/FileLocksmith.UITests/FileLocksmithContextMenuTests.csactivates the real tier-1 command, locates the package-specificdllhostand lifecycle window, postsWM_CLOSE, requires process exit within five seconds, and verifies Explorer can reactivate the command.This PR is intentionally separate from #49502. That PR concerns
PowerToys.FileLocksmithUI.exenative handle enumeration and0xc0000005; this PR concerns package servicing of context-menu COM surrogates.Validation Steps Performed
FileLocksmith.ContextMenu.ServicingShutdownis discovered by the MSTest executable./p:SpectreMitigation=falsebecause this host lacks the optional Spectre-mitigated MSVC libraries, and/m:1after a parallel PCH memory-pressure failure.Nightly validation after merge:
dllhostowns the expected servicing window.MOAPPLICATION_HANG_*ContextMenu!HANG_QUIESCEreports.