Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Native dependency injection - FAQ and troubleshooting

Platform spec article

Native dependency injection - FAQ and troubleshooting

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Normative text for locked v0.2 choices lives in feature hub ADRs (D-LMETA-DI-0001D-LMETA-DI-0010 under Native dependency injection adr/). This section retains troubleshooting only.

TopicadrId
Multiple implementations, host override, scope modelD-LMETA-DI-0005, D-LMETA-DI-0006, D-LMETA-DI-0007
Library launch, field inject, registry spellingD-LMETA-DI-0008, D-LMETA-DI-0003, D-LMETA-DI-0004
Pipeline placement, mod vs app hostD-LMETA-DI-0009, D-LMETA-DI-0010
Diagnostics band E1701–E1799Reserved on hub; codes in tables below
WebHostv0.3 — v0.2 is ConsoleHost + manual with (follow-up, not yet an ADR)

Field injection keeps type headers uniform and gives the compiler a single slot-lowering story for inject without ctor signature churn across inheritance. Constructor inject is rejected (E1712).

How do I consume two Storage implementations?

Section titled “How do I consume two Storage implementations?”

Register both in registry and inject inject Storage[] storages. Order follows deterministic registration merge order (see Design model).

Can I force a global service inside a named scope?

Section titled “Can I force a global service inside a named scope?”

Use inject global::Logger logger on a field or in init / dispose parameters.

Can a library launch its host for testing?

Section titled “Can a library launch its host for testing?”

No — use an App / test Host project target that **launch**es the library host, or a test harness entry approved by the tooling spec. launch on Lib is E1711.

Declare two host types and two targets (for example app and api), each with its own entry and one launch. Only one target runs per process invocation.

  • WebHost request pipeline entering a named scope without manual with on every handler.
  • Disposable-style corelib contract as optional supplement to dispose blocks.
SymptomLikely cause
E1705Two for Contract lines but singular inject Contract
E1706Field inject of scoped service outside with
E1711launch in a library target
E1712inject on constructor parameters
Wrong implementation at inject siteInner scope shadows global — use global::
E1702Two launch calls on one entry path