Skip to content

Enable nullable on NuGet.Protocol V3 search/list/autocomplete types - #7519

Merged
nkolev92 merged 2 commits into
devfrom
dev-nkolev92-nullableProtocolPhase21
Jul 9, 2026
Merged

nkolev92 merged 2 commits into
devfrom
dev-nkolev92-nullableProtocolPhase21

Conversation

@nkolev92

@nkolev92 nkolev92 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851

Description

Phase 21 of the NuGet.Protocol nullable migration: enable nullable on V3 search, list, and autocomplete resource types and their providers.

Notable decisions

  • CatalogEntry?.VersionCatalogEntry is PackageSearchMetadataRegistration?, so null-conditional is needed instead of !
  • (string?)package["version"] in the Newtonsoft JObject path — added explicit null guard rather than suppression
  • V3 providers use the established ?? throw new InvalidOperationException(...) pattern for HttpSourceResource (matching ServiceIndexResourceV3Provider and RepositorySignatureResourceProvider)
  • PackageSearchResourceV3 was already nullable-enabled — no changes needed

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.

@dotnet-policy-service dotnet-policy-service Bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jul 6, 2026
@nkolev92
nkolev92 marked this pull request as ready for review July 6, 2026 20:03
@nkolev92
nkolev92 requested a review from a team as a code owner July 6, 2026 20:03
@nkolev92
nkolev92 requested review from Nigusu-Allehu and zivkan July 6, 2026 20:03
…phase 21)

Remove #nullable disable from phase 21 files and add honest nullable
annotations:

- ListResource: abstract methods with non-null params
- AutoCompleteResource: abstract methods with non-null params
- AutoCompleteResourceV3: nullable _environmentVariableReader, null-safe
  CatalogEntry?.Version access, (string?) for JObject version cast
- PackageSearchResource: abstract SearchAsync with non-null params
- RawSearchResourceV3: JObject? searchJson in loop
- All V3 providers (AutoComplete, PackageSearch, RawSearch, V3FeedList):
  TryCreate returns INuGetResource?, use ?? throw pattern for
  HttpSourceResource
- Update PublicAPI.Shipped.txt for both net472 and net8.0 (15 entries each)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nkolev92
nkolev92 force-pushed the dev-nkolev92-nullableProtocolPhase21 branch from b46c114 to a6adc12 Compare July 6, 2026 20:04
@nkolev92 nkolev92 changed the title Enable nullable on NuGet.Protocol V3 search/list/autocomplete types (phase 21) Enable nullable on NuGet.Protocol V3 search/list/autocomplete types Jul 6, 2026
@dotnet-policy-service dotnet-policy-service Bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jul 6, 2026
jebriede
jebriede previously approved these changes Jul 6, 2026

@jebriede jebriede left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving with suggestion.

Comment thread src/NuGet.Core/NuGet.Protocol/Providers/AutoCompleteResourceV3Provider.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nkolev92

nkolev92 commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@jebriede @zivkan @Nigusu-Allehu ready for another look.

@nkolev92
nkolev92 enabled auto-merge (squash) July 8, 2026 23:01
@nkolev92
nkolev92 merged commit 49dae87 into dev Jul 9, 2026
20 of 21 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-nullableProtocolPhase21 branch July 9, 2026 00:47
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