locked
File Sync: Destination Provider won't detect changes RRS feed

  • Question

  • Hello,

    I am using Sync Framework 2.1 to synchronize files from a server to various clients via share access.

    The problem I see is the following:

    - Adding new client, start sync, sync completed successfully

    - Deleting some files on the client

    - Running sync again (execute detect changes on local and remote provider first) with no result: 0 changes applied, 0 changes skipped of total 0 changes. I am not getting any error messages (not during the changes detection and not during the sync).

     

    I have also tried to use ExplicitDetectChanges without success. It does work again though, when I delete the filesync.metadata file on the client.

    Any ideas?

     

    Thanks,

    Nico

    Tuesday, July 12, 2011 9:27 AM

All replies

  • is this happening on a specific client only?
    Tuesday, July 12, 2011 10:59 AM
  • No, it is happening on every client I have tested so far.
    Tuesday, July 12, 2011 1:59 PM
  • is the sync bidirectional? better if you can post the code snippet

     

    Tuesday, July 12, 2011 2:22 PM
  • Hi,

    no, this is unidirectional. Here is the snippet:

     

            FileSyncProvider sourceReplica = new FileSyncProvider(masterid, localrootfolder, filter, FileSyncOptions.None);
            sourceReplica.DetectChanges();
            FileSyncProvider destReplica = new FileSyncProvider(slaveid, @"\\"+curtask.clienthostname + remotesharename, filter, FileSyncOptions.ExplicitDetectChanges);
            destReplica.DetectChanges();
            destReplica.AppliedChange += new EventHandler<AppliedChangeEventArgs>(delegate(object sender, AppliedChangeEventArgs e)
            {
              appliedchanges++;
            });
            destReplica.SkippedChange += new EventHandler<SkippedChangeEventArgs>(delegate(object sender, SkippedChangeEventArgs e)
            {
              skippedchanges++;
            });
            destReplica.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.RenameDestination;
            SyncOrchestrator agent = new SyncOrchestrator();
            agent.LocalProvider = sourceReplica;
            agent.RemoteProvider = destReplica;
            agent.Direction = SyncDirectionOrder.Upload;
            agent.SessionProgress += new EventHandler<SyncStagedProgressEventArgs>(delegate(object sender, SyncStagedProgressEventArgs agent_SessionProgress)
            {
              DatabaseHelper.updateSyncTaskProgress(curtask.id, (agent_SessionProgress.TotalWork == 0 ? 100 : Convert.ToInt32((agent_SessionProgress.CompletedWork * 1.0) / (agent_SessionProgress.TotalWork * 1.0) * 100.0)));
            });
            agent.Synchronize();
    


    Tuesday, July 12, 2011 5:01 PM
  • have you tried enabling tracing? i just copied your code and replaced the source and target folders and removed both filters and it works.
    Thursday, July 14, 2011 3:49 PM