-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Exception calling Dispose on IJSInProcessObjectReference instance in Blazor WebAssembly #48280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The bug seems to arise from pull #46693. They switched from using IJSUnmarshalledRuntime to JSImport for calling "DotNet.jsCallDispatcher.disposeJSObjectReferenceById" but it fails. The JSImport attribute gives an incorrect location for the function to call. From [JSImport("DotNet.jsCallDispatcher.disposeJSObjectReferenceById", "blazor-internal")]
private static partial void DisposeJSObjectReferenceById([JSMarshalAs<JSType.Number>] long id); If switched to the below JSImport it works. [JSImport("globalThis.DotNet.jsCallDispatcher.disposeJSObjectReferenceById")]
private static partial void DisposeJSObjectReferenceById([JSMarshalAs<JSType.Number>] long id); |
Fix for bug dotnet#48280
Just submitted pull request #48287 for it. It is my first pull request to another repo. Constructive criticism is welcome. |
* Update JSInProcessObjectReference.cs Fix for bug #48280 * Add JSObjectReferences dispose tests --------- Co-authored-by: Mackinnon Buck <[email protected]>
* Update JSInProcessObjectReference.cs Fix for bug #48280 * Add JSObjectReferences dispose tests --------- Co-authored-by: Todd T <[email protected]> Co-authored-by: Mackinnon Buck <[email protected]>
Is there an existing issue for this?
Describe the bug
Calling Dispose on an instance of IJSInProcessObjectReference throws an exception. Only affects Blazor WebAssembly.
Affected versions of DotNet
8.0.0-preview.3.23177.8
8.0.0-preview.4.23260.4
Expected Behavior
I expected calling Dispose to not throw an exception.
Steps To Reproduce
Code to demonstrate the bug.
Or in a new Blazor WebAssembly project use the below code in the Program.cs
Exceptions (if any)
.NET Version
8.0.0-preview.4.23260.4
Anything else?
No response
The text was updated successfully, but these errors were encountered: