Drop net6.0 and net7.0 TFMs, keep net8.0+ and netstandard2.x#5387
Drop net6.0 and net7.0 TFMs, keep net8.0+ and netstandard2.x#5387
Conversation
Both net6.0 (Nov 2024) and net7.0 (May 2024) are out of support. Remove net6.0 from TargetFrameworks in test/nuget-tester projects and update all #if NET6_0_OR_GREATER / NET7_0_OR_GREATER preprocessor directives to NET8_0_OR_GREATER across 67 files. .NET Framework users are unaffected (covered by netstandard targets). Closes #4786
There was a problem hiding this comment.
Code Review: Drop net6.0 and net7.0 TFMs
This is a clean, well-scoped maintenance PR. Both .NET 6 (EOL Nov 2024) and .NET 7 (EOL May 2024) are out of support, and aligning the preprocessor guards with the actual supported TFMs is the right call.
What's done well
- Mechanically correct: All 74 preprocessor directive changes (71×
NET6_0_OR_GREATER+ 3×NET7_0_OR_GREATER) are consistently updated toNET8_0_OR_GREATER, which matches the minimum specific TFM now supported. - No functionality lost: Since net8, net9, net10 all satisfy
NET8_0_OR_GREATER, all previously-guarded code (DateOnly/TimeOnly, Parallel.ForEachAsync, Task.IsCompletedSuccessfully, generic math, static abstract members, etc.) continues to compile and run for all supported consumers. - Correct project file cleanup:
TUnit.TestProject.LibraryandTUnit.NugetTesterhave theirnet6.0targets removed; the main library projects already targetnetstandard2.0;net8.0;net9.0;net10.0, so no change needed there. netstandard2.0users are unaffected: Thenetstandard2.0target never defined these symbols, so the fallback code paths remain unchanged.
Minor observations (no action required)
-
Feature-to-guard accuracy: A few of the original
NET6_0_OR_GREATERguards were slightly conservative for their feature (e.g.,Task.IsCompletedSuccessfullyis available since .NET 5 / netstandard2.1, andBigInteger.IsPowerOfTwopredates .NET 6 entirely). Since the project doesn't target netstandard2.1 or net5, this was already moot before the PR and remains moot after — the newNET8_0_OR_GREATERguards are perfectly correct for the current TFM matrix. -
NET7_0_OR_GREATER→NET8_0_OR_GREATER: The three cases here (MatrixRangeAttribute<T>usingINumber<T>generic math,StaticAbstractMemberTests.cs, andMatrixTests.cs) all require features introduced in .NET 7 / C# 11. With .NET 7 dropped,NET8_0_OR_GREATERis the correct minimum guard.
Verdict
Approved. The change is straightforward, correct, and a sensible step in keeping the project aligned with the supported .NET release cadence. Nothing to block on.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
Summary
net6.0fromTargetFrameworksinTUnit.TestProject.LibraryandTUnit.NugetTestercsproj files#if NET6_0_OR_GREATERand#if NET7_0_OR_GREATERpreprocessor directives to#if NET8_0_OR_GREATERacross 67 filesnetstandard2.0targets)Both
net6.0(Nov 2024) andnet7.0(May 2024) are out of support. The library projects already targetnetstandard2.0;net8.0;net9.0;net10.0— this change aligns the preprocessor directives and test projects with that reality.Closes #4786
Test plan