I am developing a Windows Store app using the new universal app stuff (I am not including a phone project currently). Intermittently at run time I get a Windows.UI.Xaml.Markup.XamlParseException
with the message Failed to assign to property 'Windows.UI.Xaml.Controls.ContentPresenter.Content'
.
The key here is this is intermittent, I can run the app many times with no issue and then suddenly it will happen & if I restart it seldom if ever happens immediately afterwards. It only shows up at runtime.
In terms of environment, on every page I have a custom content control which we use to set the chrome for the page, so that it is uniform and also so we can handle popups etc... The XAML for that control is at: http://pastebin.com/T6KNWhxy
The issue occurs on most pages, however the camera page (XAML at http://pastebin.com/azdQ33Y2) seems to have it happen far more often.
I have built a light app which uses the same controls that reproduces the problem fairly consistently: https://github.com/rmaclean/HeatherSpeedApp
It also happens when running normally (i.e. without debugging). Loading up the dump file from that crash has the following error (which matches the details in the event log):
Unhandled exception at 0x7582B152 (combase.dll) in triagedump.dmp: 0xC000027B: An application-internal exception has occurred (parameters: 0x055C31F8, 0x00000004).
I have tried:
Any suggestions on what could be causing it?
Exception details
{"XAML parsing failed."}
[Windows.UI.Xaml.Markup.XamlParseException]: {"XAML parsing failed."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
HResult: -2144665590
InnerException: null
Message: "XAML parsing failed."
Source: null
StackTrace: null
TargetSite: null
The cause is having a custom ContentControl which has more than one ContentPresenter on it. If more than one of the ContentPresenters has a default value of null, then the XAML engine will have an intermittent failure caused by it not being able to layout correctly.
The work around is to set the default value to be an empty Grid or similar object.
Full internal details of the issue are here.