RegisterApplicationRestart failing to restart application

Jöran Malek 96 Reputation points
2025-04-03T09:49:14.49+00:00

We have an application, that provides an updater via PackageManager.AddPackageByAppInstallerFileAsync - this works fine in combination with Windows 10, and Windows 11, when registering for application restart with RegisterApplicationRestart.

On Windows Server 2022 and Windows Server 2025 this way of automatically restarting an app after an update doesn't work, what's the expected way of restarting an application during an update?

Windows development | Windows App SDK
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-04-04T05:23:02.5833333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    If your app is a WinUI3 application, it is recommended to use AppInstance.Restart to restart your app programmatically. Like this:

     AppRestartFailureReason restartError = Microsoft.Windows.AppLifecycle.AppInstance.Restart("restartArgsInput");
    
     switch (restartError)
     {
        
     }
    

    You could get more information here: Restart API

    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.