App-V 5: The Case of the Failed Connection Group Descriptor (or . . . Another Reason not to Use Notepad for XML File Creation)

Have you ever noticed that when you go to save a newly created file in Notepad, the default encoding is ANSI? And this matters to App-V how you ask?

Normally this may not matter to you but I should inform you that this actually is important – especially if you are a purist and insist on using Notepad to create XML files. In the case of App-V, you may be using it to create dynamic configuration files or Connection Group Descriptors to test Connection Groups in stand-alone mode.

Take the following Connection Group XML descriptor document:

<?xml version="1.0" encoding="Unicode" ?>

<appv:AppConnectionGroup

  xmlns="https://schemas.microsoft.com/appv/2010/virtualapplicationconnectiongroup"

  xmlns:appv="https://schemas.microsoft.com/appv/2010/virtualapplicationconnectiongroup"

  IgnorableNamespaces=""

  DisplayName="GAME_JAVA"

  AppConnectionGroupId="2a77f876-4ab2-4d1a-8b95-9af4f0c9a7da"

  VersionId="e479fd82-127c-411e-99b6-f116f17e195a"

  Priority="42">

  <appv:Packages>

<appv:Package DisplayName="JRE6U32" PackageId="58bade90-3338-4ef5-bdf7-c7bc87c3b177" VersionId="0ec92974-d30a-4dd9-b52c-77b0ea7e59ef"/>

<appv:Package DisplayName="FREECOL_VFS" PackageId="1f635638-3e0b-44da-98f4-48f12e823c65" VersionId="6fcb3000-d4b5-45e6-991f-f88c6668b9aa"/>

  </appv:Packages>

</appv:AppConnectionGroup>

 

Do you notice anything wrong with the above document? Me neither. However, if you were save the file in Notepad using the default ANSI encoding, you may run into problems when you try to add the Connection Group.

 

The error you will get is:

  “Data at the root level is invalid. Line 1, position 42.”

You’ll notice that in the event of this error, you will likely not see much of anything else in terms of logging. The root cause is exactly what the error states. It is invalid data – due to encoding.

You can also confirm this by attempting to view the XML document in Internet Explorer. If there is an encoding mismatch where the encoding is ANSI instead of unicode, IE will just simply show a blank page. Proper XML encoding will show up correctly formatted as shown below:

 

Applications such as XML Notepad and Notepad++ match up with the schema specification automatically – especially Notepad++ (which I actually use) when you specify the output as XML specifically.

Now some savvy users may want to know what would happen if they simply just changed the element of ENCODING to ANSI in the XML document. It will error out as well because ANSI encoding is not supported.