Repository navigation
[release/11.0.1xx] Fix dnx offline package cache fallback - #55958
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Keep the cache and cancellation helpers on the concrete downloader so shared interfaces and unrelated mocks remain unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
There was a problem hiding this comment.
Pull request overview
This PR updates dotnet tool exec / dnx tool resolution to better support offline (or partially offline) scenarios by reusing already-downloaded tool packages from the global NuGet cache and only probing feeds briefly when a floating version is requested.
Changes:
- Add cache-first resolution logic for
ToolExecuteCommand, including a short, configurable feed probe and honoringNO_CACHE. - Add
ToolPackageDownloaderhelpers to select the best matching cached tool and to resolve versions with cancellation support. - Extend
NuGetPackageDownloaderto accept cancellation and treatHttpRequestExceptionsimilarly toFatalProtocolExceptionwhenIgnoreFailedSourcesis enabled. - Add end-to-end regression tests covering cached fallback behavior and cache bypass.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs | Adds end-to-end tests for cached tool fallback and cache-bypass behavior. |
| src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs | Adds cached-tool selection and cancellable version/source lookup. |
| src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs | Adds cancellable version+source resolution and improved handling of HttpRequestException with IgnoreFailedSources. |
| src/Cli/dotnet/Commands/Tool/Execute/ToolExecuteCommand.cs | Implements cache-first tool execution logic with feed probing, timeout, and NO_CACHE support. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
|
@dsplaisted this PR allows |
Use System.CommandLine cancellation tokens for global tool install and update version resolution, while preserving synchronous command entry points for direct callers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 164ae8b0-7bdd-40e6-aa03-69ee79fc0488
lbussell
left a comment
There was a problem hiding this comment.
A good follow-up might be to make async commands more first-class in the .NET CLI / in CommandBase. As far as I can tell, I don't think the synchronous version of ToolExecuteCommand.Execute() is called from anywhere.
I do agree, but pre-LLMs didn't want to do all of the grunt work myself. |
Summary
--no-cacheandNO_CACHETesting
src\Cli\dotnet\dotnet.csprojdnxanddotnet tool execcache fallback testsFixes #50579