Repository navigation
Fix Octokit's GitHub reads in the native-AOT build - #48
Merged
Merged
Conversation
Fixes #47. In the native-AOT binary, find-previous and generate printed nothing and current-version threw a NullReferenceException in PocoJsonSerializerStrategy.DeserializeObject. Octokit reads responses by reflection with no trimming annotations, so the trimmed binary had lost three things that reflection needs: - the models' constructors and setters: the csproj now roots the Octokit assembly for RID builds; - List<T>'s capacity constructor, which SimpleJson uses for every JSON array; - the StringEnum<T>(string) constructor for each enum the read models reach (ItemState, ItemStateReason, LockReason, MergeableState, TeamPrivacy). StringEnum is a struct, so each instantiation needs its own entry. OctokitClient creates the client and carries DynamicDependency entries for the last two. The binary grows from 10.8 MB to 13.9 MB on osx-arm64. ./build.sh smokeaot publishes the AOT binary for this machine and runs find-previous, current-version and generate against elastic/apm-agent-dotnet 1.11.0, failing unless the known output comes back. CI's aot-pack job runs it after packing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 12, 2026
This brings every dependency of release-notes to its latest stable version, the tool manifest and GitHub Actions included. **Prompt summary:** Bring every dependency, GitHub Actions included, to its latest version, drop unused and sponsor-gated packages, and release the nullean repositories in dependency order. ## What | Package | Old | New | |---|---|---| | MinVer | 6.0.0 | 8.0.0 | | Nullean.Argh | 0.18.0 | 0.28.0 | | NuGet.Versioning | 6.13.1 | 8.0.0 (net10.0), 7.9.0 (net8.0) | | Octokit | 14.0.0 | 14.0.0 (already latest) | | FSharp.Core | 11.0.101 | 11.0.101 (already latest) | | Nullean.Make.Fs | 0.25.0 | 0.28.0 | | Proc / Proc.Fs (transitive, through Make.Fs) | 0.17.0 | 0.21.0 | | tool minver-cli | 6.0.0 | 8.0.0 | | tool nupkg-validator | 0.10.0 | 0.11.5 | | tool assembly-differ | 0.16.0 | 0.18.2 | | tool curb-cli | 0.14.0 | 0.14.1 | | docker/login-action | v3.7.0 | v4.8.0 | | nullean/.github release-drafter.yml, zizmor.yml | v1.3.0 | v1.5.0 | The global.json SDK (11.0.100) is already the latest .NET 11 SDK. The other actions were already on their latest versions. **TFM ceiling:** NuGet.Versioning 8.0.0 targets only net10.0 and net472. On net8.0 it restores the .NET Framework build (NU1701), so net8.0 stays on 7.9.0, the last version with a net8.0 target, through a TFM-conditioned `PackageVersion`. **Tool manifest order:** minver-cli, the only classic tool, comes first. assembly-differ, nupkg-validator and curb-cli are RID-specific and follow it. That order avoids the .NET 11.0.100 tool-restore bug on a cold cache. **Removed:** nothing. Every package is used: Octokit and NuGet.Versioning by the tool, MinVer for versioning, and FSharp.Core and Nullean.Make.Fs by the build. There are no sponsor-gated packages, direct or transitive. **Code changes forced by bumps:** - nupkg-validator 0.11 needs the `validate` subcommand (`build/scripts/Program.fs`). - Make.Fs 0.27+ makes `-s` a switch without a value, so `./build.sh <target> -s true` becomes `-s` in `ci.yml` and `AGENTS.md`. - assembly-differ 0.18 moves to a `diff` subcommand. `generateapichanges` now runs `assembly-differ diff …`, and `-f github-comment` is kept. The CLI surface is unchanged under Argh 0.28.0: the same five commands and the same flags (checked with `--help`). **Breaking:** none. The tool package declares no dependencies, so consumers are not pulled up, and both TFMs ship as before. ## Verify - `mise run ci`: build, pack, `nupkg-validator validate` (signed with 96c599bbe3e70f5d) and the `assembly-differ diff` 0.18.2 report against the published `release-notes.any`. All pass. curb check: 0 would change. - `mise run check`: curb clean, and zizmor reports no findings. `actionlint` (with shellcheck) is clean, and `zizmor --min-severity medium .github` reports no findings. - `NUGET_PACKAGES=$(mktemp -d) DOTNET_CLI_HOME=$(mktemp -d) dotnet tool restore`: "Restore was successful". - `check-package-readme.sh` passes on `release-notes` and `release-notes.any`. - The sponsor-package grep over `project.assets.json` prints nothing. - `dotnet list package --outdated` lists only the documented NuGet.Versioning ceiling on net8.0. build/scripts with `--include-transitive`: no updates. - `dotnet pack -r osx-arm64` (native AOT) succeeds. The only trim/AOT warnings are Octokit's own IL2104/IL3053, as on `main`. The Mach-O arm64 binary runs `--help` and `--version`. - `./build.sh smokeaot -s`, anonymous against GitHub, run once, with #48 merged in: `find-previous` prints `1.10.0`, `current-version` prints `1.11.1`/`1.11.2`, and `generate` lists #1239, #1310 and #1302 under their headings. Exit 0. - Mutation check: setting `SignAssembly` to false makes `mise run ci` fail in `validatepackages` ("NOT publicly signed with expected token"). After the revert it passes again. The repository has no tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #47
The native-AOT binary (the per-RID packages, the container and the GitHub Action) now reads releases and issues the same way the managed builds do. Before,
find-previousandgenerateprinted nothing andcurrent-versionthrew. A new./build.sh smokeaottarget runs the AOT binary against GitHub in CI'saot-packjob, so this cannot come back unnoticed.Why
Octokit reads every response with SimpleJson (
PocoJsonSerializerStrategy). SimpleJson uses reflection, and Octokit has no trimming annotations. The trimmed binary had lost three things that reflection needs:The models' constructors and setters. Rooting only the
List<T>constructors still left this error:List<T>'s capacity constructor. SimpleJson makes each JSON array into aList<T>withMakeGenericTypeand findsList(int)by reflection. Nothing calls that constructor statically for Octokit's models, so the lookup returns null and invoking it throws. Rooting only the Octokit assembly still gave theNullReferenceExceptionfrom the issue, atDeserializeObject + 0x6f8.StringEnum<T>(string)for each enum the models reach.StringEnumis a struct, so native AOT compiles each instantiation separately and an open-type entry does not cover it. With 1 and 2 fixed, every issue list still failed:GithubScanner.GetClosedIssuesswallows that exception, sogenerateprinted empty notes.find-previouswas empty for the same reason:HasLatestReleaseswallows the exception from the first read.I kept Octokit for the reads and did not replace them with
HttpClientand source-generated JSON.GithubScanner,LabelerandGitHubItemare public, and their signatures take Octokit'sGitHubClientandIssue. Replacing them would change public API, which is more than a bug fix should do.What
release-notes.csprojroots the Octokit assembly (TrimmerRootAssembly), only for RID builds, alongside the existing AOT settings.OctokitClient.Createbuilds theGitHubClientthatReleaseNotesRunner.Runused to build inline. ItsDynamicDependencyattributes keepList<>'s constructors and the constructors of the fiveStringEnum<T>instantiations thatRelease,Issue,LabelandBranchreach through their properties:ItemState,ItemStateReason,LockReason,MergeableStateandTeamPrivacy. I found these by walking the property graph of Octokit 14.0.0 with reflection. Because they aretypeofs, the build breaks if Octokit removes one.TrimmerSingleWarn=false) are the same IL2067/IL2070/IL2075 reflection warnings plus one IL3050 forMakeGenericType. Those calls now have what they need for the models this tool reads../build.sh smokeaotpublishes the AOT binary for the current machine. It then runsfind-previous,current-version --query 1.11andgenerateagainstelastic/apm-agent-dotnet1.11.0, anonymously, and fails unless the known output comes back. It stops at the first failing command, so a broken binary spends few requests. A passing run spends about 15 of the 60 anonymous requests an hour.ci.yml'saot-packjob runs./build.sh smokeaot -safter the pack step, on each RID it builds. The job uses a bare-s, which Make.Fs 0.25 accepts.StringEnum<T>entry.Verify
Local, macOS arm64, .NET SDK 11.0.100:
Reproduced on
origin/mainwithdotnet publish -f net10.0 -r osx-arm64and no token.current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0threw the reported exception.find-previousprinted an empty line.generateprinted only the "View the full list" link.The smoke target fails without the fix and passes with it:
This matches the managed
net10.0build's output on the same commands.The AOT and managed builds agree on other data too.
generateagainstnullean/release-notes(with a token, for three label sets) produced byte-identical output from both builds.The binary that CI's own pack step builds (
dotnet pack -c Release -r osx-arm64), taken out of the nupkg, gives correctfind-previousandcurrent-versionoutput.mise run cipasses: build, pack, validate and the API diff (0 breaking changes, no diff) all pass, andcurb checkreports 0 changes.mise run check,actionlint(with shellcheck) andzizmor .githubreport no findings.Not verified:
apply-labelsandcreate-releasein the AOT build. Their Octokit reads (Labels.Get,Branch.Get) are covered by the same entries (LabelandBranchwere in the property walk), but I did not run them, because they write to GitHub.403rate-limit response is possible but unlikely.🤖 Generated with Claude Code