Obtaining Meaningful Error Messages When Troubleshooting XAML in a Silverlight for Windows Embedded Application (Windows Embedded Compact 7)

Obtaining Meaningful Error Messages When Troubleshooting XAML in a Silverlight for Windows Embedded Application (Windows Embedded Compact 7)

When your Silverlight for Windows Embedded application encounters XAML issues during runtime, you might find that the warning and error messages in the Visual Studio output window do not provide specific information about the problem or where the problem occurred, making it difficult to interpret the message.

In this article:


Cause

When your application uses Binary XAML (BAML) resources that are created by the XAML Resource Packager (XRPack), warnings and error messages are less informative than if BAML was not used. For example, with BAML on, the error message may be:

407416 PID:10b03f2 TID:1600066 PC=402938ce(xamlruntimecore.dll+0x000d38ce) RA=402de947(xamlruntimecore.dll+0x0011e947) SP=0002f80c, BVA=000db004

With BAML off, the error message is:

63262774 PID:1750532 TID:1760412 [XR] XRApplication::CheckParserError - PARSE ERROR: Code: 0x80470066  Line: 2    Character:4614   Message: Unknown element: Menu.

Resolution

When you troubleshoot XAML issues in your application, we recommend that you do the following:

  • Disable BAML. You can disable BAML by using the XRPack build parameter /BamlOff.
  • Use line numbers in the XAML files so that you can more easily see where the problems occur. You can enable line numbers by using the XRPack build parameter /IndentFiltered. These line numbers appear in the XAML files in the output directory, not the files in the project.
  • Do a clean build of the Silverlight application after changing these settings so that the new settings take effect. If you modify only the XAML files and then you build the Silverlight project without cleaning it first, the resource files will not get rebuilt. You can perform a clean build every time by using the XRPack build parameter /C.
 Caution:
Because disabling BAML can reduce graphics performance, you typically disable it only when troubleshooting.

By using these recommended XRPack settings, you can troubleshoot problems more easily and generate the most useful warning and error information. To add these XRPack settings, use the procedure below. Note that the location of the file that you modify in Visual Studio depends on whether your application is a subproject of an OS design in Platform Builder or you are developing your application in Visual Studio without using Platform Builder. Choose the procedure that is appropriate for your project.

To disable BAML when your application is a subproject of an OS design in Platform Builder
  1. In Visual Studio, open your OS design solution.

  2. In Solution Explorer, expand Subprojects, then expand your application’s project node, and then expand the Resource files directory.

  3. Under Resource files, double-click <Project Name>.xrpack.

  4. Add the following lines to <Project Name>.xrpack:

    /BamlOff
    /IndentFiltered
    /C
  5. Rebuild the subproject.

To disable BAML when your application is in Visual Studio and does not use Platform Builder
  1. In Visual Studio, open your application’s solution.

  2. In Solution Explorer, expand the application’s project node.

  3. Double-click <Project Name>.xrpack.

  4. Add the following lines to <Project Name>.xrpack:

    /BamlOff
    /IndentFiltered
    /C
  5. Rebuild the project.

 


Community Resources

See Also 

Leave a Comment
  • Please add 4 and 1 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Wendy Giberson edited Original. Comment: Bolded some text in the Resolution list.

Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Wendy Giberson edited Original. Comment: Bolded some text in the Resolution list.

Page 1 of 1 (1 items)