Skip to content

NuGet.Protocol nullable enablement - Utility files - #7351

Merged
nkolev92 merged 4 commits into
devfrom
dev-nkolev92-protocol-v4
May 5, 2026
Merged

nkolev92 merged 4 commits into
devfrom
dev-nkolev92-protocol-v4

Conversation

@nkolev92

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851

Description

Continues nullable enablement for NuGet.Protocol. Removes #nullable disable from all 14 Utility files (both leaf and connected).

Files annotated

Leaf utilities (no NuGet.Protocol dependencies): CachingUtility, DedicatedAsynchronousProcessingThread, DownloadTimeoutStream, MetadataReferenceCache, PackageIdValidator, StreamExtensions, TimeoutUtility

Connected utilities (depend on other Protocol types): FeedTypeUtility, FindPackagesByIdNupkgDownloader, GetDownloadResultUtility, GlobalPackagesFolderUtility, LocalFolderUtility, OfflineFeedAddContext, OfflineFeedUtility

Cascade fix: RegistrationUtility.LoadRanges return type changed to IEnumerable<JObject?> due to StreamExtensions.AsJObjectAsync now honestly returning JObject?.

Design decisions worth reviewing

  1. null! in LocalFolderUtility.GenerateNupkgMetadataFile
    The GetContentHash delegate is typed Func<string> in NuGet.Packaging, but the lambda returns null on an unreachable branch (callers guarantee the hash file exists). Commented to explain why.

  2. DirectDownloadDirectory! in GetDownloadResultUtility
    The property is string? on PackageDownloadContext, but direct-download methods are only called when the directory is set. Three usages suppressed with !.

  3. package!.PackageStream in GlobalPackagesFolderUtility.AddPackageAsync
    After a successful AddPackageAsync the result is guaranteed non-null. Suppressed after a Debug.Assert.

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.

@nkolev92
nkolev92 requested a review from a team as a code owner April 30, 2026 23:39
@nkolev92
nkolev92 requested review from jeffkl and zivkan April 30, 2026 23:39
@nkolev92
nkolev92 merged commit 7f0b8fa into dev May 5, 2026
17 of 18 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-protocol-v4 branch May 5, 2026 16:08
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.

2 participants