Skip to content

dotnet package update --vulnerable works with TreatWarningsAsErrors - #7605

Merged
zivkan merged 2 commits into
devfrom
dev-zivkan-repro-14988
Aug 9, 2026
Merged

zivkan merged 2 commits into
devfrom
dev-zivkan-repro-14988

Conversation

@zivkan

@zivkan zivkan commented Jul 31, 2026

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#14988

Description

dotnet package update --vulnerable finds packages to update by doing an in-memory restore (not writing assets file, etc), and looking for NU1901-4 restore log messages. But it can't tell the difference between warnings treated as errors causing restore to fail, or if there's some other failure. If there's a different failure, then the assets file on disk could be invalid, so package update should not continue.

One way to avoid this is to disable TreatWarningsAsErrors for the in-memory (preview) restore. If the assets file was already out-of-sync with the project, there's no harm. If the assets file is up to date, then restore's no-op check fails and restore will have a slower code path. But we can be confident that the result will be accurate.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc. N/A

@zivkan
zivkan requested a review from a team as a code owner July 31, 2026 04:29
@zivkan
zivkan requested review from kartheekp-ms and nkolev92 July 31, 2026 04:29
@Frulfump

Copy link
Copy Markdown

NuGet/Home#15009 was closed as duplicate of the issue this fixes but it contains some more scenarios, does this PR fix them as well? It looks like it but just wanted to confirm.

@zivkan
zivkan requested review from kartheekp-ms and nkolev92 August 6, 2026 00:23
@Frulfump

Frulfump commented Aug 7, 2026

Copy link
Copy Markdown

Title of the PR has a typo should be vulnerable

@zivkan zivkan changed the title dotnet package update --vulerable works with TreatWarningsAsErrors dotnet package update --typo works with TreatWarningsAsErrors Aug 9, 2026
@zivkan zivkan changed the title dotnet package update --typo works with TreatWarningsAsErrors dotnet package update --vulnerable works with TreatWarningsAsErrors Aug 9, 2026
@zivkan
zivkan merged commit 1a68d86 into dev Aug 9, 2026
17 of 18 checks passed
@zivkan
zivkan deleted the dev-zivkan-repro-14988 branch August 9, 2026 23:32
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.

Can't update vulnerable packages - when the project restore is already failing

4 participants