Skip to content

Fix ordinary decoration without a keyed availability probe (#120) - #123

Merged
AGiorgetti merged 2 commits into
developfrom
codex/fix-120-ordinary-decoration-probe
Oct 9, 2026
Merged

AGiorgetti merged 2 commits into
developfrom
codex/fix-120-ordinary-decoration-probe

Conversation

@AGiorgetti

Copy link
Copy Markdown
Contributor

Original implementation-type activation behind a decorator unconditionally required IServiceProviderIsKeyedService. Providers exposing ordinary availability probing and keyed resolution therefore failed even for a parameterless original. The same registration succeeded in published 0.8.0.

Fixes #120. Prioritized as the new regression among the open bug/P2 issues; #121 and #122 report pre-existing defects and remain separate.

The native-compatible activator now acquires the keyed availability probe only while planning a dependency with a non-null lookup key. Ordinary dependencies and contextual ServiceKey injection use their existing paths. Actual explicit/inherited-key dependencies retain their keyed-probe requirement, and nonempty DependsOn maps keep their existing capability contract.

Ordinary generic-constraint checks now pass the ordinary probe to the existing registration-snapshot helper. Native DI exposes the same descriptor owner through both interfaces, preserving the #111 checks without requesting a hidden keyed probe. This changes the cache/helper interface type and adds no reflection lookup; exact native-type checks, descriptor-shape guards, snapshot preference and weak provider-specific caching remain. The architecture document explains this adjustment and the vNext changelog records the fix.

Verification on Windows:

  • Tests committed before implementation: 75 failures and 6 passing controls on each of net472/net8.0/net9.0/net10.0. The 81 new test cases cover native/snapshot/diagnostic providers, ordinary and probe-only wrappers, parameterless/ordinary/generic/context-key originals, null/non-null owner contexts, one/two layers, all lifetimes, disposal, native constructor policies, generic-constraint failures, and actual keyed dependencies.
  • Exact issue probe: current develop failed after decoration on all four targets; published 0.8.0 succeeded on all four; the fixed source succeeds on all four.
  • Restore and Release solution build with ContinuousIntegrationBuild=True: passed. Zero errors or compiler/analyzer warnings. Only the two existing net472 support warnings from Microsoft.Extensions.Telemetry.Abstractions and Microsoft.Extensions.Diagnostics.Testing 10.0.0 remain.
  • Full suite: 2,578 passed, zero failed/skipped on each target (10,312 total). The net472 tests executed under .NET Framework 4.8.9345.0.
  • Native DI 10.0.0 hot-cache probes: all four targets passed, each with 100 interleaved enumerations after observed native compilation.
  • Whitespace check passed. No applicable checks were unavailable.

Exact final-commit CI results will be added to the discussion when complete. Draft for review; work pauses before the next issue. Remaining open defects mean the release-validation checkpoint is still pending their resolution and review.

Co-authored-by: Codex codex@openai.com

Copy link
Copy Markdown
Contributor Author

Implemented in draft PR #123: #123

This was prioritized as the new regression among the open bug/P2 reports. The exact issue reproduction independently confirms that develop fails after decoration on net472/net8.0/net9.0/net10.0 while published 0.8.0 succeeds on every target. The fixed source now succeeds on every target too.

The original-type activator previously requested IServiceProviderIsKeyedService before examining any constructor. It now acquires that probe only when a constructor dependency needs a non-null lookup key. Parameterless and ordinary-dependency originals, null owner contexts, and direct ServiceKey injection therefore retain ordinary provider support. Private decorator slots still use keyed resolution; availability probing and keyed resolution remain separate capabilities. Actual explicit/inherited-key dependencies still fail clearly when the keyed availability probe is missing. Nonempty DependsOn maps retain their existing requirements.

Preserving #111's generic-constraint checks required the existing snapshot helper/cache to accept the ordinary probe interface as well. For native DI, both interfaces refer to the same CallSiteFactory descriptor owner. The helper keeps its exact native-type guard, copied descriptor field, metadata-shape guard, weak provider-specific cache, and preference for Mammoth's snapshot. There is no additional reflection lookup or dependency activation during planning. The rationale is documented in the architecture document, already linked from the code comment and README Architecture section.

Tests were committed first: 75 failed and 6 keyed controls passed on each target. All 81 new cases now pass, including wrappers whose ordinary probe implements only IServiceProviderIsService, native/snapshot/diagnostic providers, repeated layers, lifetimes/disposal, constructor policies, constraint failures, and keyed controls.

Verification for final commit 7cb718572fa423b050c6083ae554f66064d35cb6:

  • Local Windows restore and Release CI-style build passed.
  • Local and Windows CI suites each passed 2,578 tests on all four targets: 10,312 passed, zero failed/skipped per run. net472 executed under .NET Framework 4.8.9345.0.
  • Local and CI native DI 10.0.0 cache probes passed on all four targets: 100 interleaved enumerations each after observed native compilation.
  • Whitespace check passed. No applicable checks were unavailable.
  • Only the two existing net472 support warnings from Microsoft.Extensions.Telemetry.Abstractions and Microsoft.Extensions.Diagnostics.Testing 10.0.0 remain; no compiler/analyzer warnings or errors.
  • Exact-commit CI succeeded. Pack and Publish were skipped.

Paused for review before another issue. #121 and #122 remain separate open defects; resolve and review those before completing the release-validation checkpoint. No release actions were taken.

@AGiorgetti
AGiorgetti marked this pull request as ready for review October 9, 2026 09:43
@AGiorgetti
AGiorgetti merged commit 571df30 into develop Oct 9, 2026
2 checks passed
@AGiorgetti
AGiorgetti deleted the codex/fix-120-ordinary-decoration-probe branch October 9, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unkeyed decoration regresses providers without a keyed availability probe

1 participant