Knowledge Base

How to fix the issue with corrupted characters in AD data


You’ve started a migration process. Unfortunately, you get information about a failed item. In addition, on launching the CodeTwo program’s Administration Panel, you get the following or a similar error:

Error: Unable to launch application. System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type C2ExchangeMigration.Common.Settings.Archive. Unexpected end of file has occurred. The following elements are not closed: StreetAddress, MigrationSource, Assignment, Assignments, Archive. Line 1, position 22297.

The error is also listed on the Bad news card. You would like to learn what’s the reason for the issue and how to fix it to complete the migration process.


Such an error usually means that the value of a certain AD attribute contains corrupted characters due to encoding issues. As a result, on reading the attribute and adding it to the XML definition file of your migration job, our program is unable to close the attribute’s XML tag and the job gets corrupted.

In the example presented above, you can see the problem concerns the StreetAddress AD attribute.

To find out the user who is assigned the problematic AD attribute and correct the data, complete the following procedure:

  1. Log in to the machine where your CodeTwo migration software is installed, paste the following address in the address bar of File Explorer:

    and press Enter.

  2. You will see the root folder of our software – its name will differ depending on the product and version of the product you use (e.g. Office 365 Migration 3.2).
  3. Open the folder and go to Database.
  4. There, you’ll see XML job definition files which have been automatically created by our software (their names look like strings with random characters, see Fig. 1.).

Sample XML job definition files in the Database folder.
Fig. 1. Sample XML job definition files in the Database folder.

  1. Open each file with a word processing app, e.g. Notepad++ or WordPad, and scroll down to the bottom, to see if it ends abruptly without a closing tag (in our example, </StreetAddress> is the missing closing tag, see Fig. 2.).


    If you’ve experienced the issue recently (with the last migration job), try to sort the XML files by date modified – the most recently created/modified file is most likely the one without a closing XML tag at the end.

File ends abruptly with the opening <StreetAddress> tag ( the corrupted value and the closing tag are missing).
Fig. 2. File ends abruptly with the opening <StreetAddress> tag (the corrupted value and the closing tag are missing).

  1. If you finally find the corrupted XML file, you will be able to determine the affected AD user by finding the first instance of e.g. the <DisplayName> or <EmailAddress> tag above the non-closed XML tag.
  2. Once you know the affected user, you can delete or modify the problematic AD value for them (Fig. 3.).

The value of the StreetAddress attribute with the corrupted character.
Fig. 3. The value of the StreetAddress attribute with the corrupted character.

  1. You also need to manually delete the corrupted XML job definition file (see step 4). To be able to do it, close the program (plus stop the CodeTwo Office 365 Migration Data Provider Service if your current migration job(s) connect to the source server via MAPI).
  2. Finally, redefine your migration job from scratch.

Now, you should no longer experience the error and your migration process should complete successfully.


If you, however, experience the same error, it may mean there are more character encoding issues in your AD database. In such a case, you should investigate and eliminate all the issues before reattempting to migrate your data.

Was this information useful?