Skip to content

Opt a second set of tasks into multithreaded execution - #17497

Merged
ViktorHofer merged 1 commit into
dotnet:mainfrom
ViktorHofer:mt-safe-subset-2
Sep 8, 2026
Merged

ViktorHofer merged 1 commit into
dotnet:mainfrom
ViktorHofer:mt-safe-subset-2

Conversation

@ViktorHofer

@ViktorHofer ViktorHofer commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Second extraction of safe task migrations from #17381.

  • Adds [MSBuildMultiThreadableTask] to another batch of tasks that have no static/process-wide state.
  • Resolves relative paths at the task boundary via TaskEnvironment.GetAbsolutePath.
  • Where a task calls into a helper, the absolute-path proof is carried in BCL FileInfo/DirectoryInfo rather than AbsolutePath, so shared helpers (FileUtilities, NuGetVersionUpdater) stay free of any MSBuild coupling and need no suppressions.
  • One suppression remains, for Path.GetTempPath() in NuGetVersionUpdater, which has no safe alternative yet (Add TaskEnvironment.GetTempPath() msbuild#14583).

Copilot AI lite review requested due to automatic review settings September 7, 2026 10:36

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 review overview

🟡 Changes recommended

It introduces binary-breaking public API signature changes (e.g., CatalogEntry.FromFile, CatalogBuilder.AddFile/WriteTo) that should retain string overloads for compatibility.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 High severity · 1 Medium severity · 1 Low severity

New issues introduced by this change (4)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath…
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to…
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like…
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes…
What changed in this PR

Opts an additional set of MSBuild task assemblies into in-proc multithreaded execution (-mt) by applying [MSBuildMultiThreadableTask], implementing IMultiThreadableTask, and resolving path inputs via TaskEnvironment at task boundaries to avoid reliance on ambient process state.

Changes:

  • Annotate additional tasks as multithreadable and inject TaskEnvironment to make path resolution project-scoped.
  • Resolve previously-relative/ambient file system inputs (files/directories, output paths, optional inputs) through TaskEnvironment with targeted null/optional handling.
  • Add thread-safety serialization in TargetFrameworkResolver.GetNearest to protect NuGet internal caches under concurrent use.
File Description
src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs Annotate task + resolve additional asset/output paths via TaskEnvironment.
src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs Annotate task + resolve input/output paths via TaskEnvironment.
src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs Annotate task + resolve RootDir-relative enumeration/comparisons via TaskEnvironment.
src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​ReadNuGetPackageInfos.cs Annotate task + resolve nupkg paths via TaskEnvironment.
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​ValidateFileVersions.cs Annotate task + resolve file paths via TaskEnvironment.
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​GenerateSharedFrameworkDepsFile.cs Annotate task + resolve inputs/outputs via TaskEnvironment (incl. optional runtime graph).
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​GeneratePlatformManifestEntriesFromTemplate.cs Annotate task + resolve existing file path before extracting versions.
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​GeneratePlatformManifestEntriesFromFileList.cs Annotate task + resolve OriginalFilePath before extracting versions.
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​FileUtilities.cs Switch helper APIs to consume AbsolutePath for task-safe path handling.
src/​Microsoft.DotNet.SharedFramework.Sdk/​src/​CreateFrameworkListFile.cs Annotate task + resolve item paths before calling file-version helpers and writing output.
src/​Microsoft.DotNet.PackageTesting/​VerifyTypes.cs Annotate task + resolve assembly inputs via TaskEnvironment; plumb AbsolutePath internally.
src/​Microsoft.DotNet.PackageTesting/​VerifyClosure.cs Annotate task + resolve assembly and output paths via TaskEnvironment; plumb AbsolutePath internally.
src/​Microsoft.DotNet.PackageTesting/​GetCompatiblePackageTargetFrameworks.cs Annotate task + resolve package paths via TaskEnvironment.
src/​Microsoft.DotNet.NuGetRepack/​tests/​VersionUpdaterTests.cs Update tests to match AbsolutePath-based APIs.
src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs Annotate task + resolve inputs/outputs via TaskEnvironment and adapt to AbsolutePath APIs.
src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​ReplacePackageParts.cs Annotate task + resolve file operations via TaskEnvironment and suppress safe temp-root warnings.
src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​NuGetVersionUpdater.cs Retype internal helper to AbsolutePath for task-safe path handling and temp-dir creation.
src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs Opt task into multithreaded execution via attribute.
src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs Opt task into multithreaded execution via attribute.
src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​AkaMSLinksBase.cs Implement IMultiThreadableTask + resolve certificate path via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​Vsix/​FinalizeInsertionVsixFile.cs Annotate task + resolve VSIX path via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​OptProf/​GetRunSettingsSessionConfiguration.cs Annotate task + resolve config/bootstrapper inputs via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​OptProf/​GenerateTrainingPropsFile.cs Annotate task + resolve output directory via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​OptProf/​GenerateTrainingInputFiles.cs Annotate task + resolve config/IO paths via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​OptProf/​FindLatestDrop.cs Annotate task + resolve JSON input path via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.TargetFramework/​src/​TargetFrameworkResolver.cs Add locking around GetNearest to prevent concurrent corruption in NuGet caches.
src/​Microsoft.DotNet.Build.Tasks.TargetFramework/​src/​ChooseBestTargetFrameworksTask.cs Annotate task + resolve runtime graph path via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.TargetFramework/​src/​ChooseBestP2PTargetFrameworkTask.cs Annotate task + resolve runtime graph path via TaskEnvironment.
src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​GenerateFileCatalog.cs Annotate task + resolve input/output paths via TaskEnvironment and AbsolutePath.
src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs Retype public API to AbsolutePath for file inputs.
src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs Retype public APIs to AbsolutePath for file inputs and output.
src/​Microsoft.DotNet.Build.Tasks.FileCatalog.Tests/​CatalogTests.cs Update tests to use AbsolutePath-based catalog APIs.
Suppressed comments (1)

src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs:98

  • CatalogBuilder.WriteTo is a public API; switching its parameter from string to AbsolutePath is a binary-breaking change. Keep a string overload (forwarding to the new one) to preserve backwards compatibility for already-compiled consumers.
        public void WriteTo(AbsolutePath path)

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

Copilot AI review requested due to automatic review settings September 7, 2026 12:31

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 review overview

🔵 Needs a closer look

Public FileCatalog helper APIs changed from string to AbsolutePath without preserving the original overloads, creating a breaking API surface for any existing consumers.

Review tier: Lite
Findings: 2 High severity · 1 Medium severity · 1 Low severity

Pre-existing issues (4)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View comment
Suppressed comments (3)

src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs:32

  • Changing this public API from FromFile(string, ...) to FromFile(AbsolutePath, ...) is a breaking change for any consumers of the FileCatalog library. To preserve compatibility while still supporting AbsolutePath, keep the AbsolutePath overload but re-introduce the original string overload (forwarding to the new overload).
    public static CatalogEntry FromFile(AbsolutePath filePath, string? name = null)
    {
        if (string.IsNullOrEmpty(filePath))
        {
            throw new ArgumentException("File path must not be null or empty.", nameof(filePath));

src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs:82

  • CatalogBuilder.AddFile was changed from accepting string to AbsolutePath, which is a breaking change for any callers using this helper outside the task assembly. Consider adding a string overload that preserves the original null/empty validation and forwards to the AbsolutePath overload.
    /// <summary>Adds a file by path.</summary>
    public CatalogBuilder AddFile(AbsolutePath filePath, string? name = null)
        => Add(CatalogEntry.FromFile(filePath, name));

src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs:102

  • CatalogBuilder.WriteTo was changed from taking a string to an AbsolutePath, which breaks existing callers. Adding a WriteTo(string) overload that preserves the original validation and forwards to the AbsolutePath overload keeps existing code working.
    /// <summary>Builds and writes the catalog to <paramref name="path"/>.</summary>
    public void WriteTo(AbsolutePath path)
    {
        if (string.IsNullOrEmpty(path))
        {
            throw new ArgumentException("Path must not be null or empty.", nameof(path));

Copilot AI review requested due to automatic review settings September 7, 2026 13:59

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 review overview

🟡 Changes recommended

A warning-suppression pragma in UpdatePackageVersionTask is currently scoped such that it will not suppress the intended analyzer diagnostic at the actual call site.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 High severity · 1 Medium severity · 2 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — The MSBuildTask0005 suppression currently doesn't cover the call site that the analyzer is likely…
Pre-existing issues (4)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View comment

Copilot AI review requested due to automatic review settings September 7, 2026 14:57

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 review overview

🟡 Changes recommended

A path-prefix check uses a culture-sensitive StartsWith overload that should be made ordinal to avoid locale-dependent behavior and to match the method’s other comparisons.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 High severity · 2 Medium severity · 2 Low severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — StartsWith here uses the culture-sensitive overload, which is risky for path prefix checks and…
Pre-existing issues (5)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View comment
Low severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — The MSBuildTask0005 suppression currently doesn't cover the call site that the analyzer is likely… View comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View comment
Suppressed comments (1)

src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WriteUsageReports.cs:175

  • This argument line is mis-indented, which makes the File.WriteAllText call harder to read and inconsistent with the surrounding formatting.
        File.WriteAllText(
TaskEnvironment.GetAbsolutePath(Path.Combine(OutputDirectory, "annotated-usage.xml")),
            report.ToString());

Copilot AI review requested due to automatic review settings September 7, 2026 15:21

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 review overview

🟡 Changes recommended

WritePackageUsageData.AbsoluteRootDir can yield “relative” paths that start with a directory separator when RootDir lacks a trailing separator, breaking Path.Combine and prefix checks.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 High severity · 3 Medium severity · 2 Low severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — AbsoluteRootDir only appends a trailing directory separator when the input RootDir had one.…
Pre-existing issues (6)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — StartsWith here uses the culture-sensitive overload, which is risky for path prefix checks and… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View comment
Low severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — The MSBuildTask0005 suppression currently doesn't cover the call site that the analyzer is likely… View comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View comment

Copilot AI review requested due to automatic review settings September 7, 2026 16:23

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 review overview

🔵 Needs a closer look

The updated RootDir containment validation in WritePackageUsageData relies on a prefix check that can incorrectly treat non-descendant paths as “within” the root and should be fixed before merging.

Review tier: Lite
Findings: 2 High severity · 3 Medium severity · 2 Low severity

Pre-existing issues (7)
Severity Finding
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — AbsoluteRootDir only appends a trailing directory separator when the input RootDir had one.… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — StartsWith here uses the culture-sensitive overload, which is risky for path prefix checks and… View comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View comment
Low severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — The MSBuildTask0005 suppression currently doesn't cover the call site that the analyzer is likely… View comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View comment
Suppressed comments (2)

src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WriteUsageReports.cs:175

  • This File.WriteAllText call has a mis-indented argument line, which makes the block harder to read and stands out from the surrounding formatting.
        File.WriteAllText(
TaskEnvironment.GetAbsolutePath(Path.Combine(OutputDirectory, "annotated-usage.xml")),
            report.ToString());

src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WritePackageUsageData.cs:97

  • The ProjectDirectoriesOutsideRoot validation uses a raw string prefix check (StartsWith) which can be bypassed by paths that share the same prefix but are not actually under RootDir (e.g. .../repo vs .../repo2). This can lead to incorrect validation results when determining whether inputs are within the root.
        // Compare resolved paths on both sides; GetPathRelativeToRoot below resolves too, so a
        // raw comparison here would disagree with it whenever RootDir is relative.
        string[] projectDirectoriesOutsideRoot = ProjectDirectories.NullAsEmpty()
            .Where(dir => !TaskEnvironment.GetAbsolutePath(dir).Value.StartsWith(AbsoluteRootDir, StringComparison.Ordinal))
            .ToArray();

Copilot AI review requested due to automatic review settings September 7, 2026 16:34

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 review overview

🔵 Needs a closer look

The PR touches many build tasks and concurrency-sensitive code paths, so it warrants a final human review to validate behavioral parity and threading safety end-to-end.

Review tier: Lite
Findings: 3 Medium severity

New issues introduced by this change (3)
Severity Finding
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​AkaMSLinksBase.cs — Consider treating whitespace-only ClientCertificate as not set and trimming before resolving to…
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — Before resolving ProdConBuildManifestFile with TaskEnvironment.GetAbsolutePath, treat…
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — AdditionalAssetDirs entries coming from MSBuild properties/items often contain leading/trailing…
Issues resolved since last review (7)
Severity Finding
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — AbsoluteRootDir only appends a trailing directory separator when the input RootDir had one.… View resolved comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WritePackageUsageData.cs — StartsWith here uses the culture-sensitive overload, which is risky for path prefix checks and… View resolved comment
Low severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — The MSBuildTask0005 suppression currently doesn't cover the call site that the analyzer is likely… View resolved comment
Low severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — The first argument line in this multi-line File.WriteAllText call is mis-indented, which makes… View resolved comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​WriteBuildOutputProps.cs — Path.GetDirectoryName(OutputPath) can return null (e.g., when OutputPath is just a file name like… View resolved comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogEntry.cs — CatalogEntry.FromFile is a public API and changing its parameter type from string to… View resolved comment
High severity src/​Microsoft.DotNet.Build.Tasks.FileCatalog/​CatalogBuilder.cs — CatalogBuilder.AddFile is a public API; switching its parameter from string to AbsolutePath… View resolved comment
Suppressed comments (1)

src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WriteUsageReports.cs:104

  • Before resolving PoisonedReportFile with TaskEnvironment.GetAbsolutePath, treat whitespace-only values as unset and trim the path to prevent accidental invalid-path resolutions from padded MSBuild properties.
        if (!string.IsNullOrEmpty(PoisonedReportFile))
        {
            AbsolutePath poisonedReportFile = TaskEnvironment.GetAbsolutePath(PoisonedReportFile);
            if (File.Exists(poisonedReportFile))

Copilot AI review requested due to automatic review settings September 7, 2026 16:41

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 review overview

🔵 Needs a closer look

The change opts many build tasks into in-proc multi-threaded execution and adjusts path/concurrency behavior across multiple components, which warrants a final human review for ecosystem-impact and subtle concurrency/IO edge cases.

Review tier: Lite
Findings: None

Issues resolved since last review (2)
Severity Finding
High severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​ReplacePackageParts.cs — The suppression around Path.GetTempPath() uses MSBuildTask0002, but the same API is suppressed… View resolved comment
Medium severity src/​Microsoft.DotNet.SourceBuild/​tasks/​src/​UsageReport/​WriteUsageReports.cs — PoisonedReportFile is optional; with TaskEnvironment.GetAbsolutePath it can now throw for… View resolved comment

Copilot AI review requested due to automatic review settings September 7, 2026 18:44

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 review overview

🔵 Needs a closer look

WriteBuildOutputProps now treats whitespace AdditionalAssetDirs values as the project directory after GetAbsolutePath, which can incorrectly include unintended directories and should be filtered with IsNullOrWhiteSpace.

Review tier: Lite
Findings: None

Suppressed comments (1)

src/Microsoft.DotNet.SourceBuild/tasks/src/WriteBuildOutputProps.cs:75

  • AdditionalAssetDirs now filters with IsNullOrEmpty before resolving via TaskEnvironment.GetAbsolutePath. A whitespace-only value (e.g. " ") will pass the filter, resolve to the project directory, and then Directory.Exists/EnumerateDirectories will treat it as a real asset directory. Previously, Directory.Exists(" ") returned false, so whitespace was effectively ignored. Use IsNullOrWhiteSpace to preserve the earlier tolerant behavior.
        var additionalAssets = (AdditionalAssetDirs ?? new string[0])
            .Where(dir => !string.IsNullOrEmpty(dir))
            .Select(dir => TaskEnvironment.GetAbsolutePath(dir))
            .Where(dir => Directory.Exists(dir))
            .Where(dir => Directory.EnumerateDirectories(dir).Any())

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 review overview

🟡 Changes recommended

UpdatePackageVersionTask currently treats an empty required OutputDirectory as null, which can silently switch execution into read-only mode and change failure/output behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — OutputDirectory is marked [Required], but the current `string.IsNullOrEmpty(OutputDirectory) ?…

Copilot AI review requested due to automatic review settings September 8, 2026 06:57

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 review overview

🟢 Approval recommended

The changes consistently apply TaskEnvironment boundary resolution and update dependent helpers/tests accordingly, with no verified functional regressions found in the reviewed diffs.

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
Medium severity src/​Microsoft.DotNet.NuGetRepack/​tasks/​src/​UpdatePackageVersionTask.cs — OutputDirectory is marked [Required], but the current `string.IsNullOrEmpty(OutputDirectory) ?… View resolved comment

akoeplinger
akoeplinger previously approved these changes Sep 8, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7

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 review overview

🔵 Needs a closer look

The changes affect a broad set of build tasks and path/concurrency behavior across multiple subsystems, making the regression surface large even though no specific defects were found in review.

Review tier: Lite
Findings: None

@ViktorHofer
ViktorHofer merged commit 860cc94 into dotnet:main Sep 8, 2026
12 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants