Skip to content

Add MessagePackFormatter.InternStrings property#1446

Merged
AArnott merged 1 commit into
mainfrom
fix-1434
Jun 2, 2026
Merged

Add MessagePackFormatter.InternStrings property#1446
AArnott merged 1 commit into
mainfrom
fix-1434

Conversation

@AArnott
Copy link
Copy Markdown
Member

@AArnott AArnott commented Jun 1, 2026

This allows users to opt-out of string interning functionality.

Closes #1434

@AArnott AArnott added this to the v2.25 milestone Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 20:42
Copy link
Copy Markdown

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

This PR adds a new MessagePackFormatter.InternStrings configuration property so consumers can opt out of string interning for MessagePack user data (arguments/return values/errors), addressing the unbounded memory growth scenario described in #1434.

Changes:

  • Introduces MessagePackFormatter.InternStrings (defaulting to true) and rebuilds user-data serialization options when toggled.
  • Updates MassageUserDataOptions to conditionally include the StringInterningResolver based on InternStrings.
  • Adds unit tests that validate the default value and behavior when disabling/re-enabling interning before/after calling SetMessagePackSerializerOptions.

Reviewed changes

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

File Description
src/StreamJsonRpc/MessagePackFormatter.cs Adds the InternStrings property and uses it to conditionally include string interning in the user-data resolver chain.
test/StreamJsonRpc.Tests/MessagePackFormatterTests.cs Adds tests covering default and toggling behavior of InternStrings.

Comment thread src/StreamJsonRpc/MessagePackFormatter.cs
Comment thread src/StreamJsonRpc/MessagePackFormatter.cs Outdated
This allows users to opt-out of string interning functionality.

Fixes #1434
Copilot AI review requested due to automatic review settings June 2, 2026 13:12
Copy link
Copy Markdown

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 2 out of 2 changed files in this pull request and generated no new comments.

@AArnott AArnott merged commit 6eb1227 into main Jun 2, 2026
10 checks passed
@AArnott AArnott deleted the fix-1434 branch June 2, 2026 17:30
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.

StringInterningResolver hardcoded, causes memory leak in long-running applications

3 participants