Marten#4349: AOT publishing guide#4469
Merged
Merged
Conversation
New page at docs/configuration/aot-publishing.md walks through publishing a Marten-backed .NET app with PublishAot=true. Models after JasperFx's docs/codegen/aot.md (219 lines), adapted to the Marten 9 surface — main adaptation is the one-phase model (Marten 9 retired runtime code generation in #4461, so there's no `dotnet run -- codegen write` step the JasperFx guide builds around). Sections: - What AOT publishing buys you + when it's the right choice - Prerequisites (.NET 9/10, Marten 9.0+, STJ serializer, optional Marten.SourceGenerator) - How Marten 9 differs from the broader Critter Stack two-phase model - Project setup walkthrough (csproj, AddMarten with STJ, [JasperFxAssembly] marker, publish command) - What works / annotated / doesn't work — including the ~15 cascading IL warnings from Marten.Internal.ClosedShape.* construction sites that PR #4468's audit surfaced - The Newtonsoft.Json escape hatch — concrete migration from UseNewtonsoftForSerialization to UseSystemTextJsonForSerialization - Verifying your app is AOT-clean (publish output scan + reference to Marten.AotSmoke) - Troubleshooting common failure modes (missing GeneratedEvolver, IL3050 on custom projection base, LINQ in AOT, Reflection.Emit secondary-store boot failure, publish performance) - Performance — cites the Marten.SourceGenerator README's compiled- query benchmark, defers end-to-end AOT cold-start benchmarks to CritterStackScalability - Cross-references — JasperFx guide, Marten.SourceGenerator README, migration guide anchor Sidebar entry added under "Configuration" between "Optimized Development Workflow" and "Multi-Tenancy with Database per Tenant". markdownlint + cspell clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Ticks the "AOT publishing guide specific to Marten" checkbox on #4349 (Marten 9.0 master plan). New page at
docs/configuration/aot-publishing.md(259 lines, within the chip's 200-350 target).Models after JasperFx's
docs/codegen/aot.md(219 lines), adapted to Marten's surface. Main adaptation: the one-phase model — Marten 9 retired runtime code generation entirely in PR #4461, so there's nodotnet run -- codegen writestep the JasperFx guide builds around. The Marten guide calls out the difference explicitly with a side-by-side mermaid diagram.Sections
Marten.SourceGeneratorfor compiled queriesInternal/Generated/folder, whyservices.AddRuntimeCompilation()doesn't exist anymoreAddMartenwith STJ,[JasperFxAssembly]marker, publish commandIL2026/IL3050warnings fromMarten.Internal.ClosedShape.*construction sites that PR Marten#4349: Add Marten.AotSmoke + extension package IsAotCompatible audit #4468's audit surfaced; AOT-publishing apps will see these until the per-document-type source-generator extension lands (tracked on [Master] Marten 9.0 #4349)UseNewtonsoftForSerializationtoUseSystemTextJsonForSerializationplus the gotchas (property casing, polymorphic types, DateTime formatting)src/Marten.AotSmokeas the canonical clean consumer[GeneratedEvolver],IL3050on custom projection base, LINQ in AOT,Reflection.Emitsecondary-store boot, slow publish)Marten.SourceGeneratorREADME's compiled-query benchmark (~25× cold, ~31% steady-state); defers end-to-end AOT cold-start benchmarks to CritterStackScalabilityMarten.SourceGeneratorREADME, migration-guide anchor, MSFT trim-warning catalog, MSFT Native AOT docsSidebar
Added under "Configuration" between "Optimized Development Workflow" and "Multi-Tenancy with Database per Tenant" (
docs/.vitepress/config.mts:144).Test plan
markdownlintclean on the new filemarkdownlintclean across alldocs/**/*.mdcspellclean on the new filesrc/Marten/DocumentStore.cs:84line reference, PR numbers (Removing All Runtime Compilation From Marten. (Boom) #4461 / [#4454 Phase 3] Port ancillary stores off the codegen subclass path #4459 / Marten#4349: Add Marten.AotSmoke + extension package IsAotCompatible audit #4468), repo pathsReferences: #4349 (master plan — not "Closes", this just ticks one box).
🤖 Generated with Claude Code