locked
Crash when copy SQLite Data Base To local Folder in Windows phone 8.1

    Question

  • Hello 

    I Use existing data base for my windows phone app when Create package from my app in first run app crashing and then when run again  open app

    my code :

            private async void CopyDatabase()
            {
                bool isDatabaseExisting = false;
    
                try
                {
                    StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("DataFile.db");
                    isDatabaseExisting = true;
                }
                catch
                {
                    isDatabaseExisting = false;
                }
    
                if (!isDatabaseExisting)
                {
                    StorageFile databaseFile = await Package.Current.InstalledLocation.GetFileAsync("DataBaseFile.db");
                    await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder, "DataFile.db", NameCollisionOption.ReplaceExisting);
    
                }
    
            }

    my data base file is 60 MB 

    in Emulator work good and not crashing

    how can solve this ?

    Please help 

    Tuesday, December 16, 2014 4:21 PM

All replies

  • What is the exception when the application crashes? Make sure you're running under a debugger.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 16, 2014 8:10 PM
    Moderator
  • don't give exception when debug in emulator when Get package from app and test in device crashing app in first run

    Tuesday, December 16, 2014 9:09 PM
  • Can you deploy to a phone and try it there under the debugger?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, December 17, 2014 3:44 PM
    Moderator
  • I deploy in device but not crashing just i run app by package crashing app 

    my app is windows phone 8.1 universal 

    Wednesday, December 17, 2014 5:37 PM