We recently introduced a JavaScript.Runtime class with methods like the following:
|
public static int BindJSObject(int jsId, int mappedType) |
|
{ |
|
JSObject? obj; |
|
lock (_boundObjects) |
These methods are invoked through JS code here:
|
var namespace = "System.Runtime.InteropServices.JavaScript"; |
|
var classname = binding_fqn_class.length > 0 ? binding_fqn_class : "Runtime"; |
|
this.bind_js_obj = get_method ("BindJSObject"); |
|
this.bind_core_clr_obj = get_method ("BindCoreCLRObject"); |
|
this.bind_existing_obj = get_method ("BindExistingObject"); |
|
this.unbind_js_obj = get_method ("UnBindJSObject"); |
However, the linker doesn't know that these methods need to be preserved, so it is trimming them out. Thus, a trimmed Blazor app doesn't load successfully.
We should enable it so these methods are preserved by the linker.
cc @marek-safar @lewing
We recently introduced a JavaScript.Runtime class with methods like the following:
runtime/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Runtime.cs
Lines 61 to 64 in 9ce5e48
These methods are invoked through JS code here:
runtime/src/mono/wasm/runtime/binding_support.js
Lines 60 to 61 in 2c3cd0d
runtime/src/mono/wasm/runtime/binding_support.js
Lines 79 to 82 in 2c3cd0d
However, the linker doesn't know that these methods need to be preserved, so it is trimming them out. Thus, a trimmed Blazor app doesn't load successfully.
We should enable it so these methods are preserved by the linker.
cc @marek-safar @lewing