Skip to content

Conversation

@SteveSandersonMS
Copy link
Member

Previously we had two different JS interop primitives used by Blazor on WebAssembly:

  • mono_wasm_invoke_js_marshalled
  • mono_wasm_invoke_js_unmarshalled

The exact set of params and semantics was embedded in the runtime and not updatable without runtime changes.

This PR proposes a single replacement for both the above - mono_wasm_invoke_js_blazor - which:

  • Is not opinionated about the semantics of the call - it just passes it through to Blazor JS code. As such it doesn't have to distinguish marshalled and unmarshalled cases, unlike the previous implementation.
  • Doesn't fix a particular set of parameters up front - it just receives a void* and passes it through. Blazor can therefore organize whatever set of parameters it wants on some struct and pass it through. As such it doesn't have to distinguish between sync and async calls, unlike the previous implementation.

I'm suggesting we do this now so that we can implement some enhancements to JS interop on the Blazor side without needing further runtime changes.

#endif

// Blazor specific custom routines - see dotnet_support.js for backing code
extern void* mono_wasm_invoke_js_blazor (MonoString **exceptionMessage, void *callInfo, void* arg0, void* arg1, void* arg2);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the arg0/arg1/arg2 params is so we can retain the earlier semantics about how reference and value types are represented in the unmarshalled interop cases.

@SteveSandersonMS
Copy link
Member Author

@lewing I don't know what's going on with the build failures - they seem unrelated to this PR.

Copy link
Member

@lewing lewing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look fine. CI is having issues.

@SteveSandersonMS SteveSandersonMS merged commit f4179b9 into master Aug 6, 2020
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@jkotas jkotas deleted the stevesa/unify-blazor-interop branch August 22, 2020 14:30
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants