Akavache not working in Windows 8.1 Universal App

253 views Asked by At

I’m trying to make work Akavache in a Windows Universal Application (8.1 for now, using ReactiveUI 6.5).

To make sure that it is not related to my architecture, I did an empty solution that has all the necessary packages and requirements (VC++ for both platforms), and I still get the same issue. This is a blocker for me since I want all my queries to be cached.

Here's the code:

BlobCache.ApplicationName = "MyApp"; // In AppBootstrapper`

// In My ViewModel
SubmitCommand = ReactiveCommand.CreateAsyncTask(async _ =>
{
    var isTrue = await BlobCache.UserAccount.GetOrFetchObject("login_credentials",
        async () => await Task.FromResult(true)
    );
    // My Code never goes further than this

    if (!isTrue)
    {
        throw new Exception("I'm false!");
    }

    return isTrue;
});

SubmitCommand.Subscribe(isTrue => {
    Debug.WriteLine("I got a new value!");
});

SubmitCommand.ThrownExceptions.Subscribe(ex => {
    UserError.Throw(ex.Message, ex);
});

// In The View
ViewModel = new MainPageViewModel();
this.BindCommand(ViewModel, x => x.SubmitCommand, x => x.SubmitCommand);

public MainPageViewModel ViewModel
{
    get { return (MainPageViewModel)GetValue(ViewModelProperty); }
    set { SetValue(ViewModelProperty, value); }
}
public static readonly DependencyProperty ViewModelProperty =
    DependencyProperty.Register("ViewModel", typeof(MainPageViewModel), typeof(MainPage), new PropertyMetadata(null));

object IViewFor.ViewModel
{
    get { return ViewModel; }
    set { ViewModel = (MainPageViewModel)value; }
}

Edit After some debug, Windows Phone 8.1 Silverlight works, not Jupiter.

So what's missing?

I'm using RXUI 6.5 (latest) with a Windows Phone 8.1 (Jupiter) (with shared Universal Projects)

Updated: Akavache.Sqlite3 is causing the issue. InMemoryCache is working (removing Akavache.Sqlite3 "fixes" the problem), but not Sqlite3. Also, registering BlobCache's different types of cache (copy paste from https://github.com/akavache/Akavache/blob/3c1431250ae94d25cf7ac9637528f4445b131317/Akavache.Sqlite3/Registrations.cs#L32) is working apparently.. so I suppose the Registration class aren't working properly and calling new Akavache.Sqlite3.Registrations().Register(Locator.CurrentMutable); is not working.

Edit: My temporary solution is to copy paste this into my application, and I invoke it after BlobCache.ApplicationName. It works, but I shouldn't technically have to do that.

Thanks for your help

0

There are 0 answers