This was quite an interesting error for a mailbox I tried to migrate from Exchange 2013 to Exchange Online. The mailbox synced to 95% and I received the below error after I tried completing the batch.
Error details: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ISourceFolder_EnumerateChanges2Result. The InnerException message was ‘Maximum number of items that can be serialized or deserialized in an object graph is ‘2000000’.
The key to this error is the object graph limit that is set in the MsExchangeMailboxReplication.exe config file. To resolve the issue do the following:
- Logon to your on premises Exchange CAS servers that you use as the proxies for migrating mailboxes to EOL. (In my case this was Exchange 2013)
- Open Notepad as an administrator
- Browse to C:\Program Files\Microsoft\Exchange Server\V15\Bin (or your Exchange installation path) and open the MsExchangeMailboxReplication.exe config file
- Hit ctrl + f in Notepad and search for maxItemsInObjectGraph (there are two entries and I had to change both values)
- You want to increase the number in these strings: <dataContractSerializer maxItemsInObjectGraph=”20000000″/> This is what the original looks like below.
- Restart the mailbox replication service on all the servers where you have changed the value.
- If the migration failed, then delete the migration job and restart it. You should not have the error again.
- Change the strings back to default using the above steps after you migrated the affected mailboxes for which you received the above error.
Here’s what the entries in the config file look like before any changes were made:
<serviceDebug includeExceptionDetailInFaults=”True” />
<serviceAuthorization serviceAuthorizationManagerType=”Microsoft.Exchange.MailboxReplicationService.MRSProxyAuthorizationManager, Microsoft.Exchange.MailboxReplicationService.ProxyService, Version=126.96.36.199, Culture=neutral, PublicKeyToken=%%%%%%%”/>