Repository navigation
feat: Native AOT and trimming support, project logo, revised readmes - #23
Merged
Merged
Conversation
- 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.
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.
Summary
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
IsAotCompatibleinMyCSharp.HttpClientHintsandMyCSharp.HttpClientHints.AspNetCore. The trimming, AOT and single-file analyzers now run on every build, andTreatWarningsAsErrorsturns any finding into a build error. No library code had to change.tests/HttpClientHints.NativeAot.Smoke(new): a console app published withPublishAot. 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:Sec-CH-UA-MobileAccept-CHandAccept-CH-Lifetimeresponse headers ofUseHttpClientHints()in anApplicationBuilderpipelineGetClientHints()(including the per-request cache) andGetClientHintsView()onHttpContextandIHeaderDictionaryIHttpClientHintsFeatureregistered byUseHttpClientHintsFeature()native-aotinbuild-and-test.yml. It publishes and runs the smoke test fornet8.0,net9.0,net10.0andnet11.0onlinux-x64. The job runs for pull requests and for builds ofmain.Logo and readmes
res/httpclienthints-logo.png, in the style of the HttpUserAgentParser logo. The address bar showsSec-CH-UA-Platform, the magnifier shows the decoded value, and the fourth icon is a CPU forSec-CH-UA-Arch. It replaces the generic myCSharp.de logo as the NuGet package icon.README.mdtoreadme.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".Accept-CH, that browsers send them only over HTTPS, and which hints browsers send on every request.Version
version.json: 3.3 → 4.0.Verification
dotnet build -c Release: 0 warnings with the AOT analyzers enabled.dotnet test -c Releasewith coverage: 296 tests passed. Line and branch coverage of both packages are still 100%.win-x64with .NET 8, 9, 10 and 11: no trimming or AOT warnings, and all 16 checks of the native executable passed. Thelinux-x64publish runs in the new CI job of this PR.dotnet pack: both packages contain the new icon and their readme.