You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I dispose my JsObjectWrapperBase-derived object in the DisposeAsync of a component, I get an exception that JsRuntime is null. The problem is from there:
publicclassJsRuntimeObjectRef:IAsyncDisposable{internalIJSRuntimeJsRuntime{get;set;}[JsonPropertyName("__jsObjectRefId")]publicintJsObjectRefId{get;set;}publicasyncValueTaskDisposeAsync(){JsRuntimeObjectRefruntimeObjectRef=this;// HERE: runtimeObjectRef.JsRuntime is null in the next lineawaitJSRuntimeExtensions.InvokeVoidAsync(runtimeObjectRef.JsRuntime,"browserInterop.removeObjectRef",newobject[1]{(object)runtimeObjectRef.JsObjectRefId}).ConfigureAwait(false);GC.SuppressFinalize((object)runtimeObjectRef);}}
Not sure what might be causing this, it's not null in the object itself, so I added this method to my object:
publicnewasyncValueTaskDisposeAsync(){// NOTE: For some reason JsObjectRef's JsRuntime is null in DisposeAsync, so this is copied from thereawaitJsRuntime.InvokeVoidAsync("browserInterop.removeObjectRef",newobject[1]{JsObjectRef.JsObjectRefId});GC.SuppressFinalize(JsObjectRef);GC.SuppressFinalize(this);}
I'm using Blazor WASM 6.0.6 on .NET 6.
The text was updated successfully, but these errors were encountered:
When I dispose my
JsObjectWrapperBase
-derived object in theDisposeAsync
of a component, I get an exception thatJsRuntime
is null. The problem is from there:Not sure what might be causing this, it's not null in the object itself, so I added this method to my object:
I'm using Blazor WASM 6.0.6 on .NET 6.
The text was updated successfully, but these errors were encountered: