Skip to content

Enable nullable annotations for remote find-by-id resources - #7567

Merged
nkolev92 merged 3 commits into
devfrom
dev-nkolev92-nullableProtocolPhase25
Jul 17, 2026
Merged

nkolev92 merged 3 commits into
devfrom
dev-nkolev92-nullableProtocolPhase25

Conversation

@nkolev92

@nkolev92 nkolev92 commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851

Description

Enable nullable annotations for remote find-by-id and plugin-backed resource adapter files in NuGet.Protocol.

Notable decisions:

  • PluginResource.GetPluginAsync returns Task<GetPluginResult?> (null when no plugin claims the operation)
  • PluginCreationResult properties use ! after Message guard (non-null guaranteed by constructor contract but not compiler-enforceable)
  • BuildModel in RemoteV2 preserves original NRE behavior with ! (not made null-safe)
  • HttpSourceResource obtained via ?? throw pattern (not ! suppression)

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 15, 2026 15:45
Remove #nullable disable from RemoteV2/V3FindPackageByIdResource,
their providers, and HttpFileSystemBasedFindPackageByIdResourceProvider.
Annotate return types honestly (FindPackageByIdDependencyInfo?,
IPackageDownloader?). Providers use established ?? throw pattern for
HttpSourceResource. Update PublicAPI.Shipped.txt for both TFMs.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 816b2aa5-51ce-416b-b88f-a82473b99cd9
Remove #nullable disable from plugin resource files (PluginResource,
PluginResourceProvider, DownloadResourcePlugin, DownloadResourcePluginProvider,
PluginFindPackageByIdResource, PluginFindPackageByIdResourceProvider).

Key decisions:
- PluginResource.GetPluginAsync returns Task<GetPluginResult?> (null when no
  plugin claims the operation)
- ICredentialService parameter made nullable (passed as-is from caller)
- PluginCreationResult properties use ! after Message guard (non-null
  guaranteed by constructor contract but not compiler-enforceable)
- GetPackageVersionsResponse.Versions! on Success path (same pattern)
- Private PackageInfo class uses required keyword for non-null properties

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 816b2aa5-51ce-416b-b88f-a82473b99cd9
@nkolev92
nkolev92 marked this pull request as ready for review July 15, 2026 23:50
@nkolev92
nkolev92 requested a review from a team as a code owner July 15, 2026 23: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.

2 participants