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
Shared disposal span tests capture duplicate or missing activities on Ubuntu net8.0 #7435
Two shared-object disposal span tests intermittently fail when the unit suite runs on Ubuntu with .NET 8. The same CI run passes .NET 9 and 10 and the Windows and macOS jobs. Expected: each test captures exactly its own disposal span.
Reproduction
Run dotnet run --project tests/TUnit.UnitTests -c Release -f net8.0 on Ubuntu, with the full suite executing concurrently.
PerClass_Shared_Object_Disposal_Emits_Span_Under_Class_Activity: Sequence contains more than one matching element.
Session_Shared_Object_Disposal_Emits_Span_Under_Assembly_Activity: Sequence contains no matching element.
Expected and actual
tests/TUnit.UnitTests/SharedObjectDisposeSpanTests.cs uses an AsyncLocal-scoped ActivityListener and selects a single activity by operation name. Investigate why the concurrent suite captures duplicate/missing spans and make capture deterministic, retaining the parent and scope assertions. No test should be skipped or weakened.
Environment
Ubuntu GitHub hosted runner, .NET SDK 10.0.403, target net8.0. Found while validating #7414.
Audited against main d87516cb9c: SharedObjectDisposeSpanTests still uses an AsyncLocal-scoped global ActivityListener and selects spans by operation name alone. The reported Ubuntu net8.0 duplicate/missing captures have no recorded fix or closing PR. Keep the deterministic-capture investigation and existing parent/scope assertions in scope.
The same PerClass test failed again with Sequence contains more than one matching element on Ubuntu net8.0 in run 41711535435, PR #7510 head 4aadab8bb94c67d8e20c00b65b4d2cd29edda19f, after #7492. This head predates the session ownership fix in #7509. Rebased #7510 onto main 5d9086ba57; all six SharedObjectDisposeSpanTests pass locally on net10.0. Only net10.0 is installed locally, so fresh CI must establish whether #7509 also removes this net8.0 recurrence. Retaining the evidence here rather than creating a duplicate issue; reopen if it recurs on the updated base.
Reopened after the same duplicate capture recurred on Ubuntu net8.0 in run 41772414009, PR #7535 head caa2377, which already includes #7509 and #7492.
The .NET 8 runtime explicitly allows duplicate listener callbacks: SynchronizedList.EnumWithAction in v8.0.22 restarts enumeration when another test adds or removes a listener. The existing parent filtering correctly isolates spans, but its queue counts repeated callbacks for the same Activity as separate spans. Capture must use Activity reference identity while still retaining distinct spans with identical operation names and parents. A listener-mutation regression can reproduce this deterministically without relying on test scheduling.
Activity
thomhurst commentedon Nov 3, 2026
Audited against main
d87516cb9c:SharedObjectDisposeSpanTestsstill uses an AsyncLocal-scoped global ActivityListener and selects spans by operation name alone. The reported Ubuntu net8.0 duplicate/missing captures have no recorded fix or closing PR. Keep the deterministic-capture investigation and existing parent/scope assertions in scope.Preserve parent-independent per-test disposal coverage (#7435)
Remove reporter dependency from span regression (#7435)
Isolate shared disposal span capture by parent activity (#7492)
thomhurst commentedon Nov 3, 2026
The same PerClass test failed again with
Sequence contains more than one matching elementon Ubuntu net8.0 in run 41711535435, PR #7510 head4aadab8bb94c67d8e20c00b65b4d2cd29edda19f, after #7492. This head predates the session ownership fix in #7509. Rebased #7510 onto main5d9086ba57; all six SharedObjectDisposeSpanTests pass locally on net10.0. Only net10.0 is installed locally, so fresh CI must establish whether #7509 also removes this net8.0 recurrence. Retaining the evidence here rather than creating a duplicate issue; reopen if it recurs on the updated base.thomhurst commentedon Nov 4, 2026
Reopened after the same duplicate capture recurred on Ubuntu net8.0 in run 41772414009, PR #7535 head caa2377, which already includes #7509 and #7492.
The .NET 8 runtime explicitly allows duplicate listener callbacks: SynchronizedList.EnumWithAction in v8.0.22 restarts enumeration when another test adds or removes a listener. The existing parent filtering correctly isolates spans, but its queue counts repeated callbacks for the same Activity as separate spans. Capture must use Activity reference identity while still retaining distinct spans with identical operation names and parents. A listener-mutation regression can reproduce this deterministically without relying on test scheduling.
Deduplicate repeated activity stop callbacks in tests (#7435) (#7557)