Describe the bug
I have an app that can open image files. Users can associate image file endings (e.g. .jpg) with my app or open the image files in my app using the context menu in the Windows explorer and use "open with...".
When users select multiple files (e.g. 5 image files) and then open them all in my app with a single click on the "Open" option in the context menu, my app is activated 5 times and in with each activation, the FileActivatedEventArgs.Files contains all 5 files in each activation.
Steps to reproduce the bug
<uap:Extension Category="windows.fileTypeAssociation">
<uap:FileTypeAssociation Name="images">
<uap:SupportedFileTypes>
<uap:FileType ContentType="image/jpeg">.jpg</uap:FileType>
<uap:FileType ContentType="image/jpeg">.jpeg</uap:FileType>
...
</uap:SupportedFileTypes>
<uap:DisplayName>Images</uap:DisplayName>
</uap:FileTypeAssociation>
</uap:Extension>
[STAThread]
static void Main()
{
var keyInstance = AppInstance.FindOrRegisterForKey("main");
if (keyInstance.IsCurrent)
{
keyInstance.Activated += (_, e) =>
{
// handle activation here
};
Application.Start(p =>
{
var context = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
SynchronizationContext.SetSynchronizationContext(context);
_ = new App();
});
}
else { keyInstance.RedirectActivationToAsync(AppInstance.GetCurrent().GetActivatedEventArgs()).GetAwaiter().GetResult(); }
}
Expected behavior
My app should only be activated once.
Screenshots
No response
NuGet package version
Windows App SDK 1.6.3: 1.6.250108002
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 24H2 (22621, October 2024 Update)
IDE
Visual Studio 2022
Additional context
This problem was not present in UWP. My app was only activated once in UWP, even when multiple files were opened
Describe the bug
I have an app that can open image files. Users can associate image file endings (e.g.
.jpg) with my app or open the image files in my app using the context menu in the Windows explorer and use "open with...".When users select multiple files (e.g. 5 image files) and then open them all in my app with a single click on the "Open" option in the context menu, my app is activated 5 times and in with each activation, the
FileActivatedEventArgs.Filescontains all 5 files in each activation.Steps to reproduce the bug
Expected behavior
My app should only be activated once.
Screenshots
No response
NuGet package version
Windows App SDK 1.6.3: 1.6.250108002
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 24H2 (22621, October 2024 Update)
IDE
Visual Studio 2022
Additional context
This problem was not present in UWP. My app was only activated once in UWP, even when multiple files were opened