Skip to content

Bug: Bug: Breadcrumb thread-affinity tests assume Task.Run yields a distinct thread #900

Description

@drmoisan
  • Work Mode: full-bug

Summary

Two tests assert a thread-identity property while obtaining their "worker thread" from Task.Run:

  • QuickFiler.Test/Viewers/ItemViewerBreadcrumbThreadAffinityTests.cs:204
    • ConfigureBreadcrumbDropDown_WorkerThread_ThrowsBoundaryDiagnostic
  • QuickFiler.Test/Viewers/ItemViewerBreadcrumbThreadAffinityTests.cs:237
    • InitializeBreadcrumbPipeline_WorkerThread_ThrowsBoundaryDiagnostic

Task.Run guarantees only a thread-pool thread, never a different one. Under parallel test
execution the test body is itself running on a pool thread, so the constructing thread is also
pooled, and thread reuse can make the guard's CheckAccess() return true - at which point the
expected boundary diagnostic is never raised and the assertion fails.

.GetAwaiter().GetResult() blocking a pool thread while awaiting another compounds the pressure
under contention.

This is a determinism defect, not noise. It is the same family as the repository's standing rule
that a suite needing serial execution has already violated unit-test isolation: these tests pass or
fail depending on scheduler behaviour the test never controls.

Environment

(not provided in potential file)

Steps to Reproduce

(not provided in potential file)

Expected Behavior

(not provided in potential file)

Actual Behavior

(not provided in potential file)

Logs / Screenshots

(not provided in potential file)

Impact / Severity

(not provided in potential file)

Source

From: docs/features/potential/2026-09-14-breadcrumb-thread-affinity-tests-assume-taskrun-gives-distinct-thread.md

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions