Blazor.IndexedDB.Framework
Blazor.IndexedDB.Framework copied to clipboard
Cannot access database from OnAfterRender lifecycle method
If I try to access the database from the OnAfterRenderAsync lifecycle method, or binding to a method that accesses the database, the following exception is thrown:
One or more errors occurred. (JSRuntime must be set up correctly and must be an instance of JSRuntimeBase to use DotNetObjectRef.)
With the following stack trace:
at Microsoft.JSInterop.DotNetObjectRefManager.get_Current() at Microsoft.JSInterop.DotNetObjectRef`1..ctor(TValue value) at Microsoft.JSInterop.DotNetObjectRef.Create[TValue](TValue value) at TG.Blazor.IndexedDB.IndexedDBManager.OpenDb() at TG.Blazor.IndexedDB.IndexedDBManager.EnsureDbOpen() at TG.Blazor.IndexedDB.IndexedDBManager.GetRecords[TResult](String storeName) at Blazor.IndexedDB.Framework.Extensions.TaskExtensions.InvokeAsyncWithResult(MethodInfo this, Object obj, Object[] parameters) at Blazor.IndexedDB.Framework.IndexedDb.GetRows(Type propertyType, String storeName) at Blazor.IndexedDB.Framework.IndexedDb.LoadData() at Blazor.IndexedDB.Framework.IndexedDb.WaitForConnection() at Blazor.IndexedDB.Framework.IndexedDbFactory.CreateT
However, if I call the same method from a button click it works as expected.
Hi again :) could you maybe provide me an example project with the reproducible misbehaviour? Would be of great help.
Thank you for your patience and have a nice day :)