SQLite.Net-PCL
SQLite.Net-PCL copied to clipboard
Deadlock when trying to insert data asynchronously
Good afternoon,
Using Task.WhenAll for creating tables asynchronously (CreateTableAsync<T>) works well, but doing the same thing for Inserting data doesn't (InsertAsync<T>). Short example:
var task1 = _connection.InsertAsync(data1);
var task2 = _connection.InsertAsync(data2);
await Task.WhenAll(task1, task2);
Doing the above deadlocks the app. I have also tried to use CancellationToken, but it doesn't work either.
I have noticed that if I wait for the result of the first insert (e.g., using ContinueWith), it works, so it's definitely an issue with concurrency.
Any ideas on how to achieve this?
Sincerely, Luís Fernandes