Skip to content

Honor configured NuGet sources for package discovery - #55848

Merged
baronfel merged 31 commits into
dotnet:mainfrom
baronfel:baronfel-fix-tool-search-sources
Nov 5, 2026
Merged

baronfel merged 31 commits into
dotnet:mainfrom
baronfel:baronfel-fix-tool-search-sources

Conversation

@baronfel

@baronfel baronfel commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #55792

Summary

Package discovery now uses enabled feeds from the effective NuGet configuration instead of hard-binding to nuget.org. Commands that expose --source use it as an exclusive override, --add-source appends feeds, and --configfile selects the NuGet configuration. Source order is preserved and duplicate feeds are removed. Template search intentionally does not expose --source, because its results come from the fixed Microsoft template catalog rather than arbitrary NuGet feeds. Nullable analysis is also enabled in every C# file touched by this change.

Tool search

  • Searches each selected source through NuGet.Protocol's typed PackageSearchResource rather than manually reading the service index or issuing HTTP/JSON requests.
  • Searches up to four feeds concurrently while preserving configured source order in the output.
  • Runs asynchronously and flows the System.CommandLine cancellation token through throttling, NuGet resource acquisition, and package search. Caller cancellation propagates while each feed retains its ten-second timeout.
  • Reports results and failures per source, continuing when a feed is unavailable or does not expose a package-search resource.
  • Returns success when at least one source completes successfully.

Template search

  • Keeps the Microsoft template catalog as the discovery index, then verifies each candidate's exact package version against configured NuGet feeds and any --add-source feeds.
  • Uses NuGet.Protocol's nullable FindPackageByIdResource, handles feeds that do not support it, and applies package source mapping.
  • Adds --add-source and --configfile controls to dotnet new search; it does not add --source, because arbitrary-feed template discovery is unsupported.

Workload advertising

  • Propagates the selected PackageSourceLocation into advertising-manifest latest-version checks.
  • Ensures workload update discovery uses the same configured or explicitly selected sources as the corresponding package downloads.

Validation

  • Managed CLI build with nullable analysis enabled and no warnings
  • 26 focused tool-search tests
  • 15 workload-search tests
  • 88 template-search parser tests
  • dotnet new search help approval tests
  • Configured-source template-search integration test

Copilot AI lite review requested due to automatic review settings August 18, 2026 21:20
@baronfel
baronfel requested review from a team as code owners August 18, 2026 21:20
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates .NET SDK “discovery” experiences to honor the user’s configured/enabled NuGet sources (and new --source/--add-source/--configfile controls), aligning dotnet tool search, dotnet new search, and workload advertising update checks with NuGet configuration policy instead of hardcoding nuget.org.

Changes:

  • Refactors dotnet tool search to query each selected feed via NuGet.Protocol’s PackageSearchResource, reporting per-source failures while succeeding if any source succeeds.
  • Extends dotnet new search to accept source-selection options and filters catalog hits by verifying package id+version availability against selected feeds (including package source mapping).
  • Propagates selected package source location into workload advertising manifest “latest version” checks, plus broad test updates/coverage and localization resource updates.

Reviewed changes

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

Show a summary per file
File Description
test/Microsoft.TemplateEngine.Cli.UnitTests/TemplateSearchCoordinatorTests.cs Updates expected provider display name for template search results.
test/Microsoft.TemplateEngine.Cli.UnitTests/TemplateSearch/CliTemplateSearchCoordinatorTests.cs Adds unit tests for catalog-hit availability filtering helper logic.
test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/SearchTests.cs Adds parser coverage for new dotnet new search source-selection options.
test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/TabCompletionTests.Search_GetAllSuggestions.verified.txt Updates tab-completion snapshot to include new search options.
test/Microsoft.TemplateEngine.Cli.UnitTests/NuGet/PackageAvailabilityCheckerTests.cs Adds tests for feed availability checks, failures, and source mapping behavior.
test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockNuGetPackageDownloader.cs Captures PackageSourceLocation passed to latest-version queries for workload tests.
test/Microsoft.DotNet.Cli.Utils.Tests/NuGetSourceConfigurationTests.cs Adds tests for loading enabled sources, overrides, add-source ordering/deduping.
test/dotnet.Tests/queryResultSample.json Removes sample JSON used by deleted deserializer tests.
test/dotnet.Tests/dotnet.Tests.csproj Removes queryResultSample.json from test output assets.
test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs Adds assertions that advertising checks receive configured PackageSourceLocation.
test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchParserTests.cs Adds parser coverage for tool-search --configfile, --source, --add-source.
test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchCommandTests.cs Adds behavioral tests for multi-source execution, ordering, and failure handling.
test/dotnet.Tests/CommandTests/Tool/Search/SearchResultPrinterTests.cs Adds tests for per-source headings/failures and invalid/no-source messages.
test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiRequestTests.cs Replaces URL-construction tests with PackageSearchResource behavior tests.
test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiDeserializerTests.cs Removes tests for the deleted JSON deserializer path.
test/dotnet-new.IntegrationTests/DotnetNewSearchTests.cs Updates integration expectations for template source display name.
test/dotnet-new.IntegrationTests/Approvals/DotnetNewTests.CanUseNormalMode_common.verified.txt Updates approval snapshot for template source display name.
test/dotnet-new.IntegrationTests/Approvals/DotnetNewSearchTests.CanShowMessageInCaseShortNameConflict.verified.txt Updates approval snapshot for template source display name.
test/dotnet-aot.Tests/AotParserTests.cs Updates AOT expectations to route tool search through managed fallback.
src/TemplateEngine/Microsoft.TemplateSearch.Common/Providers/NuGetMetadataSearchProviderFactory.cs Corrects provider display name to reflect catalog-based search behavior.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hant.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.zh-Hans.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.tr.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ru.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pt-BR.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.pl.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ko.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.ja.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.it.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.fr.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.es.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.de.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/xlf/LocalizableStrings.cs.xlf Adds localization entry for “all feeds failed” template availability verification.
src/Cli/Microsoft.TemplateEngine.Cli/TemplateSearch/CliTemplateSearchCoordinator.cs Filters catalog hits by package availability on selected feeds and initializes credential service for interactive mode.
src/Cli/Microsoft.TemplateEngine.Cli/NuGet/PackageAvailabilityChecker.cs Introduces feed-based id+version availability checks (with throttling and source mapping).
src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.resx Adds new localized string for template availability “all feeds failed” case.
src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs Updates resource designer for new template availability string.
src/Cli/Microsoft.TemplateEngine.Cli/Commands/search/SearchCommandArgs.cs Plumbs new source-selection/interactive options into dotnet new search args.
src/Cli/Microsoft.DotNet.Cli.Utils/NuGetSourceConfiguration.cs Adds shared loader for enabled/configured sources plus overrides/additions/deduping.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hant.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hans.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.tr.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ru.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pt-BR.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pl.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ko.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ja.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.it.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.fr.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.es.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.de.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.cs.xlf Updates localized command/option strings for tool-search source selection.
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Tool/ToolSearchCommandDefinition.cs Adds config/source/add-source options to dotnet tool search.
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Tool/ToolAppliedOption.cs Allows per-command override of --source/--add-source descriptions.
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/New/SharedOptionsFactory.cs Adds shared --source and --configfile options for dotnet new commands.
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/New/NewSearchCommandDefinition.cs Registers source-selection options for modern dotnet new search only.
src/Cli/Microsoft.DotNet.Cli.Definitions/CommandDefinitionStrings.resx Adds/updates tool-search command and option descriptions.
src/Cli/dotnet/NugetSearch/NugetToolSearchApiRequest.cs Replaces HTTP/JSON search with PackageSearchResource + typed metadata mapping.
src/Cli/dotnet/NugetSearch/INugetToolSearchApiRequest.cs Updates contract to query a specific PackageSource and return typed results.
src/Cli/dotnet/NugetSearch/NugetSearchApiSerializable/NugetSearchApiVersionSerializable.cs Removes JSON model types for the deleted deserializer path.
src/Cli/dotnet/NugetSearch/NugetSearchApiSerializable/NugetSearchApiPackageSerializable.cs Removes JSON model types for the deleted deserializer path.
src/Cli/dotnet/NugetSearch/NugetSearchApiSerializable/NugetSearchApiContainerSerializable.cs Removes JSON model types for the deleted deserializer path.
src/Cli/dotnet/NugetSearch/NugetSearchApiSerializable/NugetSearchApiAuthorsSerializable.cs Removes JSON model types for the deleted deserializer path.
src/Cli/dotnet/NugetSearch/NugetSearchApiResultDeserializer.cs Removes legacy JSON deserializer used by old tool-search implementation.
src/Cli/dotnet/NugetSearch/AuthorsConverter.cs Removes legacy JSON converter used by old tool-search implementation.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf Adds localization entry for “no sources configured” tool-search error.
src/Cli/dotnet/Commands/Workload/Install/WorkloadAdvertisingManifestUpdater.cs Passes configured PackageSourceLocation into latest-version checks.
src/Cli/dotnet/Commands/Tool/ToolCommandParser.cs Removes AOT in-proc tool search; routes to managed CLI fallback.
src/Cli/dotnet/Commands/Tool/Search/ToolSearchCommand.cs Implements per-source tool search execution, error handling, and exit codes.
src/Cli/dotnet/Commands/Tool/Search/SearchResultPrinter.cs Adds per-source output/error reporting helpers used by tool search.
src/Cli/dotnet/Commands/Tool/Search/NugetSearchSerializables.cs Adjusts download counts to long for typed metadata parity.
src/Cli/dotnet/Commands/CliCommandStrings.resx Adds localized string for tool-search “no sources configured” error.
src/Cli/dotnet-aot/AotSourceFiles.props Removes tool-search sources from AOT compile set; relies on managed fallback.
Files not reviewed (1)
  • src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs: Generated file

@Evangelink Evangelink left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note

This review was generated with AI assistance and verified against the checked-out PR branch and the corresponding NuGet.Client implementations.

I found 9 issues affecting feed compatibility, authentication, source mapping, failure reporting, and request scaling.

@baronfel

Copy link
Copy Markdown
Member Author

/aot-size

@github-actions

This comment has been minimized.

@baronfel

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

@baronfel

Copy link
Copy Markdown
Member Author

/azp run

@baronfel
baronfel requested a review from a team as a code owner August 28, 2026 06:06
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@baronfel

Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@baronfel

Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Build Failure Analysis

Summary — the Native AOT build of src/Cli/dotnet-aot/dotnet-aot.csproj fails on 9 of 10 legs (all AOT legs plus the non-AOT Windows x64/FullFramework legs) because ILC's trim/AOT analysis now reports IL2026/IL3053 from NuGet.Protocol's use of Newtonsoft.Json reflection, and this PR's own suppression for those codes doesn't apply in this build.

Root cause: WarningsNotAsErrors for IL2026/IL3053 is scoped to VMR/source-build only, but this CI build is neither

This PR adds NuGet.Protocol-based package search/discovery code to the managed dotnet CLI, and AotSourceFiles.props links several of the touched files (NugetToolSearchApiRequest.cs, INugetToolSearchApiRequest.cs, etc.) into the AOT-published dotnet-aot project. NuGet.Protocol's GetOperationClaimsRequest/GetServiceIndexResponse constructors call JToken.ToString(Formatting, JsonConverter[]), which is annotated RequiresUnreferencedCode. ILC's static analysis flags this as IL2026 (and rolls it up into an IL3053 "assembly produced AOT analysis warnings" for NuGet.Protocol.dll), and under this AOT project's warn-as-error policy that turns into a build error, failing the IlcCompile Exec task with MSB3073 (ilc exit code 1).

The PR already anticipated this — dotnet-aot.csproj adds:

<WarningsNotAsErrors Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(DotNetBuildFromVMR)' == 'true'">$(WarningsNotAsErrors);IL2026;IL3053</WarningsNotAsErrors>

citing NuGet/NuGet.Client#7518 as suppressing these only when compiling NuGet.Protocol itself, not for downstream AOT consumers. However, this public CI build (dotnet-sdk-public-ci, the one that just failed) is not a VMR / source-build-only leg, so DotNetBuildSourceOnly and DotNetBuildFromVMR are both unset/false, the Condition never applies, and IL2026/IL3053 remain warn-as-error for every leg that AOT-compiles dotnet-aot (and evidently also for the plain Windows x64 / FullFramework legs, which appear to build the AOT flavor too).

Affected files / errors

  • src/Cli/dotnet-aot/dotnet-aot.csproj (added lines) — WarningsNotAsErrors condition doesn't cover this build's configuration
  • ILC (via IlcCompile/Microsoft.NETCore.Native.targets:357) — IL2026: NuGet.Protocol.Plugins.GetOperationClaimsRequest.GetOperationClaimsRequest(String,JObject) uses JToken.ToString(Formatting, JsonConverter[])
  • ILC — IL2026: NuGet.Protocol.Plugins.GetServiceIndexResponse.GetServiceIndexResponse(MessageResponseCode,JObject) — same cause
  • .packages/nuget.protocol/7.11.0-rc.45209/lib/net10.0/NuGet.Protocol.dll — IL3053: Assembly 'NuGet.Protocol' produced AOT analysis warnings
  • MSB3073 — ilc process exited with code 1 (downstream failure of the above)

Reproduced identically (same 4 errors, only paths differ) on: Linux arm64 AOT, Linux x64 AOT, Linux x64 (non-AOT label but still AOT-compiles dotnet-aot), Mac arm64 AOT, Windows arm64 AOT, Windows x64 AOT, Windows x64, Windows x64 FullFramework. Only Linux arm64 (leg 2_0) reported no errors.

Proposed fix

Broaden the condition so the suppression also applies to this CI's build configuration — either drop the condition (these codes are already scoped by NuGet/NuGet.Client#7518 as safe to suppress for consumers, per the comment) or add whatever property flags this CI leg (e.g. also unconditionally, or Or '$(ContinuousIntegrationBuild)' == 'true' if that's the intended scope):

-    <WarningsNotAsErrors Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(DotNetBuildFromVMR)' == 'true'">$(WarningsNotAsErrors);IL2026;IL3053</WarningsNotAsErrors>
+    <WarningsNotAsErrors>$(WarningsNotAsErrors);IL2026;IL3053</WarningsNotAsErrors>

If the narrower VMR-only scoping was intentional (e.g. to keep the public CI AOT leg honest about new trim issues), the alternative is to avoid pulling NuGet.Protocol-backed types into the AOT-linked file set in AotSourceFiles.props until the trim warnings are resolved upstream, but that conflicts with this PR's goal of using NuGet.Protocol's typed search APIs from dotnet-aot's managed fallback path — a maintainer should confirm the intended scope.


Build overview
  • Project: src/Cli/dotnet-aot/dotnet-aot.csproj
  • Target framework: net11.0
  • Failing target: IlcCompile (task Exec, calling ilc via Microsoft.NETCore.Native.targets line 357)
  • RIDs observed failing: win-x64, win-arm64, linux-arm64, linux-x64, osx-arm64
  • Exit code: ILC process exit code 1 → MSB3073 → Build failed.
All MSBuild errors (identical pattern across 8 legs)
Code Project File Message
IL2026 dotnet-aot.csproj ILC NuGet.Protocol.Plugins.GetOperationClaimsRequest..ctor uses JToken.ToString(Formatting, JsonConverter[]) which has RequiresUnreferencedCodeAttribute
IL3053 dotnet-aot.csproj NuGet.Protocol.dll Assembly NuGet.Protocol produced AOT analysis warnings
IL2026 dotnet-aot.csproj ILC NuGet.Protocol.Plugins.GetServiceIndexResponse..ctor uses JToken.ToString(Formatting, JsonConverter[]) which has RequiresUnreferencedCodeAttribute
MSB3073 dotnet-aot.csproj Microsoft.NETCore.Native.targets:357 ilc command exited with code 1

Legs with this exact pattern: 1_0_Linux_arm64_AOT, 3_0_Linux_x64_AOT, 4_0_Linux_x64, 5_0_Mac_arm64_AOT, 6_0_Mac_arm64, 7_0_Windows_arm64_AOT, 8_0_Windows_x64_AOT, 9_0_Windows_x64_FullFramework, 10_0_Windows_x64.
Leg 2_0_Linux_arm64 reported no errors.


🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit b4420b3

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · auto · 73.2 AIC · ⌖ 2.08 AIC · ⊞ 7.1K · [◷]( · ◷)

@baronfel

baronfel commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

The size is ok here - we'll be working on that size regresssion shortly

Comment thread src/Cli/dotnet-aot/dotnet-aot.csproj Resolved
@baronfel
baronfel force-pushed the baronfel-fix-tool-search-sources branch from b4420b3 to 4fb118e Compare September 22, 2026 20:26
Centralize configured, exclusive, and additive NuGet source resolution for discovery commands, with localized option text and focused tests.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Search each selected NuGet feed, preserve per-source results, tolerate partial feed failures, and keep managed and Native AOT behavior aligned.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
baronfel and others added 14 commits October 28, 2026 17:40
Restore the tool search implementation to the Native AOT source closure and wire its asynchronous cancellation-aware action. Add coverage proving the command executes in-process instead of requesting managed fallback.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Ensure NuGet.Protocol's serializer feature switch is folded in Debug publishes as well as Release so the disabled Newtonsoft.Json reflection path does not enter the AOT closure.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Do not print a tags label when package metadata contains no tags, and cover the mixed populated/empty result case.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Do not print an authors label when package metadata contains no authors, and cover empty authors alongside empty tags.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Default run-dn to Release so NuGet.Protocol's serializer feature switch is folded without forcing optimization in the dotnet-aot project configuration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Parse shared --configfile options as FileInfo and rely on System.CommandLine's AcceptExistingOnly validator. Convert to string paths only at existing NuGet-facing boundaries.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Restore the Native AOT development harness to its pre-change configuration and remove comments or organization changes that do not explain necessary behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Update typed config option and search help expectations, and configure discovery fixtures to expose downloaded packages through a local NuGet source.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Keep NuGet-compatible package files in the configured local feed while giving the test discovery provider catalog copies named with its ID##version convention.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Consolidate overlapping tests, simplify template package availability orchestration, and reuse existing localized option descriptions without changing discovery behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Keep rebased workload commands aligned with typed config-file options, avoid per-result version requests for concise tool searches, and retain the narrow Native AOT warning treatment required by current NuGet.Protocol.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Regenerate the Polish CLI localization after replaying the source resource changes and align the template search help approval with the current System.CommandLine output.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
@baronfel
baronfel force-pushed the baronfel-fix-tool-search-sources branch from 4fb118e to ce689b9 Compare October 28, 2026 22:55

@Evangelink Evangelink left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note

This review was generated with AI assistance. Each finding was checked against the current PR head and reproduced before posting.

Five confirmed issues remain: configured credentials are discarded by explicit source overrides, tool-search terms are no longer URL-escaped, discovery bypasses the insecure-HTTP source policy, source deduplication conflates case-sensitive URI paths, and the new workload update gate suppresses supported feature-band fallback. I have not approved the PR.

Verification used head ce689b9948e46379c0d8c609951f38f221425798 and NuGet.Protocol 8.1.0-rc.52403:

  • Ran the assembled managed SDK against loopback NuGet V3 feeds for both dotnet tool search and dotnet new search, including Basic authentication, explicit source overrides, and HTTP sources without opt-in. Tool search with C# --skip 3 --take 4 sent only /search?q=C.
  • Executed the source loader with two HTTPS addresses differing only in path case; it selected one source although the URI values are distinct.
  • Ran focused checks through scripts\RunTests.cs: 212 existing tests passed and 2 were skipped across tool/workload, shared source configuration, template search, and managed AOT-parser coverage.
  • Added a review-only workload regression probe: direct advertising update successfully uses the installed manifest's fallback band, but background advertising update downloads nothing. That probe failed as expected. Its source was preserved outside the checkout and its TRX under artifacts/log/test-runs; the checkout was left unchanged.
  • The managed validation layout builds with /p:PublishAot=false /p:_ShouldPublishDotnetAot=false /p:UseSharedCompilation=false. Native publish/run, native parity, and binary-size measurement were not completed because the local Windows C++ linker is unavailable; the AOT-parser results above are managed executions, not native evidence.

Preserve configured source metadata, validate insecure feeds, encode search terms, and align workload advertising fallback checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
Use RuntimeInformation for the OS-specific path comparer so Microsoft.DotNet.Cli.Utils continues to compile for net472.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc

@marcpopMSFT marcpopMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 > [!NOTE]

This review was generated with AI assistance and verified against the checked-out PR branch.

Two issues found: template source discovery semantics and Native AOT runtime coverage.

Comment thread test/dotnet-aot.Tests/AotParserTests.cs Resolved
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
@marcpopMSFT

Copy link
Copy Markdown
Member

🤖 Copilot source-review finding: versionless template results bypass package source mapping

Verified at head b3a34c24518d081df04e5966e3c3af5563151235: FilterAvailablePackagesAsync excludes hits with null/empty Version from the availability candidates, while IsConfirmedAvailable unconditionally returns true for those same hits.

For example, with an enabled corp source whose PSM rules allow only Contoso.*, a catalog hit named Other.Templates with Version = null skips the mapped-source check but is still displayed and can be selected for the install example. If all hits are versionless, the empty candidate set is also marked successful without querying a feed. The catalog reader permits a missing version, so this is a supported-input edge case; I have not established that today's default catalog contains such entries or run a runtime repro.

This needs a production-code correction plus mapping-aware regression coverage, not just a test expectation update: apply full-package-ID mapping/source eligibility before the versionless compatibility shortcut, excluding IDs with no eligible selected/enabled source. Preserve the existing behavior for eligible versionless entries, mapping-disabled configurations, and explicit source overrides. A coordinator-level test should assert that a disallowed versionless hit is absent from both results and the install example, and that an all-disallowed search does not return success.

This is a search-result consistency issue, not an installation or NuGet-cache bypass: installation still enforces its own PSM. It can be handled as a focused follow-up if keeping this PR's scope unchanged.

@baronfel

Copy link
Copy Markdown
Member Author

🤖 Copilot source-review finding: versionless template results bypass package source mapping

Verified at head b3a34c24518d081df04e5966e3c3af5563151235: FilterAvailablePackagesAsync excludes hits with null/empty Version from the availability candidates, while IsConfirmedAvailable unconditionally returns true for those same hits.

For example, with an enabled corp source whose PSM rules allow only Contoso.*, a catalog hit named Other.Templates with Version = null skips the mapped-source check but is still displayed and can be selected for the install example. If all hits are versionless, the empty candidate set is also marked successful without querying a feed. The catalog reader permits a missing version, so this is a supported-input edge case; I have not established that today's default catalog contains such entries or run a runtime repro.

This needs a production-code correction plus mapping-aware regression coverage, not just a test expectation update: apply full-package-ID mapping/source eligibility before the versionless compatibility shortcut, excluding IDs with no eligible selected/enabled source. Preserve the existing behavior for eligible versionless entries, mapping-disabled configurations, and explicit source overrides. A coordinator-level test should assert that a disallowed versionless hit is absent from both results and the install example, and that an all-disallowed search does not return success.

This is a search-result consistency issue, not an installation or NuGet-cache bypass: installation still enforces its own PSM. It can be handled as a focused follow-up if keeping this PR's scope unchanged.

I don't think this is a valid finding, since there are no custom search catalog files (we construct the only one) and our constructed file always has versions. In addition, search is best-effort - any security application like Package Source Mapping is independently handled by dotnet new install already.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3dbbc31f-4199-4ea5-a54e-a458bbae4cdc
@baronfel
baronfel merged commit 8593f4e into dotnet:main Nov 5, 2026
23 checks passed
@baronfel
baronfel temporarily deployed to copilot-pat-pool November 5, 2026 18:56 — with GitHub Actions Inactive
@baronfel
baronfel temporarily deployed to copilot-pat-pool November 5, 2026 18:57 — with GitHub Actions Inactive
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 6, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 7c054e17 Deployed Nov 5, 2026 by baronfel via pat_pool #12228
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.

dotnet tool/new search hardcode NuGet.org instead of honoring configured sources

5 participants