Repository navigation
Fix keyed decorator inner dependency binding (#109) - #116
Conversation
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
|
Implemented #109 in draft PR #116, final commit The decorator activator previously bound the supplied inner service to the first assignable parameter, even when that parameter had The production fix is one additional cached-metadata check with an explanatory code comment; the changelog is updated under vNext Bug Fixes. Verification:
Awaiting your review and explicit instruction before starting another issue. |
Keyed decorator activation previously assigned the supplied inner instance to the first assignable constructor parameter, including an earlier
[FromKeyedServices]dependency. ForWrapper([FromKeyedServices("other")] IWork other, IWork inner, [ServiceKey] object key), this could reject a valid constructor or silently swap the two services. Movinginnerfirst happened to work.The activator now reserves
ServiceKeyandFromKeyedServicesparameters for their own context/lookup and binds the inner only to an ordinary assignable parameter. This preserves explicit, inherited and null-key lookup regardless of argument order, including object-typed dependencies, repeated layers, optional defaults and rejected constructors. The production change is one extra metadata check with an explanatory comment. Changelog updated under vNext Bug Fixes.Verification:
3b158fa92b2a2ba628d4e5133ebb5c62165aa6c0in isolated branch/worktreecodex/fix-109-decorator-binding; checked the issue, comments/timeline, existing PRs, branches and prior Preserve ServiceKey and inherited-key constructor semantics in custom activation paths #51 fix before changes.508bbe6; two auxiliary registration-order fixtures corrected inec100d8, before the implementation commit. Corrected tests against unchanged production code: 93 failed / 84 passed / 0 skipped per target on net472/net8.0/net9.0/net10.0.e5a2ca47bd0554a5b6da000216651b0bc144c1da.ContinuousIntegrationBuild=True: passed for all library compile targets (netstandard2.0/net8.0/net9.0/net10.0) and test targets.git -c core.whitespace=cr-at-eol diff --check: passed.Fixes #109
Co-authored-by: Codex codex@openai.com