question

DesktopMonkey-6974 avatar image
2 Votes"
DesktopMonkey-6974 asked ·

UWP Desktop Bridge app and suspend/resume

Hello,

How does suspend/resume work with an UWP app that uses Desktop Bridge? Are such apps ever suspended?

Desktop Bridge apps don't have suspend/resume based on this API documentation: https://docs.microsoft.com/en-us/uwp/api/windows.system.appresourcegroupinfo.startsuspendasync

It mentions that "This method won’t work on Desktop Bridge apps because they don’t have the concept of suspend/resume".

What concerns me is that this is a side-note in an API that isn't directly related to the Desktop Bridge. I have not been able to find Desktop Bridge related documentation that would specify how suspend/resume works with Desktop Bridge apps.

Based on my experiments, a Desktop Bridge UWP app can be suspended and resumed using Visual Studio's lifecycle controls. When the UWP app suspend is triggered, the full-trust process keeps running while the UWP app drops the AppService connection to the full-trust process and suspends.

windows-uwpwindows-desktop-bridge
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I used the Windows Application Packaging Project to package my wpf app, when I tried to use Visual Studio's lifecycle controls to suspend it, it told me it's not support to suspend. Then I opened the app from start menu and checked its status in Task Manager, but Task Manager didn't show the suspended state. So I'm confused about your description "a Desktop Bridge UWP app can be suspended and resumed using Visual Studio's lifecycle controls". Before you converted your app to UWP, what's the type of your app? And how did you convert it to UWP? When you tried to suspend your app, did it show the suspended state in Task Manager?

0 Votes 0 · ·

This is not a converted app, but rather constructed from scratch primarily as UWP app. In my case the packaging project contains a minimal UWP app and a minimal WPF app. This approach is overall documented here: https://blogs.msdn.microsoft.com/appconsult/2016/12/19/desktop-bridge-the-migrate-phase-invoking-a-win32-process-from-a-uwp-app/

The lifecycle controls are visible and can be used in VS. I don't see anything get suspended in Task Manager, but the UWP app window does change state when I use the lifecycle controls. I also see UWP app's Application.Suspending and Application.Resuming being called. This seems to be in conflict with "This method won’t work on Desktop Bridge apps because they don’t have the concept of suspend/resume", as referred to above.

0 Votes 0 · ·

Standard desktop bridge apps cannot use AppResourceGroupInfo.StartSuspendAsync() method, the project you created has a life cycle because it contains a UWP app. This document is more like integrating a Win32 and a UWP app, the UWP is the main, not the win32 app. The standard desktop bridge app is a single desktop application, which converted into a UWP application through the desktop bridge, the lifecycle controls don't work for it. In addition, you can try to use AppResourceGroupInfo.StartSuspendAsync() method in your WPF app, it can not success.

0 Votes 0 · ·

Hi, can this explanation help you understand better? Do you have any question?

0 Votes 0 · ·

0 Answers