Repository navigation
Enable nullable for NuGet.Protocol V2Feed leaves, and trivial V3 metadata leaves - #7587
Merged
Merged
Conversation
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
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
… downloaders) Removes #nullable disable from the 5 remaining composition-layer files: FactoryExtensionsV3, FactoryExtensionsVS, FeedTypeResourceProvider, LocalPackageArchiveDownloader, RemotePackageArchiveDownloader. OfflineFeedUtility now passes the real offline-feed folder as the downloader source instead of null, matching the non-null IPackageDownloader.Source contract. Co-authored-by: Copilot <[email protected]> Copilot-Session: adcfe3e1-067b-4ef1-89e7-cd0e377c18b2
…roviders Annotates ReportAbuseResourceV3 (ctor accepts string? uriTemplate, GetReportAbuseUrl non-null in/out) and the 3 providers whose TryCreate only needed widening to Task<Tuple<bool, INuGetResource?>>: MetadataResourceV3Provider, PackageDetailsUriResourceV3Provider, ReportAbuseResourceV3Provider. Co-authored-by: Copilot <[email protected]> Copilot-Session: adcfe3e1-067b-4ef1-89e7-cd0e377c18b2
CreateOrNull now returns a nullable resource, so the valid-template call sites suppress with resource! (the templates are known valid in these tests). Co-authored-by: Copilot <[email protected]> Copilot-Session: adcfe3e1-067b-4ef1-89e7-cd0e377c18b2
Annotates the 11 isolated Phase 24 V2Feed leaves (6 resources + 5 providers) that derive from already-annotated bases. Providers widen TryCreate to Task<Tuple<bool, INuGetResource?>>. DependencyInfoResourceV2Feed.ResolvePackage now returns Task<SourcePackageDependencyInfo?>. V2FeedParser.LoadXmlAsync cacheKey becomes nullable (already null-checked internally). PublicAPI.Shipped.txt updated for both TFMs. Co-authored-by: Copilot <[email protected]> Copilot-Session: adcfe3e1-067b-4ef1-89e7-cd0e377c18b2
nkolev92
marked this pull request as ready for review
July 23, 2026 00:52
zivkan
approved these changes
Jul 23, 2026
This was referenced Jul 23, 2026
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 (Phases 24 + 27)
Description
Continues the incremental
NuGet.Protocolnullable-reference-types enablement by removing#nullable disablefrom a set of isolated leaf resources, providers, and downloaders (Phase 27 wiring, the trivial V3 metadata leaves, and the Phase 24 legacy V2Feed leaves that derive from already-annotated bases).Notable decisions:
TryCreateoverrides are widened toTask<Tuple<bool, INuGetResource?>>with?? throwguards onGetResourceAsync<T>(), whose result is genuinely nullable — mirrors the established provider pattern.DependencyInfoResourceV2Feed.ResolvePackagenow returnsTask<SourcePackageDependencyInfo?>, and theCreateOrNullfactories (ReportAbuseResourceV3,PackageDetailsUriResourceV3) return nullable.V2FeedParser.LoadXmlAsynccacheKeybecomesstring?— it was already null-checked internally and every caller passes null.AutoCompleteResourceV2Feed: an empty response (204/404 → null stream) now yields an empty result set instead of throwing anNullReferenceException.PublicAPI.Shipped.txtupdated for bothnet472andnet8.0, replacing the oblivious (~) entries in place.No public API is added or removed; only nullability annotations change.
PR Checklist