Skip to content

Downgrade System.Text.Json to 9.0.2 for UWP .NET Native Toolchain compatibility#938

Merged
Tyrrrz merged 3 commits intomasterfrom
copilot/downgrade-system-text-json
Feb 16, 2026
Merged

Downgrade System.Text.Json to 9.0.2 for UWP .NET Native Toolchain compatibility#938
Tyrrrz merged 3 commits intomasterfrom
copilot/downgrade-system-text-json

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Plan to Fix UWP Compatibility Issue with System.Text.Json

  • Understand the issue: System.Text.Json v10.0.2 breaks UWP projects with .NET Native Toolchain
  • Make minimal change: Downgrade System.Text.Json from v10.0.2 to v9.0.2 in YoutubeExplode.csproj
  • Verify the change by building the project (Build succeeded for all target frameworks)
  • Verify package resolution (System.Text.Json 9.0.2 correctly resolved)
  • Request code review (No issues found)
  • Run security checks with CodeQL (No vulnerabilities found)
  • Add issue reference to PR description
  • Add XML comment explaining the downgrade and linking to issue

Changes made:

Testing:

  • ✅ All target frameworks compile successfully (netstandard2.0, net6.0, net7.0, net10.0)
  • ✅ Package resolution verified: System.Text.Json 9.0.2 is correctly resolved
  • ✅ Code review passed with no issues
  • ✅ Security scan passed

Closes #937

Original prompt

Problem

The recent update to System.Text.Json version 10.0.2 breaks compatibility with UWP projects using the .NET Native Toolchain. This causes MCG0007 build errors in Release builds.

Root Cause

In YoutubeExplode/YoutubeExplode.csproj, lines 36-40 currently reference:

<PackageReference
  Include="System.Text.Json"
  Version="10.0.2"
  Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.0'))"
/>

Since UWP targets netstandard2.0 (not compatible with netcoreapp3.0), it gets System.Text.Json v10.x. However, the legacy .NET Native toolchain (MCG) used by UWP cannot handle v10.x due to drift from the compatibility baseline.

Solution

Downgrade the System.Text.Json version to 9.0.2 for netstandard2.0 targets to restore compatibility with the .NET Native toolchain while maintaining modern .NET consumer support.

Change lines 36-40 in YoutubeExplode/YoutubeExplode.csproj from:

<PackageReference
  Include="System.Text.Json"
  Version="10.0.2"
  Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.0'))"
/>

To:

<PackageReference
  Include="System.Text.Json"
  Version="9.0.2"
  Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.0'))"
/>

Expected Outcome

References

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copilot AI changed the title [WIP] Downgrade System.Text.Json to version 9.0.2 for UWP compatibility Downgrade System.Text.Json to 9.0.2 for UWP .NET Native Toolchain compatibility Feb 16, 2026
Copilot AI requested a review from Tyrrrz February 16, 2026 13:06
@Tyrrrz Tyrrrz marked this pull request as ready for review February 16, 2026 13:08
Copilot AI review requested due to automatic review settings February 16, 2026 13:08
@Tyrrrz
Copy link
Owner

Tyrrrz commented Feb 16, 2026

@copilot please reference the original issue in the PR body via "Closes #..."

@Tyrrrz
Copy link
Owner

Tyrrrz commented Feb 16, 2026

@copilot also add XML comment explaining the downgrade and link the issue

Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot please reference the original issue in the PR body via "Closes #..."

Done! Added "Closes #937" to the PR description.

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 pull request downgrades System.Text.Json from version 10.0.2 to 9.0.2 specifically for netstandard2.0 targets to restore compatibility with UWP projects using the .NET Native Toolchain. The v10.x branch of System.Text.Json causes MCG0007 build errors in UWP Release builds because the legacy .NET Native toolchain cannot handle the newer version.

Changes:

  • Downgrade System.Text.Json package reference from 10.0.2 to 9.0.2 in YoutubeExplode.csproj

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#937

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot also add XML comment explaining the downgrade and link the issue

Done! Added XML comment explaining the downgrade for UWP .NET Native Toolchain compatibility and linked to issue #937 (commit bdd7297).

@Tyrrrz Tyrrrz merged commit 89271ea into master Feb 16, 2026
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.

System.Text.Json 10.x dependency breaks .NET Native toolchain compatibility

3 participants