From 7ebcfb5268e0c91b58c5024ae48cd661fba47a05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 10 Sep 2026 19:43:15 +0000 Subject: [PATCH 1/4] Initial plan From 8d11bf9b0f7b2ac7b6072c4aa82eae16530cd1cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 10 Sep 2026 19:46:00 +0000 Subject: [PATCH 2/4] Document DoNotParallelize deferral and cancellation behavior Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> --- ...it-testing-mstest-writing-tests-controlling-execution.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md index f030eb959b62d..244a924110810 100644 --- a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md +++ b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md @@ -152,6 +152,10 @@ The `Workers` property specifies the maximum number of threads for parallel exec The prevents parallel execution for specific assemblies, classes, or methods. Use this attribute when tests share state or resources that can't be safely accessed concurrently. +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. In runs that include multiple test sources, each source has its own deferred tail. Because deferred tests can't overlap with other tests, a slow deferred test usually increases total run time by about its own duration. + +Because MSTest runs deferred tests only after the parallelizable phase finishes, a canceled or aborted run can end before MSTest executes deferred tests. + ```csharp [assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] @@ -195,7 +199,7 @@ public class MixedTests ``` > [!NOTE] -> You only need `DoNotParallelize` when you've enabled parallel execution with the `Parallelize` attribute. +> You only need `DoNotParallelize` when you've enabled parallel execution with the `Parallelize` attribute. When parallelization is disabled (the default), `DoNotParallelize` has no effect. ### `ResourceLockAttribute` From e08d5c15f8fd114fdde8683fc2794b2abe793aac Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Fri, 11 Sep 2026 16:32:13 -0700 Subject: [PATCH 3/4] Update documentation on MSTest deferred test execution Clarify that the execution order of deferred tests is an internal detail and may change in future MSTest versions. --- .../unit-testing-mstest-writing-tests-controlling-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md index 244a924110810..78c262ee6fb9c 100644 --- a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md +++ b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md @@ -154,7 +154,7 @@ The Date: Fri, 11 Sep 2026 16:34:59 -0700 Subject: [PATCH 4/4] Fix formatting issue in MSTest documentation --- .../unit-testing-mstest-writing-tests-controlling-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md index 78c262ee6fb9c..741301193eb75 100644 --- a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md +++ b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md @@ -154,7 +154,7 @@ The