Skip to content

Enable nullable annotations for find/download/dependency/update core resources - #7570

Merged
nkolev92 merged 4 commits into
devfrom
dev-nkolev92-nullableProtocolPhase22
Jul 22, 2026
Merged

nkolev92 merged 4 commits into
devfrom
dev-nkolev92-nullableProtocolPhase22

Conversation

@nkolev92

@nkolev92 nkolev92 commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851 (Phase 22)

Description

Phase 22 of the NuGet.Protocol nullable reference type migration, covering the find/download/dependency/update core resources and their providers.

Significant decisions:

  • PluginFindPackageByIdResource.GetPackageDownloaderAsync returns Task. Override return nullability for nested generics is invariant, so this is forced by the nullable base contract.
  • PackageUpdateResource treats a null _httpSource as the file source signal. IsFileSource() is annotated with [MemberNotNullWhen(false, nameof(_httpSource))] and is used where the primary source''s null-state is what matters. PushPackageCore still routes on the supplied source argument (sourceUri.IsFile) so symbol pushes (-SymbolSource) whose file-ness differs from the primary source keep routing correctly; the non-null HttpSource is passed into PushPackageToServer, DeletePackageFromServer, and GetSecureApiKey.
  • DownloadResourceV3 passes RegistrationResourceV3 as a non-null parameter to its URL helpers rather than dereferencing a nullable field.
  • PublicAPI.Shipped.txt (net472 + net8.0) oblivious ~ entries were annotated in place rather than moved to Unshipped, per the nullable migration conventions.

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 and others added 2 commits July 17, 2026 13:54
Annotate IsFileSource() with [MemberNotNullWhen(false, nameof(_httpSource))]
and pass the non-null HttpSource into PushPackageToServer,
DeletePackageFromServer, and GetSecureApiKey, removing internal null guards.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d6ed873c-2b1e-4d4e-9cde-c217bfdc3a73
@nkolev92 nkolev92 changed the title Enable nullable annotations for find/download/dependency/update core resources (Phase 22) Enable nullable annotations for find/download/dependency/update core resources Jul 18, 2026
@nkolev92
nkolev92 marked this pull request as ready for review July 18, 2026 00:36
@nkolev92
nkolev92 requested a review from a team as a code owner July 18, 2026 00:36
@nkolev92
nkolev92 requested review from martinrrm and zivkan July 18, 2026 00:36
nkolev92 and others added 2 commits July 20, 2026 16:39
Route file-vs-server on the source argument's URI (sourceUri.IsFile)
instead of IsFileSource(), which reflects the resource's primary source.
This preserves correct routing when the symbol source's file-ness differs
from the primary push source.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 851207a5-650b-47dd-8883-e1b5db685c44
DeletePackage was always called with _source, and IsFileSource() reasons
about _httpSource (derived from _source). Referencing _source directly
prevents a future caller from passing a different source and reintroducing
the file-vs-server routing mismatch just fixed on the push path.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 851207a5-650b-47dd-8883-e1b5db685c44
@nkolev92
nkolev92 requested a review from martinrrm July 21, 2026 18:50
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.

4 participants