Skip to content

Add startup-time validator for missing peer module dependencies #130

@antosubash

Description

@antosubash

Across one consumer integration, four separate failure modes all came down to "module X is in the assembly graph but its peer module is missing":

Missing peer Symptom
Admin needs OpenIddict Startup crash, Body was inferred… (misleading minimal-API error)
Email needs BackgroundJobs Startup crash, Unable to resolve IBackgroundJobs
Admin/Users/etc. need Localization Silent — every label renders as bare key (Users.Title, Roles.ColName)
Tenants needs FeatureFlags Same *.Contracts-only ProjectReference shape

The crash cases are partially addressed by declaring runtime deps as PackageReferences (separate issue). But the silent-fallback cases (Localization missing → bare keys; menu items pointing to nonexistent peer routes) need an actual diagnostic.

Suggested fix

A single boot-time pass that:

  1. Scans [Module]-attributed types for declared dependencies
  2. Inspects endpoint handlers' DI parameter requirements
  3. Inspects shared useTranslation() calls vs TranslationLoader registration
  4. Emits clear diagnostics:
    • ModuleX endpoint Y requires service Z which is not registered (install module Q)
    • ModuleX uses translations but SimpleModule.Localization is not installed; UI labels will render as bare keys

Could ship as builder.AddSimpleModule(o => o.ValidateModuleGraph = true) for opt-in until stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions