Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Cannot access database from OnAfterRender lifecycle method #12

Open
dmarciano opened this issue Jul 14, 2019 · 1 comment
Open

Cannot access database from OnAfterRender lifecycle method #12

dmarciano opened this issue Jul 14, 2019 · 1 comment

Comments

@dmarciano
Copy link

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.

@Reshiru
Copy link
Owner

Reshiru commented Jul 24, 2019

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 :)

@Reshiru Reshiru added this to the v1.0.2 milestone Jul 24, 2019
@Reshiru Reshiru removed this from the v1.0.2 milestone Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants