locked
SQLite database missing in debug after device disconnected and reconnected to USB RRS feed

  • Question

  • User368971 posted

    Hello, may be somebody can shed the light how to solve the following problem: I am writing app with xamarin forms using SQLite for storing local data. at some point I found, that sometimes my SQLite database missing . couple of days I was searching through internet trying to find the solution and checking everything .. today I found, that it happens after I disconnect device from USB, connect it back and trying to start debugging

    configuration. windows 10 pc (10.0.17134.407), MS VS 15.9.2, Xamarin Forms 3.4.0.1008975 , SQLite-net-pcl 1.5.231 . device Samsung S7edge (SM-G935FD) with android 8.0.0

    piece of code

            if (!File.Exists(dbfname))
            {
                System.Diagnostics.Debug.WriteLine("no database found, creating new");
                IsNewDB = true;
            }
            else
            {
                IsNewDB = false;
            }
    

    working as expected on a device during numerous debug session restarts, working on simulator, working on a device disconnected from computer. but once I connect it to computer and starts debugging session file.exists returns false

    database is here dbfname = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "dbname.db"

    thanks in advance

    ish

    Thursday, November 22, 2018 3:23 PM

All replies

  • User368971 posted

    for some reason after USB reconnection msbuild completely reinstall application .. I think that here all data is removed

    2>[BEGIN] Removing previous version of application 2>[MESSAGE] Removing previous version of application... 2>Removing previous version of application... 2>DEBUG RunShellCommand ce12160cd043882605 pm uninstall -k "com.companyname.Application" 2>DEBUG RunShellCommand ce12160cd043882605 pm uninstall -k "com.companyname.Application" 2>TASK: UninstallPackage pm uninstall -k "com.companyname.Application" completed?:Success 2> 2>TASK: UninstallPackage pm uninstall -k "com.companyname.Application" completed?:Success 2> 2>[END] 2>[BEGIN] Installing application on device 2>[MESSAGE] Copying application to device... 2>Copying application to device... 2>[PROGRESS] 10 2>10% ... 896kb of 8482kb copied 2>[PROGRESS] 20 2>20% ... 1728kb of 8482kb copied 2>[PROGRESS] 30 2>30% ... 2560kb of 8482kb copied 2>[PROGRESS] 40 2>40% ... 3456kb of 8482kb copied 2>[PROGRESS] 50 2>50% ... 4288kb of 8482kb copied 2>[PROGRESS] 60 2>60% ... 5120kb of 8482kb copied 2>[PROGRESS] 70 2>70% ... 5952kb of 8482kb copied 2>[PROGRESS] 80 2>80% ... 6848kb of 8482kb copied 2>[PROGRESS] 90 2>90% ... 7680kb of 8482kb copied 2>[PROGRESS] 100 2>100% ... 8482kb of 8482kb copied

    Friday, November 23, 2018 9:26 AM
  • User338216 posted

    Obviously its been a few years but I am assuming you had a different build that the build you were pushing since the build was purposefully reinstalled.

    Wednesday, July 29, 2020 6:56 PM