obs-websocket-dotnet icon indicating copy to clipboard operation
obs-websocket-dotnet copied to clipboard

feat: Introduce System.Text.Json for AOT Compatibility

Open aron-666 opened this issue 7 months ago • 0 comments

This change aims to improve the project's compatibility with AOT (Ahead-Of-Time) compilation environments.

Key Changes:

  • Replaced all usages of Newtonsoft.Json.Linq.JObject with System.Text.Json related APIs to support AOT compilation optimizations in .NET 8 and later versions.
  • This modification should reduce runtime reflection, leading to improved startup times and reduced memory footprint.

Motivation: The original JObject implementation could lead to compatibility issues in AOT compilation mode, potentially preventing the application from starting or running correctly. System.Text.Json is the officially recommended JSON processing library by .NET and offers better support for AOT compilation.

Important Notes for Reviewer:

  • Test Project: I have not modified the project's existing test code. I've performed basic local tests on the core functionalities to ensure JSON serialization and deserialization operations work as expected.
  • Recommendation: Given that this change impacts the project's data processing logic, it is highly recommended that the project owner performs a comprehensive review and full regression testing before merging this Pull Request. This will help ensure all functionalities operate correctly and as expected under the System.Text.Json environment.
  • Potential Impact: While System.Text.Json behaves similarly to JObject in most cases, there might be subtle differences in certain edge cases (e.g., specific JSON format parsing behaviors). It's advisable to review relevant data processing logic.

Thank you for your review!

aron-666 avatar Jun 08 '25 14:06 aron-666