Unable to Activate Windows Metro Style Application

March 26th 2012 XAML Windows Store

Probably the most interesting error I had to troubleshoot since I started developing my first Windows Metro application happened to me after doing some restructuring and cleaning up of the existing code base. Almost immediately after starting the application the debugger stopped its execution somewhere in App.g.i.cs (an auto generated file in obj folder, not part of the code I've written):

if (Debugger.IsAttached) Debugger.Break();

Trying to continue execution from this point on resulted only in another even more vague error message:

Unable to activate Windows Metro style application

Fortunately the fix turned out to be really simple once it dawned on me how to get more information: the second argument of UnhandledException event handler inside which the execution stopped was UnhandledExceptionEventArgs. Peeking inside revealed the mystery:

XAML parsing failed.

There was an error in App.xaml which for same strange reason didn't cause the build to fail nor did it prevent the app from starting. It was listed in the Error List though:

An error occured while finding the resource dictionary

At least now I know what to look for when it happens next time.

Copyright
Creative Commons License