Skip to content

feat: Update target frameworks to net8.0#69

Merged
jsonbailey merged 1 commit into
mainfrom
jb/sdk-1435/update-to-net8
Jun 16, 2026
Merged

feat: Update target frameworks to net8.0#69
jsonbailey merged 1 commit into
mainfrom
jb/sdk-1435/update-to-net8

Conversation

@jsonbailey

@jsonbailey jsonbailey commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Overview

Updates dotnet-sdk-internal to support net8.0, matching the target framework set used by the dotnet-core packages (server-ai, telemetry, server, common).

Resolves SDK-1435.

Target frameworks: netstandard2.0;netcoreapp3.1;net462;net6.0netstandard2.0;net462;net8.0

Not a breaking change

Dropping netcoreapp3.1 and net6.0 does not warrant a major version bump:

  • netstandard2.0 and net462 continue to cover .NET Framework consumers.
  • netcoreapp3.1 is not used by the consuming SDKs.
  • Both dropped frameworks are out of support, and removing out-of-support TFMs is permitted without a major version.

The CS8352/CS8350 problem (why this stalled previously)

The JsonConverterHelpers ref-struct helpers (ArrayHelper/ObjectHelper) could not be consumed under net8.0: the .NET 7+ runtime enables byref-field ref-safety analysis regardless of LangVersion, so the compiler assumed these ref structs might capture a reference to the Utf8JsonReader passed to their methods, producing CS8350/CS8352 at every call site (including plain inline Next(ref reader) calls — so every downstream consumer would hit it on net8.0).

Fix: annotate the Utf8JsonReader parameters as scoped to declare that the helpers never capture a reference to the reader (which is true), and raise LangVersion to 11 so the annotation is available. scoped is a compile-time-only annotation — verified to build cleanly on netstandard2.0 and net462 as well. There is direct precedent: dotnet-core's server-ai ships LangVersion 11 with the identical TFM set.

Other changes

  • HttpProperties: simplified the handler guard #if NETCOREAPP || NET6_0#if NETCOREAPP (the branch selects SocketsHttpHandler, available on all .NET Core 2.1+/.NET 5+ targets, so no version floor applies; the || NET6_0 clause was redundant).
  • CI and release actions updated to install the 8.0 SDK and target net8.0.

Testing

  • net8.0: 180/180 unit tests pass.
  • netstandard2.0 and net462: build clean.
  • No tests were removed or disabled.

Note

Medium Risk
TFM matrix changes can affect consumers that targeted net6.0/netcoreapp3.1 directly; public helper signatures changed to scoped ref, which downstream code must compile against on modern runtimes.

Overview
Aligns LaunchDarkly.InternalSdk with the dotnet-core TFM set by moving the modern target from net6.0 / netcoreapp3.1 to net8.0 while keeping netstandard2.0 and net462. Default build/test frameworks and GitHub Actions (setup-dotnet 8.0, CI matrix, full release framework_target) are updated accordingly; LangVersion is raised to 11.

JsonConverterHelpers ArrayHelper / ObjectHelper APIs now use scoped ref Utf8JsonReader so net8.0 ref-safety analysis (CS8350 / CS8352) passes without changing runtime behavior. Tests mirror those signatures.

HttpProperties uses #if NETCOREAPP only (drops redundant NET6_0). System.Collections.Immutable is no longer pulled in for the removed netcoreapp3.1 TFM.

Reviewed by Cursor Bugbot for commit 74fefad. Bugbot is set up for automated code reviews on this repo. Configure here.

Replace netcoreapp3.1 and net6.0 with net8.0 (keeping netstandard2.0 and
net462), mirroring the dotnet-core packages. This is not a breaking change:
netstandard2.0/net462 still cover .NET Framework consumers, netcoreapp3.1 is
not used by the consuming SDKs, and net6.0/netcoreapp3.1 are out of support,
so no major version bump is required.

The JsonConverterHelpers ref-struct helpers (ArrayHelper/ObjectHelper) could
not be used under net8.0 because the .NET 7+ runtime enables byref-field
ref-safety analysis regardless of LangVersion, causing CS8350/CS8352 at every
call site. Annotate the Utf8JsonReader parameters as 'scoped' to declare that
the helpers never capture a reference to the reader, and raise LangVersion to
11 so the annotation is available. This unblocks net8.0 for all consumers.

Simplify the HttpProperties handler guard from '#if NETCOREAPP || NET6_0' to
'#if NETCOREAPP'. The branch selects SocketsHttpHandler (for ConnectTimeout
support), which exists on all .NET Core 2.1+ / .NET 5+ targets, so there is no
version floor to enforce; the unversioned NETCOREAPP symbol already covers
every such target and the '|| NET6_0' clause was redundant.

Update CI and release actions to install the 8.0 SDK and target net8.0.
@jsonbailey jsonbailey marked this pull request as ready for review June 16, 2026 21:00
@jsonbailey jsonbailey requested a review from a team as a code owner June 16, 2026 21:00
@jsonbailey jsonbailey merged commit 235c52f into main Jun 16, 2026
10 checks passed
@jsonbailey jsonbailey deleted the jb/sdk-1435/update-to-net8 branch June 16, 2026 21:52
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.

2 participants