Resolve net task host params from the project properties#11543
Conversation
baronfel
left a comment
There was a problem hiding this comment.
Some very minor documentation nits as I was looking through. If I can understand this PR then you've done a great job making things easy to follow 🤣
7b6c601 to
1f121ae
Compare
…ttps://github.com/YuliiaKovalova/msbuild into dev/ykovalova/use_project_props_for_sdk_resolution
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for resolving NET Task Host execution parameters from project properties to address issues with task host initialization. The solution introduces packet versioning infrastructure to enable protocol compatibility and adds logic to extract dotnet host path and SDK version information from project properties.
- Adds packet versioning support with extended headers for MSBuild's communication protocol
- Implements logic to resolve
DOTNET_HOST_PATHandRuntimeIdentifierGraphPathfrom project properties - Refactors TaskHostConfiguration to use packet versioning instead of runtime parameters for AppDomain serialization decisions
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/INodePacket.cs | Adds NodePacketTypeExtensions class with packet versioning utilities and reorganizes enum values |
| src/Shared/TaskHostConfiguration.cs | Removes runtime parameter dependency, uses packet version for AppDomain config decisions |
| src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs | Implements project property resolution for NET runtime host paths and SDK validation |
| src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs | Adds logic to gather dotnet host path and MSBuild assembly path from project properties |
| src/Shared/NodeEndpointOutOfProcBase.cs | Implements extended header reading and packet versioning in communication protocol |
| src/Framework/ITranslator.cs | Adds PacketVersion property to ITranslator interface |
| src/Framework/BinaryTranslator.cs | Implements PacketVersion property in both reader and writer translators |
| src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs | Implements extended header writing with packet versioning |
| src/Shared/CommunicationsUtilities.cs | Updates handshake logic to support predefined tools directory parameter |
| src/Build/Resources/Constants.cs | Adds constants for dotnet host path and MSBuild assembly path |
| src/Build/Instance/TaskFactories/TaskHostTask.cs | Updates constructor signature and method calls for new parameter handling |
| src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs | Updates parameter merging logic and method signatures |
| src/Build/Evaluation/IntrinsicFunctions.cs | Updates method calls for new parameter handling |
| src/Build/Evaluation/Evaluator.cs | Updates SDK resolution to use new constant names |
| src/Shared/BuildEnvironmentHelper.cs | Removes unused NET-specific directory properties |
| src/Build/BackEnd/Node/OutOfProcServerNode.cs | Fixes typo in comment |
| src/Build/BackEnd/Components/Communications/NodeLauncher.cs | Updates comment for broader process types |
| src/UnitTests.Shared/RunnerUtilities.cs | Reorders field declarations |
| src/Build.UnitTests/TestAssets/ExampleNetTask/TestNetTask/TestNetTask.csproj | Adds SDK attribute to project |
| src/Build.UnitTests/NetTaskHost_E2E_Tests.cs | Updates test to use new environment variables and error handling |
| src/Build.UnitTests/BackEnd/TaskHostConfiguration_Tests.cs | Removes runtime parameter from test constructors |
| global.json | Reorders SDK paths priority |
074b8da to
8a1b057
Compare
rainersigwald
left a comment
There was a problem hiding this comment.
Will look a the hard parts tomorrow 😅
6dd942b to
1ac8408
Compare
rainersigwald
left a comment
There was a problem hiding this comment.
Overall looking good to me!
based on: #11393
fixes: #11343
This PR contains logic that helps to resolve NetTaskHost execution params based on the project properties.
DOTNET_HOST_PATH=> resolves path to dotnet.exeRuntimeIdentifierGraphPath=> gives the path to the sdk version resolved for the given project.The values are passed to
NodeProviderOutOfProcTaskHostby using taskHostParameters.The exception is generated on attempt to use this functionality for sdk9 and lower.
For further flexibility the packet versioning support was added in NodePacketType.
MSBuild Packet Structure Overview
MSBuild's packet communication protocol supports versioning through an extended header mechanism. This document outlines the binary structure of packets with and without version information.
Basic Packet Format
Packet Type Byte (Position 0) Bit Layout
NodePacketType Value Ranges
Key Design Principle: Clean bit separation ensures the extended header flag (bit 6) never conflicts with packet type values (0-63).
Implementation Notes