locked
Synchronization on the remaining items are stopped when a skippedchange is raised on one item RRS feed

  • Question

  • Hi, when I am synchronizing a pair of folders, and the "SkippedChange" event is raised due to one item in one of the folders changing at the time, synchronization stops right away instead of carrying on with the remaining items in the folder.  Is that intentional, and is there a way to continue?

    The codes below shows how I make the synchronization call.  I am using Sync Framework v1.0.  I need to use this version because that's what my clients have right now.  Thank you.

            SyncOrchestrator agent = new SyncOrchestrator();
            agent.LocalProvider = m_sourceProvider;
            agent.RemoteProvider = m_destProvider;
            agent.Direction = SyncDir;

            agent.Synchronize();
    Tuesday, February 23, 2010 9:16 PM

Answers

  • I assume that one file on the destination folder was updated after the change detection but before the change (file update) application by the sync framework.

    So I tried this scenario with 2 files on each folder in sync.  Update both files on the source folder.  Then update the first file on the destination folder during the debug process.  Here is what have found.

    1. The destination file change was detected as a concurrency conflict before the update is applied in sync.  Therefore this update is skipped by the file sync provider.
    2. [SkippedChange] event is raised on the destination provider at the handler [OnSkippedChange].
    3. The Sync continues to the second file update and the second change is applied on the destination folder.

    So I did not repro this case (using Sync Framework V1).

    Therefore, if you have observed that the remaining file updates were stopped applying then you could have a different scenario.  (Would you mind describing more about what you have seen?)

    Thanks.
    • Marked as answer by Yunwen Bai Thursday, February 25, 2010 7:00 AM
    • Unmarked as answer by Yunwen Bai Thursday, February 25, 2010 7:30 PM
    • Marked as answer by ohanna Wednesday, March 3, 2010 12:01 AM
    Wednesday, February 24, 2010 10:53 PM
    Answerer
  • Hi -

    Do you see a AppliedChange event for the other 8 or do you see the SkippedChange first for the one that you modified. Are you sure that there is no exception being raised in the SkippedChange event? An exception would result in an error being sent to the native code and the sync being aborted. The best way to check maybe to ensure that your event handling method is empty ( no code) and checking to see if this error still occurs.

    Thanks
    Deepa
    Deepa ( Microsoft Sync Framework)
    • Marked as answer by ohanna Wednesday, March 3, 2010 12:01 AM
    Tuesday, March 2, 2010 7:09 PM
    Answerer

All replies

  • are you using the filesyncprovider shipped with syncFx1.0 ?

    thanks
    Yunwen
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 24, 2010 7:23 AM
  • Yes that's right.  And I initiated it as follows. Thanks.

    m_destProvider = new FileSyncProvider(destId, myDestLocation, myFilter, FileSyncOptions.RecycleDeletedFiles | FileSyncOptions.RecycleConflictLoserFiles);

    m_destProvider.AppliedChange += new EventHandler<AppliedChangeEventArgs>(destProvider_AppliedChange);

    m_destProvider.SkippedChange += new EventHandler<SkippedChangeEventArgs>(destProvider_SkippedChange);

    m_destProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;

    m_destProvider.PreviewMode = false;

    Wednesday, February 24, 2010 4:39 PM
  • I assume that one file on the destination folder was updated after the change detection but before the change (file update) application by the sync framework.

    So I tried this scenario with 2 files on each folder in sync.  Update both files on the source folder.  Then update the first file on the destination folder during the debug process.  Here is what have found.

    1. The destination file change was detected as a concurrency conflict before the update is applied in sync.  Therefore this update is skipped by the file sync provider.
    2. [SkippedChange] event is raised on the destination provider at the handler [OnSkippedChange].
    3. The Sync continues to the second file update and the second change is applied on the destination folder.

    So I did not repro this case (using Sync Framework V1).

    Therefore, if you have observed that the remaining file updates were stopped applying then you could have a different scenario.  (Would you mind describing more about what you have seen?)

    Thanks.
    • Marked as answer by Yunwen Bai Thursday, February 25, 2010 7:00 AM
    • Unmarked as answer by Yunwen Bai Thursday, February 25, 2010 7:30 PM
    • Marked as answer by ohanna Wednesday, March 3, 2010 12:01 AM
    Wednesday, February 24, 2010 10:53 PM
    Answerer
  • By the way, if you repeat the exact same scenario, but without doing the concurrent file change on the destination folder during the file sync, do all file updates on the source folder apply successfully on the destination folder?

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, February 26, 2010 3:48 PM
    Answerer
  • Thanks Leo.

    When I repeat the same scenario, but without doing the concurrent file change on the destination folder during the file sync, all file updates on the source folder are applyied successfully on the destination folder.

    Thanks for trying out the scenario for me.  It's good to know what's supposed to happen.  For me, when 9 files have been updated, and only 1 of them is being modified during the sync, the changes on the other 8 are not applied.  I will do more debugging to see if I can get more specific information so you could help me.

    Cheers.
    Saturday, February 27, 2010 4:35 AM
  • Hi -

    Do you see a AppliedChange event for the other 8 or do you see the SkippedChange first for the one that you modified. Are you sure that there is no exception being raised in the SkippedChange event? An exception would result in an error being sent to the native code and the sync being aborted. The best way to check maybe to ensure that your event handling method is empty ( no code) and checking to see if this error still occurs.

    Thanks
    Deepa
    Deepa ( Microsoft Sync Framework)
    • Marked as answer by ohanna Wednesday, March 3, 2010 12:01 AM
    Tuesday, March 2, 2010 7:09 PM
    Answerer
  • Thanks Deepa.

    I did more tests and this is what happened:

    1) Modify 9 files on the source location.
    2) Modify 1 of them while the sync happens, let's call it File 6.
    3) I see each of these files coming up one by one in the "Applying Change" event for the destination provider.
    4) The files that come up in "Applying Change" event BEFORE File 6 all get synched correctly ("Applied Change" event occurred).
    5) Then I see "File 6" (the file that gets modified concurrently during the sync) in "Applying Change" event.
    6) Right away, "Skipped Change" event comes up for File 6, and yes, with an exception.
    7) Nothing happens for the rest of the changed files (those that haven't come up in the "Applying Change" event in step 4 above.  No event gets invoked for these files.

    You are right.  Once I remove my codes (to capture the exception) in my skipped_change event, the rest of the files get synched.

    Thanks.
    Wednesday, March 3, 2010 12:01 AM