Skip to content

Unit-test external-ownership marking in tracking discovery, including an object reached by both paths #7376

Closed

Description

@thomhurst

Problem

PR #7328 (fixing #7205) gave ObjectGraphDiscoverer's tracking discovery a heldByExternalOwner flag, an injectedValues set, and a second traversal, so IAsyncInitializer objects beneath a scope-owned service are marked externally owned while values of TUnit-injected data-source properties stay with the tracker.

Coverage today is integration-level, in tests/TUnit.TestProject/Bugs/_7205:

  • an IAsyncInitializer dependency beneath a scope-owned service (NestedScopeDependencyTests), disposed exactly once;
  • a TUnit-injected IAsyncInitializer beneath a scope-owned service (NestedProbeService.Fixture), disposed exactly once.

Not covered: one object reached by both paths in the same graph, once as an injected property value and once as an IAsyncInitializer property of a scope-owned service. Nothing pins which owner wins.

Raised by the Claude review on #7328 (head ca412cb, item 4).

Acceptance criteria

  • Unit tests in tests/TUnit.UnitTests cover the three cases above directly against the discoverer, including the shared-object case, in source-generated and reflection property registries.
  • The shared-object case asserts that the tracker keeps an object that a TUnit-injected property supplies, and disposes it exactly once.

Blocked by #7382 (the ownership portion of replacement PR #7384). PR #7328 was closed without merging. Its implementation and review remain historical context.

Activity

  1. added
    enhancementNew feature or request
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 2, 2026
  2. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Triage: #7328 was closed without merging. Its external-ownership implementation is now in open PR #7384, which closes #7382. Replaced the broad #7205 parent dependency with #7382 so this follow-up can proceed as soon as ownership lands, without waiting for unrelated session-lifetime work in #7383. The requested work is still absent from main d8badac.

  3. thomhurst commented on Nov 5, 2026

    @thomhurst
    OwnerAuthor

    The replacement ownership implementation in #7635 carries forward the complete direct test suite from #7634 and adapts it to row scope owner handles. Its eight cases pass in both source-generated and reflection execution, with explicit property-registry checks. #7634 is closed as superseded; #7635 now closes this issue alongside #7378.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low: cleanup, minor enhancement, or rare edge caseenhancementNew feature or requestin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions