Forum Xamarin.Forms

Sqlite DB is being erased after disconeect cable, reconnect and run in Debug from Visual studio

EliranEliran USMember ✭✭

Hi, I wrote a Xamarin.Forms app which reads and writes to Sqlite db.
This is what I do:

  1. Connect usb cable to the device (Android phone), click F5 (in Visual Studio 2017) for debugging.
  2. Make operations which write to SqliteDb (The location of the db is System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal).
  3. Turn off the app and run for debug again. EveryThing works fine. The data is there.

4.Now if I disconnect the cable, ReConnect it, Click again the F5 button for debugging...and all the db is gone.

It happens only when I run from the IDE for debug (If I use the app as a regular user (not running from Visual studio) the data stays as it should).

Things I tried already and didn't help:

  • In Debug-->Options-->Xamarin---> Checkd Preserve application data cache on device between deploys
  • In the manifest (in the application tag) I added android:allowBackup="false" android:fullBackupOnly="false"
  • On the device I turned off the option for Automatic Restore.

Does someone have an other idea what else can I do?

Sign In or Register to comment.