Migrating Windows RP application to Windows 8 RTM – XAMLParseException

After I installed new Windows 8 with new Visual Studio 2012 I expected smooth migration of my projects. However one small issue cost me about one hour of investigation. I checked “Migrating your Release Preview app to Windows 8″ doc but I didn’t find any information about my issue.  So I am sharing following post that I hope will save someone’s time.

Error

I opened my project in new VS 2012. It compiled without any problems. I just had to change “OSMinVersion” and “OSMaxVersionTested” to 6.2.1. However when I run it, I got XAMLParseException with error

“{“XAML parsing failed.”}”.

StackTrace:

at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
at Shopping.Game.Controls.EndGameWindow.InitializeComponent() in \Shopping\Shopping.Game\obj\x86\Debug\Windows\EndGameWindow.g.i.cs:line 44
at Shopping.Game.Controls.EndGameWindow..ctor() in \Shopping\Shopping.Game\Windows\EndGameWindow.xaml.cs:line 28
at Shopping.Shopping_XamlTypeInfo.XamlTypeInfoProvider.Activate_6_EndGameWindow() in \Shopping\Shopping\obj\x86\Debug\XamlTypeInfo.g.cs:line 135
at Shopping.Shopping_XamlTypeInfo.XamlUserType.ActivateInstance() in \Shopping\Shopping\obj\x86\Debug\XamlTypeInfo.g.cs:line 404

My solution contains few projects and I keep “”EndGameWindow” UserControl in “Shopping.Game” project. Project “Shopping” is a main one.

I commented out everything from EndGameWindow.xaml and EndGameWindow.xaml.cs files but it still failed. Even for new created UserControls.

Problem

What I found? I found that inside the files {fielname}.g.i.cs under path obj/x86/Debug/ generated URL contains wrong project name, instead of “Shopping.Game” it was “Shopping_Game”.

global::System.Uri("ms-appx:///Shopping_Game/Controls/EndGameWindow.xaml")

Solution

Solution is super simple, don’t put dots in the project’s name. I didn’t check what would happen if I would manually change the value in the {filename}.g.i.cs file as this is auto generated file and my changes would be overwritten with compilation. I just renamed my project. I don’t use dot anymore in the name, which was my kind of naming convention. It was always working in VS 2010 and VS 2012 RC, but I can live without it. :)

How to change the name? Go to project’s properties and update Assembly name. I changed as well Default namespace and project’s name in the solution, just to have everything nice and clean.

[Edit 08/19/2012] Fix

Thanks to Tim Heuer we now know that there is a hotfix available for described issue. To get it, just follow this link: http://support.microsoft.com/kb/2739194. Awesome! :)

About

Software Development Department

Tagged with: , , ,
Posted in Windows 8, XAML
3 comments on “Migrating Windows RP application to Windows 8 RTM – XAMLParseException
  1. omar says:

    Thanks ! you saved my day.

  2. Eugene says:

    Thank you,

    At least now I know where is the problem.
    I have 20+ assemblies in my solution and I don’t want to rename them all. And hotfix is avalible only by request so I’m waiting whem MS support will replay.

  3. theCake says:

    Hey there,
    I’ve run into this issue before, applied the hotfix and was happy. Until today, when the exception popped up on my freshly installed desktop system. I applied the hotfix, but there’s no change, the Apps still won’t run.
    Any ideas?

    It seems like you have to ‘Clean Solution’ before it starts working again…

    VS dev team, you promised an update on the KB page – this was MONTHS ago, and the issue is still there?! It was extremely difficult to even get the patch, since it is not publicly available. And now it turns out, that it does not even fix the issue

    ..what a nice start in the day..
    cheers,
    theCake

1 Pings/Trackbacks for "Migrating Windows RP application to Windows 8 RTM – XAMLParseException"

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>