Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't assume the Include attribute is present on a <ProjectReference> node #9238

Merged
merged 2 commits into from Mar 7, 2024

Conversation

brettfo
Copy link
Collaborator

@brettfo brettfo commented Mar 7, 2024

When parsing project references, we were assuming all of the elements looked like this:

...
<ProjectReference Include="path\to\other.csproj" />
...

If that Include attribute isn't present, then we'll eventually throw with:

undefined method `tr' for nil:NilClass

          relative_path = ref_path.tr("\\", "/")
                                  ^^^

The fix is to simply skip processing that particular <ProjectReference> element if it doesn't have the requisite attribute. Similar behavior is also present elsewhere in project_file_parser.rb, so it's a known pattern that we just missed applying here.

Of all of the current undefined method '_' for nil:NilClass errors in NuGet, this is the largest class.

@brettfo brettfo requested a review from a team as a code owner March 7, 2024 18:18
@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Mar 7, 2024
@abdulapopoola abdulapopoola merged commit 0edddaf into main Mar 7, 2024
67 checks passed
@abdulapopoola abdulapopoola deleted the dev/brettfo/nuget-nil-ref-path branch March 7, 2024 18:59
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.

None yet

3 participants