title: EntryPointNotFoundException in SQLite after displaying FolderBrowserDialog
body: <p>When using a 64-bit program System.Data.SQLite is throwing the following EntryPointNotFoundException:</p>
  
  <blockquote>
    <p>Unable to find an entry point named 'sqlite3_changes_interop' in DLL 'SQLite.Interop.dll'.</p>
  </blockquote>
  
  <p>Strangely it only occurs if <code>Foreign Keys=True</code> is specified in the connection string and more importantly only after I display a <code>FolderBrowserDialog</code>. I was browsing for a folder to display databases to load.</p>
  
  <p>The following code displays the problem:</p>
  
  <pre><code>public Form1()
  {
      InitializeComponent();
  
      // Exception below if this is displayed
      using (var diag = new FolderBrowserDialog())
      {
          diag.ShowDialog(this);
      }
  
      var conn = new SQLiteConnection("data source=':memory:'");
      conn.Open(); // Works fine
      conn.Close();
  
      // No exception below if displayed here instead
      //using (var diag = new FolderBrowserDialog())
      //{
      //    diag.ShowDialog(this);
      //}
  
      conn = new SQLiteConnection("data source=':memory:';foreign keys=True");
      conn.Open(); // EntryPointNotFoundException thrown here
      conn.Close();
  }
  </code></pre>
  
  <p>Opening the connection with <code>foreign keys=True</code> works fine if the dialog isn't shown or if it is shown after any other SQLite connection is opened. The code also works fine if the program runs as a 32-bit process. The behaviour is also the same if I use either the single mixed mode x64 SQLite assembly or the MSIL + x64 interop assembly. I'm using v1.0.92.0 so <a href="https://stackoverflow.com/q/14396656/1730559">this</a> is not the problem.</p>
  
  <p>So the question is why would showing the <code>FolderBrowserDialog</code> affect the System.Data.SQLite assembly finding the entry point in its own interop library and why would it only occur in a 64-bit process?</p>
  
  <p>As a work around I can load an in-memory database before doing anything else in the program but I don't like this "solution" as I'm using EF6 and would like to be able to use different providers configured via a config file or even at runtime via user input. Hence all the sqlite specific code is in another assembly. </p>