No window on first run: SQLite Error 14: 'unable to open database file'

Player Version

3R301

Issue

On the first run, it doesn’t show a window. I have to open Task Manager, delete the running instance, and run it for a second time.

The issue turns out to be when pop.db doesn’t exist before the program runs.

        public void InitDatabase()
        {
            // No error catching in here - if we fail to create this DB then we have big issues?
            this.databasePath = ApplicationSettings.Default.LibraryPath + @"\pop.db";

            if (!File.Exists(this.databasePath))
            {
                File.Create(this.databasePath);
            }

            using (var connection = new SqliteConnection("Filename=" + this.databasePath))
            {
                // Open the connection
                connection.Open(); <-- Exception: SQLite Error 14: 'unable to open database file'

Despite what the error says, the pop.db does exist by that line. I’ve even logged when it was created just above the using line.

I’ve tried flushing the File.Create() line to no avail, and I can’t think what else to try.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.