ChangeNotExpected Exception while retrieving the IDFormats for Remote provider using Custom Sync Provider
-
Thursday, March 01, 2012 12:01 PM
Hi,
I have a typical Cutomer-Order-OrderDetails database and I have 3 databases with the above schema. I wrote a custom sync provider to sync the data between these 3 databases.
Lets say I have 3 replicas ReplicaA, ReplicaB, and ReplicaC .I inserted 1 record in each table in the databases and trying to sync. When I try to sync Replica A and Replica B the data from Replica B is transfered to Replica A and internally when the Sync call the ProcessChangeBatch method on the Replica B I am getting the following exception while retrieving the IDFormats
{Microsoft.Synchronization.ChangeNotExpectedException: Change was provided that was not expected either because it is out-of-order or incorrect.
---> System.Runtime.InteropServices.COMException: Change was provided that was not expected either because it is out-of-order or incorrect.
at Microsoft.Synchronization.CoreInterop.ISynchronousNotifyingChangeApplier.ApplyChanges(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChanges, Object pUnkDataRetriever, IEnumSyncChanges pDestinationVersions, ISyncKnowledge pDestinationKnowledge, IForgottenKnowledge pDestinationForgottenKnowledge, ISynchronousNotifyingChangeApplierTarget pChangeApplierTarget, ISyncSessionState pSessionState, ISyncCallback pCallback)
at Microsoft.Synchronization.NotifyingChangeApplier.ISynchronousNotifyingChangeApplierImpl.ApplyChanges(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChanges, Object pUnkDataRetriever, IEnumSyncChanges pDestinationVersions, ISyncKnowledge pDestinationKnowledge, IForgottenKnowledge pDestinationForgottenKnowledge, ISynchronousNotifyingChangeApplierTarget pChangeApplierTarget, ISyncSessionState pSessionState, ISyncCallback pCallback)
--- End of inner exception stack trace ---
at Microsoft.Synchronization.NotifyingChangeApplier.ISynchronousNotifyingChangeApplierImpl.ApplyChanges(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChanges, Object pUnkDataRetriever, IEnumSyncChanges pDestinationVersions, ISyncKnowledge pDestinationKnowledge, IForgottenKnowledge pDestinationForgottenKnowledge, ISynchronousNotifyingChangeApplierTarget pChangeApplierTarget, ISyncSessionState pSessionState, ISyncCallback pCallback)
at Microsoft.Synchronization.NotifyingChangeApplier.ApplyChanges(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, IChangeDataRetriever changeDataRetriever, IEnumerable`1 destinationVersions, SyncKnowledge destinationKnowledge, ForgottenKnowledge destinationForgottenKnowledge, INotifyingChangeApplierTarget changeApplierTarget, SyncSessionContext syncSessionState, SyncCallbacks syncCallback)
at OMSMetaDataStore.OMSSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)I am using the following code for initializing my IDFormats of my provider
_idFormats = new SyncIdFormatGroup();
_idFormats.ItemIdFormat.IsVariableLength = true;
_idFormats.ItemIdFormat.Length = 500;
_idFormats.ReplicaIdFormat.IsVariableLength = true;
_idFormats.ReplicaIdFormat.Length = 500;
_idFormats.ChangeUnitIdFormat.IsVariableLength = true;
_idFormats.ChangeUnitIdFormat.Length = 500;Thanks in advance

