Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

Migrates the MSBuild.BuildHost RPC layer from Newtonsoft.Json to System.Text.Json.

Changes

  • JsonSettings.cs: Replace JsonSerializerSettings with JsonSerializerOptions
    • CamelCasePropertyNamesContractResolverJsonNamingPolicy.CamelCase
    • StringEscapeHandling.EscapeNonAsciiJavaScriptEncoder.Create(UnicodeRanges.BasicLatin)
  • Request.cs / Response.cs: JTokenJsonElement
  • RpcServer.cs / RpcClient.cs: JsonConvertJsonSerializer
  • Package references: Remove Newtonsoft.Json, add System.Text.Json for net472 only (BCL for .NET Core)
// Before
request.Parameters[i].ToObject(methodParameters[i].ParameterType)
JToken.FromObject(result)

// After
request.Parameters[i].Deserialize(methodParameters[i].ParameterType, JsonSettings.SingleLineSerializerOptions)
JsonSerializer.SerializeToElement(result, JsonSettings.SingleLineSerializerOptions)
Original prompt

This section details on the original issue you should resolve

<issue_title>Remove dependency on Newtonsoft.Json from Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost project</issue_title>
<issue_description>Use System.Text.Json instead.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Remove dependency on Newtonsoft.Json in BuildHost project Remove dependency on Newtonsoft.Json from Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost Dec 5, 2025
Copilot AI requested a review from tmat December 5, 2025 22:13
Copilot finished work on behalf of tmat December 5, 2025 22:13
@tmat tmat marked this pull request as ready for review December 5, 2025 23:37
@tmat tmat requested a review from a team as a code owner December 5, 2025 23:37
@tmat tmat marked this pull request as draft December 5, 2025 23:37
@tmat tmat marked this pull request as ready for review December 5, 2025 23:44
@tmat
Copy link
Member

tmat commented Dec 5, 2025

@jasonmalinowski ptal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dependency on Newtonsoft.Json from Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost project

2 participants