PowerToys
PowerToys copied to clipboard
Refine the CmdPal launch and activation logic when opening a new app instance
Summary of the Pull Request
This PR address https://github.com/microsoft/PowerToys/issues/39376
Key changes:
- Ensures RedirectActivationToAsync(args) is properly awaited using .GetAwaiter().GetResult() to preserve activation data.
- Uses DispatcherQueue.TryEnqueue to safely handle UI thread execution and avoid COMException during window activation.
- Addresses a race condition in Logger.InitializeLogger where multiple instances could trigger creation of unexpected log files. The root cause is that TextWriterTraceListener attempts to create a log file even if the target file is already in use, which results in a fallback file path prefixed with a GUID.
PR Checklist
- [x] Closes: #39376
- [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] Tests: Added/updated and all pass
- [ ] Localization: All end user facing strings can be localized
- [ ] Dev docs: Added/updated
- [ ] New binaries: Added on the required places
- [ ] JSON for signing for new binaries
- [ ] WXS for installer for new binaries and localization folder
- [ ] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx