Skip to content

additional unparseable file message#14464

Merged
brettfo merged 1 commit into
mainfrom
dev/brettfo/nuget-bad-packages-config
Mar 16, 2026
Merged

additional unparseable file message#14464
brettfo merged 1 commit into
mainfrom
dev/brettfo/nuget-bad-packages-config

Conversation

@brettfo
Copy link
Copy Markdown
Contributor

@brettfo brettfo commented Mar 16, 2026

From scanning the error reporting, I found a scenario where it was really easy to pull out the error of an unparsable packages.config file.

@github-actions github-actions Bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Mar 16, 2026
@brettfo brettfo force-pushed the dev/brettfo/nuget-bad-packages-config branch from c61026f to 0c5866c Compare March 16, 2026 23:03
@brettfo brettfo marked this pull request as ready for review March 16, 2026 23:29
@brettfo brettfo requested a review from a team as a code owner March 16, 2026 23:29
Copilot AI review requested due to automatic review settings March 16, 2026 23:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves NuGet helper error detection so Dependabot can surface a clearer “dependency file not parseable” error when packages.config parsing fails during MSBuild/NuGet operations.

Changes:

  • Adds a new MSBuild output regex to detect packages.config parsing failures and extract file path + message.
  • Adds a corresponding unit test case covering the new error output format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs Adds an additional regex pattern for packages.config parse errors in ThrowOnUnparseableFile.
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs Adds a fixture output + expected error mapping for the new regex.

Comment on lines 729 to +731
new Regex(@"\nAn error occurred while reading file '(?<FilePath>[^']+)': (?<Message>[^\n]*)\n"),
new Regex(@"NuGet\.Config is not valid XML\. Path: '(?<FilePath>[^']+)'\.\n\s*(?<Message>[^\n]*)(\n|$)"),
new Regex(@"Error parsing packages\.config file at (?<FilePath>[^:]+): (?<Message>[^\n]*)\n"),
Comment on lines +643 to +644

^^^ this blank line is necessary to force a newline at the end of the output
{
new Regex(@"\nAn error occurred while reading file '(?<FilePath>[^']+)': (?<Message>[^\n]*)\n"),
new Regex(@"NuGet\.Config is not valid XML\. Path: '(?<FilePath>[^']+)'\.\n\s*(?<Message>[^\n]*)(\n|$)"),
new Regex(@"Error parsing packages\.config file at (?<FilePath>[^:]+): (?<Message>[^\n]*)\n"),
@brettfo brettfo merged commit fb51f94 into main Mar 16, 2026
108 checks passed
@brettfo brettfo deleted the dev/brettfo/nuget-bad-packages-config branch March 16, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: dotnet:nuget NuGet packages via nuget or dotnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants