2

In my DB ctor:

databasePath = GetPath(docsFolder);
connection = new SQLiteAsyncConnection(databasePath);
connection.CreateTableAsync<BO>().Wait();

Database path is /data/user/0/com.companyname.AppName/files/fn.db3 (Package name filtered only here)

But that occurs when creating a table: Unhandled Exception: System.AggregateException: One or more errors occurred.

In BO I removed already DateTime: Currently only string and int are types that are applied.

public class BO
{
        [PrimaryKey, AutoIncrement]
        public int ID { get; set; }

        public string From { get; set; }

        public string To { get; set; }

        public string Note { get; set; }
}

NuGet:

  <package id="sqlite-net-pcl" version="1.4.118" targetFramework="portable45-net45+win8+wpa81" />
  <package id="SQLitePCLRaw.bundle_green" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />
  <package id="SQLitePCLRaw.core" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />

EDIT: In the AggregateException is one TypeInitializationException, which occurs when creating the table. But SQLite.SQLiteConnection is stated as TypeName concerning the TypeInitializationException when debugging. SQLiteAsyncConnection connection was clearly defined in the code. Is there a privilege missing to create a db file?

mnemonic
  • 1,605
  • 2
  • 17
  • 26
  • 2
    AggregateException is not informative. Try to catch it and print its e.Flatten().InnerExceptions. Or just stop in the debugger and check the inner exceptions. You should get there the actual error. – Grisha Feb 03 '18 at 17:19
  • Post edited. A TypeInitializationException occurs. – mnemonic Feb 07 '18 at 19:14
  • Can you please post the whole exception message? – Grisha Feb 07 '18 at 19:42
  • When reviewing the AggregateException entry, the debugger refers within the one entry only to the name(TypeInitializationException ) and the type(SQLite.SQLiteConnection). No message is displayed in the debugger. I will check whether printing is possible. – mnemonic Feb 08 '18 at 09:43
  • Ta-da. The type initializer for 'SQLite.SQLiteConnection' threw an exception. That's really helpful. Isn't it. – mnemonic Feb 08 '18 at 19:32
  • Yes it is. Now tr – Grisha Feb 08 '18 at 20:15
  • Now try to look at – Grisha Feb 08 '18 at 20:15
  • Or use Flatten() to see them all. – Grisha Feb 08 '18 at 20:17
  • As already mentioned, only one exception entry. InnerException does not provide additional information. – mnemonic Feb 08 '18 at 21:51
  • Maybe you can use "break when thrown" feature in VS studio exception helper and break when the first, most inner exception is thrown. And then check its message. There is really no other way to see what's going on. – Grisha Feb 08 '18 at 21:59
  • Thanks for your help. Perhaps I overlooked something. In the meantime, I played with additional references and it is solved. – mnemonic Feb 09 '18 at 11:18

1 Answers1

0

2 packages were missing within the Android project.

SQLitePCLRaw.lib.e_sqlite3.android
SQLitePCLRaw.provider.e_sqlite3.android
mnemonic
  • 1,605
  • 2
  • 17
  • 26