I've talked before about application configuration file support in the .NET Compact Framework version 2.  I've discussed promoting version 1 applications to run on version 2, and some of the elements of the file's format.  Today, I'd like to spend some time talking about some scenarios where application configuration file processing may fail.

Incorrect formatting
By far, the most common issue I have encountered with failing application configuration files is when I have made a mistake when typing the XML.  If any of the XML tags or attributes are misspelled, processing of the application configuration file will fail silently. 

When none of the versions specified in the supportedRuntime tag can be found, an error message similar to the following will be displayed.

.NET CF Initialization Error
To run this application, you must first install one of the following versions of the .NET Compact Framework:
Contact your application publisher for instructions about obtaining the appropriate version of the .NET Compact Framework.

In the example above, I created an application configuration file which listed two fictitious .NET Compact Framework versions (v4.5.6789 and v5.6.7890). 

To combat my tendency towards typing mistakes, I typically create one application configuration file and copy / rename as appropriate.  The baseline file I use is listed here.

"XML Core Services and Document Object Model (DOM)" is not installed in the device image
Version 2 of the .NET Compact Framework requires MSXML to be installed for application configuration files to be processed.  If you are creating a device image using Platform Builder, "XML Core Services and Document Object Model (DOM)" (also known as SYSGEN_MSXML_DOM),  will automatically be added to your image when you add version 2 of the .NET Compact Framework.

Since MSXML was not a dependency of version 1 of the .NET Compact Framework, it may not be available on some devices.  On these devices, if version 2 is installed using a cab file, application configuration files may not be processed.  Unfortunately, there are no error messages displayed if MSXML cannot be loaded and applications will:

  • Attempt to run on the version of the .NET Compact Framework for which they were built (ex: version 1)
  • Attempt to run on the currently installed version of the .NET Compact Framework
  • If the version of the .NET Compact Framework for which the application was built is not found, fail to run

Take care!
-- DK

This posting is provided "AS IS" with no warranties, and confers no rights.