praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.07k stars 1.42k forks source link

ToListAsync fails #897

Open ChristianM66 opened 4 years ago

ChristianM66 commented 4 years ago

The bug was reported in a similar way under #809.

ToListAsync(), ToArrayAsync() and CountAsync() throw an exception when under Android called. However, the exception is thrown in debug and release. It makes no difference whether breakpoints are set or not. With iOS the calls work without problems.

Java.Util.ConcurrentModificationException

Examples: var query = await database.Table().Where(x => x.Id == id).ToListAsync(); var query = await database.Table().Where(x =>iIds.Contains(x.d)).ToListAsync();

Tested:

Enviroment: Win10 1909 Visual Studio 2019 16.3.9 Android min. version 7.0 (Api 24) Android target version 9.0 (Api 28)

ChristianM66 commented 4 years ago

All Async calls, such as CountAsync, ToListAsync, ToArrayAsync etc. throw a Java.Util.ConcurrentModificationException

CaseAlexander commented 4 years ago

I just ran into a very similar issue and found that if I used .ToListAsync().ConfigureAwait(false) everything worked as expected.