XAML parsing error debugging process for Windows 8

I am looking for a general XAML debugging practice / approach. Typically, C # errors are fairly easy to find and specific enough to find information. However, XAML just throws a general XAML Parsing failed error:

enter image description here

I am looking for a generalized way to approach these errors and narrow down which file, line number, or any other information that may be useful for the errors that arise.

+4
source share
3 answers

Here is a neat method that I use to identify the file causing the XAML error when it is not clear ...

Open all XAML files with resource dictionaries one by one, add a space after opening the root element. Run in the debugger again to the point of failure, when the line number increases by one, you find the file.

No one can justify this behavior. I can only imagine that the method for loading the framework resource is called with the stream, so I have no idea what the name of the file it reads is, only the position inside.

It needs to be improved. The part of the structure that calls the resource loading method should give a debug message or pass a name in some context, so the lower parts of the structure can generate reasonable error messages.

+3
source

Note. I plan to expand this when I go forward and find out more. If you want to contribute to this answer, I will change it to CW and at the same time feel free to make any changes that seem to you

Smaller changes == Smaller errors

In general, as @DenDelimarsky stated, making small changes and running / debugging the code is a good start. In most cases, this will reduce the error to the areas in which you worked.

However, here are some tips you can use to narrow down your problems:

Class Search:

Your specific message for exception e states the following:

Failed to set the property 'Windows.UI.XAML. ResourceDictionary .Source' (highlighted by me)

This means that the ResourceDicionary class has complexities that assign the Source property. First, search within the volume of files that you edited, and then, if no errors are found, use the entire solution for this class and look for any errors that may be present.

+1
source

Actually, what you see is the usual way to deal with XAML errors. Moreover, you really see the problem outside of StandardStyles. Also, if you regularly use the debugging and debugging methods after changing the XAML, it is usually quite difficult to narrow down the problem.

0
source

Source: https://habr.com/ru/post/1439903/


All Articles