Repository navigation
[dotnet] Avoid redundant ReadyToRun compilation - #26613
Conversation
Compare the stored ReadyToRun input hash with the newly computed value instead of inferring hash changes from marker timestamps. Timestamp ordering can be inverted even when WriteOnlyWhenDifferent preserves identical hash content, which causes user-only edits to run the ReadyToRun compiler unnecessarily. Extend the incremental build regression to reproduce the misleading timestamp and verify that actual ReadyToRun input hash changes still invoke compilation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9117a629-9654-4c0d-9a2f-355a8eca6186
There was a problem hiding this comment.
🟡 Changes recommended
Strengthen the test to verify real input-hash changes and deterministically reproduce timestamp ordering.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates ReadyToRun incremental-build detection to compare aggregate input hashes instead of file timestamps.
Changes:
- Removes the trigger-file timestamp protocol.
- Compares persisted and newly computed R2R input hashes.
- Extends incremental-build test coverage.
File summaries
| File | Summary |
|---|---|
tests/dotnet/UnitTests/IncrementalBuildTest.cs |
Adds regression coverage, but needs a controlled non-user input change and a more reliable timestamp offset. |
dotnet/targets/Microsoft.Sdk.R2R.targets |
Implements hash-based ReadyToRun change detection. |
Review details
Suppressed comments (1)
tests/dotnet/UnitTests/IncrementalBuildTest.cs:334
⚠️ Test reliability — A one-minute offset is not a deterministic guarantee: if this R2R build takes longer than a minute, the hash can become older than the trigger that the old implementation creates, so the regression scenario is no longer reproduced. Use a substantially larger fixed offset (or another duration-independent timestamp setup).
File.SetLastWriteTimeUtc (r2rInputHashPath, DateTime.UtcNow.AddMinutes (1));
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [CI Build #bb21248] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 264 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
ReadyToRun incremental builds used the relative timestamps of a hash file and a trigger file to determine whether non-user assemblies had changed. The hash content could remain identical while its timestamp was refreshed after the trigger, which caused user-only edits to invoke the ReadyToRun compiler.
Compare the previously stored aggregate input hash with the newly computed hash instead, and remove the timestamp-based trigger protocol.
Extend the incremental build test to deterministically reproduce the misleading timestamp ordering on iOS and Mac Catalyst. The test also verifies that a real ReadyToRun input hash change still invokes compilation.
🤖 Pull request created by Copilot