Skip to content

[dotnet] Avoid redundant ReadyToRun compilation - #26613

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/avoid-user-r2r-recompile
Sep 16, 2026
Merged

rolfbjarne merged 1 commit into
mainfrom
dev/rolf/avoid-user-r2r-recompile

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

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

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
Copilot AI lite review requested due to automatic review settings September 15, 2026 17:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: bb212481130c761c66d081768381c24bbf4c4c5a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [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
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: bb212481130c761c66d081768381c24bbf4c4c5a [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) September 16, 2026 11:01
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Sep 16, 2026
@rolfbjarne
rolfbjarne merged commit f215ac5 into main Sep 16, 2026
55 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/avoid-user-r2r-recompile branch September 16, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants