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

[wasm] fail fast if the delegate was collected prematurely #56523

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/mono/wasm/runtime/binding_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,12 @@ var BindingSupportLib = {
// It's possible the managed object corresponding to this JS object was collected,
// in which case we need to make a new one.
if (!result) {

if (typeof js_obj.__mono_delegate_alive__ !== "undefined") {
console.log("The delegate target that is being invoked is no longer available. Please check if it has been prematurely GC'd.");
return null;
}

delete js_obj.__mono_gchandle__;
delete js_obj.is_mono_bridged_obj;
}
Expand Down