[UWP] Reasons an unconstrained extended execution foreground session may be revoked?

Tyler Fonzi 1 Reputation point
2022-07-06T15:13:13.35+00:00

In UWP applications, I am aware of the ExtendedExecutionSession class, which may be revoked due to various reasons (timeout, factors dependent on the ExtendedExecutionReason Enum, etc.).

For my programming purposes, I am using an ExtendedExecutionForegroundSession Class with the ExtendedExecutionForegroundReason Enum set to Unconstrained. This session has successfully been allowed and runs unconstrained for long periods of time with no problem most the time.

However, I have noticed that there are still some instances where this extended execution session can get revoked (reason is always "SystemPolicy") but more specifically:

  1. When the UWP app gets uninstalled.
  2. When the device (laptop in this case) goes into Sleep Mode.
  3. When the Background App Permissions associated with the UWP app are set to "Never".

I've only been able to discover these reasons via trial and error and guessing on my own. Is there documentation or knowledge out there somewhere such that I can make a more extensive list of reasons why an unconstrained extended execution foreground session may be revoked by Windows?

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2022-07-07T03:25:55.357+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Yes, there are many different scenarios that could revoke the extended execution. Most of them are related to system resources which is also mentioned as If an app has an active extended execution session and the system requires background activity to halt because a foreground application requires the resources, then the session is revoked. Also there are some scenarios that you've found on your own. But currently, there is no such document that clarifies all the scenarios about SystemPolicy because there are too many possible reasons.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments