Test and debug your widget

Before attempting to run your widget for the first time, ensure that you've installed the Game Bar included with this SDK zip, and ensure that Game Bar runs correctly when hitting Win + G. If not, go back and follow the Quick Start Instructions.

Outside Game Bar

If you are testing or debugging features of your widget that don't depend on Game Bar APIs calls, you can test, debug, and iterate on your app via a normal foreground app launch. This is the same as any other Windows app being developed in VS.

Here are some methods:

  1. Press F5 "Start Debugging" will perform a "loose file" deployment of your app on the target system (local or remote), run the app outside Game Bar, and attach debugger. Later you can run your app by finding it in the Windows start menu.

  2. Right clicking your project in VS and selecting "Deploy" will just "loose file" deploy your app. You can now launch your app from the Windows start menu

  3. Create an app package to deploy later or on a separate machine. Right click on your VS project and select Store -> Create App Packages. Select "I want to create packages for sideloading" and un-check the "enable automatic updates". Click next, select the architecture variants you desire and create the package. After VS builds your variants and packages them you will get the folder location where the package was created. You can move that package folder to a target system and deploy it by running the PowerShell script. See quick start instructions "Install Sample Widget(s)" for an example. After deployment (installation) you can run your app from the Windows start menu.

Inside Game Bar

For Game Bar to discover your widget for the first time, you need to deploy your app (widget) then bring up Game Bar (Win + G). For subsequent tests, you just need to ensure your widget is closed in Game Bar, then when you load the widget again in Game Bar it will load the latest version of the app installed.

You can use the deployment and execution methods mentioned above in the Outside Game Bar scenario, but when loading your widget in Game Bar, Game Bar will launch your app process (if not already running) and create a new instance of your App object, then call OnActivated (as described earlier in this guide).

To use F5 debugging in VS when Game Bar loads your app (widget), you can update the F5 VS behavior so it doesn't cause a foreground launch. Right click on your project and go to Properties. Go to the Debugging section and change Launch Application to No. Now press F5 and then on your target load Game Bar and launch your app widget. VS will automatically attach to your app on launch.

Warning: If your widget is running inside Game Bar and you break into your widget in the debugger, you won't be able to switch back to Visual Studio's window if Game Bar is over the top of it. You may have to reboot your system if this occurs. Therefore, when testing your widget inside Game Bar we recommend one of the following approaches:

  1. Deploy and test your widget with Game Bar on a test machine separate from your development/debug machine using VS remote debugging tools.
  2. Bring up Game Bar on a different monitor than your Visual Studio window.