Skip to content

Enable nullable annotations for LocalRepositories - #7527

Merged
nkolev92 merged 4 commits into
devfrom
dev-nkolev92-nullableProtocolPhase23
Jul 14, 2026
Merged

nkolev92 merged 4 commits into
devfrom
dev-nkolev92-nullableProtocolPhase23

Conversation

@nkolev92

@nkolev92 nkolev92 commented Jun 29, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#14851

Description

Phase 23 of the NuGet.Protocol nullable migration: enable nullable on all 18 files in \LocalRepositories/\ — local adapters for find-by-id, search, metadata, download, dependency info, and autocomplete.

Notable decisions

  • Override return types annotated honestly where results may not exist: \FindPackageByIdDependencyInfo?, \IPackageDownloader?, \SourcePackageDependencyInfo?, \IPackageSearchMetadata?, \KeyValuePair<string, NuGetVersion?>
    _packageFileCache\ in \LocalV3FindPackageByIdResource\ is \LocalPackageFileCache?\ — lazy-init pattern checks for null explicitly
  • \SearchFilter filters\ parameter in \SearchAsync\ treated as non-null (removed unnecessary ?.\ conditionals)
  • \IEnumerableAsync.Current\ uses !\ — contract guarantees non-null after \MoveNextAsync()\ returns true (compiler can't prove this)

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 7, 2026
@nkolev92
nkolev92 force-pushed the dev-nkolev92-nullableProtocolPhase23 branch from b9067df to dfb76f9 Compare July 10, 2026 00:16
@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 10, 2026
@nkolev92
nkolev92 force-pushed the dev-nkolev92-nullableProtocolPhase23 branch from d128792 to 88c3243 Compare July 13, 2026 16:43
@nkolev92
nkolev92 force-pushed the dev-nkolev92-nullableProtocolPhase23 branch from 88c3243 to c8d6b84 Compare July 13, 2026 18:21
…ng API entry

The nullable annotation pass accidentally dropped the
'override NuGet.Protocol.LocalPackageSearchResource.SupportsPackageTypeFiltering.get -> bool'
line from PublicAPI.Shipped.txt (it sat between two ~-prefixed lines that were
re-annotated), causing RS0016 to fail the build for net472 and net8.0 and
cascading to all CI jobs. Re-add the entry in both target frameworks.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 33144e31-b6fa-4afc-a98e-96f613043eb6
@nkolev92 nkolev92 changed the title Enable nullable annotations for LocalRepositories (Phase 23) Enable nullable annotations for LocalRepositories Jul 14, 2026
@nkolev92
nkolev92 marked this pull request as ready for review July 14, 2026 17:38
@nkolev92
nkolev92 requested a review from a team as a code owner July 14, 2026 17:38
@nkolev92
nkolev92 requested review from Nigusu-Allehu and zivkan July 14, 2026 17:38
Nigusu-Allehu
Nigusu-Allehu previously approved these changes Jul 14, 2026
@nkolev92
nkolev92 merged commit 864808f into dev Jul 14, 2026
20 of 21 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-nullableProtocolPhase23 branch July 14, 2026 23:48
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.

Add nullable annotations to NuGet.Protocol

3 participants