Migrate ResolveCodeAnalysisRuleSet to multithreaded execution - #13636
Merged
jankratochvilcz merged 1 commit intoJul 31, 2026
Merged
jankratochvilcz merged 1 commit into
jankratochvilcz merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the built-in ResolveCodeAnalysisRuleSet task to MSBuild’s multithreaded execution model by adopting IMultiThreadableTask and routing file-probe path resolution through TaskEnvironment so FileExists checks don’t accidentally consume process-wide current-directory state when tasks run concurrently.
Changes:
- Marked
ResolveCodeAnalysisRuleSetas thread-safe ([MSBuildMultiThreadableTask]) and implementedIMultiThreadableTaskwith aTaskEnvironmentproperty. - Updated ruleset probing logic to use
TaskEnvironment.GetAbsolutePath(...)forFileExistschecks while preserving[Output] ResolvedCodeAnalysisRuleSetstring semantics and warning message inputs.
Adds [MSBuildMultiThreadableTask] and IMultiThreadableTask, routing ruleset and include-directory path resolution through TaskEnvironment.GetAbsolutePath so the task no longer depends on process CWD when running under multithreaded mode. Closes #13569. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jankratochvilcz
force-pushed
the
jankratochvilcz/multithreaded/resolve-code-analysis-rule-set
branch
from
July 7, 2026 15:06
a86064a to
0a11cfa
Compare
OvesN
approved these changes
Jul 29, 2026
jankratochvilcz
deleted the
jankratochvilcz/multithreaded/resolve-code-analysis-rule-set
branch
July 31, 2026 09:07
jankratochvilcz
added a commit
that referenced
this pull request
Jul 31, 2026
…leSet (#14589) Follow-up to #13636 addressing @OvesN's review nit. Replaces the hand-written `<summary>` on the `TaskEnvironment` property with `<inheritdoc />`, matching the convention used by every other task migrated to multithreaded execution (`Copy`, `Delete`, `Unzip`, `ResolveAssemblyReference`, etc.). Doc-comment only — no behavior change. Co-authored-by: Jan Kratochvil <jankratochvl@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Migrates
ResolveCodeAnalysisRuleSetto support MSBuild's multithreaded execution model.Changes
[MSBuildMultiThreadableTask]applied; class implementsIMultiThreadableTaskwithTaskEnvironment = TaskEnvironment.Fallbackdefault.TaskEnvironment.GetAbsolutePath.Compatibility audit
Ran the 6-deadly-sins playbook (see
.github/skills/multithreaded-task-migration/SKILL.md):ResolvedCodeAnalysisRuleSetis assigned the originalCodeAnalysisRuleSetvalue or the unalteredPath.Combine(directory, CodeAnalysisRuleSet)joined string — noAbsolutePathis ever leaked into the output. Absolutization is used solely for theFile.Existsprobes.Compiler.UnableToFindRuleSetwarning continues to be formatted with the originalCodeAnalysisRuleSetuser input.Path.GetFullPath.CodeAnalysisRuleSetis short-circuited at the top before anyGetAbsolutePathcall, preserving the originalreturn nullbehavior. EmptyMSBuildProjectDirectoryis still gated by!string.IsNullOrEmptyso we never callGetAbsolutePathwith a degenerate combined path.Validation
Microsoft.Build.Tasks.csprojbuilds clean (0 warnings, 0 errors).ResolveAnalyzerRuleSet_Testspasses on bothnet10.0andnet472(12 tests × 2 TFMs = 24 passing).Part of #11834. Closes #13569.