Local Cache Sync Problems Result From Upgrading to latest betas RRS feed

  • Question

  • I have been developing an application using sync services on Sql Server 2005 in VS 2008.  With the advent of the latest VS 2008 service pack SP1 Beta, I decided to try a rebuild of the system around Sql Server 2008.  I upgraded to the following components:


    VS 2008 SP1 Beta in Windows XP 32 bit SP 3 latest updgrades

    .net framework 3.5 SP1 Beta

    Sql Server 2008 64 bit addition Feb CTP on the server (x64 Windows Server 2008 no HyperV - latest upgrades)

    Microsoft Sync Services v1.0 CTP v1.0 CTP2 (x86)

    Microsoft Sync Services for ADO.net (x86)

    Microsoft Sql ServerCompact 3.5 SP1 English Beta


    I am now experiencing these problems:


    1.) The WCF service project in the solution is NOT Visible in the Server Sync Dialog Box in the Client Local DB Cache Project.  ( The service project installs and runs correctly however)

    2.) Since I could not export the sync files to the Service Project, I tried syncing the local cache directly from the app but got the following inner exception stack trace:


       at System.DateTime.System.IConvertible.ToInt64(IFormatProvider provider)
       at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
       at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)


    This is odd because I am able to sync the local cache from the Sync Dialog box when configuring it.


    Here is the Sync Code in the UI App:


    private static ClientLocalDataCache.GrayMatterDataSetTableAdapters.GeneralCodesTableAdapter generalCodesTA =

    new ClientLocalDataCache.GrayMatterDataSetTableAdapters.GeneralCodesTableAdapter();

    public static ClientLocalDataCache.GrayMatterDataSetTableAdapters.GeneralCodesTableAdapter GeneralCodesTA


    get { return generalCodesTA; }


    private static ClientLocalDataCache.LocalDataCacheSyncAgent syncAgent =

    new ClientLocalDataCache.LocalDataCacheSyncAgent();


    public static void SyncLocalCacheAndRemoteServer()




    syncAgent.GeneralCodes.SyncDirection = SyncDirection.Bidirectional;

    syncStatistics = syncAgent.Synchronize();



    catch (TimeoutException timeProblem)


    Console.WriteLine("Timeout :" + timeProblem.Message);


    catch (FaultException faultException)


    Console.WriteLine("Fault :" + faultException.Message + faultException.StackTrace);


    catch (CommunicationException commException)


    Console.WriteLine("Comm Exception :" + commException.Message + commException.StackTrace);


    catch (System.Reflection.TargetInvocationException targetException)


    Console.WriteLine("InvocationException :" + targetException.Message + targetException.StackTrace);


    catch (Exception exception)


    Console.WriteLine("Unknown Exception :" + exception.Message + exception.StackTrace);





    Here are my questions:


    1.)  Did I upgrade to the correct components? 

    2.)  Should I have gotton the x64 Sync Services stuff instead?

    3.)  Have I missed some configuration settings in VS studio?

    4.) What is the recommended set of upgrades allowing the safest development for this scenario?


    This is a general question about segregating the solution into tiers:


    It seams like it would be advantagous to keep a single data set with tables from both the local cache and the the tables I want to access from the remote DB both from a conceptual perspective and a practical perspective.  The N-tier walkthough, however, creates two different data sets which does not seem to me an optimal solution. 


    What is really the best practice from a Sync Services perspective?  Separate local cache and remote data into two datasets as per the walkthrough or combine local and remote tables in one dataset and why?


    P.S. Here is the Outer Exception Stack Trace....


       at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
       at System.Data.SqlClient.SqlParameter.GetCoercedValue()
       at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
       at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters)
       at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.EnumerateChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession, IDbTransaction transaction, EnumerateChangeType changeType, SyncSchema traceSchema)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
       at Microsoft.Synchronization.SyncAgent.Synchronize()
       at ObjectToDataTier.DataRoot.SyncLocalCacheAndRemoteServer() in C:\Documents and Settings\cole.XXXX\My Documents\Visual Studio 2008\Projects\ClientProjects\ClientV01\ObjectToDataTier\DataRoot.cs:line 42


    Additional Information:

    I have another data tier that is configured to use the SyncServices contained in my WCF Sync Tier.  I completed the rewire and was able to update the dataset in that tier to SQL Server 2008 with no problems whatsoever.  ( the layout of the solution follows closely the n-tier walkthrough northwind example).


    I have monkeyed with the local cache side for a couple of days now and am ditw ...






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