|
| 1 | +# Brief: Issue #119 — Add support for all currently supported .NET frameworks (net9.0, net10.0) |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +The library currently targets `net8.0;netstandard2.0`. |
| 6 | +As of March 2026, .NET 9 (STS) and .NET 10 (LTS) are both in active support alongside .NET 8 (LTS). |
| 7 | +This issue adds `net9.0` and `net10.0` as target frameworks across the library, test, examples, benchmarking, and CI projects. |
| 8 | +No code logic changes are expected — the existing `#if NET5_0_OR_GREATER` guard in `Bitwise.cs` already covers all three modern targets. |
| 9 | +The spec file `spec/tech-standards/build-system.md` must also be updated to reflect the new targets. |
| 10 | + |
| 11 | +## Affected Files (confirmed by exploration) |
| 12 | + |
| 13 | +| File | Current value | Required value | |
| 14 | +|------|--------------|----------------| |
| 15 | +| `HdrHistogram/HdrHistogram.csproj` | `net8.0;netstandard2.0` | `net10.0;net9.0;net8.0;netstandard2.0` | |
| 16 | +| `HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj` | `net8.0` | `net10.0;net9.0;net8.0` | |
| 17 | +| `HdrHistogram.Examples/HdrHistogram.Examples.csproj` | `net8.0` | `net10.0` | |
| 18 | +| `HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj` | `net8.0` | `net10.0;net9.0;net8.0` | |
| 19 | +| `.github/workflows/ci.yml` | `dotnet-version: 8.0.x` | `8.0.x`, `9.0.x`, `10.0.x` (multi-line) | |
| 20 | +| `spec/tech-standards/build-system.md` | Documents `net8.0;netstandard2.0` | Update to reflect new targets | |
| 21 | + |
| 22 | +## Conditional Compilation |
| 23 | + |
| 24 | +Only one `#if` guard exists in the main library: |
| 25 | + |
| 26 | +- `HdrHistogram/Utilities/Bitwise.cs`: `#if NET5_0_OR_GREATER` — uses `System.Numerics.BitOperations.LeadingZeroCount()`. |
| 27 | + |
| 28 | +This guard already applies correctly to net8.0, net9.0, and net10.0. |
| 29 | +No new `#if` directives are required. |
| 30 | +No `#if NET9_0_OR_GREATER` or `#if NET10_0_OR_GREATER` optimisations have been identified as necessary for this changeset. |
| 31 | + |
| 32 | +## Acceptance Criteria |
| 33 | + |
| 34 | +- [ ] `HdrHistogram.csproj` targets `net10.0;net9.0;net8.0;netstandard2.0` |
| 35 | +- [ ] `HdrHistogram.UnitTests.csproj` targets `net10.0;net9.0;net8.0` |
| 36 | +- [ ] `HdrHistogram.Examples.csproj` targets `net10.0` |
| 37 | +- [ ] `HdrHistogram.Benchmarking.csproj` targets `net10.0;net9.0;net8.0` |
| 38 | +- [ ] CI installs .NET SDK 8.0.x, 9.0.x, and 10.0.x |
| 39 | +- [ ] `dotnet build -c Release` succeeds for all target frameworks |
| 40 | +- [ ] `dotnet test` passes on all three modern runtimes (net8.0, net9.0, net10.0) |
| 41 | +- [ ] `dotnet pack` produces a NuGet package containing assemblies for all four targets |
| 42 | +- [ ] No regressions — all existing tests pass on all targets |
| 43 | +- [ ] `spec/tech-standards/build-system.md` updated to reflect the new target frameworks |
| 44 | + |
| 45 | +## Test Strategy |
| 46 | + |
| 47 | +No new tests need to be written. |
| 48 | +The existing test suite in `HdrHistogram.UnitTests/` provides full coverage. |
| 49 | +Multi-targeting the test project is sufficient: `dotnet test` automatically runs all tests against each `<TargetFrameworks>` entry. |
| 50 | +The CI pipeline, once updated to install all three SDKs, will exercise net8.0, net9.0, and net10.0 in a single `dotnet test` invocation. |
| 51 | + |
| 52 | +Verification locally: |
| 53 | + |
| 54 | +```bash |
| 55 | +dotnet build HdrHistogram/HdrHistogram.csproj -c Release |
| 56 | +dotnet test HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj -c Release |
| 57 | +dotnet pack HdrHistogram/HdrHistogram.csproj -c Release --no-build |
| 58 | +``` |
| 59 | + |
| 60 | +After `dotnet pack`, confirm the `.nupkg` contains `lib/net8.0/`, `lib/net9.0/`, `lib/net10.0/`, and `lib/netstandard2.0/` folders. |
| 61 | + |
| 62 | +## Risks and Open Questions |
| 63 | + |
| 64 | +- **net10.0 SDK availability**: The devcontainer currently uses a .NET 9.0 base image with an additional 8.0 runtime. |
| 65 | + A .NET 10.0 SDK must be available in CI (GitHub Actions `setup-dotnet@v4` supports `10.0.x`) and locally. |
| 66 | + If the devcontainer does not have .NET 10 installed, local builds targeting `net10.0` will fail. |
| 67 | + The CI step is the authoritative build environment; local failure is acceptable during transition. |
| 68 | + |
| 69 | +- **BenchmarkDotNet compatibility**: `BenchmarkDotNet` version `0.13.12` (currently referenced) must support net10.0. |
| 70 | + If it does not, the version pin may need updating. |
| 71 | + This should be verified during implementation by attempting a Release build of the benchmarking project. |
| 72 | + |
| 73 | +- **Examples project**: The issue specifies updating to `net10.0` only (single target, not multi-target). |
| 74 | + This is intentional — examples are a developer-facing runnable tool, not a shipped library. |
| 75 | + |
| 76 | +- **Spec update**: `spec/tech-standards/build-system.md` still documents AppVeyor CI. |
| 77 | + That section was already outdated before this issue. |
| 78 | + Only the target framework tables and CI setup sections need updating here; AppVeyor cleanup is out of scope. |
0 commit comments