Skip to content

Update to .NET 11, drop .NET 8 and adopt MTP - #1182

Merged
stuartlang-je merged 10 commits into
justeattakeaway:mainfrom
slang25:update-tfms-cve-mtp
Nov 25, 2026
Merged

stuartlang-je merged 10 commits into
justeattakeaway:mainfrom
slang25:update-tfms-cve-mtp

Conversation

@slang25

@slang25 slang25 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

A bit of maintenance, now that .NET 8 and 9 are out of support and .NET 11 is out. There's also a CVE in Microsoft.AspNetCore.WebUtilities that was breaking restore (NU1902 + TreatWarningsAsErrors).

The main changes are in the first two commits, the rest are follow-ups from review and CI.

Update to .NET 11 SDK, drop .NET 8 and adopt MTP

  • Update the SDK to 11.0.100 and opt dotnet test into Microsoft.Testing.Platform via global.json
  • Replace the net8.0 TFM with net10.0, so we now target netstandard2.0;net472;net10.0
  • Run the library tests on both net10.0 and net11.0. CI now installs the .NET 10 SDK as well, and so does build.ps1 when it installs the SDK locally
  • Bump Microsoft.AspNetCore.WebUtilities to 2.3.14 for CVE-2026-118750. We never touched the vulnerable FileBufferingReadStream, but audit flags it all the same
  • Bump xunit.v3 to 4.0.3, which uses MTP by default, and drop Microsoft.NET.Test.Sdk and xunit.runner.visualstudio
  • Swap coverlet.msbuild (VSTest only) for coverlet.MTP. The 95% threshold is still enforced, and the merged report and step summary are now generated by the ReportGenerator dotnet tool in build.ps1
  • Bump GitHubActionsTestLogger to 3.0.5 for its MTP support (--report-github)
  • #if NET8_0 should have been NET8_0_OR_GREATER, otherwise net10.0 would have quietly fallen back to the old header hashing code
  • In .NET 11 HttpClient observes cancellation when buffering the response content, so Inject_Latency_For_Http_Get_With_Cancellation now expects a TaskCanceledException there
  • Only ignore major updates of Microsoft.AspNetCore.WebUtilities in Dependabot, so we get patches like this one in future

Remove dependency on Microsoft.AspNetCore.WebUtilities

We only used QueryHelpers.ParseQuery() for ForFormContent(), so I've replaced it with a small internal FormUrlEncodedParser that copies its behaviour, quirks and all (case-insensitive keys, keys without a = aren't decoded, repeated values are joined with , but empty ones are dropped, as StringValues.ToString() does). The tests compare the parser's output with the real ParseQuery(), for a bunch of edge cases plus 100k seeded random inputs. It's no longer a dependency of the library, so no more CVE noise for consumers, and the net10.0 package has no dependencies at all now 🙂

Versioning

Dropping net8.0 means .NET 8/9 consumers now get the netstandard2.0 assets, which didn't have the JsonTypeInfo<T> overloads of WithJsonContent<T>() and RegisterGetFromJson<T>(), so package validation flagged them as removed. The System.Text.Json package has JsonTypeInfo<T> for netstandard2.0, so those overloads are now compiled for every TFM instead and no package validation suppressions are needed. However, falling back to netstandard2.0 on .NET 8/9 still drops runtime behaviour gated behind #if NET6_0_OR_GREATER / #if NET8_0_OR_GREATER (most notably the synchronous InterceptingHttpMessageHandler.Send() override, ReadOnlyMemoryContent support in ForFormContent(), and AOT/trimming annotations), so this bumps AssemblyVersion and VersionPrefix to 6.0.0.

Also, Inject_Latency_For_Http_Get flaked once locally under coverage (the 50ms delay measured as 49.95ms). It's not new and I couldn't reproduce it, but running two TFMs makes it a little more likely, so it could do with a small tolerance at some point.

🤖 Generated with Claude Code

slang25 and others added 2 commits November 18, 2026 15:33
- Update the .NET SDK to 11.0.100 and use Microsoft.Testing.Platform for `dotnet test`.
- Replace the net8.0 TFM with net10.0 as .NET 8 and 9 are now out of support.
- Run the library tests on both net10.0 and net11.0.
- Update Microsoft.AspNetCore.WebUtilities to 2.3.14 to resolve CVE-2026-118750.
- Update xunit.v3 to 4.0.3 and remove Microsoft.NET.Test.Sdk and xunit.runner.visualstudio.
- Replace coverlet.msbuild with coverlet.MTP and generate coverage reports using the ReportGenerator tool.
- Update GitHubActionsTestLogger to 3.0.5 for MTP support.
- Fix test for HttpClient cancellation behaviour change in .NET 11.
- Use the HashCode-based header hashing for all TFMs from net8.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the use of `QueryHelpers.ParseQuery()` for matching form content
with an internal parser that has the same behaviour. This removes the
library's dependency on Microsoft.AspNetCore.WebUtilities, along with its
transitive dependencies, so consumers no longer receive vulnerability
reports for a package that was only used for a single method.

The tests compare the parser's output to `QueryHelpers.ParseQuery()` for
a set of edge cases and for randomly generated content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slang25
slang25 requested a review from a team as a code owner November 18, 2026 15:36
Copilot AI balanced review requested due to automatic review settings November 18, 2026 15:36
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (3d5da88) to head (6b23a83).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1182      +/-   ##
==========================================
+ Coverage   99.33%   99.54%   +0.21%     
==========================================
  Files          15       13       -2     
  Lines         896      873      -23     
  Branches      205      214       +9     
==========================================
- Hits          890      869      -21     
+ Misses          4        3       -1     
+ Partials        2        1       -1     
Flag Coverage Δ
linux 99.54% <100.00%> (+0.21%) ⬆️
macos 99.54% <100.00%> (+0.21%) ⬆️
windows 99.54% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repeated form values cause quadratic string copying, while the build script can fail when the .NET 10 runtime is missing or local tools are invoked from outside the repository directory.

3 open issues
What changed in this PR

Modernizes the library’s build and test infrastructure for .NET 11 and removes its production dependency on ASP.NET Core WebUtilities while preserving form-matching behavior.

Changes:

  • Replaces the library’s net8.0 target with net10.0 and runs library tests on .NET 10 and 11.
  • Migrates testing and coverage to Microsoft.Testing.Platform, coverlet.MTP, and the ReportGenerator tool.
  • Adds an internal form parser with compatibility tests against QueryHelpers.ParseQuery().
File Description
tests/​HttpClientInterception.Tests/​JustEat.HttpClientInterception.Tests.csproj Adds dual-runtime testing and parser comparison dependencies.
tests/​HttpClientInterception.Tests/​FormUrlEncodedParserTests.cs Adds edge-case, randomized, and form-matching tests.
tests/​HttpClientInterception.Tests/​Examples.cs Updates cancellation expectations for .NET 11.
tests/​HttpClientInterception.Benchmarks/​JustEat.HttpClientInterception.Benchmarks.csproj Adds the .NET 11 benchmark target.
src/​HttpClientInterception/​PublicAPI/​net10.0/​PublicAPI.Unshipped.txt Records the .NET 10 public API surface.
src/​HttpClientInterception/​PublicAPI/​net10.0/​PublicAPI.Shipped.txt Initializes the .NET 10 shipped API baseline.
src/​HttpClientInterception/​JustEat.HttpClientInterception.csproj Updates targets and removes unnecessary dependencies.
src/​HttpClientInterception/​HttpRequestInterceptionBuilderExtensions.cs Uses the internal parser for form matching.
src/​HttpClientInterception/​HttpClientInterceptorOptions.cs Preserves modern header hashing on newer targets.
src/​HttpClientInterception/​FormUrlEncodedParser.cs Implements dependency-free form parsing.
src/​HttpClientInterception/​CompatibilitySuppressions.xml Suppresses baseline errors for removed .NET 8 overloads.
samples/​SampleApp/​SampleApp.csproj Moves the sample application to .NET 11.
samples/​SampleApp.Tests/​SampleApp.Tests.csproj Updates the sample tests and removes VSTest dependencies.
samples/​SampleApp.Tests/​ReposTests.cs Switches deserialization to System.Text.Json.
global.json Selects the .NET 11 SDK and Microsoft.Testing.Platform.
Directory.Packages.props Updates dependencies for the testing migration.
Directory.Build.targets Removes MSBuild-based coverage reporting.
Directory.Build.props Removes legacy coverage configuration.
build.ps1 Adds runtime installation, MTP coverage, and merged reporting.
.vscode/​launch.json Updates the sample debug path to .NET 11.
.github/​workflows/​update-dotnet-sdk.yml Removes the obsolete test SDK update entry.
.github/​workflows/​dependabot-approve.yml Removes the obsolete test SDK approval entry.
.github/​workflows/​build.yml Installs .NET 10 alongside the selected SDK.
.github/​dependabot.yml Allows WebUtilities minor and patch updates.
.config/​dotnet-tools.json Registers the ReportGenerator tool.

Review effort: Balanced

Comment thread build.ps1 Resolved
Comment thread build.ps1 Resolved
slang25 and others added 8 commits November 19, 2026 16:52
Collect the values for each key and join them once, rather than copying
the accumulated string each time a key is repeated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Run from the repository root so global.json, which selects the SDK and
  the test runner, and the local tools manifest are always found.
- Install missing runtimes even when the required SDK is already present.
- Set DOTNET_ROOT for local installs so the test applications use the
  locally installed runtimes.
- Use the platform path separator when updating PATH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace Test-DotNetRuntimes with Get-MissingDotNetRuntime, which uses a
singular noun and returns the missing runtimes so the caller can report
them with Write-Output instead of Write-Host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coverlet.MTP reports branches that coverlet.msbuild did not, which
reduced the coverage reported to Codecov. Add tests for them, and for
the form parser branches that were only covered by the copy of the
parser compiled into the tests, rather than the library itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The netstandard2.0 and net472 builds reference a version of
System.Text.Json that supports JsonTypeInfo<T>, so the overloads of
WithJsonContent<T>() and RegisterGetFromJson<T>() no longer need to be
limited to .NET.

This avoids a breaking change for applications targeting .NET 8 and 9,
which now use the netstandard2.0 build instead of the removed net8.0
build, so the package validation suppressions are no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants