Add fast-paths for ToolLocationHelper property functions#12025
Closed
Add fast-paths for ToolLocationHelper property functions#12025
Conversation
Contributor
|
Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
…latformSDKDisplayName Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add fast-paths for property functions used in template projects
Add fast-paths for ToolLocationHelper property functions
Jun 16, 2025
Member
|
let's retry with newer copilot version! |
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.
This PR adds fast-path implementations for two commonly used ToolLocationHelper property functions that were identified as performance bottlenecks in template projects:
GetPlatformSDKLocation(String, String)GetPlatformSDKDisplayName(String, String)Problem
When building template projects in .NET 10.0.100-preview.5, these property functions don't have fast paths and require expensive reflection calls during project evaluation. The tracing output showed:
Solution
Added fast-path implementations in
WellKnownFunctions.csfollowing the established pattern:Microsoft.Build.Utilities.csprojin the Build project to access ToolLocationHelperParseArgs.TryGetArgsThe fast-paths avoid the expensive reflection mechanism and provide direct calls to the underlying methods when the signature matches exactly (two string parameters).
Changes
src/Build/Microsoft.Build.csproj: Added project reference to Utilitiessrc/Build/Evaluation/Expander/WellKnownFunctions.cs: Added fast-path implementationssrc/Build.UnitTests/Evaluation/Expander_Tests.cs: Added test caseTesting
TestToolLocationHelperFastPathsFixes #12024.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
dnceng.pkgs.visualstudio.comdotnet build src/Build/Microsoft.Build.csproj --configuration Debug --verbosity minimal(dns block)dotnet test src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj --filter TestToolLocationHelperFastPaths --configuration Debug --verbosity normal(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.