Shared Blazor Components Require Matching Dependency Contracts in Every Host
A bug fix in a cross-platform Blazor project revealed that sharing UI components across browser and .NET MAUI native hosts does not guarantee each host can construct those components at runtime. A shared page that gained a required workflow dependency failed in the browser host because that host's composition root had no registration for it, even though native hosts handled it correctly. The root cause was treating a bootstrap shared among native apps as sufficient coverage for all hosts, including browser and preview environments. The resolution involved defining a minimal capability contract — covering only context revision, readiness, and change signalling — that both host types could implement honestly rather than sharing a single heavyweight service. Each composition root now registers its own adapter, ensuring the shared workflow's invariants are enforced consistently regardless of which host renders the page.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in