Akavache icon indicating copy to clipboard operation
Akavache copied to clipboard

[Bug]: Secure Cache is not persisted from V10 to V11

Open JosueSquareSix opened this issue 2 months ago • 0 comments

Describe the bug 🐞

An existing Maui App that uses Akavache with V10 cannot access the data after updating to V11; the app throws the following exceptions.

SQLite.SQLiteException: no such table: CacheElement SELECT Value FROM CacheElement WHERE Key = ? AND (Expiration IS NULL OR Expiration = 0 OR Expiration > ?) AND TypeName = ?

System.Collections.Generic.KeyNotFoundException: The given key 'YourKey' (type 'YourKeyType') was not present in the cache.

SQLite.SQLiteException: not an error at SQLite.SQLiteCommand.ExecuteNonQuery()

Step to reproduce

Create a Maui app and install Akavache 10.2.41, and register the application name.

Registrations.Start(CacheName);
        BlobCache.ApplicationName = CacheName;
        BlobCache.Secure.ForcedDateTimeKind = DateTimeKind.Local;

Then insert an object in the secure cache.

BlobCache.Secure.InsertObject("test_key", "test_value");

var cacheObject = BlobCache.Secure.GetObject<string>("test_key");

After inserting a value in the cache, update Akavache to 11.4.1, use the new pattern builder to set up Akavache, and replace the BlocCache reference with CacheDatabase.

AppBuilder.CreateSplatBuilder().WithAkavacheCacheDatabase<NewtonsoftSerializer>(x => x
            .WithApplicationName(CacheService.CacheName)
            .UseForcedDateTimeKind(DateTimeKind.Local)
            .WithSqliteProvider()
            .WithSqliteDefaults());

Now use GetObject to retrieve the previously inserted object, and observe the exceptions.

CacheDatabase.Secure.GetObject<string>("test_key");

Reproduction repository

No response

Expected behavior

Secure data from BlocCache should be accessible in CacheDatabase.

Screenshots 🖼️

Image

IDE

Rider macOS

Operating system

MacOS

Version

26.1

Device

Any Device

ReactiveUI Version

No response

Additional information ℹ️

No response

JosueSquareSix avatar Nov 12 '25 05:11 JosueSquareSix