Xaml Parse Exception

I have been playing around with some great tutorials on Silverlight/WPF and calling external API’s for a little CRM project I am working on. Today I came across a weird error and thought I would document it here so next time it happens – I'll know how to fix it!

So Visual Studio 2008 gives a nice split view so you can see the Xaml you’re working on & a preview of the results. I was adding Style elements to my App.xaml page – and suddenly the preview stopped displaying. I tried to compile & run the app. It compiled fine, but got to the InitialiseComponent step, and threw a very nondescript error: AG_E_Unknown_Error […]


Looking at my Page.xaml I also noticed that the style element I had just created & linked to was underlined in blue squiggles:


Turns out it was just because of an error in the style definition in the App.xaml page. Even with the intellisense prompts, I had still managed to miss something! I had forgotten to put the # in the beginning of the Foreground property colour definition. As soon as I added that & saved – all was once again happy! :)