Skip to content

feat: Native AOT and trimming support, project logo, revised readmes - #23

Merged
BenjaminAbt merged 3 commits into
mainfrom
feat/native-aot-logo-readme
Nov 24, 2026
Merged

BenjaminAbt merged 3 commits into
mainfrom
feat/native-aot-logo-readme

Conversation

@BenjaminAbt

Copy link
Copy Markdown
Member

Summary

HttpClientHints logo

This PR marks both packages as compatible with Native AOT and trimming and verifies this in CI with a Native AOT smoke test on .NET 8, 9, 10 and 11. It also adds a project logo and revises the readmes in the same way as mycsharp/HttpUserAgentParser#104. The version goes from 3.3 to 4.0.

No public API changes. Existing applications do not need to change anything.

Changes

Native AOT and trimming

  • IsAotCompatible in MyCSharp.HttpClientHints and MyCSharp.HttpClientHints.AspNetCore. The trimming, AOT and single-file analyzers now run on every build, and TreatWarningsAsErrors turns any finding into a build error. No library code had to change.
  • tests/HttpClientHints.NativeAot.Smoke (new): a console app published with PublishAot. It roots both library assemblies, so the trimmer and the AOT compiler analyze all of their code, not only the code the app reaches. ILC runs with --warnaserror, so any trimming or AOT warning fails the publish. At runtime it checks:
    • decoding of quoted header values and of Sec-CH-UA-Mobile
    • the Accept-CH and Accept-CH-Lifetime response headers of UseHttpClientHints() in an ApplicationBuilder pipeline
    • GetClientHints() (including the per-request cache) and GetClientHintsView() on HttpContext and IHeaderDictionary
    • IHttpClientHintsFeature registered by UseHttpClientHintsFeature()
  • CI: new job native-aot in build-and-test.yml. It publishes and runs the smoke test for net8.0, net9.0, net10.0 and net11.0 on linux-x64. The job runs for pull requests and for builds of main.

Logo and readmes

  • Logo res/httpclienthints-logo.png, in the style of the HttpUserAgentParser logo. The address bar shows Sec-CH-UA-Platform, the magnifier shows the decoded value, and the fourth icon is a CPU for Sec-CH-UA-Arch. It replaces the generic myCSharp.de logo as the NuGet package icon.
  • readme: renamed README.md to readme.md, like the package readmes. New header with logo and badges (build, coverage, NuGet, Native AOT, trimming, strong-named, SourceLink). The NuGet table has columns for version, downloads and install command. New section "Native AOT and trimming".
  • Package links go to nubrowse.com instead of nuget.org.
  • Client Hints introduction: it said that hints are sent "after the first response from the client". Now it says that the server requests them with Accept-CH, that browsers send them only over HTTPS, and which hints browsers send on every request.
  • Package readmes (shown on NuGet): install, quick start and links to the main readme. The ASP.NET Core readme had the title of the core package; this is fixed.
  • Version history references such as "Since 3.2" are removed. The readmes describe the current behavior only.

Version

version.json: 3.3 → 4.0.

Verification

  • dotnet build -c Release: 0 warnings with the AOT analyzers enabled.
  • dotnet test -c Release with coverage: 296 tests passed. Line and branch coverage of both packages are still 100%.
  • Native AOT publish of the smoke test for win-x64 with .NET 8, 9, 10 and 11: no trimming or AOT warnings, and all 16 checks of the native executable passed. The linux-x64 publish runs in the new CI job of this PR.
  • dotnet pack: both packages contain the new icon and their readme.

- Add res/httpclienthints-logo.png in the style of the HttpUserAgentParser logo
  and use it as the NuGet package icon.
- Rename README.md to readme.md like the package readmes.
- Add a centered header with logo and badges, and a NuGet table with version,
  downloads and install command.
- Link packages to nubrowse.com instead of nuget.org.
- Correct the Client Hints introduction: the server requests hints with Accept-CH,
  and browsers send them only over HTTPS.
- Expand the package readmes with install and quick start, and fix the title of
  the ASP.NET Core package readme.
- Remove version history references from the readmes.
- Set IsAotCompatible in both packages, so the trimming, AOT and single-file
  analyzers check them on every build.
- Add tests/HttpClientHints.NativeAot.Smoke. It roots both library assemblies,
  is published with Native AOT and checks decoding, the Accept-CH middleware,
  the HttpContext and header extensions and IHttpClientHintsFeature at runtime.
- Publish and run the smoke test with .NET 8, 9, 10 and 11 on linux-x64 in
  every CI build of main and of pull requests.
- Document Native AOT and trimming support in the readmes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant