CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.89k stars 1.38k forks source link

Application activation does not work from toast for unpackaged app Framework 4.8 #4359

Open 11v1 opened 3 years ago

11v1 commented 3 years ago

Describe the bug

If application is built for framework 4.8 then it's activation (when app is closed) from toast does not calls OnActivation after app start.

Steps to Reproduce

if NET48

            HttpClient c = new HttpClient();
            using (var stream = await c.GetInputStreamAsync(new Uri(httpImage)))
            {
                using (var fileStream = File.OpenWrite(imagePath))
                {
                    stream.AsStreamForRead().CopyTo(fileStream);
                }
            }

else

            HttpClient c = new HttpClient();
            using (var stream = await c.GetStreamAsync(httpImage))
            {
                using (var fileStream = File.OpenWrite(imagePath))
                {
                    stream.CopyTo(fileStream);
                }
            }

endif

            return imagePath;
        }
        catch
        {
            return string.Empty;
        }
    }


<!-- Being able to reproduce the problem in the sample app, really stream-lines the whole process in being able to discover, resolve, and validate bug fixes. -->

Steps to reproduce the behavior:

1. Change Microsoft.Toolkit.Win32.WpfCore.SampleApp target framework to net48
2. Paste above code to make project buildable
3. Start sample app
4. Press "Pop toast"
5. Close app
6. Press on notification to activate app
7. Application starts but event OnActivated is not called. System event log has entry that "DCOM server {...} was not activated for the allotted time"

When project is build for net core 3.1 then activation works as expected.

<!-- Provide as many code-snippets or XAML snippets where appropriate. -->

## Expected behavior
Application starts and OnActivated event is called.

<!-- A clear and concise description of what you expected to happen. -->

## Environment

<!-- Check one or more of the following options with "x" and replace the {build_number} and {minor_version} with the actual values -->

NuGet Package(s): Microsoft.Toolkit.Uwp.Notifications 7.1.1 <!-- Which NuGet Packages have you used -->

Windows 10 Build Number: 19043

Device form factor:

- [*] Desktop

Visual Studio version:

- [*] 2019 (16.11.3)
ghost commented 3 years ago

Hello 11v1, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

michael-hawker commented 3 years ago

FYI @andrewleader