Repository navigation
Extract non-multithreading task cleanups from #17381 - #17469
Merged
Merged
Conversation
The property declarations were spread over five lines each with the accessors on their own lines. Collapse them to the single-line form used elsewhere in the task. UseNetPlatform keeps its block body because it has real accessor logic. Formatting only, no behavior change. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
The Execute/ExecuteImpl split exists so ExecuteImpl can return early while Execute still ends with 'return !Log.HasLoggedErrors;'. In these six tasks ExecuteImpl contains no return statement at all, so the split is pure indirection. Tasks that do use early returns (FindLatestDrop, GenerateTrainingInputFiles, GenerateTrainingPropsFile, LocateDotNet) keep the split. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs — GetOutputFileContent() can return null when it logs an error, but `File.WriteAllText(OutputPath,… |
What changed in this PR
This PR extracts non-multithreading cleanup changes from #17381, primarily simplifying several MSBuild task implementations and tightening task-object caching to avoid cross-project reuse when RepositoryRoot (and SdkVersion) differ.
Changes:
- Simplify several MSBuild tasks by inlining
ExecuteImpl()intoExecute()when there are no early returns. - Collapse multi-line auto-properties in
ValidatePackage(formatting-only). - Fix task object caching to include
global.jsonpath (andSdkVersionforCheckRequiredDotNetVersion) in cache entry validation.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/Vsix/GetPkgDefAssemblyDependencyGuid.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/Vsix/FinalizeInsertionVsixFile.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/GetRunSettingsSessionConfiguration.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidatePackage.cs | Formatting-only: collapses auto-properties. |
| src/Microsoft.DotNet.Arcade.Sdk/src/ValidateLicense.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.cs | Adds globalJsonPath to cache entry validation to prevent incorrect cache reuse across different repo roots. |
| src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs | Inlines ExecuteImpl into Execute and returns based on Log.HasLoggedErrors. |
| src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs | Adds globalJsonPath and SdkVersion to cache entry validation to prevent incorrect cache reuse. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
CheckRequiredDotNetVersion and LocateDotNet both registered their cached result under a constant key and then decided cache hits by comparing fields stored inside the cached entry. Two problems followed from that: - The comparison had to be kept in sync with the inputs by hand, and it omitted the global.json path, so a second project with a different RepositoryRoot could be served another root's answer. - RegisterTaskObject is implemented as ConcurrentDictionary.TryAdd, so with a constant key only the first registration of a build ever takes effect. Every other repository root missed the cache and then failed to populate it, recomputing on every single invocation. Move the identity into the key itself as a readonly record struct. The engine's dictionary lookup now does the comparison, distinct inputs get distinct entries, and the cached value is just the result.
ViktorHofer
force-pushed
the
task-cleanup
branch
from
September 1, 2026 07:38
8bb3f31 to
c8546ba
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Review tier: Lite
Findings: 1
Pre-existing issues (1)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.Arcade.Sdk/src/GenerateSourcePackageSourceLinkTargetsFile.cs — GetOutputFileContent() can return null when it logs an error, but `File.WriteAllText(OutputPath,… View comment |
akoeplinger
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Non-multithreading changes extracted out of #17381 to shrink that PR and keep the risk separable. Each commit stands alone.
ValidatePackage— formatting only.ExecuteImplwhere it has no early returns — theExecute/ExecuteImplsplit only earns its keep whenExecuteImplreturns early. In these six tasks it has noreturnat all. Tasks that do use early returns keep the split.CheckRequiredDotNetVersionandLocateDotNetcache under a constant build-scoped key but never compare the path the entry came from, so a second project with a differentRepositoryRootcan get the first one's answer.CheckRequiredDotNetVersionalso ignoredSdkVersion.The cache fix is the only behavioral change.