Skip to content

build(aot): enable PublishTrimmed and PublishAot - #439

Merged
dnyw4l3n13 merged 7 commits into
mainfrom
build/430-publish-trimmed-aot
Oct 28, 2026
Merged

dnyw4l3n13 merged 7 commits into
mainfrom
build/430-publish-trimmed-aot

Conversation

@prpixie

@prpixie prpixie commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enable PublishTrimmed and PublishAot for the BuildBot publish configuration so the published output can be trimmed and compiled ahead-of-time.

Closes #430

@prpixie prpixie added the auto-pr Pull request created automatically label Oct 28, 2026
@dnyw4l3n13 dnyw4l3n13 changed the title docs(changelog): placeholder for #430 PublishTrimmed/PublishAot build(aot): enable PublishTrimmed and PublishAot Oct 28, 2026
@dnyw4l3n13 dnyw4l3n13 added AI-Work Work for an AI Agent High High Priority labels Oct 28, 2026
Remove the Serilog.Enrichers.Demystifier package reference and its .Enrich.WithDemystifiedStackTraces() call in ServerStartup, ahead of publishing trimmed AOT builds.

Refs #430
…mage (#430)

Enable InvariantGlobalization in BuildBot.csproj and remove the en-US culture validation from ServerStartup.cs, which is no longer meaningful under invariant mode. Switch the Dockerfile to the plain runtime-deps 11.0 resolute chiseled image, as ICU is no longer required.
Enable PublishAot and PublishTrimmed in BuildBot.csproj and remove the -p:PublishAot=false override from src/publish so the publish script produces a trimmed native AOT build.
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: implemented #430 in separate commits (head 8d6d3a0): buildcheck binding-generator property fix, removed System.Reactive/System.Interactive.Async, removed Serilog.Enrichers.Demystifier, InvariantGlobalization + plain chiseled runtime-deps image, PublishAot/PublishTrimmed, and the changelog entry. Local build, buildcheck, 391 tests and a linux-x64 AOT publish are clean; CI runs next. Not verified: AOT binary at runtime, and the linux-arm64 AOT compile (needs clang/zlib on the runner). Pre-existing, left alone: build-check action finds *.sln so misses src/BuildBot.slnx; src/publish has duplicate -p:FFPublishing/SolutionDir and conflicting IsProduction; Dockerfile has a stale commented FROM; dependabot.yml still lists Serilog.Enrichers.Demystifier; local dotnet test fails on SDK rc.3 vs rc.2 pinned in global.json.

@credfeto

credfeto commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Roslyn analyzer findings

Source Rule Level File Line Suppressed Message
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.CloudFormation.cs 26 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.CloudFormation.cs 26 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet CA2000 error src/BuildBot/Helpers/ServerStartup.cs 116 yes Call System.IDisposable.Dispose on object created by 'CreateLogger()' before all references to it are out of scope
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.Test.cs 22 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGet(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.Test.cs 22 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGet(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 34 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.GitHub.cs 34 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 44 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.GitHub.cs 44 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 54 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.GitHub.cs 54 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.Watchtower.cs 19 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL3050 error src/BuildBot/Helpers/Endpoints.Watchtower.cs 19 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. This API may perform reflection on the supplied delegate and its parameters. These types may require generated code and aren't compatible with native AOT applications.
DotNet IL2026 error src/BuildBot/obj/Release/net11.0/Microsoft.AspNetCore.Http.RequestDelegateGenerator/Microsoft.AspNetCore.Http.RequestDelegateGenerator.RequestDelegateGenerator/GeneratedRouteBuilderExtensions.g.cs 1014 yes Using member 'Microsoft.AspNetCore.Http.HttpResponseJsonExtensions.WriteAsJsonAsync(HttpResponse, TValue, JsonSerializerOptions, CancellationToken)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
DotNet IL3050 error src/BuildBot/obj/Release/net11.0/Microsoft.AspNetCore.Http.RequestDelegateGenerator/Microsoft.AspNetCore.Http.RequestDelegateGenerator.RequestDelegateGenerator/GeneratedRouteBuilderExtensions.g.cs 1014 yes Using member 'Microsoft.AspNetCore.Http.HttpResponseJsonExtensions.WriteAsJsonAsync(HttpResponse, TValue, JsonSerializerOptions, CancellationToken)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and need runtime code generation. Use the overload that takes a JsonTypeInfo or JsonSerializerContext for native AOT applications.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Simplify clean - advancing to code review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Code review clean - advancing to security review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Security review clean, advancing to coverage check

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Coverage ratchet passed - advancing to Human Review. .NET Overall 100.0% (baseline 100.0%); all 7 instrumented projects at 100.0%. COVERAGE.md left unchanged because the measured numbers are identical to main.

@dnyw4l3n13
dnyw4l3n13 marked this pull request as ready for review October 28, 2026 07:07
@dnyw4l3n13
dnyw4l3n13 requested a review from a team as a code owner October 28, 2026 07:07
@dnyw4l3n13
dnyw4l3n13 enabled auto-merge October 28, 2026 07:07
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Finalize: PR marked ready and auto-merge enabled (all required checks passed or skipped).

@credfeto

Copy link
Copy Markdown
Member

Super-linter summary

Language Validation result
BASH Pass ✅
DOCKERFILE_HADOLINT Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@dnyw4l3n13
dnyw4l3n13 merged commit ffcd06e into main Oct 28, 2026
41 checks passed
@dnyw4l3n13
dnyw4l3n13 deleted the build/430-publish-trimmed-aot branch October 28, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Work Work for an AI Agent auto-pr Pull request created automatically High High Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(aot): enable PublishTrimmed and PublishAot now Discord.Net is gone

3 participants