locked
System.Exception: There is a sync session already in progress, please try again later RRS feed

  • Question

  • Hi Bevets,

     

    I modified the code as your solution.

    When I set the SyncSessions.txt as below:

    VCardOutlookProvider default VCardWindowsContactsProvider default
    VCardWindowsContactsProvider default VCardOutlookProvider default

    I will encounter the following exception when I sync the 1st, 3rd, 5th....time:

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    System.Exception: There is a sync session already in progress, please try again later.
       at MsfSample.GenericSyncProvider`1.LoadSyncMetadata() in C:\MsfProviderSampleCode\GenericSyncProvider\GenericSyncProvider.cs:line 392
       at MsfSample.GenericSyncProvider`1.BeginSession(SyncProviderPosition position, SyncSessionContext syncSessionContext) in C:\MsfProviderSampleCode\GenericSyncProvider\GenericSyncProvider.cs:line 692
       at Microsoft.Synchronization.KnowledgeProviderProxy.BeginSession(SYNC_PROVIDER_ROLE providerRole, ISyncSessionState pSessionState)
       at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
       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 MsfSample.Sync.DoSync() in C:\MsfProviderSampleCode\MsfSample\Sync.cs:line 164
       at MsfSample.SyncUi.syncButton_Click(Object sender, EventArgs e) in C:\MsfProviderSampleCode\MsfSample\SyncUi.cs:line 41
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Do you know what's the problem? Does your code be able to sync between Outlook and Windows Contacts?

    Thanks.

    • Moved by Max Wang_1983 Thursday, April 21, 2011 9:42 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Tuesday, September 16, 2008 2:23 AM

Answers

  • Thanks for your reply.

    I found the main cause is that VCardOutlookProvider and VCardWindowsContactsProvider use the same path for metadata files.

    Therefore, it will cause that second provider cannot access metadata files.

    There will be no exception after that I changed the path of metadata files for VCardOutlookProvider and VCardWindowsContactsProvider.

    Wednesday, September 24, 2008 10:48 AM

All replies

  • I think this exception arises when a meta data file is not closed properly.  That particular MsfProvider sample is dependent on file paths that are hardcoded in the sample.  If you installed the sample anywhere other than on C: and did not manually change all the hardcoded file paths then the code may be writing meta data to one path and reading it from another.  This will confuse it into thinking that a session is still in progress.

    This thread talks about properly closing the meta data files:
    http://forums.microsoft.com/sync/ShowPost.aspx?PostID=3481722&SiteID=75


    Monday, September 22, 2008 7:53 PM
  • Thanks for your reply.

    I found the main cause is that VCardOutlookProvider and VCardWindowsContactsProvider use the same path for metadata files.

    Therefore, it will cause that second provider cannot access metadata files.

    There will be no exception after that I changed the path of metadata files for VCardOutlookProvider and VCardWindowsContactsProvider.

    Wednesday, September 24, 2008 10:48 AM