On Windows 10, the startup performance of Universal Windows Platform (UWP) apps is improved by proactively launching and then suspending apps in a technique called Prelaunch. Many applications will not need to do anything special to work in this mode, but some applications may need to adjust their behavior, for example an application that shows animations that the user needs to see on startup, or a messaging app that changes the user’s online status. To help debug any issues in these code paths Visual Studio 2015 Update 1 and Windows 10 Version 1511 (November 2015 Update) added support that enable you to start debugging the app from Visual Studio in Prelaunch mode.
Debugging is supported both from a Visual Studio project, and for apps already installed on the machine (e.g. if you need to debug an app built in a lab and deployed for testing purposes).
A few things to note:
- For debugging Prelaunch to work correctly you need both Visual Studio 2015 Update 1 and the Windows 10 Version 1511 installed on your machine otherwise you will receive an error that the “Windows Store app could not be activated”
- Currently Prelaunch will only work when debugging on a Desktop edition of Windows 10 (Home, Pro, Enterprise, and Education)
- If your app needs to change its startup behavior based on which mode it is launched in, this is done by checking the value of the PrelaunchActivated property on the LaunchActivatedEventArgs parameter in the OnLaunched method if your app’s App.xaml.cs file
To start debugging a Visual Studio project in Prelaunch mode, choose Debug -> Other Debug Targets -> Debug Universal Windows App Prelaunch.
To start debugging Prelaunch in an app that is already installed on the machine, choose Debug -> Other Debug Targets -> Debug Installed App Package… Then, in the selection dialog that appears choose the app and check “Activate app with Prelaunch”
You will know the app was started in Prelaunch mode because the PrelaunchActivated property will be true.
We hope you find this functionality useful and please let us know if you have any questions or problems below in the comments section, using the Send Feedback feature in Visual Studio, or through twitter.