Repository navigation
Fix Helix test sharding: parse TestFullMSBuild as boolean - #54000
Merged
MichaelSimons merged 1 commit intoApr 21, 2026
Merged
Conversation
The AssemblyScheduler methodLimit was using string.IsNullOrEmpty to check the TestFullMSBuild environment variable. On Windows TestBuild jobs, the pipeline YAML sets TestFullMSBuild to 'false' (a non-empty string), which caused the check to use methodLimit=32 instead of the intended 16. On Linux, the variable is not set at all, correctly resulting in methodLimit=16. This meant Windows TestBuild produced ~329 Helix work items while Linux produced ~514 for the same test assemblies, making Windows critical-path bound on its longest ~16m work item. Fix by properly parsing the env var as a boolean so both platforms consistently use methodLimit=16 for TestBuild, and 32 only for the FullFramework job where TestFullMSBuild is genuinely 'true'. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Helix test sharding behavior in the custom MSBuild task that creates xUnit Helix work items by correctly interpreting the TestFullMSBuild environment variable as a boolean flag (instead of “non-empty string”).
Changes:
- Determine
isFullMSBuildby checking whetherTestFullMSBuildequals"true"(case-insensitive). - Use that boolean to select the
AssemblySchedulermethodLimit(32 for full MSBuild, otherwise 16), restoring intended cross-OS symmetry for TestBuild jobs.
lbussell
reviewed
Apr 20, 2026
lbussell
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
AssemblySchedulermethodLimitwas determined by checkingstring.IsNullOrEmpty(Environment.GetEnvironmentVariable("TestFullMSBuild")). ThetestFullMSBuildparameter defaults tofalsefor all jobs (Windows, Linux, macOS).However, only the Windows-conditional test step includes
TestFullMSBuildin its env block (line 162), while the non-Windows test step does not set it at all (lines 168-178).Since
"false"is a non-empty string,IsNullOrEmptyreturnsfalse, and the code selectsmethodLimit=32on Windows instead of the intended16. On Linux/macOS the env var is absent (null), somethodLimit=16is correctly used.Impact
This caused an unintentional asymmetry in Helix work item counts (observed in build 1387124):
methodLimit=32), max item ~16.3mmethodLimit=16), max item ~15.9mBecause the Windows Helix pool is critical-path bound (276 agents, most running 1 item each), the larger shards made the longest work item the bottleneck. Fixing this should reduce the Windows Helix wall-clock by ~5-8 minutes.
Fix
Parse the environment variable as a boolean instead of checking for non-empty. This ensures:
methodLimit=16TestFullMSBuild=true):methodLimit=32(unchanged)