Skip to content

feat: Make common sdk AOT safe#169

Merged
jsonbailey merged 4 commits intolaunchdarkly:mainfrom
justindbaur:main
Apr 8, 2026
Merged

feat: Make common sdk AOT safe#169
jsonbailey merged 4 commits intolaunchdarkly:mainfrom
justindbaur:main

Conversation

@justindbaur
Copy link
Copy Markdown
Contributor

@justindbaur justindbaur commented Oct 13, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Part of #90
Prerequisite for launchdarkly/dotnet-sdk-internal#49

Describe the solution you've provided

I made all targets of the common SDK trim safe using the built in system text json source generators.

Describe alternatives you've considered

The already written converters could be called directly in the places where LdValue and Context need to be serialized.

Additional context

I do have a test console app that can be published with AOT and then ran to make sure that these items can be serialized properly but wasn't totally sure where I should put it. If that is desired I can add it, just need to know where to put it.


Note

Medium Risk
Touches core JSON serialization paths for LdValue and Context and introduces framework-conditional behavior; mistakes could change emitted JSON or break deserialization under specific target frameworks/AOT settings.

Overview
Improves trim/native-AOT compatibility by switching LdValue and Context serialization/deserialization to use System.Text.Json source generation on NET7_0_OR_GREATER via a new LdJsonSerializerContext.

Adds AOT/trimming warning annotations to LdJsonSerialization APIs on .NET 7+, updates enum conversion helpers to use generic Enum.GetValues<T>() when available, and adjusts the CommonSdk project settings to enable AOT compatibility and set LangVersion 9.0 for net7+ builds.

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

@justindbaur justindbaur changed the title Make common sdk AOT safe feat: Make common sdk AOT safe Oct 13, 2025
@justindbaur justindbaur marked this pull request as ready for review October 13, 2025 00:54
@justindbaur justindbaur requested a review from a team as a code owner October 13, 2025 00:54
cursor[bot]

This comment was marked as outdated.

@jsonbailey
Copy link
Copy Markdown
Contributor

@justindbaur thanks for submitting the PR. I will review this as soon as I can.

@jsonbailey
Copy link
Copy Markdown
Contributor

@justindbaur sorry for the delay in review. I've reviewed and tested the builds with a sample project and this looks good.

@jsonbailey jsonbailey merged commit 8c6948e into launchdarkly:main Apr 8, 2026
19 checks passed
@jsonbailey
Copy link
Copy Markdown
Contributor

I will let you know once we have the new package released but are hoping to release it this week.

jsonbailey pushed a commit that referenced this pull request Apr 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.2.0](LaunchDarkly.CommonSdk-v7.1.1...LaunchDarkly.CommonSdk-v7.2.0)
(2026-04-08)


### Features

* Make common sdk AOT safe
([#169](#169))
([8c6948e](8c6948e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this PR only updates release metadata/version numbers and
documentation (changelog/provenance), with no functional code changes in
the library itself.
> 
> **Overview**
> **Releases `LaunchDarkly.CommonSdk` v7.2.0.**
> 
> Bumps the `pkgs/shared/common` version to `7.2.0` in
`.release-please-manifest.json` and updates the package version in
`LaunchDarkly.CommonSdk.csproj`.
> 
> Updates release docs by adding the `7.2.0` entry to `CHANGELOG.md`
(noting the AOT-safety feature) and updating the version used in
`PROVENANCE.md` verification instructions.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d2e954b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@jsonbailey
Copy link
Copy Markdown
Contributor

@justindbaur

The new common package has been published with the AOT update incorporated. I've also released updates for all the SDKs that rely on it. Thanks again for your commit!
LaunchDarkly.ClientSdk: v5.7.1
LaunchDarkly.ServerSdk: v8.11.2
LaunchDarkly.CommonSdk: v7.2.0
LaunchDarkly.InternalSdk: v3.6.1

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