Skip to content

Migrate DownloadFile task to use TaskEnvironment API#13113

Merged
JanProvaznik merged 2 commits intomainfrom
copilot/migrate-downloadfile-task
Feb 6, 2026
Merged

Migrate DownloadFile task to use TaskEnvironment API#13113
JanProvaznik merged 2 commits intomainfrom
copilot/migrate-downloadfile-task

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Migrate the DownloadFile task to use TaskEnvironment API based on the pattern used here: #12914

Make sure to preserve correctness, performance and that the tests pass


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@dotnet-policy-service
Copy link
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.

@JanProvaznik
Copy link
Member

@copilot try again

Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
@JanProvaznik
Copy link
Member

blocked by #13120

@JanProvaznik JanProvaznik marked this pull request as ready for review February 2, 2026 09:34
Copilot AI review requested due to automatic review settings February 2, 2026 09:34
@JanProvaznik JanProvaznik requested a review from SimaTian February 2, 2026 09:35
@JanProvaznik JanProvaznik changed the title [WIP] Migrate DownloadFile task to use TaskEnvironment API Migrate DownloadFile task to use TaskEnvironment API Feb 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the DownloadFile task to the new multithreadable task pattern so that path resolution is thread-safe and aligned with the TaskEnvironment API used by other file I/O tasks.

Changes:

  • Marked DownloadFile as a multithreadable task ([MSBuildMultiThreadableTask]) and implemented IMultiThreadableTask with a TaskEnvironment property.
  • Switched destination folder resolution in DownloadFile from directly using DestinationFolder.ItemSpec to TaskEnvironment.GetAbsolutePath(...) to avoid process-global current-directory state.
  • Updated DownloadFile unit tests to initialize TaskEnvironment via TaskEnvironmentHelper.CreateForTest() wherever the task is instantiated and uses file system paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Tasks/DownloadFile.cs Makes DownloadFile multi-threadable and uses TaskEnvironment.GetAbsolutePath to resolve the destination folder path before creating the directory.
src/Tasks.UnitTests/DownloadFile_Tests.cs Ensures tests explicitly set TaskEnvironment for DownloadFile instances so the new API is exercised safely under the test harness.

Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JanProvaznik JanProvaznik merged commit 53a802a into main Feb 6, 2026
15 checks passed
@JanProvaznik JanProvaznik deleted the copilot/migrate-downloadfile-task branch February 6, 2026 12:33
JanProvaznik added a commit to JanProvaznik/msbuild that referenced this pull request Feb 25, 2026
Thanks for asking me to work on this. I will get started on it and keep
this PR's description up to date as I form a plan and make progress.


<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> Migrate the DownloadFile task to use TaskEnvironment API based on the
pattern used here: dotnet#12914
> 
> Make sure to preserve correctness, performance and that the tests pass


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants