Skip to content

NuGet.Protocol nullable enablement - Converters, Events, DependencyInfo - #7337

Merged
nkolev92 merged 6 commits into
devfrom
dev-nkolev92-protocol-v3
Apr 30, 2026
Merged

nkolev92 merged 6 commits into
devfrom
dev-nkolev92-protocol-v3

Conversation

@nkolev92

@nkolev92 nkolev92 commented Apr 28, 2026 •

Copy link
Copy Markdown
Member

Bug

Progress: NuGet/Home#14851

Description

Continues nullable enablement for NuGet.Protocol. Removes #nullable disable from Converters, Events, and DependencyInfo files. Adds ""Prefer Immutability and Non-Null Types"" section to docs/coding-guidelines.md.

Design decisions worth reviewing

  1. GetRegistrationInfo now returns RegistrationInfo? (null for not-found)
    The method's XML doc has said ""Returns Null if the package does not exist"" since 2015, but the implementation never actually returned null — it returned an empty RegistrationInfo with Id = null. Fixed by making the method actually return null when empty, and making RegistrationInfo.Id a required string. The callers in DependencyInfoResourceV3 already had the null checks — they were dead code that is now live.

  2. required init on internal types
    DependencyInfo, PackageInfo, and RegistrationInfo use required init for properties set at construction, get-only for collections. All callers already use object initializers, so no behavioral change.

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 28, 2026 17:18
@nkolev92
nkolev92 force-pushed the dev-nkolev92-protocol-v3 branch from bca1236 to 411a4ae Compare April 28, 2026 17:25
@nkolev92 nkolev92 changed the title NuGet.Protocol nullable phases 3-5: Converters, Events, DependencyInfo NuGet.Protocol nullable enablement - Converters, Events, DependencyInfo Apr 29, 2026
@nkolev92
nkolev92 requested a review from zivkan April 29, 2026 16:02
jeffkl
jeffkl previously approved these changes Apr 29, 2026
@nkolev92
nkolev92 merged commit ed23a2a into dev Apr 30, 2026
17 of 18 checks passed
@nkolev92
nkolev92 deleted the dev-nkolev92-protocol-v3 branch April 30, 2026 17:07
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