locked
Sync Framwork custom implementation RRS feed

  • Question

  • Hi, i'm trying to understand Microsofts Syncronization FrameWork. So far i have undestand some important issues, but i read about that the tick count for replica can be the local clock, im implementing the GetNextTickCount() method like

    return (ulong) DateTime.UtcNow.Ticks;

    im adding existing contacts, and logically the version of creation can be the time of creation + idreplica.

    Everything goes as planned until the sinchronization begins... the i get the error

    "A version was not contained in a knowledge instance as expected."

    When i see the Knowledge is says [0:0].

    How i can solve this..??

    • Moved by Max Wang_1983 Friday, April 22, 2011 7:38 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, May 9, 2008 11:10 PM

All replies

  • Hi,

     

    Do you have the call stack where you see this error? It may help us find the cause. Are you setting Knowledge.SetLocalTickCount(DateTime.UtcNow.Ticks) on each provider before starting the sync session?

     

    Tuesday, May 13, 2008 4:00 AM
  • Hi thnx for the reply...

    My call stack
    >    KitOutlookSync.dll!KitOutlookSync.MySyncController.Synchronize(Microsoft.Synchronization.KnowledgeSyncProvider destinationProvider = {<ContactsInfo>
       <ReplicaId>localReplica</ReplicaId>
       <Knowledge>Scope: [(0:0)]</Knowledge>
       <ContactTable>
           <Contact id="12846f08-1021-45b1-af4d-8d95e421d144" updateVersion="633468162329708750">
               m, jorge h
           </Contact>
           <Contact id="137161" updateVersion="633468162329865000">
               m, jorge h
           </Contact>
       </ContactTable>
    </ContactsInfo>
    }, Microsoft.Synchronization.KnowledgeSyncProvider sourceProvider = {<ContactsInfo>
       <ReplicaId>jmacWSReplica</ReplicaId>
       <Knowledge>Scope: [(0:0)]</Knowledge>
       <ContactTable>
           <Contact id="137160" updateVersion="633468162330333750">
               m, g g
           </Contact>
           <Contact id="137161" updateVersion="633468162330333750">
               m, Jorge
           </Contact>
       </ContactTable>
    </ContactsInfo>
    }, Microsoft.Synchronization.SyncDirectionOrder direction = DownloadAndUpload) Line 34    C#
         TestingSync.exe!TestingSync.Form1.button1_Click(object sender = {Text = "My Sync!!"}, System.EventArgs e = {X = 25 Y = 11 Button = Left}) Line 176 + 0x12 bytes    C#
         [External Code]   
         TestingSync.exe!TestingSync.Program.Main() Line 17 + 0x1a bytes    C#
         [External Code]   

    The execption stack trace
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, Int32& changesApplied, Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
       at Microsoft.Synchronization.SyncOrchestrator.Synchronize()
       at KitOutlookSync.MySyncController.Synchronize(KnowledgeSyncProvider destinationProvider, KnowledgeSyncProvider sourceProvider, SyncDirectionOrder direction) in C:\KITExtras\Outlook\Research\KitOutlookSync\MySyncController.cs:line 28

    And yes, every time i call to Sinchronize() method i set
                localProvider.ReplicaMetadata.GetKnowledge().SetLocalTickCount((ulong)DateTime.UtcNow.Ticks);
                remoteProvider.ReplicaMetadata.GetKnowledge().SetLocalTickCount((ulong)DateTime.UtcNow.Ticks);
    But when debugging the localProvider.ReplicaMetadata.GetKnowledge() says Scope[0:0]...


    In MyReplica class im using an internal ReplicaMetadata object...
            public SyncKnowledge GetKnowledge()
            {
                if (replicaMetadata == null) throw new NullReferenceException("The internal Metadata is null.");
                return replicaMetadata.GetKnowledge();
            }

    thnx in advanced...
    Monday, May 19, 2008 6:06 PM
  •  

    I'm not sure why your local tick count is not reflected in your knowledge even though you seem to be setting it. Is is possible for you to share your project so I can debug?

     

    sid

     

    Tuesday, May 20, 2008 4:54 PM
    Moderator