Fix app activation firing multiple times when launching multiple files#4
Draft
Fix app activation firing multiple times when launching multiple files#4
Conversation
Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] App activation fires multiple times when launching multiple files
Fix app activation firing multiple times when launching multiple files
May 22, 2025
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.
Problem
When a user selects multiple files in Windows Explorer (e.g., 5 image files) and opens them all at once with a single click, the application is activated multiple times. Each activation receives the same complete set of files in the
FileActivatedEventArgs.Filescollection, leading to duplicate processing.This behavior is different from UWP where the app would only be activated once with all files, as expected.
Root Cause
When multiple files are selected and opened at once, Windows sends multiple activation events to the application. The Windows App SDK framework was forwarding each of these events as separate activations to the application, without detecting that they were duplicates containing the same set of files.
Solution
The fix implements a deduplication system that:
This change:
Test Scenario
To verify this fix, select multiple files of the same type in Windows Explorer and open them all at once. The application should now only be activated a single time, with all files available in the
FileActivatedEventArgs.Filescollection.Fixes #3.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.