Repository navigation
Use implicit AbsolutePath conversions in built-in tasks - #15202
Conversation
Replace redundant Value reads at path consumers with the existing implicit string conversion instead of widening task analyzer recognition. Keep canonicalization and nullable unwrapping unchanged, document the preferred pattern, and cover direct and transitive analyzer calls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes preserve path values, include regression coverage for the unchanged analyzer contract, and have no identified blocking issues.
Review effort: Balanced
Findings: None
What changed in this PR
Updates built-in tasks to use implicit AbsolutePath conversions, preserving analyzer recognition without changing runtime path values or analyzer rules.
Changes:
- Replace redundant
.Valueaccesses with implicit conversions. - Add direct and transitive regression tests for accepted conversions and rejected bare
.Valueaccess. - Document the recommended analyzer-safe pattern.
| File | Description |
|---|---|
| src/Tasks/XmlTaskUtility.cs | Pass the absolute path directly to OpenRead. |
| src/Tasks/WriteCodeFragment.cs | Use implicit conversion for filename extraction. |
| src/Tasks/Untar.cs | Simplify source and destination path conversions. |
| src/Tasks/TaskEnvironmentExtensions.cs | Simplify conversions and update helper documentation. |
| src/Tasks/TarDirectory.cs | Pass absolute paths directly to filesystem constructors. |
| src/Tasks/SystemState.cs | Simplify cache path assignment. |
| src/Tasks/SGen.cs | Simplify assembly path conversions. |
| src/Tasks/RedistList.cs | Simplify redist path assignment. |
| src/Tasks/ManifestUtil/LauncherBuilder.cs | Use implicit conversions for launcher file operations. |
| src/Tasks/InstalledSDKResolver.cs | Simplify SDK directory assignment. |
| src/Tasks/BootstrapperUtil/Util.cs | Simplify project directory conversion. |
| src/Tasks/BootstrapperUtil/ResourceUpdater.cs | Simplify resource file path assignment. |
| src/Tasks/AxTlbBaseTask.cs | Simplify tool path conversion. |
| src/Tasks/AssemblyDependency/ReferenceTable.cs | Simplify canonical reference path assignment. |
| src/Tasks/AssemblyDependency/Reference.cs | Pass framework paths directly to directory checks. |
| src/Tasks/AssemblyDependency/RawFilenameResolver.cs | Simplify raw filename resolution. |
| src/Tasks/AssemblyDependency/Node/RarNodeExecuteRequest.cs | Simplify captured project directory assignment. |
| src/Tasks/AssemblyDependency/HintPathResolver.cs | Simplify hint path conversion. |
| src/Tasks/AssemblyDependency/AssemblyFoldersFromConfig/AssemblyFoldersFromConfigResolver.cs | Simplify configured directory conversions. |
| src/Tasks/AssemblyDependency/AssemblyFoldersFromConfig/AssemblyFoldersFromConfigCache.cs | Preserve absolute path types through directory selection. |
| src/TaskAnalyzer/README.md | Explain implicit conversions and bare .Value handling. |
| src/TaskAnalyzer.Tests/TransitiveCallChainAnalyzerTests.cs | Cover conversions in source helpers. |
| src/TaskAnalyzer.Tests/MultiThreadableTaskAnalyzerTests.cs | Cover conversions directly in tasks. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
6325c36 to
4bf7510
Compare
Fold the direct and transitive cases into compact data-driven tests that compare implicit conversions with bare Value access. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
4bf7510 to
bac3c79
Compare
There was a problem hiding this comment.
✅ 24/24 dimensions clean — no findings.
Warning
Firewall blocked 3 domains
The following domains were blocked by the firewall during workflow execution:
api.github.life-white.ukgithub.life-white.ukraw.githubusercontent.com
[!TIP]
api.github.com is blocked because GitHub API access uses the built-in GitHub tools by default. Instead of adding api.github.com to network.allowed, use tools.github.mode: gh-proxy for direct pre-authenticated GitHub CLI access without requiring network access to api.github.com:
tools:
github:
mode: gh-proxySee GitHub Tools for more information on gh-proxy mode.
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "api.github.com"
- "github.com"
- "raw.githubusercontent.com"See Network Configuration for more information.
Generated by Expert Code Review (on open) for #15202 · copilot · gpt56 · 784.9 AIC · ⌖ 4.94 AIC · ⊞ 24.5K
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
rainersigwald
left a comment
There was a problem hiding this comment.
The theme here is "if we're going to use AbsolutePath, should we keep it around longer, not just for immediate normalization into a string that we then lose type-level absolute-path-ness on?"
|
The PR's theme is not exactly "if we're going to use AbsolutePath, should we keep it around longer, not just for immediate normalization into a string that we then lose type-level absolute-path-ness on?" But rather "Unblock running analyzer as a warning not as a suggestion". I would like to separate those concerns and make a separate follow up PR that addresses the first theme (which is for sure is a correct thing to do). |
rainersigwald
left a comment
There was a problem hiding this comment.
That makes sense to me.
Related issue(s): Fixes #15072
Context
Built-in tasks sometimes pass
AbsolutePath.Valueto file APIs. Accessing.Valueturns the path into a plain string, so the analyzer loses the proof that it is absolute and reports a diagnostic.Pass
AbsolutePathdirectly instead. Its implicit conversion produces the same string while preserving enough type information for analyzer verification. This is an alternative to #15073.Changes Made
.Valueaccesses at path-consuming APIs with implicit conversions, while retaining.Valuefor string-specific operations.Compatibility
No runtime or analyzer behavior change. Bare
AbsolutePath.Valueremains untrusted.Testing