Skip to content

Conversation

@AArnott
Copy link
Member

@AArnott AArnott commented Nov 7, 2025

This is a formatter intended for use in the vs-servicehub repo to support FrameworkServices so that we can have a full stack brokered service system that is NativeAOT safe.
The formatter is hard to use, and will likely evolve into a fully PolyType-based JSON serializer. In the meantime, I have [Experimental] slapped onto it to avoid having to maintain the public API for any user outside of vs-servicehub.

@AArnott AArnott added this to the PolyType milestone Nov 7, 2025
@AArnott AArnott requested a review from Copilot November 7, 2025 04:06
@AArnott AArnott force-pushed the dev/andarno/stjNativeAotSafe branch from f58d409 to e31485b Compare November 7, 2025 04:09
Copy link

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 PolyTypeJsonFormatter class that provides NativeAOT-compatible JSON serialization for StreamJsonRpc using PolyType. The formatter is marked as experimental and enables AOT scenarios where dynamic code generation isn't available.

Key changes:

  • Introduces PolyTypeJsonFormatter as a new formatter option with PolyType-based serialization
  • Refactors RequestIdJsonConverter into a shared RequestIdSTJsonConverter for use across formatters
  • Creates supporting infrastructure classes (IGenericTypeArgAssist, SourceGenerationContext)
  • Adds comprehensive test coverage with multiple test classes for different scenarios

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 26 comments.

Show a summary per file
File Description
src/StreamJsonRpc/PolyTypeJsonFormatter.cs New formatter implementation with PolyType support and experimental attribute
src/StreamJsonRpc/RequestIdSTJsonConverter.cs Extracted RequestId converter for System.Text.Json reuse
src/StreamJsonRpc/SourceGenerationContext.cs Source generation context for built-in types
src/StreamJsonRpc/IGenericTypeArgAssist.cs Helper interfaces for generic type argument handling
src/StreamJsonRpc/RequestId.cs Added System.Text.Json converter attribute
src/StreamJsonRpc/SystemTextJsonFormatter.cs Refactored to use shared RequestIdSTJsonConverter
src/StreamJsonRpc/StreamJsonRpc.csproj Whitespace formatting fixes
test files Test classes for PolyTypeJsonFormatter covering various scenarios
Comments suppressed due to low confidence (2)

src/StreamJsonRpc/PolyTypeJsonFormatter.cs:1347

Copy link

@etvorun etvorun left a comment

Choose a reason for hiding this comment

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

:shipit:

@AArnott AArnott force-pushed the dev/andarno/stjNativeAotSafe branch from e31485b to 9254613 Compare November 7, 2025 16:41
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.

3 participants