Repository navigation
[dotnet-linker] Write the generated typemap assemblies deterministically. - #26485
Conversation
…lly. The typemap assemblies we generate got a new random module version id (MVID) and a new timestamp every time they were written, which means they'd be different for every build even if nothing had changed. This is bad for incremental builds, because the MVID of every assembly in the app ends up in the generated native registrar code, so the registrar code would change on every build, forcing a recompile and a relink of the native executable. Fix this by asking Cecil to compute the MVID from the contents of the assembly (and to use a fixed timestamp), which means the MVID now only changes when the contents of the typemap assembly actually change. Verified by doing two clean builds of MySimpleApp (iOS/ios-arm64/CoreCLR) and comparing the MVIDs of every assembly in the app bundle as well as the generated registrar.mm: they're now identical (before this change the four typemap assemblies differed, and so did registrar.mm). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ef04d7c1-e5e3-4244-ac92-f7341ddac90e
There was a problem hiding this comment.
Pull request overview
This PR updates the typemap assembly writing logic in the dotnet-linker registrar step to produce deterministic outputs (stable MVIDs and timestamps), preventing unnecessary downstream registrar code changes and improving incremental build behavior.
Changes:
- Introduced a
WriteDeterministicallyhelper that writes typemap assemblies withDeterministicMvid = trueand a fixed timestamp. - Switched both root typemap assembly and per-assembly typemap outputs to use the deterministic writer.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@dalexsoto stamp |
✅ 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 #f333610] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 205 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
The typemap assemblies we generate got a new random module version id (MVID) and a new timestamp every time they were written, which means they'd be different for every build even if nothing had changed.
This is bad for incremental builds, because the MVID of every assembly in the app ends up in the generated native registrar code, so the registrar code would change on every build, forcing a recompile and a relink of the native executable.
Fix this by asking Cecil to compute the MVID from the contents of the assembly (and to use a fixed timestamp), which means the MVID now only changes when the contents of the typemap assembly actually change.
Verified by doing two clean builds of MySimpleApp (iOS/ios-arm64/CoreCLR) and comparing the MVIDs of every assembly in the app bundle as well as the generated registrar.mm: they're now identical (before this change the four typemap assemblies differed, and so did registrar.mm).
🤖 Pull request created by Copilot