fix(android): register TriggerAliasEditorViewModel so the Rules page works#22
Closed
HarryCordewener wants to merge 1 commit into
Closed
fix(android): register TriggerAliasEditorViewModel so the Rules page works#22HarryCordewener wants to merge 1 commit into
HarryCordewener wants to merge 1 commit into
Conversation
…works Opening the Rules page on Android threw "Cannot provide a value for property 'Vm' on type RulesPage. There is no registered service of type TriggerAliasEditorViewModel." — the view model was registered on the Web host (Program.cs) but never in the MAUI container (MauiProgram.cs), so DI failed when RulesPage tried to inject it. Register it in MauiProgram, mirroring the Web registration (IWorldStore-backed, transient). With this, the set of injected view models exactly matches the set registered in the MAUI container. Android head builds clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHCRc5CJ6595iMzEgYYdQp
There was a problem hiding this comment.
Pull request overview
Fixes an Android crash when navigating to the Rules page by aligning the MAUI DI container’s view model registrations with the Web host, ensuring TriggerAliasEditorViewModel can be resolved for RulesPage.
Changes:
- Register
TriggerAliasEditorViewModelinMauiProgram.csas a transient service backed byIWorldStore. - Add in-code context explaining why the registration is needed (host DI drift between Web and MAUI).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tapping Rules on Android crashed with an "Unknown Error". The log shows:
RulesPageinjectsTriggerAliasEditorViewModel, which is registered on the Web host (Program.cs) but was never registered in the MAUI container (MauiProgram.cs). So DI failed to resolve it on Android and the render threw. (Web was unaffected — it had the registration.)Fix
Register
TriggerAliasEditorViewModelinMauiProgram, mirroring the Web registration (IWorldStore-backed, transient). After this, the set of view models injected by the UI exactly matches the set registered in the MAUI container — verified there are no other gaps.Android head builds clean.
Note
This class of bug is host-DI drift between
Program.cs(Web) andMauiProgram.cs(MAUI). A follow-up could extract a sharedAddSharpClientViewModels(...)registration to prevent recurrence, but the scopes differ (Web usesScopedper-circuit; MAUI usesTransient/Singleton), so it isn't a trivial merge — left out of this fix.🤖 Generated with Claude Code