Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: ChangesApplied event incorrectly occurs before a change that is in a retry queue is applied to a database in a Sync Framework 2.1-based application


Symptoms

Consider the following scenario:
  • You create an application that uses Microsoft Sync Framework 2.1 to perform database synchronization on a computer.
  • You configure the application to use batching for the delivery of changes.
  • The application uses a handler to perform some actions if the ChangesApplied event is fired and if the DbSyncContext.IsLastBatch property is set to True.
  • A change fails in one of the tables that are synchronized because of a constraint violation.
  • The failed change operation is put in a retry queue.
In this scenario, a ChangesApplied event incorrectly occurs before the failed change is applied.

For example, table A contains a primary key that is referenced by table B as a foreign key. When a delete operation for a row in table A arrives in a batch and a delete operation for table B arrives in another batch, the delete operation in table A fails. The operation may fail because of a foreign key violation. The delete operation in table A is put in a retry queue. However, the ChangesApplied event is incorrectly called before all the failed changes that are in the retry queue are applied. Therefore, the business logic is broken in the ChangesApplied event.

↑ Back to the top


Resolution

To resolve this issue, apply the following cumulative update.

After you apply this update, the ChangesApplied event is called only if all changes that are in the retry queue are applied to a database.

Cumulative update

The hotfix for this issue was first released in Sync Framework 2.1 build 2.1.2503.00. For more information about how to obtain this hotfix package, click the following article number to view the article in the Microsoft Knowledge Base:
2531321 Description of the hotfixes that are released in Sync Framework 2.1 build 2.1.2503.00
Note Because the builds are cumulative, each new hotfix release contains all the hotfixes that were included in the previous Sync Framework 2.1 hotfix release. We recommend that you consider applying the most recent hotfix release that contains this hotfix. For more information about the builds that were released after Sync Framework 2.1 was released, click the following article number to view the article in the Microsoft Knowledge Base:
2531326 Description of the Sync Framework 2.1 builds that were released after Sync Framework 2.1 was released

↑ Back to the top


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Workaround

To work around this issue, do not use batching in the application.

↑ Back to the top


References

For more information about how to deliver changes in batches, visit the following MSDN website:For more information about how to use events and to program business logic, visit the following MSDN website:

↑ Back to the top


Keywords: kbqfe, kbfix, kbexpertiseadvanced, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 2535671
Revision : 1
Created on : 1/7/2017
Published on : 4/18/2011
Exists online : False
Views : 99