Skip to content

Upgrade RestSharp fork from .NET 2.0/3.5 to .NET Framework 4.8#15

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1780932413-net48-upgrade
Open

Upgrade RestSharp fork from .NET 2.0/3.5 to .NET Framework 4.8#15
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1780932413-net48-upgrade

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Retargets the whole solution to .NET Framework 4.8 and removes the .NET 2.0/3.5-era workarounds that are now native to the framework. This is the migration requested across all four projects (RestSharp, RestSharp.Net2, RestSharp.Tests, RestSharp.IntegrationTests).

Key changes (not obvious from the diff alone):

  • Framework retarget: every .csproj now uses <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> (was v3.5 / v2.0 / v4.0). Dropped <TargetFrameworkProfile>Client</TargetFrameworkProfile> and the <RequiredTargetFramework>3.5</RequiredTargetFramework> hints, and refreshed the BootstrapperPackage entries to the 4.8 redist.

  • RestSharp.Net2 is now a real 4.8 build: removed the bundled LinqBridge-1.2.cs and the entire System.Xml.Linq/* Mono source tree (28 files) since LINQ and System.Xml.Linq ship with 4.8. Added native System.Core and System.Xml.Linq references, and dropped the Net2;NET_2_0 define constants so DefineConstants is just TRACE;DEBUG;FRAMEWORK / TRACE;FRAMEWORK.

  • Dependency bumps (HintPaths + packages.config updated to point at the new TFM lib folders):

    • Newtonsoft.Json 4.0.8/4.5.113.0.3 (lib/net45)
    • xunit 1.9.0.15662.4.2. xunit 2.x is split into multiple assemblies, so the single xunit/xunit.extensions/xunit.runner.tdnet references became xunit.abstractions + xunit.assert (netstandard1.1) + xunit.core + xunit.execution.desktop (net452). Test code needed no changes — it only uses [Fact] and basic Assert.*.
  • Code cleanup: simplified the #if NET_2_0 block in SharedAssemblyInfo.cs to the unconditional restsharp.org company/copyright, removed the dead #if Net2 using RestSharp.Contrib; in Extensions/StringExtensions.cs, and removed the duplicate Microsoft.CSharp.targets import in RestSharp.csproj.

  • Misc: bumped both .sln headers to Format Version 12.00 / # Visual Studio Version 17, updated README.markdown to describe a .NET 4.8 fork (dropped the LinqBridge/Mono caveats). Committed the new package folders to match the repo's existing convention of vendoring packages/ (there is no nuget restore step in CI).

Testing

Built and tested on Linux via mono xbuild + xunit console runner (net4.8 reference assemblies):

  • All four projects build with 0 errors.
  • RestSharp.Tests: 83 / 83 passing.
  • RestSharp.IntegrationTests: 11 passing, 1 skipped (oAuth1 — needs real consumer key/secret by design). The one failure, FileTests.Handles_Binary_File_Download, is a pre-existing Linux/mono-only issue — the test hardcodes a Windows path separator (Environment.CurrentDirectory + "\\Assets\\Koala.jpg"); the asset is copied correctly and this passes on Windows. Tests were not modified.

Link to Devin session: https://app.devin.ai/sessions/7f42583b6cb44dc5a33a59ec7808ccf6
Requested by: @travismyers-png


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

- Retarget RestSharp, RestSharp.Net2, RestSharp.Tests and
  RestSharp.IntegrationTests to TargetFrameworkVersion v4.8
- Drop Client Profile and RequiredTargetFramework 3.5 remnants
- Bump Newtonsoft.Json 4.x -> 13.0.3 and xunit 1.9 -> 2.4.2
- Remove bundled LinqBridge and Mono System.Xml.Linq sources now that
  LINQ and System.Xml.Linq are native to .NET 4.8
- Strip Net2/NET_2_0 conditional compilation and define constants
- Remove duplicate Microsoft.CSharp.targets import
- Modernize solution file format headers and refresh README

Co-Authored-By: Travis Myers <travis.myers@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🚩 xUnit 1.x to 2.x upgrade may require test runner configuration changes

The upgrade from xUnit 1.9 to 2.4.2 changes how tests are discovered and run. xUnit 2.x requires a test runner that supports v2 (e.g., xunit.runner.console 2.x or Visual Studio test adapter). The packages.config files correctly include xunit.runner.console 2.4.2, but the test projects don't appear to have an app.config with binding redirects or a runner integration configured. The test code itself uses only basic [Fact] attributes and Assert methods which are compatible across versions, and no using Xunit.Extensions was found. However, any CI/build scripts that invoke the old xUnit 1.x console runner will need updating.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good callout — addressed in this PR:

  • The v2-compatible runner is vendored: xunit.runner.console 2.4.2 is in both test packages.config files and packages/. I verified the tests actually run under it: mono packages/xunit.runner.console.2.4.2/tools/net452/xunit.console.exe RestSharp.Tests/bin/Release/RestSharp.Tests.dll83/83 passing (IntegrationTests 11 pass / 1 skip).
  • There are no CI/build scripts in the repo that invoke the old xUnit 1.x runner (no .github/workflows, no appveyor; package.cmd only does ILMerge packaging), so nothing references the removed xunit.runner.tdnet.
  • No binding redirects were needed: all xunit references use SpecificVersion=False and resolve against the vendored DLLs, and the build/run completed with no assembly-load errors. If this is later wired into a VS test adapter on Windows, an app.config with redirects can be added then, but it isn't required for the current console-runner flow.

No code change needed here.

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.

0 participants