title: Sql Server CE 3.5 Merge Replication Synchronise is Hanging
body: <p>I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server.  When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call to Synchronize().</p>
  
  <p>If I look at the replication monitor in sql server, it gets to the point where it says the subscription is no longer synchronising and doesn't show any errors.  Therefore I am assuming this to mean the synchronisation is complete.</p>
  
  <p><a href="http://server/virtualdirectory/sqlcesa35.dll?diag" rel="nofollow noreferrer">http://server/virtualdirectory/sqlcesa35.dll?diag</a> does not report any issues.</p>
  
  <p>This is my first attempt at any handheld development, so I may have done something daft.  However, SQL Server seems to be reporting a successful synchronisation.</p>
  
  <p>Any help would be greatly appreciated as I have spent ages on this ! </p>
  
  <p>Here is my code.</p>
  
  <pre><code>const string DatabasePath = @"SD Card\mydb.sdf";
  var repl = new SqlCeReplication
                 {
                     ConnectionManager = true,
                     InternetUrl = @"http://server/virtualdirectory/sqlcesa35.dll",
                     Publisher = @"servername",
                     PublisherDatabase = @"databasename",
                     PublisherSecurityMode = SecurityType.DBAuthentication,
                     PublisherLogin = @"username",
                     PublisherPassword = @"password",
                     Publication = @"publicationname",
                     Subscriber = @"PPC",
                     SubscriberConnectionString = "Data Source=" + DatabasePath
                 };
  try
  {
      Cursor.Current = Cursors.WaitCursor;
      if (!File.Exists(DatabasePath))
      {
          repl.AddSubscription(AddOption.CreateDatabase);
      }
      repl.Synchronize();
      MessageBox.Show("Successfully synchronised");
  }
  catch (SqlCeException e)
  {
      DisplaySqlCeErrors(e.Errors, e);
  }
  finally
  {
      repl.Dispose();
      Cursor.Current = Cursors.Default;
  }
  </code></pre>