Skip to content

Remove usage of Newtonsoft.Json in favor of System.Text.Json #1932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 21, 2025

This PR replaces Newtonsoft.Json with System.Text.Json throughout the codebase. The changes were focused on:

  1. Updating test files:

    • Updated test/DocumentFormat.OpenXml.Packaging.Tests/PartConstraintRuleTests.cs to use System.Text.Json for deserialization
    • Updated test/DocumentFormat.OpenXml.Packaging.Tests/ParticleTests.cs with custom converters for System.Text.Json
    • Replaced Newtonsoft-specific serialization logic with equivalent System.Text.Json functionality
  2. Updating generator models:

    • Converted gen/DocumentFormat.OpenXml.Generator.Models/Converters/QualifiedNameConverter.cs to use System.Text.Json's converter pattern
    • Converted gen/DocumentFormat.OpenXml.Generator.Models/Converters/TypedQNameConverter.cs to use System.Text.Json's converter pattern
    • Updated gen/DocumentFormat.OpenXml.Generator.Models/OpenXmlGeneratorDataSource.cs to use System.Text.Json for deserialization
  3. Package references:

    • Updated gen/DocumentFormat.OpenXml.Generator.Models/DocumentFormat.OpenXml.Generator.Models.csproj to reference System.Text.Json
    • Kept Newtonsoft.Json in Directory.Packages.props for backward compatibility with test projects

The PR maintains backward compatibility but ensures all code now uses System.Text.Json serialization and deserialization mechanisms.

Fixes #1931.

Warning

Firewall rules blocked me from connecting to one or more addresses

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

  • crl3.digicert.com
    • Triggering command: dotnet build (dns block)
  • crl4.digicert.com
    • Triggering command: dotnet build (dns block)
  • ocsp.digicert.com
    • Triggering command: dotnet build (dns block)
  • s.symcb.com
    • Triggering command: dotnet build (dns block)
  • s.symcd.com
    • Triggering command: dotnet build (dns block)
  • ts-crl.ws.symantec.com
    • Triggering command: dotnet build (dns block)
  • ts-ocsp.ws.symantec.com
    • Triggering command: dotnet build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • www.microsoft.com
    • Triggering command: dotnet build (dns block)

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


💡 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 Copilot AI changed the title [WIP] Remove usage of Newtonsoft in favor of System.Text Remove usage of Newtonsoft.Json in favor of System.Text.Json May 21, 2025
@Copilot Copilot AI requested a review from twsouthwick May 21, 2025 15:40
Copilot finished work on behalf of twsouthwick May 21, 2025 15: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.

Remove usage of Newtonsoft in favor of System.Text
2 participants