Open
Description
Describe the bug
I am seeing regularly below exception in my exception logs.
JsonSerializationMixin.GetObject[T] (Akavache.IBlobCache This, System.String key)
System.ArgumentNullException: Value cannot be null. Parameter name: source
at System.Reactive.Linq.Observable.SelectMany[TSource,TResult] (System.IObservable`1[T] source, System.Func`2[T,TResult] selector) <0x7c91370e34 + 0x000e0> in <11c0ec0fa99843708cbf96b5e08890cd>:0 \n at Akavache.JsonSerializationMixin.GetObject[T] (Akavache.IBlobCache This, System.String key)
I am not sure why it is occurring but it seems that maybe BlobCache is null according to the source code, if i am reading it correct.
public static IObservable<T> GetObject<T>(this IBlobCache blobCache, string key)
{
if (blobCache is null)
{
throw new ArgumentNullException(nameof(blobCache));
}
if (blobCache is IObjectBlobCache objCache)
{
return objCache.GetObject<T>(key);
}
return blobCache.Get(GetTypePrefixedKey(key, typeof(T))).SelectMany(DeserializeObject<T>);
}
If thats the case in what cases it maybe null ? I initialize akavache right inside the App.cs Constructor as
Akavache.BlobCache.ApplicationName = "myCache";
Akavache.BlobCache.EnsureInitialized();
and I only use Shutdown in Ondestroy
protected override void OnDestroy()
{
base.OnDestroy();
Akavache.BlobCache.Shutdown().Wait(); // this calls the shutdown code
Akavache.BlobCache.UserAccount = null; // clear out the static cached variables
}
If that is so far fine what could be the reason BlobCache is null after initialized?