Bing Maps for Metro Gotcha

July 6, 2012 at 4:12 pm | Posted in Metro, Visual Studio 2011, Windows 8 | Leave a comment

Just ran into a mysterious behavior when trying to use the Bing Maps API for C#/XAML Metro applications. I have several apps that use this API and seem to be working well. This morning, I tried to make another test app and Visual Studio said it could not render the map. The error message indicated that the class was not registered. I doubled checked that the Build configuration was set to Debug with a specific processor type and that I had the Bing Maps and C++ runtime in my resources. I cleaned the solution and rebuilt it with no success.

Finally, I deleted the Bing Maps resource from the solution. When I re-added it, the problem cleared.

(An update: Another solution that I had given up on before discovering this trick suddenly started working after closing and restarting Visual Studio.)

This is one thing that I dislike about XAML development. There is a lot of magic that is going on behind the scenes. It appears that if things are not just so, the solution can break. Fragile. Reminds me of the early days of XAML/WPF in Visual Studio (maybe even for WinForms, I don’t know) but there were times that you could screw up a name of something in your project and the designer would go nuts. No amount of rework would recover. The only recourse was to start over with a fresh template and carefully reconstruct the project piece by piece.


Blog at
Entries and comments feeds.