You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace the process-wide externally-owned mark in ObjectTracker with per-owner tracking #7378
Raised by the Claude review of #7328 (comment 6569591414, point 3), which fixes #7205.
What:#7328 stops the object tracker from disposing services that a disposable dependency injection scope owns. It does this with a process-wide, permanent mark: ObjectTracker.MarkExternallyOwned (src/TUnit.Core/Tracking/ObjectTracker.cs) adds the object to a static ConditionalWeakTable. Several places compensate for that mark: UntrackObject, ShouldSkipTracking, the session-end sweep, and the TryAddInjected/TryAddOwned/heldByExternalOwner branch of ObjectGraphDiscoverer.DiscoverNestedObjectsForTracking. That branch marks nested initializer objects as a side effect of discovery. The check-then-mark is not atomic. ExternallyOwnedSingletonTests covers the interleaving the remarks describe.
Proposed: track ownership per owner instead of process-wide. The data source returns or registers an owner handle (the scope or row), and the tracker skips objects registered under it. That removes the static table, the race, and the mutation during traversal.
Acceptance:
No process-wide ownership state in ObjectTracker.
Objects that a scope owns are still initialized and never disposed by the tracker. Objects TUnit injected beneath them are still disposed once.
Bugs._7205 and ExternallyOwnedSingletonTests (or their replacements) pass in source-generated and reflection modes.
Prerequisite
Blocked by #7382, the ownership portion of replacement PR #7384. PR #7328 was closed without merging; its review remains historical context.
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.
Activity
thomhurst commentedon Nov 2, 2026
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.
fix: index weak row ownership and refresh shared graphs (#7378)
fix(core): refresh only consumed external ownership graphs (#7378)
fix(core): track external ownership per row scope (#7378)
fix(engine): refresh shared static fixture ownership (#7378)
Fix scoped ownership retention and registration costs (#7378)
Fix portable weak ownership and failed-row refresh (#7378)
Fix failed-row ownership refresh for every shared owner (#7378)
fix: refresh all shared service owners (#7378)
fix: coordinate owner pins with counter retirement (#7378)
fix: share static lease and counter locking (#7378)
fix(core): track external ownership per row scope (#7635)