Skip to content

XRAY-140488 - Implement graceful dotnet restore error for all dotnet …#752

Open
gauriy-tech wants to merge 1 commit into
jfrog:devfrom
gauriy-tech:bugfix/nuget-curation-cpm-error-message
Open

XRAY-140488 - Implement graceful dotnet restore error for all dotnet …#752
gauriy-tech wants to merge 1 commit into
jfrog:devfrom
gauriy-tech:bugfix/nuget-curation-cpm-error-message

Conversation

@gauriy-tech
Copy link
Copy Markdown
Contributor

…versions

  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....
  • All static analysis checks passed.
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • Updated the Contributing page / ReadMe page / CI Workflow files if needed.
  • All changes are detailed at the description. if not already covered at JFrog Documentation, new documentation have been added.

Summary

jf ca against a .NET project using Central Package Management (CPM)
currently surfaces this when a PackageReference has no matching
PackageVersion:

'dotnet restore' command failed: exit status 1 - …NU1010… The following PackageReference items do not define a corresponding PackageVersion item…
The raw NuGet output buries the actionable detail and varies wildly across
.NET SDKs (NU1010 vs NU1008, semicolon vs comma separators, anchor phrase
changes between every other release).
This PR replaces the wrapper with a concise, action-oriented message:
Central Package Management mismatch: PackageReference 'Microsoft.ApplicationInsights' does not have a corresponding PackageVersion entry. Ensure 'Microsoft.ApplicationInsights' is defined in Directory.Packages.props, then re-run 'jf ca'.

Pluralised when multiple packages are missing.

Scope

  • Only the error-return path of runDotnetRestore is touched (1-line wire-in
    in nuget.go). Happy-path restore is untouched.
  • Non-CPM failures (NU1101 package-not-found, NU1301 unreachable feed,
    MSBuild crashes, …) preserve the original verbose 'dotnet restore' command failed: … output by design — we only translate what we know.

Wording coverage (verified against live dotnet restore captures)

.NET SDK NuGet codes seen Handled
6.0.428 NU1010 / NU1008, ; separator yes
7.0.410 NU1010 / NU1008, ; separator yes
8.0.421 NU1010 / NU1008, ; separator yes
9.0.314 NU1008 even for partial mismatch (NuGet 6.12 change) yes
10.0.101 (bug report) NU1010, , separator, new anchor phrase yes

Safety net

When a CPM error code is seen but the message wording is unknown or
localised (future NuGet rewording, French/Japanese locale, etc.), the user
still gets a friendly generic CPM message instead of the raw exit status 1
blob. Raw output is logged at DEBUG for support.

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.

1 participant