(#59) Add property to IChocolateyPackageSearchMetadata#60
Merged
AdmiringWorm merged 1 commit intochocolatey:developfrom Feb 27, 2026
Merged
(#59) Add property to IChocolateyPackageSearchMetadata#60AdmiringWorm merged 1 commit intochocolatey:developfrom
AdmiringWorm merged 1 commit intochocolatey:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new AvailableVersionSource property to the IPackageSearchMetadata interface to store information about the package source where a package was located. Unlike other properties in this interface which are typically read-only, this property includes both a getter and setter to allow the source information to be set after metadata retrieval.
Changes:
- Added
AvailableVersionSourceproperty with get/set accessors toIPackageSearchMetadatainterface - Implemented the property in all classes that implement the interface (PackageSearchMetadata, LocalPackageSearchMetadata, PackageSearchMetadataV2Feed, ClonedPackageSearchMetadata, TransitivePackageSearchMetadata)
- Updated PublicAPI.Unshipped.txt files for all target frameworks (net472, netcoreapp5.0, netstandard2.0) to document the new public API surface
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/NuGet.Core/NuGet.Protocol/Model/IChocolateyPackageSearchMetadata.cs | Adds the AvailableVersionSource property declaration to the interface with get/set accessors |
| src/NuGet.Core/NuGet.Protocol/Model/ChocolateyPackageSearchMetadata.cs | Implements the property as an auto-property with JsonIgnore attribute |
| src/NuGet.Core/NuGet.Protocol/Model/ChocolateyLocalPackageSearchMetadata.cs | Implements the property with explicit getter/setter and backing field for local packages |
| src/NuGet.Core/NuGet.Protocol/Model/ChocolateyPackageSearchMetadataV2Feed.cs | Implements the property for V2 feed with auto-property |
| src/NuGet.Core/NuGet.Protocol/Model/PackageSearchMetadataBuilder.cs | Adds property to ClonedPackageSearchMetadata and removes trailing comma from previous last property |
| src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/TransitivePackageSearchMetadata.cs | Adds getter-only property forwarding to underlying metadata |
| src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Unshipped.txt | Documents new public API surface for .NET Framework 4.7.2 |
| src/NuGet.Core/NuGet.Protocol/PublicAPI/netcoreapp5.0/PublicAPI.Unshipped.txt | Documents new public API surface for .NET Core 5.0 |
| src/NuGet.Core/NuGet.Protocol/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | Documents new public API surface for .NET Standard 2.0 |
| src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/PublicAPI.Unshipped.txt | Documents new public API surface for VisualStudio contracts |
| test/TestUtilities/Test.Utility/Protocol/ChocolateyV3PackageSearchMetadataFixture.cs | Adds property to test mock implementation |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ChocolateyTestPackageSearchMetadata.cs | Adds property to test metadata class |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/NuGet.Core/NuGet.Protocol/Model/ChocolateyLocalPackageSearchMetadata.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.Protocol/Model/PackageSearchMetadataBuilder.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/TransitivePackageSearchMetadata.cs
Outdated
Show resolved
Hide resolved
This commit adds a new property to the IChocolateyPackageSearchMetadata interface, and implements this property on all instances of this interface. This is required, since we need a mechanism to store the information about _where_ a package was located. When running the FindPackage method in Chocolatey.CLI, the retured metadata class doesn't have this information, however, at the time of calling this method, we do know what source is being used, so we can record this information, we just need a property to store it. Once stored, it can then be retrieved furhter upstream as/when required. Typically, properties on the IChocolateyPackageSearchMetadata interface don't have a public set, since they are typically initialised when being created, however, since we are only setting this property once the meta data is returned, we need there to be a public set method for this property. Due to a failing build on GitHub Actions, the CA1416 entry has been added to the NoWarn attribute in the props file, so that the build does not fail. It is unclear why this is now causing a problem, when it wasn't before, but it was felt that this was a safe change, since an override for this warning already exists when running the build in a different environment.
3efdd1c to
3997028
Compare
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.
Description Of Changes
This commit adds a new property to the IChocolateyPackageSearchMetadata interface, and implements this property on all instances of this interface.
Motivation and Context
This is required, since we need a mechanism to store the information about where a package was located. When running the FindPackage method in Chocolatey.CLI, the retured metadata class doesn't have this information, however, at the time of calling this method, we do know what source is being used, so we can record this information, we just need a property to store it. Once stored, it can then be retrieved furhter upstream as/when required.
Typically, properties on the IChocolateyPackageSearchMetadata interface don't have a public set, since they are typically initialised when being created, however, since we are only setting this property once the meta data is returned, we need there to be a public set method for this property.
Testing
The testing of the change here will be done with another PR into the Chocolatey CLI repository.
That PR can be found here:
https://gitlab.com/chocolatey/central-management/choco-licensed-management-ui/-/merge_requests/708
Operating Systems Testing
Change Types Made
Change Checklist
Related Issue
Fixes #59