Skip to content

Add NuGetVersionStjConverter - #7358

Merged
Nigusu-Allehu merged 2 commits into
devfrom
dev-nyenework-stj-nuget-version-converter
May 7, 2026
Merged

Nigusu-Allehu merged 2 commits into
devfrom
dev-nyenework-stj-nuget-version-converter

Conversation

@Nigusu-Allehu

@Nigusu-Allehu Nigusu-Allehu commented May 3, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#14881

Description

This is a focused slice of #7301, split per-converter to make reviewing easier.

Converters are being migrated first so that the upcoming Registration resource migrations don't become bloated PRs.

NuGetVersionStjConverter deserializes NuGetVersion from JSON strings (and numeric tokens for parity with NSJ), returning null for null inputs and throwing on unexpected token types. Used by version properties on protocol model classes.

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.

@Nigusu-Allehu Nigusu-Allehu self-assigned this May 4, 2026
@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-stj-nuget-version-converter branch from f1a0103 to b656dd9 Compare May 6, 2026 22:34
@Nigusu-Allehu
Nigusu-Allehu marked this pull request as ready for review May 7, 2026 00:24
@Nigusu-Allehu
Nigusu-Allehu requested a review from a team as a code owner May 7, 2026 00:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a System.Text.Json converter for NuGetVersion as part of the ongoing Newtonsoft.Json → STJ migration in NuGet.Protocol, plus unit tests to validate parity for common inputs.

Changes:

  • Introduce NuGetVersionStjConverter to deserialize NuGetVersion from JSON strings (and numeric tokens for NSJ parity).
  • Add unit tests comparing NSJ and STJ behavior for valid inputs and invalid token types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/NuGet.Core/NuGet.Protocol/Converters/NuGetVersionStjConverter.cs Adds the STJ converter implementation for NuGetVersion read/write.
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Converters/NuGetVersionStjConverterTests.cs Adds tests validating STJ behavior and NSJ parity for typical inputs.

Copilot AI commented May 7, 2026

Copy link
Copy Markdown
Contributor

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • data.nuget.org
    • Triggering command: /usr/bin/dotnet dotnet msbuild src/NuGet.Core/NuGet.Protocol/NuGet.Protocol.csproj -v:q (dns block)
    • Triggering command: /usr/bin/dotnet dotnet msbuild src/NuGet.Core/NuGet.Protocol/NuGet.Protocol.csproj -v:q -p:RestorePackages=false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Nigusu-Allehu
Nigusu-Allehu merged commit 34494c8 into dev May 7, 2026
17 of 18 checks passed
@Nigusu-Allehu
Nigusu-Allehu deleted the dev-nyenework-stj-nuget-version-converter branch May 7, 2026 23:20
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.

Add System.Text.Json equivalent of NuGetVersionConverter

5 participants