I have a desktop client that uses a synchronization infrastructure to synchronize a database with a server. Sometimes I experience problems with the "Cleanup" of table change tracking.
I did some research and found a message on the Internet that yielded some code that drops anchors in a table and then resyncs. This is intended to force the table to reload, thereby exacerbating the problem. (Source here)
I implemented the following code:
= On Synchronization :: =
catch (SyncException ex)
{
Exception ex2 = ex.InnerException;
if (ex2.Message.Contains("cleaned up"))
{
try
{
syncStats = syncAgent.Synchronize(true);
catch (Exception anothererror)
{
}
}
= Sync Agent :: =
public SyncStatistics Synchronize(bool reinit)
{
if (!reinit)
return base.Synchronize();
try
{
ClientSyncProvider sqlCeProvider;
sqlCeProvider = (ClientSyncProvider)this.LocalProvider;
foreach (SyncTable st in this.Configuration.SyncTables)
{
if (st.SyncDirection != SyncDirection.Snapshot)
{
sqlCeProvider.SetTableReceivedAnchor(st.TableName, new SyncAnchor());
}
}
}
catch (Exception ex)
{
}
return base.Synchronize();
}
"", Synchronize (true) null , . , , , "catch (ex anothererror) {" "" .
, ?
,
.