'Closing Main UWP app also closes all other hosted app views
I just encountered a weird behavior in UWP apps when using the Protocol for Results activation.
- First, activate the app using Protocol for Results activation from another app.
- Open the app activated by Protocol for Results by its primary tile. You should now have the main app and the hosted app view running.
- Close the main app.
- The hosted app view is also closed without any error.
This also happens when you have the app already running and launch another view using the Protocol for Results activation. Closing the main app will also close the hosted app view.
Am I missing some configuration here? I haven't found this behavior stated in the docs too.
Please note that this is vanilla UWP. Not full trust and not WinUI. Thank you
Solution 1:[1]
Closing Main UWP app also closes all other hosted app views
I have to say it is by design, the launched view will host in main app, and you can't interact with current app if the host view does not close. You can just close the view manually or call ReportCompleted in host view.
If you force off the main app with Task Manage, the view will lost host and then close. Currently, there is no such configuration could disable this, if you do want such feature, I'd suggest you submit a feedback/feature request about this API/feature in the Feedback Hub. You could find the Feedback Hub in the Start Menu. Please select Developer Platform->API Feedback as the category when you submit your request. The related team will check the request.
Update
It's not good practice to open the ProtocolApp after launched result view. Even though the result view is hosted in Main view, but it is still sub-process of ProtocolApp that runs in the background, you could check task manager to verify this. The main process of ProtocolApp will resume from background, when we open ProtocolApp through its primary tile. And if we close the main process, the sub-process will be killed also. It's by design.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

