Skip to content

Escape localized restore errors in package list JSON - #57083

Merged
zivkan merged 1 commit into
dotnet:release/11.0.2xxfrom
zivkan:fix/package-list-json-escaping
Nov 13, 2026
Merged

zivkan merged 1 commit into
dotnet:release/11.0.2xxfrom
zivkan:fix/package-list-json-escaping

Conversation

@zivkan

@zivkan zivkan commented Nov 12, 2026

Copy link
Copy Markdown
Member

Fix invalid package-list JSON when localized restore errors contain quotes.

Testing: Four regression cases passed across both command forms and three locales using an isolated SDK overlay.

Fixes: NuGet/Home#15140
Fixes: #57063

Encode localized problem text as a JSON string and test restore failures
across command forms and locales.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1f376772-430b-4c25-8b99-48310010d579
@zivkan
zivkan requested a review from a team as a code owner November 12, 2026 03:28
Copilot AI balanced review requested due to automatic review settings November 12, 2026 03:28
@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.

🟢 Approval recommended

No active review issues were identified for the change that escapes localized restore-error text in JSON output.

No open issues 🎉

What changed in this PR

Fixes invalid JSON in the .NET CLI’s package-list restore errors when localized messages contain double quotes, addressing #57063.

Changes:

  • JSON-encodes localized restore error text while preserving the existing output structure.
  • Adds four regression cases covering both command forms and Portuguese (Brazil), German, and English locales, checking JSON validity and localized message content.
File Description
test/​dotnet.Tests/​CommandTests/​Package/​List/​GivenDotnetListPackage.cs Adds regression coverage for localized restore failures in JSON output.
src/​Cli/​dotnet/​Commands/​Package/​List/​PackageListCommand.cs Escapes localized error text before inserting it into JSON.

Review effort: Balanced

@zivkan
zivkan merged commit 59e655f into dotnet:release/11.0.2xx Nov 13, 2026
22 of 24 checks passed
@zivkan
zivkan temporarily deployed to copilot-pat-pool November 13, 2026 20:53 — with GitHub Actions Inactive
@zivkan
zivkan temporarily deployed to copilot-pat-pool November 13, 2026 20:53 — with GitHub Actions Inactive
@zivkan
zivkan temporarily deployed to copilot-pat-pool November 13, 2026 20:53 — with GitHub Actions Inactive
@zivkan
zivkan temporarily deployed to copilot-pat-pool November 13, 2026 20:55 — with GitHub Actions Inactive
@baronfel

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx

@zivkan
zivkan temporarily deployed to copilot-pat-pool November 13, 2026 20:57 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 78553c43 Deployed Nov 13, 2026 by zivkan via conclusion #13773
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants