Skip to content

Adds System.Text.Json serialization support to the NuGet plugin protocol#7326

Merged
Nigusu-Allehu merged 11 commits into
devfrom
dev-nyenework-plugin-stj
Jun 2, 2026
Merged

Adds System.Text.Json serialization support to the NuGet plugin protocol#7326
Nigusu-Allehu merged 11 commits into
devfrom
dev-nyenework-plugin-stj

Conversation

@Nigusu-Allehu
Copy link
Copy Markdown
Member

@Nigusu-Allehu Nigusu-Allehu commented Apr 27, 2026

Bug

Fixes: NuGet/Home#14888

Description

Adds System.Text.Json serialization support to the NuGet plugin protocol, gated behind a feature flag. When enabled plugin message serialization/deserialization uses STJ source-generated contexts

Key changes:

  • New STJ converters: MessageConverter, StjSemanticVersionConverter, StjTimeSpanConverter, RawJsonStringConverter, StjGetOperationClaimsResponseConverter
  • Feature-flag branching in Sender, StandardInputReceiver, and StandardOutputReceiver
  • Test coverage for both NSJ and STJ paths in MessageConverterTests
    • These tests are a lot. Goal is to ensure there is parity when serializing and deserializing messages.

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.

This comment was marked as outdated.

@dotnet-policy-service dotnet-policy-service Bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label May 14, 2026
@Nigusu-Allehu Nigusu-Allehu force-pushed the dev-nyenework-plugin-stj branch from fb47bdc to 2f86310 Compare May 14, 2026 14:20
@dotnet-policy-service dotnet-policy-service Bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label May 14, 2026
@Nigusu-Allehu Nigusu-Allehu requested a review from Copilot May 14, 2026 16:31

This comment was marked as outdated.

@dotnet-policy-service dotnet-policy-service Bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label May 21, 2026
@Nigusu-Allehu Nigusu-Allehu force-pushed the dev-nyenework-plugin-stj branch from bcf5dca to 422d5f5 Compare May 27, 2026 01:39
@dotnet-policy-service dotnet-policy-service Bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label May 27, 2026
@Nigusu-Allehu Nigusu-Allehu requested a review from Copilot May 27, 2026 01:41

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 42 out of 43 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/NuGet.Core/NuGet.Protocol/Strings.Designer.cs: Language not supported

Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/MessageConverter.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 42 out of 43 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • src/NuGet.Core/NuGet.Protocol/Strings.Designer.cs: Language not supported

Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/Sender.cs
Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/MessageConverter.cs
Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/RawJsonStringConverter.cs
@Nigusu-Allehu Nigusu-Allehu marked this pull request as ready for review May 27, 2026 20:25
@Nigusu-Allehu Nigusu-Allehu requested a review from a team as a code owner May 27, 2026 20:25
jeffkl
jeffkl previously approved these changes May 28, 2026
Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/Messages/GetOperationClaimsResponse.cs Outdated
@Nigusu-Allehu Nigusu-Allehu requested a review from nkolev92 May 28, 2026 22:31
Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/MessageConverter.cs Outdated
Comment thread src/NuGet.Core/NuGet.Protocol/Plugins/StjTimeSpanConverter.cs Outdated
@Nigusu-Allehu Nigusu-Allehu requested a review from nkolev92 June 1, 2026 20:06

return stringWriter.ToString();
}
return JsonSerializer.Serialize(value, value.GetType(), PluginJsonContext.Default.Options);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: This class had a generic name and localized namespace with a generic implementation.

Now it has a generic name, localized namespaced with a localized implementation. I don't think renaming would be a bad idea.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

merged but I will try to include this in another PR maybe.

@Nigusu-Allehu Nigusu-Allehu merged commit 76e5f30 into dev Jun 2, 2026
17 of 18 checks passed
@Nigusu-Allehu Nigusu-Allehu deleted the dev-nyenework-plugin-stj branch June 2, 2026 23:24
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.

Migrate NuGet Plugin message deserialization to System.Text.Json

5 participants