Fix a Metro app that doesn't start anymore.
How to fix a Metro app under development that doesn't start anymore.
Nico Vuyge
2012-03-20
40 days of Windows 8 Metro and WinRT development: Day 1 and 2.
Status of old problems.
In a previous post about my initial conversion of a C++ metro app to the Windows 8 consumer preview, I mentioned the following open issues:
-
SettingsPane API change: This turned out to be a small change and I could fix this quickly. If I had bothered to spend 5 minutes extra reading the docs, I could have done this on day 0.
-
Microsoft Advertising: Microsoft has released a new version of the advertising SDK for Windows 8 Metro apps. Unfortunately, it doesn't work at all in a C++ project. Visual Studio just crashes when trying to add a reference to those assemblies. Apparently this is going to be fixed at some undisclosed moment in the future, as you can see in the response of Ian Ferreira to my question in the comments.
Unable to start a Metro app that previously did work, with solution.
Yesterday I had a very weird problem with the Metro app I am working on. No matter what I did (cleaning the solution, uninstallling the app from the Metro Start interface, building a previous (known good) version from source control, I tried desperately too much stuff to mention here), my app wouldn't start anymore. Not a single breakpoint was hit anymore, and after a dozen of seconds waiting in the Metro startup screen, the app just disappeared. I guess I don't need to mention I lost a lost of time because of this. In the end, I installed a fresh Windows 8 Consumer Preview and fresh Visual Studio in a VM, and the latest source of my project in the TFS preview, and it worked immediately! So the problem was isolated to my main development machine. I didn't want to go through a full reinstall of this machine, and searched for an alternative solution. As it turns out, I could solve the issue by giving my app a new Package Name GUID and Application Name in my Package.appxmanifest. This essentially makes it a different app to the Metro Subsystem and this fresh start solved the issue. This is another indication that the issue was not related to my code, but that it was some kind of corruption of whatever state the Metro subsystem maintains for my app.
Remaining issues.
Apart from the missing C++ support for the advertising SDK, nothing is currently preventing me to continue the development of my app. The current status of the Visual Studio Metro UI designer is a major annoyance though. For some reason, it can't create and display my custom controls anymore, so I basically have to go through a compile-and-run cycle to test my visualisations. This slows me down a bit (Is there anybody with a workaround?), but not too much. What is worse is that the designer so soooo terribly slow, and it sometimes blocks Visual Studio for quite a few seconds. But I guess that's the sacrifice to make for running beta software.