Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve XAML parse errors?

I have a XAML (Windows 8 WinRT XAML) + C# application that has a XAML UserControl. In the designer, I don't see any issue (no red underlines or similar). The Project also compiles without any errors. When I run the application, the application breaks in InitializeComponent() with "XAML parse error". I have no idea, how to debug this kind of issue. What would be the steps to identify the problem? Yes, The there is something wrong with the XAML User Control or the ressource dictionary but how would one deal with this kind of error in a structured way?

[EDIT]

Ok, it seems that trail-error seems to be the right approach for WinRT.

BTW. I found the issue with "my" code.

My project was called "Pegasus.Core" and in the generated CalenderControl.g.i.cs file from visual studio, the path was this: "ms-appx:///Pegasus_Core/View/CalendarControl.xaml" -> replaced "." with "_"

The fix url

like image 824
Jasper Avatar asked Nov 26 '12 15:11

Jasper


1 Answers

Sometimes the exception gives you a good hint as to which line it failed on if you watch the exception object. Other than that - removing and re-adding pieces of XAML is what I often end up doing in such cases. It's just a limitation of error reporting in the platform that would be nice if it was improved, but we have to cope with version 1 until the next version hopefully improves things a little bit.

like image 141
Filip Skakun Avatar answered Oct 12 '22 06:10

Filip Skakun