You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[build] Fix concurrent SDK version generation. Fixes #26685 - #26687
Multi-target assembly-preparer builds can invoke the same Make recipes concurrently. The shared SdkVersions.cs.tmp file can be truncated by another invocation, causing a false regeneration error, while writing ProductConstants.cs directly can expose incomplete source to a compiler.
Generate both files through process-specific temporary files and atomically publish completed output. Clean up temporary files on exit and ignore leftovers from interrupted builds. Genuine SdkVersions.cs changes still fail the build with the existing instruction to commit the regenerated file.
Let Make own incremental dependency tracking instead of the incorrect and incomplete MSBuild input/output paths. Track the shared recipes and version configuration as Make prerequisites, and quote the project directory passed to make.
Multi-target assembly-preparer builds can invoke the same Make recipes concurrently. Use process-specific temporary files and atomically publish completed output so one invocation cannot truncate another invocation’s temporary file or expose partially written ProductConstants.cs to a compiler. Clean up temporary files on exit while preserving the error requiring genuine SdkVersions.cs changes to be committed.
Let Make own incremental dependency tracking instead of the incorrect and incomplete MSBuild input/output paths. Track the shared recipes and version configuration as Make prerequisites, and quote the project directory passed to make.
Fixes#26685
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Extend the generated-source ignore rules to cover the PID-suffixed temporary files used by concurrent generation. The recipes normally remove these files on exit, but an abrupt process termination can bypass cleanup; any leftovers should remain ignored just like the previous shared temporary file.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The generated-source targets consume Make.config.inc, whose writer still used one shared temporary file and removed the published configuration before replacement. Concurrent Make invocations could therefore interfere before reaching the already-protected C# generators.
Use a process-specific temporary file, clean it on exit, and preserve the published configuration until the existing atomic rename replaces it. Ignore interrupted-generation leftovers and make the configuration depend on its generator script so changes to that script trigger regeneration.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add Make.versions prerequisite to prevent stale generated version metadata
Make.config:40
❌ bug — create-make-config.sh reads ./Make.versions when computing the commit distances, but this target does not depend on $(TOP)/Make.versions. After a version change, Make can therefore reuse a stale Make.config.inc, and the generated constants consume outdated version metadata. Add $(TOP)/Make.versions to this prerequisite list.
[!NOTE]
This review comment was generated by GitHub Copilot.
Use POSIX trap syntax for /bin/sh compatibility
tools/common/Make.common:8
❌ error — This recipe now uses Bash's EXIT trap, but Make does not select Bash for recipe execution; on Linux the default /bin/sh is commonly dash, which rejects EXIT and aborts before generating SdkVersions.cs. Use the POSIX 0 trap (or explicitly run the recipe under Bash) so the Linux build path remains valid.
[!NOTE]
This review comment was generated by GitHub Copilot.
This issue also appears on line 56 of the same file.
Add Make.versions to the Make.config.inc prerequisites because create-make-config.sh uses its history to calculate per-platform NuGet commit distances. This ensures version updates refresh the cached metadata before the generated-source recipes consume it, while unchanged builds remain incremental.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Version generation misses HEAD changes in reused checkouts
Make.config:40
❌ bug — create-make-config.sh computes the NuGet commit distances from git blame ... HEAD and git rev-list ... HEAD, but this prerequisite list only tracks the checked-in configuration and script. In a reused checkout, advancing HEAD without changing Make.config or Make.versions leaves Make.config.inc up to date, so SdkVersions.cs/ProductConstants.cs can retain stale version data. Add appropriate Git revision/index prerequisites (the version-generation rules in dotnet/Makefile:112 track both) or another revision marker, after GIT_DIRECTORY has been resolved for worktrees.
[!NOTE]
This review comment was generated by GitHub Copilot.
#26685 (#26869)
Multi-target assembly-preparer builds can invoke the same Make recipes concurrently. The shared SdkVersions.cs.tmp file can be truncated by another invocation, causing a false regeneration error, while writing ProductConstants.cs directly can expose incomplete source to a compiler.
Generate both files through process-specific temporary files and atomically publish completed output. Clean up temporary files on exit and ignore leftovers from interrupted builds. Genuine SdkVersions.cs changes still fail the build with the existing instruction to commit the regenerated file.
Let Make own incremental dependency tracking instead of the incorrect and incomplete MSBuild input/output paths. Track the shared recipes and version configuration as Make prerequisites, and quote the project directory passed to make.
Fixes#26685
🤖 Pull request created by Copilot
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Backport of #26687.
#26685 (#26879)
Multi-target assembly-preparer builds can invoke the same Make recipes concurrently. The shared SdkVersions.cs.tmp file can be truncated by another invocation, causing a false regeneration error, while writing ProductConstants.cs directly can expose incomplete source to a compiler.
Generate both files through process-specific temporary files and atomically publish completed output. Clean up temporary files on exit and ignore leftovers from interrupted builds. Genuine SdkVersions.cs changes still fail the build with the existing instruction to commit the regenerated file.
Let Make own incremental dependency tracking instead of the incorrect and incomplete MSBuild input/output paths. Track the shared recipes and version configuration as Make prerequisites, and quote the project directory passed to make.
Fixes#26685
🤖 Pull request created by Copilot
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Backport of #26687.
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-target assembly-preparer builds can invoke the same Make recipes concurrently. The shared SdkVersions.cs.tmp file can be truncated by another invocation, causing a false regeneration error, while writing ProductConstants.cs directly can expose incomplete source to a compiler.
Generate both files through process-specific temporary files and atomically publish completed output. Clean up temporary files on exit and ignore leftovers from interrupted builds. Genuine SdkVersions.cs changes still fail the build with the existing instruction to commit the regenerated file.
Let Make own incremental dependency tracking instead of the incorrect and incomplete MSBuild input/output paths. Track the shared recipes and version configuration as Make prerequisites, and quote the project directory passed to make.
Fixes #26685
🤖 Pull request created by Copilot