Skip to content

Handle XmlException in ResolveCentralPackageVersion#41

Merged
HandyS11 merged 2 commits into008-nuget-package-renderingfrom
copilot/sub-pr-40
Feb 24, 2026
Merged

Handle XmlException in ResolveCentralPackageVersion#41
HandyS11 merged 2 commits into008-nuget-package-renderingfrom
copilot/sub-pr-40

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

ProjectRootElement.Open() can throw XmlException on malformed Directory.Packages.props files, but the catch filter in ResolveCentralPackageVersion only covered IOException and InvalidOperationException, causing an unhandled exception instead of continuing the directory tree walk.

Changes

  • ProjectParser.cs: Added XmlException to the exception filter, matching the pattern already used in BuildGraphUseCase
// Before
catch (Exception ex) when (ex is IOException or InvalidOperationException)

// After
catch (Exception ex) when (ex is IOException or InvalidOperationException or XmlException)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: HandyS11 <62420910+HandyS11@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on NuGet package rendering PR Handle XmlException in ResolveCentralPackageVersion Feb 24, 2026
Copilot AI requested a review from HandyS11 February 24, 2026 13:15
@HandyS11 HandyS11 marked this pull request as ready for review February 24, 2026 13:17
Copilot AI review requested due to automatic review settings February 24, 2026 13:17
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

Updates the core project parsing logic to be more resilient when resolving Central Package Management versions from Directory.Packages.props, specifically ensuring malformed XML doesn’t crash the directory-walk resolution.

Changes:

  • Extend the exception filter in ResolveCentralPackageVersion to also handle XmlException.
  • Add System.Xml import to support the new exception type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ProjGraph.Lib.Core/Parsers/ProjectParser.cs
@HandyS11 HandyS11 merged commit 0712362 into 008-nuget-package-rendering Feb 24, 2026
7 checks passed
@HandyS11 HandyS11 deleted the copilot/sub-pr-40 branch February 24, 2026 13:21
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.

3 participants