Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Untracked assembly-resolution paths and Windows drive-root rewriting can produce unsound cache keys.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds root-relative ILLink cache identities so equivalent worktrees can share eligible cached outputs.
Changes:
- Maps source-root paths into stable cache keys and relative invocations.
- Expands cache eligibility checks and input hashing.
- Adds target wiring, documentation, and extensive tests.
| File | Description |
|---|---|
LinkTask.cs |
Implements path mapping and cache validation. |
Microsoft.NET.ILLink.targets |
Forwards SDK source roots. |
Mock.cs |
Captures cache invocation details. |
ILLink.Tasks.Tests.cs |
Tests sharing, eligibility, and fallback behavior. |
eng/illink.targets |
Defines the runtime repository source root. |
sfx-finish.proj |
Forwards source roots for framework trimming. |
oob-trim.proj |
Forwards source roots for OOB trimming. |
illink-tasks.md |
Documents task behavior and configuration. |
task-cache.md |
Updates cache design decisions. |
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
Keep ILLink configuration and input identity in the task while sharing entry validation, publication, directory restoration, and usage metadata. Preserve v1 serialization, mutex names, diagnostics, and purge semantics. Compile shared sources into consumers without adding a runtime assembly. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Reference the shared invocation cache entry metadata directly from the purge tool and tests. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Keep ILLink configuration and task tests in ILLink, and exercise storage with a tool-independent fixture. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Share opt-in parsing, cache-directory resolution, diagnostics, and construction while keeping ILLink eligibility and input identity in its task. Move configuration tests alongside the shared storage tests and preserve ILLink configuration behavior. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Share entry enumeration, last-used handling, deletion, diagnostics, and summary reporting with explicit layout and tool labels. Keep the ILLink CLI and idle-cache requirement unchanged. Move engine tests into shared sources and cover independent layouts while retaining CLI tests in the tool project. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Move restore-or-execute orchestration and successful-result storage into the shared cache sources. Keep ILLink eligibility, key computation and output preparation in task callbacks, preserving the existing directory-only v1 storage contract. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Describe inputs, context, and outputs independently of cache policy and compute content identities in the shared layer. Resolve cache configuration lazily and keep output preparation in normal tool execution, with cache-owned restoration on hits. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Preserve runtime library ExtraArgs input discovery in DescribeInvocation, including readable XML inputs and assembly search-directory inventories. Adapt bypass returns and diagnostic assertions to the extracted invocation-description contract. Assisted-by: GitHub Copilot CLI:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Move the ILLink cache CLI into a standalone dotnet-build-cache tool. Support named ILLink and crossgen2 caches with explicit-directory, environment, and shared platform-default resolution, independently of task enablement. Update build, test, CI, and usage wiring and align tool-file identity coverage with explicit absence markers. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Use only the explicit cache directory in CI commands and the matching example. Explain that a cache name does not validate directory ownership when an explicit directory is supplied. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Let output validation exceptions propagate instead of falling back to normal execution, preserving the existing protection against overlapping cache and output directories. Cover rejected declarations and ILLink output cleanup with regression tests. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Record input roles while generating execution arguments and logical cache context. Capture normalized file identities in InvocationDescription and extract source-root mapping from LinkTask. Remove override detection and assembly-name/module preflight restrictions; defer hashless linked-resource tracking. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Resolve physical input and output locations through a reversible path map instead of retaining parallel path and identity inventories. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Preserve root-relative invocation construction and reversible path identities while integrating CachedToolTask diagnostic capture and replay. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Record arguments once and render execution and cache context from the same structured list, preserving original spelling on normalization fallback. Replace the abstract path map with a concrete shared SourceRootPathMap and retain linker-specific symbol checks in ILLink. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Reuse prepared paths in argument rendering, input discovery, output preparation and cache descriptions. Preserve original argument spelling for fallback and retain relative execution without deterministic mappings. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Store canonical full paths for file access and map distinct paths once during key construction, including structured argument context. Pass known paths to ILLink as full paths without changing its working directory. Retain cross-root sharing and reject overlapping logical namespaces. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Remove the invocation builder and rendering callbacks, retaining plain physical path records until cache key computation. Drop working-directory identity and redundant path normalization, and allow nested physical roots with independent logical prefixes. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Record task settings and item metadata directly instead of retaining command-line fragments. Keep ordered physical path inputs separate from the content inventory, mapping them only during key construction, and remove InvocationArgument.IsPath. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Construct cache descriptions directly from task parameters, resolving physical paths only for cache file access. Remove inline cache bookkeeping and argument rewriting, preserve the original response-building flow and raw extra arguments, and expose the content inventory as an unordered read-only collection. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Register supported extra arguments directly in the cache description, restore feature and substitution settings, and retain input/context collections without intermediate copies. Keep original tool argument construction unchanged. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Restore conservative assembly inventory, defer cache-only preparation until extra arguments pass, and remove unrelated execution and formatting changes. Cover early bypass and ignored input dependencies. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Restore byte-only satellite inventory and limit symbol checks to emission. Preserve portable PDB paths without inspecting existing document or CodeView paths, and simplify physical invocation path handling. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <[email protected]> Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
…mbol preservation are absent Avoid bypassing the ILLink cache when SourceRoots lack logical MappedPath prefixes, have conflicting logical mappings, or when portable PDBs are emitted without PreserveSymbolPaths. In these cases, include physical paths in the cache key so entries still store and hit at the same locations without being shared across worktrees. Assisted-by: Copilot:gemini-4-neon Co-authored-by: Copilot <[email protected]> Copilot-Session: 63f42165-ce0c-4ed8-8526-5f1e29a55b24
Verify via reflection that every public declared parameter on ILLink is covered by the cache key or explicitly bypasses caching, and that mutating each parameter changes the generated tool arguments (except SourceRoots) and cache key accordingly. Assisted-by: Copilot:gemini-4-neon Co-authored-by: Copilot <[email protected]> Copilot-Session: 63f42165-ce0c-4ed8-8526-5f1e29a55b24
Map external XML and assembly-location diagnostic origins using --pathmap when logical SourceRoots are provided, so linker diagnostics are path-independent and can be cached and replayed verbatim across worktrees. Assisted-by: GitHub-Copilot-CLI:gemini-4-neon Co-authored-by: Copilot <[email protected]> Copilot-Session: 63f42165-ce0c-4ed8-8526-5f1e29a55b24
…implification-temp # Conflicts: # src/tools/illink/src/ILLink.Tasks/LinkTask.cs # src/tools/illink/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs
There was a problem hiding this comment.
🟡 Changes recommended
Critical flaws can turn invalid descriptor paths into successful cache hits, replay incorrect XML diagnostic origins or stale symbol paths, and corrupt linker arguments for source roots containing quotes even with caching disabled.
4 open issues
Review effort: Balanced
| var paths = new SourceRootPathMap(SourceRoots); | ||
| pathDependentReason = paths.HasLogicalRoots ? null : "no SourceRoots have logical MappedPath prefixes."; |
| } | ||
| foreach (ITaskItem reference in ReferenceAssemblyPaths ?? Array.Empty<ITaskItem>()) | ||
| { | ||
| if (!AddAssembly(AddPath(nameof(ReferenceAssemblyPaths), reference.ItemSpec), checkOutputSymbols: false)) |
| path = Path.GetFullPath(path); | ||
| if (path.Length > Path.GetPathRoot(path).Length) | ||
| path = path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); |
| @@ -44,22 +44,26 @@ public abstract class ProcessLinkerXmlBase | |||
| protected readonly LinkContext _context; | |||
|
|
|||
| protected ProcessLinkerXmlBase(LinkContext context, Stream documentStream, string xmlDocumentLocation) | |||
| : this(context, documentStream, context.MapPath(xmlDocumentLocation), resource: null) | |||
- Move LinkContext.AddPathMap/MapPath outside #if !ILTRIM so ILTrim.Core compiles. - Normalize alternate directory separators in SourceRootPathMap.Map for Windows paths. - Match LinkTask.Quote trailing-backslash trimming in ILLink.Tasks.Tests assertions. - Reject quoted SourceRoots before --pathmap emission, verify effective skip action before waiving reference symbol checks, preserve trailing separators on file paths during cache input discovery, and resolve external XML paths before mapping diagnostic origins. Assisted-by: Copilot:gemini-4-neon Co-authored-by: Copilot <[email protected]> Copilot-Session: 63f42165-ce0c-4ed8-8526-5f1e29a55b24
There was a problem hiding this comment.
🟡 Changes recommended
External linked-resource changes can now restore stale DLLs from the cache, and method-based diagnostics still expose physical source paths instead of applying path mapping.
6 open issues
Include linked-resource files in the cache key · New Resolve external XML paths before mapping diagnostic origins Preserve trailing separators when discovering cache inputs Verify effective skip action before waiving reference symbol checks Reject quoted source roots before generating path mappings Apply path mapping to method-based diagnostic origins · New
Review effort: Balanced
| throw new BadImageFormatException("Input PE image has no managed metadata.", path); | ||
| MetadataReader metadata = pe.GetMetadataReader(); | ||
| foreach (AssemblyFileHandle handle in metadata.AssemblyFiles) | ||
| foreach (AssemblyReferenceHandle reference in metadata.AssemblyReferences) |
| !GetStringParam(token, out string? logicalPath)) | ||
| return -1; | ||
|
|
||
| context.AddPathMap(physicalPath, logicalPath); |


Builds on #135886 to share eligible ILLink task cache entries across worktrees with equivalent layouts. Map declared source roots into stable cache identities while retaining full content hashing, and run single-root invocations from that root with structured relative arguments rather than rewriting raw command strings. Use the shared invocation cache for storage and restoration.
Caching remains opt-in, with compiler and symbol-preservation defaults unchanged. Unsupported inputs run uncached with their original arguments and working directory. This branch retains the already-merged resolver fix from #136249 because the current base predates it.
Validated both task targets, 355 task/shared-cache tests, 1,307 linker tests (30 existing skips), and 65 cache-maintenance tests on Linux. Real enclosing-root and disjoint-root cache hits matched uncached DLL/PDB bytes, including concurrent writers and SDK mapping probes. Windows/macOS execution and full runtime builds were not run.
Note
This pull request description was created with assistance from GitHub Copilot.