Closed marcustindab closed 7 months ago
Further investigations: This error happens when any barrel.Empty
-method is being executed. We've updated the nuget to the latest version (2.1.1) and I saw in your implementation that you've added the following flags SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex
. This is kind of a major issue for us. We're willing to give you any information you need to make an update for this. Our (physical) android device is running android 14, and we're using the latest version of .Net Maui.
More info extracted from our Application Insights:
Message: attempt to write a readonly database
Exception type: SQLite.SQLiteException
Failed method: SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery
SQLite.SQLiteException:
at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery (SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null)
at SQLite.SQLiteConnection.Insert (SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null)
at SQLite.SQLiteConnection.InsertOrReplace (SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null)
at MonkeyCache.SQLite.Barrel.Add (MonkeyCache.SQLite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at MonkeyCache.SQLite.Barrel.Add (MonkeyCache.SQLite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at MonkeyCache.SQLite.Barrel.Add (MonkeyCache.SQLite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at xxx.RequestManager.AddToCache (xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
So it turns out that the following lines are really important (for Android) in the .csproj-file:
<ItemGroup>
<TrimmerRootAssembly Include="MonkeyCache.SQLite" RootMode="library" />
<TrimmerRootAssembly Include="SQLite-net" RootMode="library" />
</ItemGroup>
Hope it helps someone!
Thanks a ton for this workaround. I was facing another SQLiteException, that no column id was found.
Hi,
We're using MonkeyCache and the SQLlite storage. When we run the function
barrel.EmptyAll()
then the following exception is being thrown:SQLite.SQLiteException: 'attempt to write a readonly database'
.