Я использую слепок SQLite-net-PCL. Я не могу создать таблицу с этой моделью. Я получаю это исключение здесь.
Состояние внутреннего исключения:
at SQLite.SQLite3.Prepare2 (SQLitePCL.sqlite3 db, System.String query) [0x0001b] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.620 I/mono-stdout( 3072): at SQLite.SQLite3.Prepare2 (SQLitePCL.sqlite3 db, System.String query) [0x0001b] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteCommand.Prepare () [0x00011] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.625 I/mono-stdout( 3072): at SQLite.SQLiteCommand.Prepare () [0x00011] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteCommand.ExecuteNonQuery () [0x00030] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.627 I/mono-stdout( 3072): at SQLite.SQLiteCommand.ExecuteNonQuery () [0x00030] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteConnection.Execute (System.String query, System.Object[] args) [0x00039] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.629 I/mono-stdout( 3072): at SQLite.SQLiteConnection.Execute (System.String query, System.Object[] args) [0x00039] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteConnection.MigrateTable (SQLite.TableMapping map, System.Collections.Generic.List`1[T] existingCols) [0x000ae] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.631 I/mono-stdout( 3072): at SQLite.SQLiteConnection.MigrateTable (SQLite.TableMapping map, System.Collections.Generic.List`1[T] existingCols) [0x000ae] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteConnection.CreateTable (System.Type ty, SQLite.CreateFlags createFlags) [0x0013e] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.632 I/mono-stdout( 3072): at SQLite.SQLiteConnection.CreateTable (System.Type ty, SQLite.CreateFlags createFlags) [0x0013e] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteConnection.CreateTable[T] (SQLite.CreateFlags createFlags) [0x00000] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.634 I/mono-stdout( 3072): at SQLite.SQLiteConnection.CreateTable[T] (SQLite.CreateFlags createFlags) [0x00000] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteAsyncConnection+<>c__DisplayClass31_0`1[T].<CreateTableAsync>b__0 (SQLite.SQLiteConnectionWithLock conn) [0x00000] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.636 I/mono-stdout( 3072): at SQLite.SQLiteAsyncConnection+<>c__DisplayClass31_0`1[T].<CreateTableAsync>b__0 (SQLite.SQLiteConnectionWithLock conn) [0x00000] in <eaa146ee868043e287f5507c8701ad9e>:0
at SQLite.SQLiteAsyncConnection+<>c__DisplayClass29_0`1[T].<WriteAsync>b__0 () [0x00013] in <eaa146ee868043e287f5507c8701ad9e>:0
02-01 18:18:23.638 I/mono-stdout( 3072): at SQLite.SQLiteAsyncConnection+<>c__DisplayClass29_0`1[T].<WriteAsync>b__0 () [0x00013] in <eaa146ee868043e287f5507c8701ad9e>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
02-01 18:18:23.640 I/mono-stdout( 3072): at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 02-01 18:18:23.641 I/mono-
public class Setting
{
[PrimaryKey]
// public int id { get; set; }
public int UserID { get; set; }
public string Email { get; set; }
public bool AutoUpload { get; set; }
public bool UseCellularData { get; set; }
public int MaxStoredRecordings { get; set; }
public string UnitPreference { get; set; }
public string DateFormatPreference { get; set; }
public string TimeFormat { get; set; }
public string SerialNo { get; set; }
}
Фактическое исключение:
Я получаю это исключение
System.AggregateException: One or more errors occurred.D/ConnectivityManager.CallbackHandler( 487): CM callback handler got msg 524294
02-01 19:06:50.907 I/mono-stdout( 487): at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 02-01 19:06:50.917 I/mono-stdout( 487): at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 at System.Threading.Tasks.Task.Wait () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
02-01 19:06:50.919 I/mono-stdout( 487): at System.Threading.Tasks.Task.Wait () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at Feelix.Storage.DatabaseManager..ctor (System.String dbPath) [0x0003c] in D:\22\developer branch\Feelix\Feelix\Feelix\Storage\DatabaseManager.cs:45
02-01 19:06:50.921 I/mono-stdout( 487): at Feelix.Storage.DatabaseManager..ctor (System.String dbPath) [0x0003c] in D:\22\developer branch\Feelix\Feelix\Feelix\Storage\DatabaseManager.cs:45
Thread finished: <Thread Pool> #2
The thread 0x2 has exited with code 0 (0x0).
Мой стол
database = new SQLiteAsyncConnection(dbPath);
database.CreateTableAsync<Patient>().Wait();
database.CreateTableAsync<User>().Wait()
database.CreateTableAsync<Setting>().Wait();
database.CreateTableAsync<DeviceSessionDB>().Wait();
database.CreateTableAsync<DeviceSessionRecordingsDB>().Wait();
Все таблицы созданы успешно, кроме настройки таблицы страниц.
Можете ли вы показать фактическое сообщение об исключении и код?
Нет, я не буду менять эту таблицу @SushiHangover
Привет @Crowcoder, я получаю это исключение
В вашем catch заблокируйте сгладить совокупное исключение и обновите вопрос с сообщением об исключении.
Привет @Crowcoder, см. обновленные данные выше, спасибо, Сурия.





Не уверен, что это исправит, но я использую асинхронный метод для создания таблиц вместо Wait(). Ниже показано, как я это делаю, используя ваш код (я удалил код асинхронной блокировки, чтобы сделать его более простым):
public class Repo {
//set up 'database' variable
public Repo() {
CreateTablesAsync()
}
private async void CreateTablesAsync() {
await database.CreateTableAsync<Patient>().ConfigureAwait(false);
await database.CreateTableAsync<User>().ConfigureAwait(false);
await database.CreateTableAsync<Setting>().ConfigureAwait(false);
await database.CreateTableAsync<DeviceSessionDB>().ConfigureAwait(false);
await database.CreateTableAsync<DeviceSessionRecordingsDB>().ConfigureAwait(false);
}
}
Вы пытаетесь изменить существующую таблицу?