title: c# to vb using Sync Framework strange error
body: <p>I followed Microsoft's walkthrough for Sync Framework which is written in C#. And I wish to translate it to VB. I have simplified the code as much as possible. Both codes compile fine. They are running under 2 projects within the same solution. C# runs fine, but VB gives the following error.</p>
  
  <p>System.Data.SqlClient.SqlException was unhandled
    Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Specified LocalDB instance name is invalid.
  )</p>
  
  <p>Searching for this error, it leads toward an error in the connection string, but as you can see both connection strings are identical. The only difference is that one is running in C# the other in VB.</p>
  
  <p>The C# Code is:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  using System.Data.SqlClient;
  using Microsoft.Synchronization;
  using Microsoft.Synchronization.Data;
  using Microsoft.Synchronization.Data.SqlServer;
  
  
  namespace ExecuteExpressSync
  {
  class Program
  {
      static void Main(string[] args)
      {
  
          SqlConnection clientConn = new SqlConnection("Data Source=(LocalDB)\\v11.0;AttachDbFilename=c:\\Database\\SyncExpressDB.mdf;Integrated Security=True");
          SqlConnection serverConn = new SqlConnection("Data Source=Toshiba\\SQLEXPRESST;Initial Catalog=SyncDB;User ID=sa;Password=XXX");
  
          SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
  
          syncOrchestrator.LocalProvider = new SqlSyncProvider("ProductsScope", clientConn);
          syncOrchestrator.RemoteProvider = new SqlSyncProvider("ProductsScope", serverConn);
  
          syncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload;
  
          SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
  
          Console.WriteLine("Total Changes Downloaded: " + syncStats.DownloadChangesTotal);
  
      }
  
  }
  }
  </code></pre>
  
  <p>and the VB code is:</p>
  
  <pre><code>Imports System.Data.SqlClient
  Imports Microsoft.Synchronization
  Imports Microsoft.Synchronization.Data
  Imports Microsoft.Synchronization.Data.SqlServer
  
  Module Module1
  
  Sub Main()
  
      Dim clientConn As SqlConnection = New SqlConnection("Data Source=(LocalDB)\\v11.0;AttachDbFilename=c:\\Database\\SyncExpressDB.mdf;Integrated Security=True")
      Dim serverConn As SqlConnection = New SqlConnection("Data Source=Toshiba\\SQLEXPRESST;Initial Catalog=SyncDB;User ID=sa;Password=XXX")
  
      Dim syncOrchestrator As SyncOrchestrator = New SyncOrchestrator
  
      syncOrchestrator.LocalProvider = New SqlSyncProvider("ProductsScope", clientConn)
      syncOrchestrator.RemoteProvider = New SqlSyncProvider("ProductsScope", serverConn)
  
      syncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload
  
      Dim syncStats As SyncOperationStatistics = syncOrchestrator.Synchronize()
  
      Console.WriteLine("Total Changes Downloaded: " + syncStats.DownloadChangesTotal)
  
  End Sub
  
  
  End Module
  </code></pre>
  
  <p>The error occurs in</p>
  
  <pre><code>Dim syncStats As SyncOperationStatistics = syncOrchestrator.Synchronize()
  </code></pre>