MAUI BlazorWebView, plugins architectures and multiple AppDomains - good plan or nah? #55700
Unanswered
richardhauer
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi community.
I have a MAUI desktop app that hosts a BlazorWebView.
The app uses a plugin model, whereby the plugins are packaged as nuget packages and reside in one of the AppData folders to be discovered and loaded at runtime by the shell (in alphabetical order). To achieve this, I have a custom assembly resolver that reads the
.deps.json
and tries to load dependent assemblies and native libraries out of the.nupkg
lib folder.This works great at the moment, but I envisage a time where two plugins have conflicting dependencies. Say, one loads Newtonsoft.Json 11 first and then a later loaded plugin requires 13 but 11 is already loaded.
To address this issue, I have considered using a separate AppDomain for each plugin. Each plugin is a Razor Class Library and can contain both services and UI components. I'm wondering if there's any guidance here on how to handle navigating across AppDomains in Blazor components? There's a lot of wiring to put together to even make a basic PoC here, so I'm curious if there's a better way I haven't thought of before I even attempt this.
If I attempt to load a Blazor component from a different AppDomain into the render tree will it work? Could I create some sort of "remoting shim" component that lives in the main AppDomain and remotes requests/responses to components in plugin AppDomains? Is this crazy? Is there a better way to solve this problem?
Any help / direction / feedback would be great!
Beta Was this translation helpful? Give feedback.
All reactions