none
SQL Server Change Tracking has cleaned up tracking information. To recover from this error, the client must reinitialize its local database RRS feed

All replies

  • can you post the service side code throwing the exception and the client side catching it?

    Tuesday, July 12, 2011 6:24 AM
    Moderator
  • Server Side Code:

     

    try

                {

                    var tmp = this._serverSyncProvider.GetChanges(groupMetadata, syncSession);

                    return tmp;

                }

                catch (SyncException se)

                {

                    if (se.ErrorNumber == SyncErrorNumber.StoreException)

                    {

                        SqlException sqlExcept = se.InnerException as SqlException;

                        if (sqlExcept != null && sqlExcept.Class == 16 && sqlExcept.State == 3)

                        {

                            throw new ApplicationException("ChangeTrackingCleanedUp", se);

                        }

                    }

                    throw se;

                }

                catch (Exception ex)

                {

                    throw ex;

                }

     

    Client Side Code:

    catch (TargetInvocationException ex)

                {

    // It doesn't go inside this if condition ... 

                    if (ex.InnerException != null && ex.InnerException.Message == "ChangeTrackingCleanedUp")

                    {

                        OrderDetailsCacheClientSyncProvider syncProvider = (OrderDetailsCacheClientSyncProvider)syncAgent.LocalProvider;

                        foreach (SyncTable st in syncAgent.Configuration.SyncTables)

                        {

                            if (st.SyncDirection != Microsoft.Synchronization.Data.SyncDirection.Snapshot)

                            {

                                syncProvider.SetTableReceivedAnchor(st.TableName, new SyncAnchor());

                            }

                        }

                        syncStats = syncAgent.Synchronize();

                    }

                    else

                    {

                        throw ex;

                    }

                }


    Divya
    Tuesday, July 12, 2011 4:36 PM
  • can you try catching a more generic exception on the client and see what the stack shows? try   catch (Exception ex) and inspect it.

    Wednesday, July 13, 2011 1:40 AM
    Moderator
  • I am able to catch "TargetInvocation Exception". The innerMessage is CFFAult. This is the same thing that is thrown if I dont have any server side code to catch the exception and throw it.

     


    Divya
    Wednesday, July 20, 2011 8:21 PM
  • either of these two works for me on the client:

     catch (FaultException ex)
                {
                    
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                }
    catch (Exception ex)
                {
                    
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                }

    and the message is not in the InnerException, just the top level exception.

     

    Thursday, July 21, 2011 2:03 AM
    Moderator
  • On my client side I want to catch the specific exception in this case so that I can set the Anchor and run the sync funtion again. I will do these steps only if I am sure that the exception I got is "Change Tracking Cleanup". 

    Since my client is mobile application, the System.ServiceModel namespace doesnt include "FaultException" class. If i just use Exception, How should I check if the exception I got is "Change Tracking Cleanup" exception.

     


    Divya
    Thursday, July 21, 2011 1:22 PM
  • are you using a third party library in your app? have you tried going deep into your exception stack to see if there are other nested exceptions?
    Friday, July 22, 2011 1:08 AM
    Moderator