Skip to content

[Bug]: The criteria to raise a warning for no symbol api key while pushing symbol packages is incorrect #11743

Open
@kartheekp-ms

Description

@kartheekp-ms

NuGet Product Used

dotnet.exe, NuGet.exe

Product Version

dotnet nuget push and nuget.exe push

Worked before?

No response

Impact

No response

Repro Steps & Context

Execute dotnet nuget push *.nupkg -s https://packagesource/v3/index.json --api-key apikey --symbol-source https://symbolsource command. Please note --symbol-api-key is neither passed to the commandline or added to the NuGet.Config file.

Actual
No warning is raised. Pushing of symbol packages may fail if the server requires a symbol api key for the operation to be successful.

Expected
NuGet Client raises a warning saying Found symbols package '{0}', but no API key was specified for the symbol server. To save an API Key, run 'NuGet.exe setApiKey [your API key from http://www.NuGet.org]' because symbol apikey is neither passed via commandline not it was found in the NuGet.Config file.

In the existing implementation, code checks for empty or null value for --api-key when pushing symbol packages to an online feed for e.g., nuget.org. If the validation fails, it raises a warning saying Found symbols package '{0}', but no API key was specified for the symbol server. To save an API Key, run 'NuGet.exe setApiKey [your API key from http://www.NuGet.org]'

https://github.com/NuGet/NuGet.Client/blob/2f609f59dee750a4670838701b0de83792ff7402/src/NuGet.Core/NuGet.Protocol/Resources/PackageUpdateResource.cs#L284

Instead, it should check for empty or null value for --symbol-api-key because the logic is trying to push a symbols package not a regular package .nupkg.

The fix for this issue is simply to validate symbol api key and then raise a warning if the value validation fails.

Verbose Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions