Skip to content

Clarify MSTest [DoNotParallelize] deferred execution and cancellation semantics - #55941

Open
meaghanlewis with Copilot wants to merge 4 commits into
mainfrom
copilot/update-donotparallelize-docs
Open

Clarify MSTest [DoNotParallelize] deferred execution and cancellation semantics#55941
meaghanlewis with Copilot wants to merge 4 commits into
mainfrom
copilot/update-donotparallelize-docs

Conversation

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

[DoNotParallelize] docs described only mutual exclusion, but omitted two scheduler behaviors that affect correctness assumptions and runtime cost: deferred end-of-source execution and early-cancellation skip behavior. This PR updates the conceptual MSTest execution guidance to document those semantics explicitly and scope them correctly to each test source (assembly).

  • Behavioral semantics added

    • Documents that MSTest partitions each source into parallelizable and nonparallelizable sets when in-assembly parallelization is enabled.
    • States that the parallelizable set runs first, and DoNotParallelize tests run serially afterward as a deferred tail.
  • Execution scope clarified

    • Clarifies that “runs last” is per test source/assembly, not global across a multi-assembly run.
  • Cancellation interaction documented

    • Explains that deferred tests might not execute if the run is canceled or aborted before the parallelizable phase completes.
  • Existing note tightened

    • Makes explicit that DoNotParallelize is inert when parallelization is not enabled (default behavior).
When you enable in-assembly parallelization, MSTest partitions each test source (assembly) into parallelizable and nonparallelizable tests. MSTest runs the parallelizable set first, then runs the `DoNotParallelize` set one test at a time at the end of that source's run.

Because MSTest runs deferred tests only after the parallelizable phase finishes, a canceled or aborted run can end before MSTest executes deferred tests.

Internal previews

File Preview link
docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Learn preview

Build report

Copilot AI lite review requested due to automatic review settings September 10, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MSTest [DoNotParallelize] docs to include defer-to-end ordering Clarify MSTest [DoNotParallelize] deferred execution and cancellation semantics Sep 10, 2026
Copilot AI requested a review from meaghanlewis September 10, 2026 19:46
@meaghanlewis
meaghanlewis marked this pull request as ready for review September 10, 2026 22:47
@meaghanlewis
meaghanlewis requested a review from a team as a code owner September 10, 2026 22:47
Comment thread docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md Outdated
Clarify that the execution order of deferred tests is an internal detail and may change in future MSTest versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSTest [DoNotParallelize] docs omit defer-to-end ordering and cancellation behaviour

4 participants