Enable nullable on local repository types in NuGet.Protocol - #7492
#7492Merged
nkolev92 merged 1 commit intoJun 19, 2026
devNuGet/NuGet.Client:devfrom
dev-nkolev92-nullable-local-repoNuGet/NuGet.Client:dev-nkolev92-nullable-local-repoCopy head branch name to clipboard
Merged
Enable nullable on local repository types in NuGet.Protocol#7492nkolev92 merged 1 commit intodevNuGet/NuGet.Client:devfrom dev-nkolev92-nullable-local-repoNuGet/NuGet.Client:dev-nkolev92-nullable-local-repoCopy head branch name to clipboard
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
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
marked this pull request as ready for review
June 19, 2026 18:21
zivkan
approved these changes
Jun 19, 2026
zivkan
left a comment
Member
There was a problem hiding this comment.
One of those "good enough" vs "should we be correct" choices. 🤷
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 disablefrom:LocalPackageInfo— core local package data classFindLocalPackagesResource— abstract base for local enumerationFindLocalPackagesResourcePackagesConfig/Unzipped/V2/V3— concrete implementations*ProviderclassesLocalPackageSearchMetadata— implementsIPackageSearchMetadatafor local packagesKey decisions
GetPackage()now returnsLocalPackageInfo?— all implementations can return null (e.g.,TryGetValuein Unzipped, nullable returns fromLocalFolderUtility). This is the main API surface change.LocalPackageInfoprotected parameterless ctor usesnull!on fields/auto-properties. The only subclass (TestLocalPackageInfoin tests) overrides all virtual members, so these fields are never accessed through that path.ArgumentNullExceptionguards toPackagesConfig,Unzipped,V2,V3constructors for therootparameter (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!).PublicAPI.Shipped.txtfor both net472 and net8.0 TFMs.CS8602inFindLocalPackagesResourceTests.cs(added!afterGetPackage()calls in test assertions).PR Checklist