Repository navigation
Make MSBuild tasks safe for multi-threaded execution - #17381
ViktorHofer wants to merge 33 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prepares Arcade MSBuild tasks for in-process multithreaded execution through task annotations, project-scoped environment handling, analyzer enforcement, and concurrency fixes.
Changes:
- Updates MSBuild dependencies and adds analyzer guardrails.
- Migrates tasks to
TaskEnvironmentand removes the obsolete shared task base. - Addresses shared caches, serializers, and other concurrency hazards while leaving unsafe task chains unannotated.
Show a summary per file
| File | Review result |
|---|---|
src/Microsoft.DotNet.XliffTasks/Tasks/XlfTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/UpdateXlf.cs |
Moderate: exception handling still compares against a potentially relative path. |
src/Microsoft.DotNet.XliffTasks/Tasks/TranslateSource.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/TransformTemplates.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/SortXlf.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/GatherXlf.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/GatherTranslatedSource.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Tasks/EnsureAllResourcesTranslated.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.XliffTasks/Model/Document.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/GenerateSwaggerCode.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SourceBuild/tasks/src/WriteBuildOutputProps.cs |
Moderate: relative asset directories are checked against the process directory. |
src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WriteUsageReports.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WritePackageUsageData.cs |
Moderate: RootDir is not normalized consistently. |
src/Microsoft.DotNet.SourceBuild/tasks/src/ReadNuGetPackageInfos.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SignCheckTask/SignCheckTask.cs |
Critical: the shared verifier registry is not safe for concurrent or repeated construction. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/ValidateFileVersions.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/GenerateSharedFrameworkDepsFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromTemplate.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromFileList.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/FileUtilities.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/src/CreateFrameworkListFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.PackageTesting/VerifyTypes.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.PackageTesting/VerifyClosure.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.PackageTesting/GetCompatiblePackageTargetFrameworks.cs |
Critical: static mutable framework collections are shared across executions. |
src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/WaitForHelixJobCompletion.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/StopAzurePipelinesTestRun.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/StartAzurePipelinesTestRun.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/SendHelixJob.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/InstallDotNetTool.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/GetHelixWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs |
Critical: the process-wide client can be overwritten or disposed during concurrent execution. |
src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAndroidWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CreateMTPWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CreateFailedTestsForFailedWorkItems.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CheckHelixJobStatus.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CheckAzurePipelinesTestResults.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Helix/Sdk/CancelHelixJob.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/TypeParser.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/SourceGenerator.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/NotSupportedAssemblyGenerator.cs |
Critical: the shared process-wide assembly resolver is not thread-safe. |
src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSource.cs |
Critical: the shared process-wide assembly resolver is not thread-safe. |
src/Microsoft.DotNet.GenFacades/ClearAssemblyReferenceVersions.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.GenAPI/GenAPITask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Deployment.Tasks.Links/src/DeleteAkaMSLinks.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Deployment.Tasks.Links/src/CreateAkaMSLinks.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.CMake.Sdk/src/CreateCMakeFileApiQuery.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.CMake.Sdk/Microsoft.DotNet.CMake.Sdk.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/WixToolTaskBase.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/WixToolTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/HarvesterToolTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/CreateVisualStudioWorkloadSet.wix.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Workloads/src/CreateVisualStudioWorkload.wix.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/Vsix/GetPkgDefAssemblyDependencyGuid.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/Vsix/FinalizeInsertionVsixFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/GetRunSettingsSessionConfiguration.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/GenerateTrainingPropsFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/GenerateTrainingInputFiles.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/FindLatestDrop.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/TargetFrameworkResolver.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/Microsoft.DotNet.Build.Tasks.TargetFramework.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestTargetFrameworksTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestP2PTargetFrameworkTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/ValidateHarvestVersionIsLatestForReleaseTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/TestBuildEngine.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/RuntimeGraphTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/PackageIndexTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/Log.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/tests/CreateTrimDependencyGroupsTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidationTask.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidatePackage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateFrameworkPackage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs |
Critical: mutable cached PackageIndex instances are shared across executions. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/SplitReferences.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/SplitDependenciesBySupport.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PromoteDependencies.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageMetadata.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetAssetResolver.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/Microsoft.DotNet.Build.Tasks.Packaging.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/HarvestPackage.cs |
Moderate: relative package-folder offsets can produce invalid asset paths. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetSupportedPackagesFromPackageReports.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetRuntimeTargets.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetRuntimeJsonValues.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageVersion.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageFromModule.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageDestination.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageDescription.cs |
Critical: the static description cache is not synchronized. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetMinimumNETStandard.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLayoutFiles.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLastStablePackage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetInboxFrameworks.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetAssemblyReferences.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackages.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackageReports.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GenerateRuntimeDependencies.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GeneratePackageReport.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GenerateNuSpec.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/FilterUnknownPackages.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/CreateTrimDependencyGroups.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyPreReleaseSuffix.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyMetaPackages.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyBaseLine.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/StabilizeWixFileId.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMacOSDistributionFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateGuidFromName.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateCurrentVersion.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/ExecWithRetries.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateWixCommandPackageDropBase.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateRpmPackage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateMD5SumsFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateLightCommandPackageDrop.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateDebPackage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateControlFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateChangelogFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.FileCatalog/GenerateFileCatalog.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.FileCatalog.Tests/CatalogTests.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PushToBuildStorage.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishSignedAssets.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishBuildToMaestro.cs |
Critical: the environment proxy still reads process-global environment state. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestV4.cs |
Critical: shared credential detection still reads process-global environment state. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestV3.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/LaunchDebugger.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/ConfigureInputFeed.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/UploadToAzure.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/CreateNewAzureContainer.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/CreateAzureContainerIfNotExists.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/BlobFeedAction.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageAssetPublisher.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/ValidateLicense.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/SingleError.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/SaveItems.cs |
Moderate: the saved output still uses the original relative path. |
src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs |
Moderate: project loading and process start still use original relative paths. |
src/Microsoft.DotNet.Arcade.Sdk/src/GroupItemsBy.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/GetAssemblyFullName.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/GenerateResxSource.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/GenerateChecksums.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/ExtractNgenMethodList.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/CompareVersions.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs |
Reviewed; no final comment. |
src/Microsoft.DotNet.Arcade.Sdk/src/CalculateAssemblyAndFileVersions.cs |
Reviewed; no final comment. |
src/Common/Internal/BuildTask.cs |
Reviewed; no final comment. |
eng/Version.Details.xml |
Reviewed; no final comment. |
eng/Version.Details.props |
Reviewed; no final comment. |
eng/MultiThreadableTaskAnalyzer.globalconfig |
Reviewed; no final comment. |
eng/BuildTask.targets |
Reviewed; no final comment. |
Directory.Packages.props |
Reviewed; no final comment. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (16)
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateLightCommandPackageDrop.cs:10
- The derived task is annotated, but
CreateWixCommandPackageDropBasestill performs its coreDirectory/Fileoperations with rawpackageDropOutputFolder,OutputFolder,WixSrcFiles, andLocpaths. Relative inputs therefore continue to use the process current directory; the single resolvedWixProjectFilecopy here does not make the inherited execution safe. ThreadTaskEnvironmentthrough the base chain or leave this task unannotated.
src/Microsoft.DotNet.Build.Tasks.Installers/src/ExecWithRetries.cs:17 - The outer task is annotated, but each inner
Microsoft.Build.Tasks.Execis created without propagating the outerTaskEnvironment. Its working directory and child-process environment consequently fall back to process-global state, so relative commands/working directories can resolve incorrectly in a multi-threaded build. Add and assign the child task'sTaskEnvironment, or do not opt this wrapper in.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GeneratePackageReport.cs:24 - The new environment plumbing does not reach
RuntimeFile: both resolver constructors later pass the raw string toJsonRuntimeFormat.ReadRuntimeGraph. A relative runtime.json consequently remains process-current-directory dependent. ResolveRuntimeFilebefore constructing either resolver.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackages.cs:24 RuntimeFileis still passed unmodified toAggregateNuGetAssetResolver, whose constructor reads the file directly. Relative values therefore remain dependent on the process current directory despite this task being annotated; passTaskEnvironment.GetAbsolutePath(RuntimeFile)instead.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/HarvestPackage.cs:20RuntimeFileis still passed raw to bothNuGetresolver constructors, which read it directly. Relative runtime graph paths therefore bypass the newly injected project directory and can load/fail against the process current directory. Resolve this input before constructing the resolvers.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs:17- This task is now marked multithreadable, but
BaseDirectoryis passed unchanged toPackageBuilder.PopulateFiles. If a caller supplies a relative base directory, NuGet resolves the package files against the process current directory rather thanTaskEnvironment.ProjectDirectory, so-mtcan pack the wrong files. ResolveBaseDirectorythroughTaskEnvironmentbefore passing it to the NuGet API.
src/Microsoft.DotNet.Deployment.Tasks.Links/src/CreateAkaMSLinks.cs:12 - The shared
AkaMSLinksBasehelper readsClientCertificatewithFile.ReadAllTextdirectly. For a relative certificate path, this annotated task still resolves against the process current directory rather than the project directory supplied byTaskEnvironment, so concurrent projects can read the wrong file or fail. AddTaskEnvironmentplumbing and resolve the certificate path before enabling the annotation.
src/Microsoft.DotNet.Deployment.Tasks.Links/src/DeleteAkaMSLinks.cs:11 - The shared
AkaMSLinksBasehelper readsClientCertificatewithFile.ReadAllTextdirectly. For a relative certificate path, this annotated task still resolves against the process current directory rather than the project directory supplied byTaskEnvironment, so concurrent projects can read the wrong file or fail. AddTaskEnvironmentplumbing and resolve the certificate path before enabling the annotation.
src/Microsoft.DotNet.Helix/Sdk/CheckAzurePipelinesTestResults.cs:16 - This task now runs concurrently with other
AzureDevOpsTaskinstances, but the base class uses one staticRandomforGetRetryDelay.Randominstances are not thread-safe, so concurrent retries race on the generator and can produce corrupted/non-random backoff values, defeating retry staggering. UseRandom.Sharedor an instance-local generator before opting these tasks into multithreaded execution.
src/Microsoft.DotNet.Helix/Sdk/CheckAzurePipelinesTestResults.cs:16 - This annotation also opts the
AzureDevOpsTaskbase implementation into in-process multi-threading, but that base readsBUILD_*,SYSTEM_*, and the access token viaEnvironment.GetEnvironmentVariable. Those values are process-global rather than the injected per-project task environment, so concurrent projects can observe the wrong build credentials/metadata. ThreadTaskEnvironmentthrough the base or leave these derived tasks TaskHost-routed.
src/Microsoft.DotNet.Helix/Sdk/CreateFailedTestsForFailedWorkItems.cs:15 - This task now runs concurrently with other
AzureDevOpsTaskinstances, but the base class uses one staticRandomforGetRetryDelay.Randominstances are not thread-safe, so concurrent retries race on the generator and can produce corrupted/non-random backoff values, defeating retry staggering. UseRandom.Sharedor an instance-local generator before opting these tasks into multithreaded execution.
src/Microsoft.DotNet.Helix/Sdk/InstallDotNetTool.cs:18 - This task is annotated while inheriting
MSBuildTaskBase, which has noTaskEnvironment;DestinationPath,ToolPath, andWorkingDirectoryare passed toFileSystem/Commandunchanged. Relative paths and the command's inherited environment therefore still depend on the process current directory/environment. Resolve these inputs and propagate the task environment through the helper interfaces, or keep the task out of in-process multi-threading.
src/Microsoft.DotNet.Helix/Sdk/StartAzurePipelinesTestRun.cs:13 - This task now runs concurrently with other
AzureDevOpsTaskinstances, but the base class uses one staticRandomforGetRetryDelay.Randominstances are not thread-safe, so concurrent retries race on the generator and can produce corrupted/non-random backoff values, defeating retry staggering. UseRandom.Sharedor an instance-local generator before opting these tasks into multithreaded execution.
src/Microsoft.DotNet.Helix/Sdk/StopAzurePipelinesTestRun.cs:13 - This task now runs concurrently with other
AzureDevOpsTaskinstances, but the base class uses one staticRandomforGetRetryDelay.Randominstances are not thread-safe, so concurrent retries race on the generator and can produce corrupted/non-random backoff values, defeating retry staggering. UseRandom.Sharedor an instance-local generator before opting these tasks into multithreaded execution.
src/Microsoft.DotNet.SourceBuild/tasks/src/ReadNuGetPackageInfos.cs:13 PackagePathsis a plain string array, andReadIdentitypasses each value directly toPackageArchiveReader. Relative package paths therefore still resolve against the process current directory despite this task being annotated. InjectTaskEnvironmentand resolve the paths before opening them (including callers of the static helper).
src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WritePackageUsageData.cs:24- The four package-file arrays are still passed directly to
ReadNuGetPackageInfos.ReadIdentity, which opens each string as-is. Relative nupkg paths therefore use the process current directory even though this task now has a per-projectTaskEnvironment; pass resolved paths into the helper.
- Files reviewed: 184/184 changed files
- Comments generated: 17
- Review effort level: Lite
fbebc51 to
eea6ad7
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (17)
src/Microsoft.DotNet.Arcade.Sdk/src/SaveItems.cs:53
- The directory is now resolved through
TaskEnvironment, butproject.Save(File)below still passes the raw path. With a relativeFilein an in-process multithreaded build, the directory can be created under the project directory while the generated project is written relative to the process current directory. Save using the same environment-resolved path.
Directory.CreateDirectory(TaskEnvironment.GetAbsolutePath(path));
src/Microsoft.DotNet.Arcade.Sdk/src/SingleError.cs:9
- The get-then-register sequence is not atomic. Two concurrently scheduled
SingleErrorinstances with the same text can both observe no sentinel and both log an error, defeating the task's single-error contract. Synchronize the check/registration or use an atomic build-scoped gate before opting this task into multithreaded execution.
[MSBuildMultiThreadableTask]
src/Microsoft.DotNet.Build.Tasks.Feed/src/LaunchDebugger.cs:11
Debugger.Launch()depends on process-wide debugger state and can prompt or attach the debugger for the entire MSBuild process. That is not safe for a task opted into in-process multithreaded execution; remove the multithreadable annotation from this diagnostic-only task.
[MSBuildMultiThreadableTask]
public class LaunchDebugger : Microsoft.Build.Utilities.Task
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs:28
- The concrete task is opted into multithreading, but its inherited
PublishArtifactsInManifestBasestill callsEnvironment.GetEnvironmentVariabledirectly when deciding whether Entra credentials are available. The injectedTaskEnvironmenton this class is therefore not used for that decision, so concurrent project executions still depend on process-global environment state. Move the check into the environment-aware plumbing in the base class, or remove the opt-in until that migration is complete.
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestV4.cs:21 - This annotation opts the task into in-process execution even though the inherited
PublishArtifactsInManifestBasereads Azure credential variables withEnvironment.GetEnvironmentVariableand has noTaskEnvironmentplumbing. That makes the task depend on process-global state, contrary to the multithreadable-task contract. Either thread the environment through the base class or leave this task unannotated.
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishBuildToMaestro.cs:35 - Several execution paths still call
_getEnvProxy.GetEnv, whose implementation usesEnvironment.GetEnvironmentVariabledirectly (for example, the Azure DevOps collection URI, project, and build identifiers). The task is now annotated and has aTaskEnvironment, but those reads bypass it and retain process-global behavior. Replace the proxy with the injected environment before opting this task into multithreading.
src/Microsoft.DotNet.Build.Tasks.Feed/src/PushToBuildStorage.cs:48 - This task is now routed as multithreadable, but it has no
TaskEnvironment; the injected file system receives paths such aspackage.OriginalFile, the local storage directories, andAssetManifestPathwithout project-relative normalization. Any relative input still uses the process current directory. Normalize the task's path inputs before model/file-system operations or leave it TaskHost-routed.
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/UploadToAzure.cs:20 - This task is now opted into concurrent in-process execution, but
TokenSourceis static andCancel()cancels that shared source. Cancelling one task instance therefore cancels every concurrently runningUploadToAzureinvocation, causing unrelated uploads to stop. Make the cancellation source/token instance-owned before enabling multithreaded execution.
src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateMD5SumsFile.cs:42 - The file is opened via
TaskEnvironment.GetAbsolutePath, but the emitted relative name still subtracts the rawRootDirectorylength from the rawItemSpec. When these inputs are project-relative, the checksum file contains a malformed path (or throws) even though hashing succeeded. Compute the relative name from the same normalized file and root paths.
src/Microsoft.DotNet.Build.Tasks.Installers/src/ExecWithRetries.cs:18 - This wrapper opts into in-process multithreading but delegates to
Microsoft.Build.Tasks.Execwithout injecting a per-project environment or resolvingWorkingDirectory. A relative working directory therefore still uses the process current directory, and the child process inherits ambient process state. Keep this task TaskHost-routed (or replace the wrapper with aToolTaskimplementation usingTaskEnvironment).
src/Microsoft.DotNet.Build.Tasks.Packaging/src/GeneratePackageReport.cs:15 - This task now runs in-process and calls
FrameworkUtilities, whose sharedFrameworkReduceris initialized through an unsynchronizedif (s_reducer == null) s_reducer = new FrameworkReducer()lazy path. Concurrent first use can race on that static state, so this opt-in does not meet the thread-safety requirement. Make the helper useLazy<FrameworkReducer>/synchronized initialization (and audit the other newly annotated callers) before enabling this task.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/HarvestPackage.cs:619 - This helper has the same mismatch: it enumerates from
TaskEnvironment.GetAbsolutePath(packageFolder)but stripspackageFolder.Lengthfrom the resulting absolute path. Relative package folders therefore yield incorrect item paths. Keep the normalized folder in the relative-path calculation.
src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAndroidWorkItems.cs:18 - The annotated task passes APK metadata through
XHarnessTaskBase.GetNameAndPathand rawIFileSystemoperations, but neither the task nor the base has aTaskEnvironment. A relative APK path (and the generated payload path) is consequently resolved against the process current directory rather than the project directory. Normalize these paths before the helper/file-system calls or remove the annotation.
src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs:18 - The annotated task passes app-bundle and temporary paths through
XHarnessTaskBase/rawIFileSystemoperations without aTaskEnvironment. Relative inputs are therefore still resolved against the process current directory in multithreaded builds. Normalize all paths before this helper chain or remove the annotation.
src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs:21 - The task is now eligible to run concurrently, but its HTTP client is stored in the static mutable
_clientfield and reassigned for every task instance. Concurrent invocations can overwrite each other's client while requests are in flight, so one task can use another task's handler/configuration. Make the client instance-owned (and dispose it appropriately), or do not opt this task into multithreaded execution.
src/Microsoft.DotNet.Helix/Sdk/InstallDotNetTool.cs:18 - This task is annotated, but its destination, dotnet executable, working directory, and mutex/file-system paths are passed through raw
IFileSystem/command APIs with noTaskEnvironment. Relative inputs therefore still resolve against the process current directory in multithreaded builds. Inject and apply the task environment to every path, or do not opt this task in.
src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WritePackageUsageData.cs:146 - The files returned here are absolute because
GetAbsolutePath(RootDir)is used, butGetPathRelativeToRootstill compares them with the unnormalizedRootDir. IfRootDiris relative, every discovered asset path fails theStartsWithcheck and the task throws instead of producing usage data. NormalizeRootDironce withTaskEnvironmentbefore both the scan and relative-path calculation.
- Files reviewed: 185/185 changed files
- Comments generated: 15
- Review effort level: Lite
Copilot's reviewer found two bug classes on dotnet/arcade#17381 that my own audit missed, plus the two races I had already fixed independently. 1. Paths resolved at one site but used raw at another. These do not throw; they silently produce wrong results, which is why the null-guard audit did not surface them: - HarvestPackage enumerated the resolved absolute folder but computed package-relative paths with Substring(rawPath.Length + 1), so a relative PackagesFolders entry misclassified every harvested asset. Fixed at the source: LocatePackageFolder now returns an absolute path, so every downstream use agrees. - WritePackageUsageData compared absolute enumeration results against a raw RootDir in both GetPathRelativeToRoot and the ProjectDirectories validation, throwing for every discovered file when RootDir is relative. Added AbsoluteRootDir, which preserves any trailing separator because callers depend on the stripped result staying relative. - UpdateXlf's exception filter compared FileNotFoundException.FileName against the unresolved path, turning a friendly BuildErrorException into an unhandled exception. - SaveItems created the resolved directory but saved to the raw path; InstallDotNetCore checked the resolved VersionsPropsPath but loaded the raw one and launched the raw DotNetInstallScript; WriteBuildOutputProps filtered AdditionalAssetDirs with an unresolved Directory.Exists. 2. Tasks annotated despite process-global state inherited from a base class. The analyzer does not walk into base types, so these all passed a clean analyzer run. De-annotated with TODOs pointing at arcade#17378: - The five Feed publishing tasks (PublishArtifactsInManifestBase reads AZURESUBSCRIPTION_*, SYSTEM_ACCESSTOKEN and workload-identity variables from the process environment; PublishBuildToMaestro goes through _getEnvProxy). - Four AzureDevOpsTask derivatives (same environment reads plus a shared static Random for retry jitter). - Two RoslynBuildTask derivatives (process-wide AssemblyLoadContext.Resolving). - SignCheckTask (static _fileVerifiers populated per manager construction), FindDotNetCliPackage (static HttpClient overwritten per execution), CreateLightCommandPackageDrop (base still uses raw paths). FinalizeInsertionVsixFile and ReadNuGetPackageInfos were annotated but never implemented IMultiThreadableTask, so TaskEnvironment was never injected and every resolution silently used Fallback. Both are now fully migrated instead. Also keyed the LocateDotNet and CheckRequiredDotNetVersion build-scoped caches by repository and SDK version; they are registered per build, not per project, so a second repository could reuse the first one's result. UpdatePackageIndex is deliberately left annotated: it passes a single AbsolutePath to PackageIndex.Load, which binds to the uncached overload rather than the cached IEnumerable one, so it never shares a mutable index. Annotated tasks: 119 of 136. Arcade builds clean (0 warnings, 0 errors); PackageTesting (9), Packaging (48) and Feed (214) tests pass. The one Arcade.Sdk.Tests failure is the pre-existing NU1009 SwixBuild conflict, which this change does not touch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
eea6ad7 to
6ae5f84
Compare
MSBuild 18.x can execute tasks on multiple threads inside a single node (`-mt`), but only for tasks that opt in via [MSBuildMultiThreadableTask]. Everything else is routed to an out-of-proc sidecar TaskHost, which is far more expensive than the in-proc path. Measuring a runtime inner-repo build in the VMR with `-mt -nodeReuse:true` against a baseline showed only a 3.6% wall-clock improvement, because none of Arcade's tasks were annotated: TaskHost task invocations went from 849 to 14,125 and total task time went *up* by 98 seconds, cancelling out most of the gain from threading. This annotates 133 of Arcade's 136 concrete tasks and makes the supporting code multi-threading safe: - Update the MSBuild package dependencies from 17.12.50 to 18.8.2, which is the first version exposing both [MSBuildMultiThreadableTask]/IMultiThreadableTask and ToolTask.TaskEnvironment. - Reference Microsoft.Build.TaskAuthoring.Analyzer from eng/BuildTask.targets so new violations are caught at build time. eng/MultiThreadableTaskAnalyzer.globalconfig scopes it to tasks that have already opted in, and disables the API-shape suggestions (MSBuildTask0006-0008, 0011) which would be binary-breaking for task parameters set from targets across the ecosystem. - Replace ambient process state with the injected TaskEnvironment: relative paths now resolve against the project directory instead of the process-wide current directory, environment variables are read per-project, and child processes are started from TaskEnvironment.GetProcessStartInfo(). - Thread AbsolutePath through the shared path helpers in Packaging, GenFacades, Feed, NuGetRepack, SharedFramework.Sdk, PackageTesting and XliffTasks. - Fix a real data race: TargetFrameworkResolver.CreateOrGet used an unsynchronized static Dictionary cache. It is now a ConcurrentDictionary. - Stop sharing a static Newtonsoft JsonSerializer instance in PackageIndex. - Delete the internal BuildTask/ILog base class. It only wrapped Microsoft.Build.Utilities.Task and TaskLoggingHelper, and standing between tasks and the MSBuild base class meant every derived task needed its own TaskEnvironment plumbing. Tasks now derive from Microsoft.Build.Utilities.Task directly and use Log/TaskLoggingHelper. SignToolTask, CreateVisualStudioWorkload and CreateVisualStudioWorkloadSet are deliberately left unannotated. Their helper chains (BatchSignUtil, ZipData, Configuration, VerifySignatures, WorkloadPackageBase, MsiBase, SwixProject, ...) still resolve paths against the process-wide current directory, and converting them is a much larger change. Each carries a TODO pointing at the tracking issue. Both run once per build, so keeping them TaskHost-routed costs effectively nothing. Contributes to dotnet#17378 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6ae5f84 to
244ce41
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (1)
src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishBuildToMaestro.cs:39
IMultiThreadableTaskis documented as a thread-safe routing signal, even though the current router bug ignores interface-only implementations. Once fixed, this task would run in-process while_getEnvProxystill reads ambient process environment. Remove the interface until environment access is migrated.
- Files reviewed: 186/186 changed files
- Comments generated: 14
- Review effort level: Balanced
- GetPackageDescription: stop memoizing failed description loads. GetOrAdd cached the null returned after an IOException, so every later invocation on the node silently got null without retrying or re-logging. - GetAssemblyFullName, ExecWithRetries: implement IMultiThreadableTask and resolve paths through TaskEnvironment. ExecWithRetries forwards its TaskEnvironment into the nested Exec instance, which MSBuild does not inject into because the task constructs it directly. - InstallDotNetTool, PushToBuildStorage, SingleError, LaunchDebugger: remove the MSBuildMultiThreadableTask attribute. These are not yet safe to run in-process, so they must keep routing to a TaskHost until they are migrated properly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removed remarks comment regarding token handling.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 12
New issues introduced by this change (12)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… |
Suppressed comments (4)
src/Microsoft.DotNet.XliffTasks/Tasks/XlfTask.cs:12
- This makes the task assembly unloadable on MSBuild hosts that predate these new framework types, rather than leaving the opt-in “inert” as the PR description states. Build-task packages exclude
Microsoft.Build.Frameworkruntime assets (eng/BuildTask.targets:33-38), so an older host supplies its own framework assembly; resolving this class then fails whenIMultiThreadableTask/TaskEnvironmentare absent. Either establish a minimum MSBuild 18.8 host requirement or ship a down-level-compatible task assembly/shim before adding these type references.
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs:98 - Replacing the public
WriteTo(string)method is a binary-breaking API change. Retain the old overload and delegate to theAbsolutePathimplementation to preserve consumers while keeping the task path-safe.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs:53 - Removing
Load(string)is a source- and binary-breaking change to this public packaged type. Preserve that overload and delegate to the typed path implementation.
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs:26 - Changing this public extension method from
stringtoAbsolutePathis a binary-breaking API change. Keep a string overload for existing consumers and forward it to the typed overload.
public static async Task<bool> IsFileIdenticalToBlobAsync(this BlobClient client, AbsolutePath file)
| /// V2 catalogs do not carry per-member file names); it is retained only for diagnostics. | ||
| /// </param> | ||
| public static CatalogEntry FromFile(string filePath, string? name = null) | ||
| public static CatalogEntry FromFile(AbsolutePath filePath, string? name = null) |
| public CatalogBuilder AddFile(AbsolutePath filePath, string? name = null) | ||
| => Add(CatalogEntry.FromFile(filePath, name)); |
| public PackageAsset[] UnusedAssets { get; set; } | ||
|
|
||
| public void Save(string path) | ||
| public void Save(AbsolutePath path) |
| public bool IsRef { get; } | ||
| public ITaskItem OriginalItem { get; } | ||
| public string SourcePath { get; } | ||
| public AbsolutePath SourcePath { get; } |
|
|
||
|
|
||
| public static Version GetAssemblyVersion(string assemblyPath) | ||
| public static Version GetAssemblyVersion(AbsolutePath assemblyPath) |
| public static class AzureStorageExtensions | ||
| { | ||
| public static string CalculateMD5(string filename) | ||
| public static string CalculateMD5(AbsolutePath filename) |
| public async Task<bool> IsFileIdenticalToBlobAsync(AbsolutePath localFileFullPath, string blobPath) => | ||
| await GetBlob(blobPath).IsFileIdenticalToBlobAsync(localFileFullPath); |
| } | ||
|
|
||
| public static void WriteRuntimeGraph(string filePath, RuntimeGraph runtimeGraph) | ||
| public static void WriteRuntimeGraph(AbsolutePath filePath, RuntimeGraph runtimeGraph) |
| public HashSet<string> IndexSources { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | ||
|
|
||
| public static PackageIndex Load(IEnumerable<string> packageIndexFiles) | ||
| public static PackageIndex Load(IEnumerable<AbsolutePath> packageIndexFiles) |
| } | ||
|
|
||
| public void Pack(string nuspecPath, string nupkgPath, Manifest manifest, bool packSymbols) | ||
| public void Pack(string nuspecPath, AbsolutePath absoluteNuspecPath, string nupkgPath, Manifest manifest, bool packSymbols) |
# Conflicts: # eng/BuildTask.targets # eng/MultiThreadableTaskAnalyzer.globalconfig # eng/Version.Details.props # eng/Version.Details.xml # src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/WixToolTaskBase.cs # src/Microsoft.DotNet.Helix/Sdk/AzureDevOpsTask.cs
The merge picks up analyzer 18.12 and the globalconfig from dotnet#17491, which enables MSBuildTask0013 and deepens the MSBuildTask0005 call-chain analysis. Both report on tasks this branch deliberately leaves out of the migration. MSBuildTask0013 flags a task that declares IMultiThreadableTask without [MSBuildMultiThreadableTask]. That combination is intentional here and each class already documents why: the interface is what makes MSBuild assign TaskEnvironment (TaskExecutionHost only tests the interface, so it is assigned in the task host too), while the attribute alone decides routing. Suppressed at each of the 13 declarations rather than in the globalconfig, so the rule keeps guarding against an accidental half-migration everywhere else. MSBuildTask0005 reports 150 file system calls reached through the SignTool and Workloads helper chains. Those chains are the documented reason SignToolTask and CreateVisualStudioWorkload are not opted in, so the tasks stay out-of-proc and the calls remain correct. Neither project contains a task carrying the attribute, so the rule has nothing in scope there today; suppressed per project with a pointer to the class comments and issue dotnet#17378. Verified the rule still fires elsewhere by temporarily reintroducing a violation in Arcade.Sdk. Also extends the existing NuGetVersionUpdater suppression to 0005, which now reports the same already-justified Path.GetTempPath call transitively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Path canonicalization regressions and unresolved public API compatibility breaks can produce incorrect task behavior and consumer failures.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 16
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs — This no longer preserves the documented behavior of ResolvedOutputPath: GetAbsolutePath roots… |
|
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs — This replaces Path.GetFullPath with an API that roots but does not canonicalize. A valid… |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — AbsolutePath equality compares the unnormalized stored value. Removing Path.GetFullPath means… |
|
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs — GetAbsolutePath only roots paths; MSBuild 18.8.2 does not canonicalize .. segments. Because… |
Pre-existing issues (12)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… View comment |
Suppressed comments (2)
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs:138
GetAbsolutePathdoes not collapse relative segments. If a CMake directory source contains.., this value remains non-canonical and cannot match the canonical project source path. Retain the previousPath.GetFullPathnormalization after project-aware resolution.
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs:191- The old
Path.GetFullPathcanonicalized artifact paths, whileGetAbsolutePathonly makes them rooted. Emitting paths that retain..or duplicate separators changes the task output identity and can defeat downstream item comparisons and incremental checks. Canonicalize the resolved path before creating the item.
| AbsolutePath resolvedOutputPath = TaskEnvironment.GetAbsolutePath(OutputPath.Replace('\\', '/')); | ||
| ResolvedOutputPath = resolvedOutputPath; |
|
|
||
| // Normalize source directory for comparison | ||
| string normalizedSourceDir = Path.GetFullPath(SourceDirectory).Replace('\\', '/').TrimEnd('/'); | ||
| string normalizedSourceDir = TaskEnvironment.GetAbsolutePath(SourceDirectory).Value.Replace('\\', '/').TrimEnd('/'); |
| // Normalizing and Removing Relative Segments from the seed paths. | ||
| string[] distinctSeeds = seeds.Select(seed => Path.GetFullPath(seed)).Distinct().ToArray(); | ||
| string[] seedNames = distinctSeeds.Select(seed => Path.GetFileName(seed)).ToArray(); | ||
| AbsolutePath[] distinctSeeds = seeds.Distinct().ToArray(); |
| } | ||
|
|
||
| var directoryParts = Path.GetFullPath(Path.GetDirectoryName(itemToSign.ItemSpec)).Split(separators); | ||
| var directoryParts = TaskEnvironment.GetAbsolutePath(Path.GetDirectoryName(itemToSign.ItemSpec)).Value.Split(separators); |
# Conflicts: # src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs # src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GenerateChecksums.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GenerateResxSource.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GetAssemblyFullName.cs # src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs # src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.cs # src/Microsoft.DotNet.Arcade.Sdk/src/SetCorFlags.cs # src/Microsoft.DotNet.Arcade.Sdk/src/SingleError.cs # src/Microsoft.DotNet.Arcade.Sdk/src/Unsign.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestV3.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestV4.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishBuildToMaestro.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishSignedAssets.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureConnectionStringBuildTask.cs # src/Microsoft.DotNet.Build.Tasks.Feed/src/common/CreateAzureContainerIfNotExists.cs # src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateControlFile.cs # src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateLightCommandPackageDrop.cs # src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMacOSDistributionFile.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/CreateTrimDependencyGroups.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/FilterUnknownPackages.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GenerateNuSpec.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GeneratePackageReport.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GenerateRuntimeDependencies.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackageReports.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackages.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetAssemblyReferences.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetInboxFrameworks.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLastStablePackage.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLayoutFiles.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageDescription.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageFromModule.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetSupportedPackagesFromPackageReports.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/HarvestPackage.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/SplitReferences.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateFrameworkPackage.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidatePackage.cs # src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidationTask.cs # src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestP2PTargetFrameworkTask.cs # src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestTargetFrameworksTask.cs # src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs # src/Microsoft.DotNet.Deployment.Tasks.Links/src/DeleteAkaMSLinks.cs # src/Microsoft.DotNet.GenAPI/GenAPITask.cs # src/Microsoft.DotNet.GenFacades/GenPartialFacadeSource.cs # src/Microsoft.DotNet.Helix/Sdk/BaseTask.cs # src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs # src/Microsoft.DotNet.Helix/Sdk/FindDotNetCliPackage.cs # src/Microsoft.DotNet.Helix/Sdk/SendHelixJob.cs # src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs # src/Microsoft.DotNet.NuGetRepack/tasks/src/ReplacePackageParts.cs # src/Microsoft.DotNet.NuGetRepack/tasks/src/UpdatePackageVersionTask.cs # src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs # src/Microsoft.DotNet.PackageTesting/GetCompatiblePackageTargetFrameworks.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/CreateFrameworkListFile.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/FileUtilities.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromFileList.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromTemplate.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/GenerateSharedFrameworkDepsFile.cs # src/Microsoft.DotNet.SharedFramework.Sdk/src/ValidateFileVersions.cs # src/Microsoft.DotNet.SignCheckTask/SignCheckTask.cs # src/Microsoft.DotNet.SignTool/src/SignToolTask.cs # src/Microsoft.DotNet.SourceBuild/tasks/src/ReadNuGetPackageInfos.cs # src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WritePackageUsageData.cs # src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/WriteUsageReports.cs # src/Microsoft.DotNet.SourceBuild/tasks/src/WriteBuildOutputProps.cs # src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/GenerateSwaggerCode.cs # src/Microsoft.DotNet.XliffTasks/Tasks/EnsureAllResourcesTranslated.cs # src/Microsoft.DotNet.XliffTasks/Tasks/GatherTranslatedSource.cs # src/Microsoft.DotNet.XliffTasks/Tasks/SortXlf.cs # src/Microsoft.DotNet.XliffTasks/Tasks/TransformTemplates.cs # src/Microsoft.DotNet.XliffTasks/Tasks/TranslateSource.cs # src/Microsoft.DotNet.XliffTasks/Tasks/UpdateXlf.cs # src/Microsoft.DotNet.XliffTasks/Tasks/XlfTask.cs
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Replacing Path.GetFullPath with non-canonicalizing path resolution introduces incorrect comparisons and outputs for valid paths containing relative segments.
Review tier: Balanced
Findings: 16
Pre-existing issues (16)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs — GetAbsolutePath only roots paths; MSBuild 18.8.2 does not canonicalize .. segments. Because… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — AbsolutePath equality compares the unnormalized stored value. Removing Path.GetFullPath means… View comment |
|
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs — This replaces Path.GetFullPath with an API that roots but does not canonicalize. A valid… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs — This no longer preserves the documented behavior of ResolvedOutputPath: GetAbsolutePath roots… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… View comment |
Suppressed comments (4)
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs:74
GetAbsolutePathroots the value but does not canonicalize..segments or separators like the previousPath.GetFullPathcall.ResolvedOutputPathis consumed byFileWritesand incremental build inputs/outputs, so equivalent paths can now be treated as different items. Preserve canonicalization after resolving against the project directory.
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs:109GetAbsolutePathdoes not canonicalize... Since this value is compared with the CMake codemodel's canonical source path, a valid input such as$(MSBuildProjectDirectory)/../../nativecan stop matching and report that the source directory is absent. Canonicalize after project-aware resolution; the same normalization is needed at lines 138 and 191.
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs:36AbsolutePathequality uses the stored, non-canonical value. RemovingPath.GetFullPathmeans equivalent seeds such asa/../b.dllandb.dllno longer deduplicate, so the filename-count check can incorrectly report multiple assembly versions. Canonicalize each resolved seed beforeDistinct().
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs:398- This replaced
Path.GetFullPathwith an API that only roots paths. A rootedItemsToSignpath containing..now reachesSplitunnormalized, which can compute an incorrect common enclosing directory. Preserve the former canonicalization after project-aware resolution.
# Conflicts: # src/Microsoft.DotNet.Build.Tasks.FileCatalog.Tests/CatalogTests.cs # src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs # src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs # src/Microsoft.DotNet.Build.Tasks.FileCatalog/GenerateFileCatalog.cs # src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs # src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs # src/Microsoft.DotNet.XliffTasks/Model/Document.cs # src/Microsoft.DotNet.XliffTasks/Model/XlfDocument.cs # src/Microsoft.DotNet.XliffTasks/Tasks/GatherTranslatedSource.cs # src/Microsoft.DotNet.XliffTasks/Tasks/SortXlf.cs # src/Microsoft.DotNet.XliffTasks/Tasks/TransformTemplates.cs # src/Microsoft.DotNet.XliffTasks/Tasks/TranslateSource.cs # src/Microsoft.DotNet.XliffTasks/Tasks/UpdateXlf.cs
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Older-host task loading and the changed optional authentication behavior remain unresolved compatibility concerns.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/GenerateSwaggerCode.cs — This static IMultiThreadableTask reference is not inert on older MSBuild hosts. Build task… |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/ProductionChannelValidator.cs — The constructor still advertises token as optional, but direct two-argument callers now pass the… |
Pre-existing issues (16)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs — GetAbsolutePath only roots paths; MSBuild 18.8.2 does not canonicalize .. segments. Because… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — AbsolutePath equality compares the unnormalized stored value. Removing Path.GetFullPath means… View comment |
|
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs — This replaces Path.GetFullPath with an API that roots but does not canonicalize. A valid… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs — This no longer preserves the documented behavior of ResolvedOutputPath: GetAbsolutePath roots… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… View comment |
| // implemented so that TaskEnvironment is injected and paths resolve correctly; | ||
| // the task simply keeps running in the task host under -mt. | ||
| #pragma warning disable MSBuildTask0013 // Interface without the attribute is deliberate; see the comment above. | ||
| public class GenerateSwaggerCode : Task, IMultiThreadableTask |
| _token = string.IsNullOrEmpty(token) | ||
| ? Environment.GetEnvironmentVariable("SYSTEM_ACCESSTOKEN") | ||
| : token; | ||
| _token = token; |
# Conflicts: # src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateLightCommandPackageDrop.cs # src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateWixBuildWixpack.cs
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
UpdatePackageIndex exposes a mutable cached index to concurrent tasks, and several public signature changes break binary compatibility.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs — This task is not safe to opt into in-process concurrency yet. PackageIndex.Load caches and… |
Pre-existing issues (18)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/GenerateSwaggerCode.cs — This static IMultiThreadableTask reference is not inert on older MSBuild hosts. Build task… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/ProductionChannelValidator.cs — The constructor still advertises token as optional, but direct two-argument callers now pass the… View comment |
|
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs — GetAbsolutePath only roots paths; MSBuild 18.8.2 does not canonicalize .. segments. Because… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — AbsolutePath equality compares the unnormalized stored value. Removing Path.GetFullPath means… View comment |
|
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs — This replaces Path.GetFullPath with an API that roots but does not canonicalize. A valid… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs — This no longer preserves the documented behavior of ResolvedOutputPath: GetAbsolutePath roots… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… View comment |
Suppressed comments (9)
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs:34
- Changing these public
LoadAPIs fromstringtoAbsolutePathremoves the existing CLR signatures, so binaries compiled against the shipped packable task assembly will fail withMissingMethodExceptionafter an Arcade update. This conflicts with the repository's no-breaking-changes policy (Documentation/Policy/ChangesPolicy.md:1-18). Keep compatibility overloads accepting the original string types and delegate them to the new typed implementations; the same applies to this class's changed publicSave,Merge, andMergeFramework*methods.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs:32 - Replacing this public
Save(string)signature withSave(AbsolutePath)is a binary-breaking change in the shipped Packaging task assembly, contrary toDocumentation/Policy/ChangesPolicy.md:1-18;Load(string)below has the same problem. Preserve the string overloads and have them delegate to the typed implementations so existing consumers continue to bind.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs:90 - Changing the type of this public property removes its existing getter signature (
string get_SourcePath()), which is binary-breaking for consumers of the packable Packaging assembly and violatesDocumentation/Policy/ChangesPolicy.md:1-18. KeepSourcePathasstringfor compatibility and carry the validatedAbsolutePathin a separate internal property, or follow the documented breaking-change process.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs:25 - This replaces the public
GetAssemblyVersion(string)CLR signature, so existing compiled consumers will fail to bind after updating the package. Preserve a string overload that delegates to the newAbsolutePathimplementation, as required by the no-breaking-changes policy inDocumentation/Policy/ChangesPolicy.md:1-18.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs:281 - Adding the
absoluteNuspecPathparameter replaces the existing publicPack(string, string, Manifest, bool)method rather than extending it, which is a binary-breaking API change underDocumentation/Policy/ChangesPolicy.md:1-18. Retain the old overload and delegate to the typed implementation after resolvingnuspecPaththrough this task'sTaskEnvironment.
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs:67 - Changing this protected virtual method's parameter type breaks existing subclasses and removes the original CLR override slot, contrary to
Documentation/Policy/ChangesPolicy.md:1-18. Keep the virtualstringsignature and resolve it throughTaskEnvironmentinside the base implementation before callingPackageReport.Load; this still gives the task an absolute path without breaking overrides.
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs:24 - This changes the signature of a public static entry point in a shipped assembly, removing the overload that accepts string paths and breaking existing compiled callers under
Documentation/Policy/ChangesPolicy.md:1-18. Keep the originalExecute(string[], string, string[], ..., string, ...)overload as a compatibility wrapper that converts to absolute paths, and move the typed implementation behind a separate overload.
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs:18 - Replacing the public string parameter with
AbsolutePathremoves the existingCalculateMD5(string)binary signature; the publicIsFileIdenticalToBlobAsyncchange below does likewise. Preserve string overloads that delegate to the typed methods so consumers of this task assembly are not broken, perDocumentation/Policy/ChangesPolicy.md:1-18.
public static string CalculateMD5(AbsolutePath filename)
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs:140
- This public method's parameter-type change removes the existing CLR signature and breaks binaries compiled against the Feed task assembly, contrary to
Documentation/Policy/ChangesPolicy.md:1-18. Keep anIsFileIdenticalToBlobAsync(string, string)compatibility overload that delegates to the typed implementation.
public async Task<bool> IsFileIdenticalToBlobAsync(AbsolutePath localFileFullPath, string blobPath) =>
await GetBlob(blobPath).IsFileIdenticalToBlobAsync(localFileFullPath);
| [MSBuildMultiThreadableTask] | ||
| public class UpdatePackageIndex : Microsoft.Build.Utilities.Task, IMultiThreadableTask |
# Conflicts: # src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs # src/Microsoft.DotNet.Arcade.Sdk/src/ExtractNgenMethodList.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GenerateChecksums.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs # src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs # src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs # src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.cs # src/Microsoft.DotNet.Arcade.Sdk/src/SaveItems.cs # src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAndroidWorkItems.cs # src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs # src/Microsoft.DotNet.Helix/Sdk/InstallDotNetTool.cs # src/Microsoft.DotNet.Helix/Sdk/SendHelixJob.cs
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Package-index source tracking loses canonicalization, allowing equivalent paths to bypass duplicate-merge protection.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — GetAbsolutePath preserves .. segments, so storing Value here regresses the previous… |
Pre-existing issues (19)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs — This task is not safe to opt into in-process concurrency yet. PackageIndex.Load caches and… View comment |
|
src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.MSBuild/GenerateSwaggerCode.cs — This static IMultiThreadableTask reference is not inert on older MSBuild hosts. Build task… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/ProductionChannelValidator.cs — The constructor still advertises token as optional, but direct two-argument callers now pass the… View comment |
|
src/Microsoft.DotNet.SignTool/src/SignToolTask.cs — GetAbsolutePath only roots paths; MSBuild 18.8.2 does not canonicalize .. segments. Because… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — AbsolutePath equality compares the unnormalized stored value. Removing Path.GetFullPath means… View comment |
|
src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs — This replaces Path.GetFullPath with an API that roots but does not canonicalize. A valid… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Templating/src/GenerateFileFromTemplate.cs — This no longer preserves the documented behavior of ResolvedOutputPath: GetAbsolutePath roots… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs — The existing public Pack(string, string, Manifest, bool) method has been replaced by this… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageIndex.cs — The PackageIndex type is public in a packable assembly, and this migration replaces its… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs — Changing this public helper’s parameter from string to AbsolutePath removes the old binary API.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/common/AzureStorageUtils.cs — This public method previously accepted string; replacing that signature breaks compiled callers.… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageExtensions.cs — Replacing the public CalculateMD5(string) extension helper with an AbsolutePath signature… View comment |
|
src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs — The public Execute method’s four path parameters changed from strings to AbsolutePath, which is… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs — This protected virtual signature is part of the public task’s subclassing contract; changing it… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/VersionUtility.cs — This replaces the public GetAssemblyVersion(string) API and will break compiled callers. Keep the… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageItem.cs — Changing the public SourcePath property type from string to AbsolutePath breaks both source… View comment |
|
src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageReport.cs — Changing this public method from Save(string) to Save(AbsolutePath) removes the existing… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogBuilder.cs — Replacing the public AddFile(string, ...) signature breaks existing source and compiled consumers… View comment |
|
src/Microsoft.DotNet.Build.Tasks.FileCatalog/CatalogEntry.cs — Changing this public packaged API from string to AbsolutePath is source- and binary-breaking;… View comment |
| var result = s_serializer.Deserialize<PackageIndex>(jsonTextReader); | ||
| result.IndexSources.Add(Path.GetFullPath(packageIndexFile)); | ||
| var result = CreateSerializer().Deserialize<PackageIndex>(jsonTextReader); | ||
| result.IndexSources.Add(packageIndexFile.Value); |


Why
MSBuild 18.x can run tasks on multiple threads inside a single node (
-mt), but only for tasks that opt in via[MSBuildMultiThreadableTask]; everything else is routed to an out-of-proc TaskHost, which is much more expensive. Arcade tasks run in essentially every project in every repo, so they are the single biggest lever.Measured on a runtime inner-repo build in the VMR —
-mt -nodeReuse:true -msagainst an otherwise identical baseline, with no Arcade task annotated:-mt+ server + node reuseOnly a 3.6% wall-clock gain: task time went up and effective parallelism went down, cancelling most of the benefit of threading. Expected saving across a full VMR build once migrated: 5-15 minutes.
What
This is the final part of the migration. The infrastructure and every other assembly already landed in
mainthrough reviewable subsets — #17469 (non-multithreading cleanups), #17497, #17507, #17513, #17522 and #17525 — which account for the 84 tasks annotated there today, and which carried the MSBuild17.12.50->18.8.2upgrade, theMicrosoft.Build.TaskAuthoring.Analyzerwiring, and the removal of the internalBuildTask/ILogbase class.eng/is untouched here.What is left is the 35 tasks in the six assemblies whose path handling runs through shared helper chains:
TaskEnvironment. Relative paths resolve against the project directory instead of the process-wide current directory, environment variables are read per-project, and child processes start fromTaskEnvironment.GetProcessStartInfo().AbsolutePaththrough the shared path helpers in Packaging, GenFacades and Feed. Retyping a helper's path parameter is what actually resolves the transitiveMSBuildTask0005chains, and it is why this subset was kept for last: eightpublicmethods on thePackageIndexhelper change fromstringtoAbsolutePath.Concurrency bugs found and fixed
The analyzer checks path/env/process API usage, not thread-safety of shared mutable state, so a clean analyzer run is not evidence a task is thread-safe. A manual sweep across the whole migration found seven such sites; five are already in
main, and these two are latent bugs today under any concurrent access, not just under-mt:GetPackageDescriptionstatic Dictionary; also memoized thenullreturned after a loggedIOException, so every later invocation silently gotnullwithout retrying.PackageIndexJsonSerializer, which is not thread-safe.Two regressions the migration introduced along the way, already fixed and worth flagging to anyone doing this work:
GetAbsolutePath(null)throws, whileFile.Exists(null)/Directory.Exists(null)returnfalse— the only two BCL path APIs with that tolerance. Mechanically wrapping them turns an optional, unset task property into a hard failure; it took out every source-build leg. This surfaced on legs running without-mt:TaskEnvironmentis injected in normal builds too.IMultiThreadableTask, so every path silently resolved againstFallback.Deliberately not migrated
14 tasks here, each carrying a comment at its declaration recording why, so the decision is not silently reverted: ambient credentials or pipeline environment (6 Feed publishing tasks), process-wide static state (
SignCheckTask,GenPartialFacadeSource,NotSupportedAssemblyGenerator), and unresolved paths flowing into helper chains (GenAPITask,PushToBuildStorage,SignToolTask,CreateVisualStudioWorkload,CreateVisualStudioWorkloadSet). Three more were excluded the same way in earlier subsets (SendHelixJob,InstallDotNetTool,SingleError), for 17 across the migration.All are P3 with no measured invocations in the hot-path profile — every task appearing in a runtime inner-repo binlog is already migrated, so annotating the rest cannot save build time — and they are where a mistake is most expensive and least testable: Maestro and blob publishing, code signing, Wix packaging.
Several keep their
IMultiThreadableTaskimplementation without the attribute. That is deliberate, not a half-migration: routing is decided by the attribute alone, so the interface only causesTaskEnvironmentto be injected, making path resolution correct in either mode. It can never become the routing signal, sinceToolTaskimplements it and that would opt in everyToolTask-derived task in the ecosystem.Validation
dotnet build Arcade.slnx -c Release --no-incremental: 0 errors, 0 warnings. Reviewers: incremental builds skip up-to-date projects, so the analyzer does not re-run and reports a false "0 warnings" —--no-incrementalis required. Liveness was separately confirmed by injecting anEnvironment.GetEnvironmentVariablecall into an annotated task and checking it was reported asMSBuildTask0002.Test suites for the assemblies in scope all pass: Packaging (48), Feed (218), SignTool (196, 7 skipped).
Workloads.Testsneeds a full VSMSBuild.exeandArcade.Validation.Tests.RepoTeststimes out building test repos locally; neither runs here.Contributes to #17378; the remaining tasks are tracked in #17388.
Filed against MSBuild while doing this work: #14779 and #14790 (
TaskRouterdocumentation contradicts the attribute-only implementation), #14780 (MSBuildTask0003code fix produces non-compiling code), and #14783/#14784/#14785 (analyzer gaps this migration surfaced).