Avalonia app with WASM-based UI-plugins; looking to bounce some ideas around
Hey everyone.
I'm currently working on a plugin system as a side project to my main Avalonia app. The plugins are meant to be compiled WASM core modules and my app will consume them. The idea is to provide a sandboxed environment that any language (that compiles valid WASM core modules) can interact with. This is to allow developers some freedoms in what language they can choose to build the plugins.
Interop between the app and the plugin happens via Extism, a WASM plugin<->host service available for many languages. It allows for the following:
For some context on that: each plugin gets a dedicated slot on my app. One whole grid row that spans the entire width of the app. The height is determined by the content that the plugin wants to present (or a fixed height, if provided).
I'm currently working on a plugin system as a side project to my main Avalonia app. The plugins are meant to be compiled WASM core modules and my app will consume them. The idea is to provide a sandboxed environment that any language (that compiles valid WASM core modules) can interact with. This is to allow developers some freedoms in what language they can choose to build the plugins.
Interop between the app and the plugin happens via Extism, a WASM plugin<->host service available for many languages. It allows for the following:
- Sending packages from and to the plugin
- Extism can allocate a block of memory to place the data in, which is then read by the other side
- This can include any JSON-serialized object, which is then deserialized on the other side
- I have not found (or not checked enough for) a way to send unmanaged structs without serializing
- Plugins can import and export unmanaged methods
- The app can define unmanaged callbacks, which the plugin can then
and call at any time (with some limited arguments)DllImport - The plugin must define some expected exports (
) that the app will then call to get certain data[UnmanagedCallersOnly]
- The app can define unmanaged callbacks, which the plugin can then
For some context on that: each plugin gets a dedicated slot on my app. One whole grid row that spans the entire width of the app. The height is determined by the content that the plugin wants to present (or a fixed height, if provided).