Fix NRE and Disallow Missing Registration Page Leaves
Bug
Fixes: https://github.com/NuGet/Home/issues/13377
Regression? Last working version: The NRE has been there since the code was written in #3462
Description
The original issue is just the wrong variable being used in the if check. However for some reason when doing dotnet tool restore in the dotnet 6 sdk the issue doesn't happen for us. But once we upgraded our project to use dotnet 8 the NRE started happening every time we ran dotnet tool restore. So this is sort of a "regression" for us because our in-house NuGet repo (cloudsmith) returns 404 if there are no active packages in a version range.
I think it makes sense to gracefully skip any missing leaf pages. We are already allowing 404's with the IgnoreNotFounds = true, flag. So I think not throwing an exception in a recoverable situation makes more sense here and it would help resolve our issue as well.
PR Checklist
-
[x] PR has a meaningful title
-
[x] PR has a linked issue.
-
[x] Described changes
-
Tests
- [x] Automated tests added
- OR
- [ ] Test exception
- OR
- [ ] N/A
-
Documentation
- [ ] Documentation PR or issue filled
- OR
- [x] N/A
@dotnet-policy-service agree company="StackOverflow"
Seems like folks don't like my fix so going to close this out.