Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Enable nullable on local repository types in NuGet.Protocol - #7492

#7492
Merged
nkolev92 merged 1 commit into
devNuGet/NuGet.Client:devfrom
dev-nkolev92-nullable-local-repoNuGet/NuGet.Client:dev-nkolev92-nullable-local-repoCopy head branch name to clipboard
Jun 19, 2026
Merged

Enable nullable on local repository types in NuGet.Protocol#7492
nkolev92 merged 1 commit into
devNuGet/NuGet.Client:devfrom
dev-nkolev92-nullable-local-repoNuGet/NuGet.Client:dev-nkolev92-nullable-local-repoCopy head branch name to clipboard

Conversation

@nkolev92

@nkolev92 nkolev92 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851

Description

Enable nullable reference types on the local repository layer in NuGet.Protocol (Phase 19 of the nullable migration plan).

Files changed (11 source + 2 PublicAPI + 1 test)

Removed #nullable disable from:

  • LocalPackageInfo — core local package data class
  • FindLocalPackagesResource — abstract base for local enumeration
  • FindLocalPackagesResourcePackagesConfig / Unzipped / V2 / V3 — concrete implementations
  • All four matching *Provider classes
  • LocalPackageSearchMetadata — implements IPackageSearchMetadata for local packages

Key decisions

  • GetPackage() now returns LocalPackageInfo? — all implementations can return null (e.g., TryGetValue in Unzipped, nullable returns from LocalFolderUtility). This is the main API surface change.
  • LocalPackageInfo protected parameterless ctor uses null! on fields/auto-properties. The only subclass (TestLocalPackageInfo in tests) overrides all virtual members, so these fields are never accessed through that path.
  • Added ArgumentNullException guards to PackagesConfig, Unzipped, V2, V3 constructors for the root parameter (previously had no null checks).
  • LocalPackageSearchMetadata: nuspec-derived string/Uri properties are nullable (Authors?, Description?, IconUrl?, etc.); properties with guaranteed values are non-null (Tags!, Title!, PackagePath!, LoadFileAsText!).
  • Updated 62 entries in PublicAPI.Shipped.txt for both net472 and net8.0 TFMs.
  • Fixed cascading CS8602 in FindLocalPackagesResourceTests.cs (added ! after GetPackage() calls in test assertions).

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.

Remove #nullable disable from 11 files in the local repository layer:
- LocalPackageInfo, FindLocalPackagesResource (abstract base)
- FindLocalPackagesResourcePackagesConfig/Unzipped/V2/V3 + providers
- LocalPackageSearchMetadata

Key changes:
- GetPackage() returns LocalPackageInfo? (can return null when not found)
- Added ArgumentNullException guards to subclass constructors
- LocalPackageInfo uses null! for fields/properties supporting protected
  parameterless ctor (subclass override pattern)
- LocalPackageSearchMetadata: nullable for nuspec-derived string/Uri
  properties, non-null for Tags/Title/PackagePath/LoadFileAsText
- Updated 62 PublicAPI.Shipped.txt entries in both TFMs
- Fixed cascading CS8602 in FindLocalPackagesResourceTests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nkolev92 nkolev92 added the Engineering Changes related to the build infrastructure of the repo and that do not change product code label Jun 19, 2026
@nkolev92
nkolev92 marked this pull request as ready for review June 19, 2026 18:21
@nkolev92
nkolev92 requested a review from a team as a code owner June 19, 2026 18:21
@nkolev92
nkolev92 requested review from Nigusu-Allehu and zivkan June 19, 2026 18:21

@zivkan zivkan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One of those "good enough" vs "should we be correct" choices. 🤷

@nkolev92
nkolev92 merged commit 8d3e0c4 into dev Jun 19, 2026
20 of 21 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-nullable-local-repo branch June 19, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engineering Changes related to the build infrastructure of the repo and that do not change product code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.