Make task environment path absolutization not throw.#13035
Merged
AR-May merged 5 commits intodotnet:mainfrom Jan 16, 2026
Merged
Make task environment path absolutization not throw.#13035AR-May merged 5 commits intodotnet:mainfrom
AR-May merged 5 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where TaskEnvironment.GetAbsolutePath throws exceptions during multi-process execution when encountering paths with invalid characters. The fix changes from using Path.GetFullPath to using Path.Combine in the MultiProcessTaskEnvironmentDriver.GetAbsolutePath method.
Changes:
- Replaced
Path.GetFullPathwithPath.CombineinMultiProcessTaskEnvironmentDriver.GetAbsolutePathto avoid exceptions on invalid path characters - Added conditional compilation directives to use
Microsoft.IO.Pathfor .NET Framework andSystem.IO.Pathfor .NET Core - Added a unit test to verify the fix handles invalid path characters without throwing
- Minor documentation improvements (XML comment references and clarifications)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Framework/TaskEnvironment.cs | Updated XML comment to use proper <see cref> syntax for ProjectDirectory; removed trailing whitespace |
| src/Build/BackEnd/TaskExecutionHost/MultiThreadedTaskEnvironmentDriver.cs | Improved comment clarity by specifying "functions used in project files" |
| src/Build/BackEnd/TaskExecutionHost/MultiProcessTaskEnvironmentDriver.cs | Added conditional imports for Microsoft.IO vs System.IO; replaced Path.GetFullPath with Path.Combine in GetAbsolutePath implementation |
| src/Build.UnitTests/BackEnd/TaskEnvironment_Tests.cs | Added test case to verify GetAbsolutePath doesn't throw with invalid path characters |
src/Build/BackEnd/TaskExecutionHost/MultiProcessTaskEnvironmentDriver.cs
Outdated
Show resolved
Hide resolved
src/Build/BackEnd/TaskExecutionHost/MultiProcessTaskEnvironmentDriver.cs
Outdated
Show resolved
Hide resolved
baronfel
approved these changes
Jan 15, 2026
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
src/Build/BackEnd/TaskExecutionHost/MultiProcessTaskEnvironmentDriver.cs
Show resolved
Hide resolved
YuliiaKovalova
approved these changes
Jan 16, 2026
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Jan 20, 2026
This was referenced Mar 11, 2026
This was referenced Mar 11, 2026
Closed
Open
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.
Context
TaskEnvironment.GetAbsolutePathcan throw exceptions during multi‑process execution. This issue can be mostly avoided by usingMicrosoft.IO.Path.Combinein .NET Framework MSBuild andSystem.IO.Path.Combinein .NET Core MSBuild in the underlying implementations. This way the only exception could be thrown on null argument.Changes Made
Start using
Path.Combinefor allAsbolutePathcreations.Testing
Added a unit test for this case.