title: Copying sqlite3 database to user folder and loading the database causes the app can not launch during WACK verification
body: <p>My app copy a sqlite3 database to user folder when users first time run the app</p>
  <pre><code>using System;
  using System.Collections;
  using SQLitePCL;
  
  //....
  
  public sealed partial class MainPage  
  {
  
  
      SQLiteConnection db;
  
      private void onLoaded(object sender, RoutedEventArgs e)
      {
          createEditableCopyOfDatabaseIfNeeded();//remove this line
      }
  
      public async void createEditableCopyOfDatabaseIfNeeded()
      {
          StorageFolder aFolder = await StorageFolder.GetFolderFromPathAsync(ApplicationData.Current.LocalFolder.Path);
  
          if (await aFolder.TryGetItemAsync(&quot;app.data&quot;) != null)
          {
              db = new SQLiteConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, &quot;app.data&quot;));
          }
          else  
          {
              var afile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(&quot;ms-appx:///Assets/app.data&quot;));
  
              if (afile != null)
              {
                  try
                  {
                      if(await afile.CopyAsync(ApplicationData.Current.LocalFolder, &quot;app.data&quot;) != null)
                      {
                          db = new SQLiteConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, &quot;app.data&quot;));
                      }
                  }
                  catch (Exception)
                  {
                  } 
              }
          }
      }
  }
  </code></pre>
  <p>This code works on my PC, but if I use WACK to verify, it reports can not launch app.</p>
  <p>If I remove the line</p>
  <pre><code>createEditableCopyOfDatabaseIfNeeded();
  </code></pre>
  <p>the app can pass WACK and launch, but it can not work correctly (database does not open).</p>
  <p>later, I found that</p>
  <pre><code>if(await afile.CopyAsync(ApplicationData.Current.LocalFolder, &quot;app.data&quot;) != null)
  </code></pre>
  <p>cause app can not launch, even I change 'app.data' to a small size png file, it still does not work, this means that the function</p>
  <p><strong>CopyAsync</strong> causes the app can not launch in WACK</p>
  <pre><code>-------------------------------------------------WACK error report
  failed Platform version launch
  Cannot launch App
  The app  failed platform version launch test.
  failed  App launch
  Cannot launch App
  failed Crashes and hangs
  Executable myapp.exe was detected by Windows Error Reporting and experienced a crash or hang.
  Application  was detected by Windows Error Reporting and experienced a crash or hang.
  Crash dump file myapp.exe.1016.dmp was created by Windows Error Reporting and provides additional information.
  Crash dump file myapp.exe.12440.dmp was created by Windows Error Reporting and provides additional information.
  
  ----------------------------------------------
  </code></pre>
  <p>Your comments are welcome</p>