Skip to content
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

Update JSInProcessObjectReference.cs #48287

Merged
merged 3 commits into from
May 24, 2023
Merged

Conversation

LostBeard
Copy link
Contributor

Fix for bug #48280 "Exception calling Dispose on IJSInProcessObjectReference instance in Blazor WebAssembly"

var jsRef = await js.InvokeAsync<IJSInProcessObjectReference>("caches.open", "default");
// below line throws an exception without fix
jsRef.Dispose();
  • [ x ] You've included inline docs for your change, where applicable.
  • [ x ] There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (Less than 80 chars)

Fixed JSImport attribute for call to "DotNet.jsCallDispatcher.disposeJSObjectReferenceById"

Fixes #48280

@LostBeard LostBeard requested a review from a team as a code owner May 17, 2023 17:22
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label May 17, 2023
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label May 17, 2023
@ghost
Copy link

ghost commented May 17, 2023

Thanks for your PR, @LostBeard. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@LostBeard
Copy link
Contributor Author

@dotnet-policy-service agree

@MackinnonBuck
Copy link
Member

Thanks for the contribution, @LostBeard!

Would you be able to add a test verifying that IJSInProcessObjectReference.Dispose() works correctly?

@LostBeard
Copy link
Contributor Author

@MackinnonBuck I am not exactly sure how to do what you are asking. I have created a demonstration project for the bug and the fix in my repo BlazorIJSInProcessObjectReferenceDisposeBugTest

Please let me know if that does not satisfy your request. I love Blazor and I am glad to help.

@MackinnonBuck
Copy link
Member

@LostBeard thanks for verifying your fix 🙂 Apologies for not being clearer - we have some automated end-to-end tests in this repository, and I was thinking a great additional test case would be verifying that JSInProcessObjectReference instances can be disposed from .NET.

Don't worry about adding those tests - I'm happy to do that.

Also, there are currently some big changes happening in this area (see #48294), so it might be best that this PR gets finalized after that PR gets merged. For example, DotNet.jsCallDispatcher is getting removed, so this fix would get immediately broken after that PR merges.

I'll keep this PR up to date with whatever changes happen elsewhere. Thanks again for your contribution!

@MackinnonBuck
Copy link
Member

/backport to release/8.0-preview5

@ghost
Copy link

ghost commented May 30, 2023

Hi @MackinnonBuck. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

@github-actions
Copy link
Contributor

Started backporting to release/8.0-preview5: https://github.com/dotnet/aspnetcore/actions/runs/5125101593

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception calling Dispose on IJSInProcessObjectReference instance in Blazor WebAssembly
3 participants