Skip to content

Conversation

@alexeyzimarev
Copy link
Member

@alexeyzimarev alexeyzimarev commented Nov 21, 2025

User description

Description

Use .NET 10 GA packages
Upgrade important dependencies
Use the latest version of System.Text.Json (fixes #2285)

Purpose

This pull request is a:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

PR Type

Enhancement


Description

  • Upgrade to .NET 10 GA packages (10.0.0)

  • Update System.Text.Json to GA version

  • Upgrade multiple dependencies to latest versions

  • Improve code formatting with consistent indentation


Diagram Walkthrough

flowchart LR
  A["Directory.Packages.props"] -->|"Update to .NET 10 GA"| B["MicrosoftTestHost 10.0.0"]
  A -->|"Update to .NET 10 GA"| C["SystemTextJson 10.0.0"]
  A -->|"Upgrade dependencies"| D["Newtonsoft.Json 13.0.4"]
  A -->|"Upgrade dependencies"| E["CsvHelper 33.1.0"]
  A -->|"Upgrade dependencies"| F["Multiple other packages"]
Loading

File Walkthrough

Relevant files
Dependencies
Directory.Packages.props
Upgrade to .NET 10 GA and dependencies                                     

Directory.Packages.props

  • Updated MicrosoftTestHostVer and SystemTextJsonVer to .NET 10 GA
    version (10.0.0)
  • Changed SystemTextJsonVer for pre-.NET 10 targets to 10.0.0
  • Upgraded multiple dependencies: Newtonsoft.Json (13.0.3 → 13.0.4),
    CsvHelper (33.0.1 → 33.1.0), Microsoft.CodeAnalysis.CSharp (4.12.0 →
    5.0.0), JetBrains.Annotations (2024.3.0 → 2025.2.2),
    HttpMultipartParser (8.4.0 → 9.2.0), Microsoft.NET.Test.Sdk (17.12.0 →
    18.0.1), System.Net.Http.Json (9.0.0 → 10.0.0),
    xunit.runner.visualstudio (2.8.2 → 3.1.5), xunit (2.9.2 → 2.9.3)
  • Reformatted XML with consistent 4-space indentation and self-closing
    tag formatting
+51/-51 

@qodo-merge-for-open-source
Copy link
Contributor

qodo-merge-for-open-source bot commented Nov 21, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #2285
🟢 Update System.Text.Json dependency from version 8.0.4 to version 8.0.5 or greater to fix
CWE-407 Inefficient Algorithmic Complexity vulnerability
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 21, 2025

Deploying restsharp with  Cloudflare Pages  Cloudflare Pages

Latest commit: d02f063
Status: ✅  Deploy successful!
Preview URL: https://99c85396.restsharp.pages.dev
Branch Preview URL: https://update-dotnet-10-packages.restsharp.pages.dev

View logs

@qodo-merge-for-open-source
Copy link
Contributor

qodo-merge-for-open-source bot commented Nov 21, 2025

PR Code Suggestions ✨

Latest suggestions up to d02f063

CategorySuggestion                                                                                                                                    Impact
Incremental [*]
Add exception handling for handler disposal

Add try-catch blocks to ensure WinHttpHandler and HttpClientHandler instances
are properly disposed if an exception occurs during their configuration.

src/RestSharp/RestClient.cs [95-104]

+HttpMessageHandler handler;
+
 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
     var winHttpHandler = new WinHttpHandler();
-    ConfigureHttpMessageHandler(winHttpHandler, options);
-    handler = winHttpHandler;
+    try {
+        ConfigureHttpMessageHandler(winHttpHandler, options);
+        handler = winHttpHandler;
+    }
+    catch {
+        winHttpHandler.Dispose();
+        throw;
+    }
 }
 else {
     var httpClientHandler = new HttpClientHandler();
-    ConfigureHttpMessageHandler(httpClientHandler, options);
-    handler = httpClientHandler;
+    try {
+        ConfigureHttpMessageHandler(httpClientHandler, options);
+        handler = httpClientHandler;
+    }
+    catch {
+        httpClientHandler.Dispose();
+        throw;
+    }
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: This is a valid suggestion that correctly identifies a potential resource leak if an exception occurs during handler configuration, improving the code's robustness and exception safety.

Low
Remove redundant platform validation check

Remove the redundant IsOSPlatform(OSPlatform.Windows) check from
ConfigureHttpMessageHandler(WinHttpHandler, ...) because the calling code
already ensures it runs only on Windows.

src/RestSharp/RestClient.cs [242-245]

 static void ConfigureHttpMessageHandler(WinHttpHandler handler, RestClientOptions options) {
-    if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
-        throw new PlatformNotSupportedException("WinHttpHandler is only supported on Windows");
-    }
+    #if NET
+    if (!OperatingSystem.IsBrowser()) {
+    #endif
+        handler.CookieUsePolicy        = CookieUsePolicy.IgnoreCookies;
  • Apply / Chat
Suggestion importance[1-10]: 3

__

Why: The suggestion correctly identifies a redundant platform check, and removing it simplifies the code. However, the check could be seen as defensive programming, so its removal is a minor improvement.

Low
  • More

Previous suggestions

Suggestions up to commit 9114256
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix potential runtime compatibility issues

Revert the SystemTextJsonVer for pre-.NET 10 targets to 9.0.10 to prevent build
or runtime errors on older frameworks.

Directory.Packages.props [15-17]

 <PropertyGroup Label="Package versions for pre-.NET 10" Condition="'$(TargetFramework)' != 'net10.0'">
-    <SystemTextJsonVer>10.0.0</SystemTextJsonVer>
+    <SystemTextJsonVer>9.0.10</SystemTextJsonVer>
 </PropertyGroup>

[Suggestion processed]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical compatibility issue where a package version intended for .NET 10 is being applied to older frameworks, which would likely cause build or runtime failures.

High

@qodo-merge-for-open-source
Copy link
Contributor

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: test-windows (net48)

Failed stage: Run tests [❌]

Failure summary:

The action failed because the test assembly RestSharp.Tests.Integrated.dll could not load the
dependency HttpTracer assembly. The specific error is:
- System.IO.FileLoadException: Could not load
file or assembly 'HttpTracer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
- The
error indicates that a strongly-named (signed) assembly is required, but the HttpTracer assembly
being referenced is not strongly-named or has a missing/incorrect strong name signature
- This
caused the test discovery to fail catastrophically, resulting in "No test is available" for the
integrated tests
- File: RestSharp.Tests.Integrated.dll (net48)

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

182:  Test run for D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Serializers.Json\bin\Debug\net48\RestSharp.Tests.Serializers.Json.dll (.NETFramework,Version=v4.8)
183:  RestSharp.Tests -> D:\a\RestSharp\RestSharp\test\RestSharp.Tests\bin\Debug\net48\RestSharp.Tests.dll
184:  RestSharp.Tests.Serializers.Csv -> D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Serializers.Csv\bin\Debug\net48\RestSharp.Tests.Serializers.Csv.dll
185:  Test run for D:\a\RestSharp\RestSharp\test\RestSharp.Tests\bin\Debug\net48\RestSharp.Tests.dll (.NETFramework,Version=v4.8)
186:  Test run for D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Serializers.Csv\bin\Debug\net48\RestSharp.Tests.Serializers.Csv.dll (.NETFramework,Version=v4.8)
187:  VSTest version 18.0.1 (x64)
188:  VSTest version 18.0.1 (x64)
189:  VSTest version 18.0.1 (x64)
190:  Starting test execution, please wait...
191:  Starting test execution, please wait...
192:  A total of 1 test files matched the specified pattern.
193:  Starting test execution, please wait...
194:  A total of 1 test files matched the specified pattern.
195:  A total of 1 test files matched the specified pattern.
196:  Results File: D:\a\RestSharp\RestSharp/test-results/net48\RestSharp.Tests.Serializers.Csv.trx
197:  Passed!  - Failed:     0, Passed:     6, Skipped:     0, Total:     6, Duration: 7 s - RestSharp.Tests.Serializers.Csv.dll (net48)
198:  Results File: D:\a\RestSharp\RestSharp/test-results/net48\RestSharp.Tests.Serializers.Json.trx
199:  Passed!  - Failed:     0, Passed:    12, Skipped:     0, Total:    12, Duration: 8 s - RestSharp.Tests.Serializers.Json.dll (net48)
200:  RestSharp.Tests.Integrated -> D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Integrated\bin\Debug\net48\RestSharp.Tests.Integrated.dll
201:  Test run for D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Integrated\bin\Debug\net48\RestSharp.Tests.Integrated.dll (.NETFramework,Version=v4.8)
202:  VSTest version 18.0.1 (x64)
203:  Starting test execution, please wait...
204:  A total of 1 test files matched the specified pattern.
205:  [xUnit.net 00:00:00.59] RestSharp.Tests.Integrated: Catastrophic failure: System.IO.FileLoadException: Could not load file or assembly 'HttpTracer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
206:  File name: 'HttpTracer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
...

218:  at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
219:  Exception rethrown at [0]: 
220:  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
221:  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
222:  at Xunit.Abstractions.ITestFramework.GetDiscoverer(IAssemblyInfo assembly)
223:  at Xunit.Runner.v2.Xunit2..ctor(IMessageSink diagnosticMessageSink, AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, Boolean verifyAssembliesOnDisk)
224:  at Xunit.Runner.v2.Xunit2.ForDiscoveryAndExecution(XunitProjectAssembly projectAssembly, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk)
225:  at Xunit.XunitFrontController.Create(XunitProjectAssembly projectAssembly, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink, ITestProcessLauncher testProcessLauncher)
226:  at Xunit.Runner.VisualStudio.VsTestRunner.<RunTestsInAssembly>d__33.MoveNext()
227:  --- End of stack trace from previous location where exception was thrown ---
228:  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
229:  at Xunit.Runner.VisualStudio.VsTestRunner.<RunTestsInAssembly>d__33.MoveNext()
230:  No test is available in D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Integrated\bin\Debug\net48\RestSharp.Tests.Integrated.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
231:  Results File: D:\a\RestSharp\RestSharp/test-results/net48\RestSharp.Tests.Integrated.trx
232:  Results File: D:\a\RestSharp\RestSharp/test-results/net48\RestSharp.Tests.trx
233:  Passed!  - Failed:     0, Passed:   221, Skipped:     0, Total:   221, Duration: 41 s - RestSharp.Tests.dll (net48)
234:  RestSharp.Tests.Serializers.Xml -> D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Serializers.Xml\bin\Debug\net48\RestSharp.Tests.Serializers.Xml.dll
235:  Test run for D:\a\RestSharp\RestSharp\test\RestSharp.Tests.Serializers.Xml\bin\Debug\net48\RestSharp.Tests.Serializers.Xml.dll (.NETFramework,Version=v4.8)
236:  VSTest version 18.0.1 (x64)
237:  Starting test execution, please wait...
238:  A total of 1 test files matched the specified pattern.
239:  Results File: D:\a\RestSharp\RestSharp/test-results/net48\RestSharp.Tests.Serializers.Xml.trx
240:  Passed!  - Failed:     0, Passed:   105, Skipped:     0, Total:   105, Duration: 1 s - RestSharp.Tests.Serializers.Xml.dll (net48)
241:  ##[error]Process completed with exit code 1.
242:  ##[group]Run actions/upload-artifact@v5

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

Test Results

   35 files     35 suites   34m 11s ⏱️
  457 tests   353 ✅ 1 💤 103 ❌
3 199 runs  3 089 ✅ 7 💤 103 ❌

For more details on these failures, see this check.

Results for commit d02f063.

♻️ This comment has been updated with latest results.

@alexeyzimarev alexeyzimarev deleted the update-dotnet-10-packages branch November 21, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inefficient Algorithmic Complexity

2 participants