Skip to content

Removing All Runtime Compilation From Marten. (Boom)#4461

Merged
jeremydmiller merged 4 commits into
masterfrom
fix/4454-phase-5-boom
May 18, 2026
Merged

Removing All Runtime Compilation From Marten. (Boom)#4461
jeremydmiller merged 4 commits into
masterfrom
fix/4454-phase-5-boom

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Phase 5 of #4454 — the final cleanup. Removes the JasperFx.RuntimeCompiler PackageReference from src/Marten/Marten.csproj and retires the last consumers. Closes #4454.

Every Roslyn-emitted surface that Phases 1–4 ported now has its replacement in mainline; this PR is the package-removal cap on that work.

Per-surface replacement table

Surface Pre-9.0 Marten 9.0
IDocumentStorage<T, TId> Roslyn-emitted subclass per document × StorageStyle Closed-shape hand-written hierarchy + reflection-built IIdentification<,> (PR #4438)
IEventStorage write path Roslyn-emitted GeneratedEventDocumentStorage Hand-written Rich/Quick/QuickWithServerTimestampsEventStorage<TId> + ClosedShapeEventDocumentStorage adapter (#4458)
IEventStorage read path Roslyn-emitted ApplyReaderDataToEvent IEventTableColumn.ReadValueSync/Async runtime delegates (#4458)
Compiled queries Roslyn-emit at first use + dotnet run -- codegen write Marten.SourceGenerator (compile-time) + FastExpressionCompiler-built reflective fallback (#4455 / #4456 / #4457)
AddMartenStore<T>() Roslyn-emitted empty class TImpl : DocumentStore, T System.Reflection.Emit proxy in SecondaryStoreProxyFactory (#4459)
JasperFx.RuntimeCompiler PackageReference required deleted

What goes in this PR

  • JasperFx.RuntimeCompiler PackageReference deleted from Marten.csproj.
  • The four files that still imported the namespace get the using line dropped: MartenServiceCollectionExtensions, DocumentStore.CompiledQueryCollection, plus Bug_4185 and working_with_initial_data in the test tree. One stray Microsoft.CodeAnalysis.VisualBasic IDE auto-import in EventsTable goes too.
  • services.AddSingleton<IAssemblyGenerator, AssemblyGenerator>() removed from AddMarten() — no consumer asks for IAssemblyGenerator anymore.
  • src/Marten/Internal/CodeGeneration/StaticOnlyCodeFileLoader.cs deleted — Phase 4 simplified its last caller (ProviderGraph IEvent branch) and removed all other consumers.
  • Bug_4185.codegen_write_should_not_produce_duplicate_secondary_store_implementations test deleted — it asserts behavior of a dotnet run -- codegen write workflow that no longer exists. The other test in the file (the runtime injection scenario that was the original bug report) stays and still passes.

Docs

  • docs/configuration/prebuilding.md deleted plus its nav entry — the "Pre-Building Generated Types" page documented the codegen-write workflow.
  • docs/migration-guide.md 9.0 AOT/codegen section rewritten into a new "Runtime code generation removed" section with the per-surface table above, and the dependency table flips JasperFx.RuntimeCompiler to retired. Also unbreaks two historical V5/V4 entries that linked to /configuration/prebuilding.
  • docs/configuration/optimized_artifact_workflow.md — drops the dynamic-codegen cold-start warning; the production environment behavior is driven entirely by ResourceAutoCreate now.
  • docs/configuration/cli.md Codegen subsection — replaced with a warning explaining that Marten 9.0 contributes no codegen artifacts and existing Internal/Generated/ folders can be deleted.
  • docs/documents/querying/compiled-queries.md — "runtime-codegen fallback" replaced with "reflection + FastExpressionCompiler fallback" everywhere.
  • src/Marten.SourceGenerator/README.md — final shipping behavior rewritten to describe the post-Phase-1E state. Marten.SourceGenerator NuGet shape replaces the ProjectReference + OutputItemType="Analyzer" example.

What stays (intentionally)

  • StoreOptions.GeneratedCodeMode, ApplicationAssembly, SourceCodeWritingEnabled, GeneratedCodeOutputPath, AllowRuntimeCodeGeneration, and opts.Events.UseClosedShapeStorage remain on the API surface as [Obsolete] no-ops so existing application bootstrapping compiles unchanged.
  • ICodeFileCollection / ICodeFile implementations on DocumentStore, StoreOptions, and EventGraph are vestigial but harmless. Cheap follow-up to remove once we've confirmed no third-party Critter-Stack tool walks them.

Test plan

  • Build clean (0 errors) across net9.0 + net10.0 on the full slnx
  • CoreTests — 443 pass, 1 pre-existing flake (use_npgsql_data_source_with_keyed_registration races on the shared schema when run alongside another test project; passes in isolation), 1 pre-existing skip
  • LinqTests compiled-query + Bug_4043 filter — 75/75 pass (covers source-gen + reflection fallback)
  • EventSourcingTests smoke (appending_events_workflow_specs, Bugs.Bug*) — 148/148 pass
  • markdownlint clean over changed docs/**/*.md
  • cspell clean over changed docs/**/*.md
  • Full CI matrix

Closes #4454.

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits May 17, 2026 22:19
Drops the `JasperFx.RuntimeCompiler` PackageReference from `src/Marten/Marten.csproj`
and retires the last consumers — closing out #4454.

What goes:

- `using JasperFx.RuntimeCompiler;` lines from `MartenServiceCollectionExtensions`,
  `DocumentStore.CompiledQueryCollection`, plus stray imports in two test files
  (`Bug_4185`, `working_with_initial_data`) and one accidental
  `Microsoft.CodeAnalysis.VisualBasic` IDE auto-import in `EventsTable`.
- `services.AddSingleton<IAssemblyGenerator, AssemblyGenerator>()` from
  `AddMarten()` — no consumer asks for `IAssemblyGenerator` anymore now that
  the secondary-store proxy uses `System.Reflection.Emit` (Phase 3) and the
  document/event/compiled-query paths build hand-written or source-generated
  artifacts.
- `src/Marten/Internal/CodeGeneration/StaticOnlyCodeFileLoader.cs` — the
  static-vs-runtime codegen dispatcher had no callers after Phase 4
  simplified ProviderGraph's IEvent branch.
- `Bug_4185_codegen_conflict_projection_with_secondary_store_dependency`'s
  `codegen_write_should_not_produce_duplicate_secondary_store_implementations`
  test — asserts behavior of a `dotnet run -- codegen write` pipeline that no
  longer exists. The remaining runtime test on the same file pins the
  inline-projection-with-secondary-store-dependency scenario it was originally
  filed against.
- `docs/configuration/prebuilding.md` and its nav entry — the
  "Pre-Building Generated Types" page documented the codegen-write workflow.
  No equivalent in Marten 9.0; closest analog is the compiled-query source
  generator covered on `docs/documents/querying/compiled-queries.md`.

What gets rewritten:

- `docs/migration-guide.md` 9.0 section: the per-surface replacement table for
  document storage, event storage, compiled queries, and secondary stores —
  what replaced each Roslyn-emit path. `JasperFx.RuntimeCompiler` row in the
  dependency table flips to "retired". The `AllowRuntimeCodeGeneration` /
  `UseClosedShapeStorage` flag sub-sections get factored into the new
  "Runtime code generation removed" section since both flags are now no-ops.
- `docs/configuration/optimized_artifact_workflow.md` — drops the dynamic-codegen
  cold-start warning; `CritterStackDefaults.Production.GeneratedCodeMode = TypeLoadMode.Static`
  is now a no-op preserved for source-compatibility, and the environment
  workflow is driven entirely by `ResourceAutoCreate`.
- `docs/configuration/cli.md` Codegen subsection — the `codegen` subcommands
  still exist in the shared JasperFx CLI for other Critter Stack tools but
  have nothing Marten to write or compare against.
- `docs/documents/querying/compiled-queries.md` — "runtime-codegen fallback"
  replaced with "reflection + FastExpressionCompiler fallback"; no Roslyn at
  any point now.
- `src/Marten.SourceGenerator/README.md` — final shipping behavior section
  rewritten to describe the post-Phase-1E state instead of the iteration-3/4
  PoC bridge. `Marten.SourceGenerator` NuGet shape replaces the
  `ProjectReference + OutputItemType="Analyzer"` example.

The `StoreOptions.GeneratedCodeMode`, `ApplicationAssembly`, `SourceCodeWritingEnabled`,
`GeneratedCodeOutputPath`, `AllowRuntimeCodeGeneration`, and
`opts.Events.UseClosedShapeStorage` knobs stay on the API surface as `[Obsolete]`
no-ops so existing application bootstrapping compiles unchanged. The
`ICodeFileCollection` / `ICodeFile` implementations on `DocumentStore`,
`StoreOptions`, and `EventGraph` stay too — they're vestigial but harmless,
and a follow-up cleanup is cheap once we're sure no third-party tool walks
them.

Closes #4454.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per the issue plan ("test-code-gen is worth a re-evaluation; either retire
the suite or convert to a source-gen round-trip"): the suite invokes
`dotnet run -- codegen delete/write/test/write` against CommandLineRunner.
Marten 9.0 contributes nothing to that pipeline now — StoreOptions /
EventGraph / DocumentStore.BuildFiles all return empty, the SecondaryStore
proxy is built via Reflection.Emit, and the compiled-query path is
source-gen-or-FEC.

- Drop the Nuke `TestCodeGen` target and its `.DependsOn(...)` wire-up in
  the parent `Test` orchestrator.
- Remove `test-code-gen` from the two main CI workflow lanes
  (pg15-jsonnet, pgLatest-systemtextjson).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller and others added 2 commits May 18, 2026 06:03
The test passes locally 3-for-3 but flakes in CI's Event Sourcing lane:
the Polly retry pipeline inside ForceAllMartenDaemonActivityToCatchUpAsync
cancels a socket I/O before the daemon catch-up completes, surfacing an
OperationCanceledException in the returned exceptions list. Tracking the
real fix in #4462; skip in the meantime so Phase 5 of #4454 can land.

Failure: https://github.com/JasperFx/marten/actions/runs/26028953643/job/76509571044?pr=4461

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Several tests in this class (use_npgsql_data_source,
use_npgsql_data_source_with_keyed_registration,
use_npgsql_multi_host_data_source, ...) spin up their own DocumentStore
against the default `public` schema with the Target document mapping +
AutoCreate.All, then run a query. When sibling test classes in CoreTests
also touch `public.mt_doc_target` from a parallel test runner, the
concurrent DDL races: one drops the PK constraint while another tries to
re-add it, surfacing as

    MartenSchemaException: DDL Execution for 'All Configured Changes' Failed!
    alter table public.mt_doc_target drop constraint pkey_mt_doc_target_ CASCADE;
    alter table public.mt_doc_target add CONSTRAINT pkey_mt_doc_target_id PRIMARY KEY (id);

Putting the whole class in the existing OneOffs collection (the
serialization fixture other public-schema-mutating tests already share)
keeps the schema migrations sequential and removes the race.

Failure: https://github.com/JasperFx/marten/actions/runs/26029552764/job/76513565330?pr=4461

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 3ca630a into master May 18, 2026
5 of 6 checks passed
@jeremydmiller jeremydmiller deleted the fix/4454-phase-5-boom branch May 18, 2026 11:38
jeremydmiller added a commit that referenced this pull request May 18, 2026
… a daemon error (#4463)

ForceAllMartenDaemonActivityToCatchUpAsync's contract is "catch all
exceptions and return them as a list so callers can assert against them."
Pre-fix, an OperationCanceledException raised by the user-supplied
CancellationToken (test CTS firing mid-catch-up) flowed through the
catch-all block and landed in the returned list, then surfaced as a fake
"exceptions should be empty but had 1 item" assertion failure in tests
that wrap the call in a Shouldly assertion. The real signal here is
caller-initiated cancellation, not a daemon error.

Tighten both the primary-store and per-T variants to re-throw an OCE
when `cancellation.IsCancellationRequested` is true — caller's CT
cancellations propagate as a normal cancellation signal (or
TaskCanceledException on the test side, which fails the test with a
clear "timed out" message rather than a misleading assertion).
Non-cancellation exceptions and OCEs from sources other than the
caller's CT still flow into the returned list as before.

The Bug_4441 test that caught this in #4461's CI run gets the skip
removed, plus headroom — outer Fact timeout 30s→60s, CT 15s→45s — so
slow CI runners working through the custom-outbox lifecycle path
(CreateBatch → BeforeCommit → AfterCommit per shard, on top of the
per-shard catch-up loop) don't pre-cancel.

Closes #4462.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 18, 2026
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>
jeremydmiller added a commit that referenced this pull request May 19, 2026
JasperFx.RuntimeCompiler ships on the 5.x line (continuation of the
4.x lineage: 4.0-alpha → 4.x → 5.0.0-alpha.1 → 5.0.0-alpha.2). The
2.0.0-alpha.x versions exist on NuGet as a separate stale series.
The JasperFx repo's src/JasperFx.RuntimeCompiler/JasperFx.RuntimeCompiler.csproj
source-of-truth confirms <Version>5.0.0-alpha.2</Version>.

Marten ships green against the stale 2.0.0-alpha.2 pin only because
Marten 9 removed all runtime compilation in PR #4461 ("Boom"), so no
runtime path actually exercises the package — but the pin is still
incorrect and should match the consumer-side reality.

Surfaced while drafting the Wolverine foundation re-pin chip (which
also bumps to 5.0.0-alpha.2). Aligns the Critter Stack 2026 wave on
the same JasperFx.RuntimeCompiler version line.

dotnet restore src/Marten.slnx verified clean against the new pin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 19, 2026
…4495)

Pre-9.0 audit gap: monolithic services.AddMarten(opts => { ... }) is
well-tested, but the multi-assembly modular case — projection types
declared in satellite assemblies (each carrying [assembly: JasperFxAssembly]),
each contributing its own IConfigureMarten that references its local
projections, composed into a main host via DI — was never explicitly
validated against the post-#276 (SG-only dispatch) + post-#4461
(zero-runtime-codegen) contracts. This PR is the regression gate.

Adds three new top-level test projects (deliberately isolated from
CoreTests / DaemonTests / EventSourcingTests):

- src/ModularConfigTests.SatelliteA/
    Order aggregate (Guid Id), OrderPlaced / OrderShipped events,
    partial OrderProjection : SingleStreamProjection<Order, Guid>,
    OrdersConfig : IConfigureMarten. [assembly: JasperFxAssembly].
    JasperFx.Events.SourceGenerator wired as analyzer-only
    PackageReference so [GeneratedEvolver] emits at compile time.

- src/ModularConfigTests.SatelliteB/
    Daily aggregate (string Id), DailyOpened / DailyClosed events,
    partial DailyProjection : MultiStreamProjection<Daily, string>
    with date-keyed identity, ReportingConfig : IAsyncConfigureMarten.
    Same JasperFxAssembly + SG analyzer wiring as SatelliteA.

- src/ModularConfigTests/
    SmokeTest: end-to-end host composition exercising both
    satellites' projections through inline dispatch. Pins:
      1. OrderingTests — registration-order = invocation-order;
         last-registered IConfigureMarten wins on scalar setter.
      2. LastWinsTests — duplicate event-type registration is
         idempotent; last-registered scalar setter wins.
      3. AddMartenTimingTests — IConfigureMarten registered AFTER
         services.AddMarten still applies (order-independent).
      4. AsyncComposeTests — IConfigureMarten + IAsyncConfigureMarten
         compose; both contributions land on final StoreOptions.

Critical finding surfaced during the work: a bare
services.AddSingleton<IAsyncConfigureMarten, T>() registration adds
the implementation to DI but never invokes its Configure() method.
The hosted service that drains async configs
(AsyncConfigureMartenApplication) is only registered by
services.ConfigureMartenWithServices<T>(). The chip's smoke-test
snippet used the bare AddSingleton; the fixture uses the
correct extension and the docs page calls the asymmetry out
explicitly. Filed upstream as a UX gap for follow-up.

Wired:
- src/Marten.slnx registers the three new projects under /Testing/.
- build/build.cs gains a TestModularConfig Nuke target, added to
  the Test aggregate's .DependsOn(...) chain after TestEventSourcing.
- All four main CI workflows
  (pg15-jsonnet[-eventsourcing], pgLatest-systemtextjson[-eventsourcing])
  get a test-modular-config step adjacent to the existing
  test-event-sourcing / test-document-db steps.
- docs/configuration/composite-configuration.md documents the pattern,
  the four locked-in design contracts, the
  [assembly: JasperFxAssembly] marker rationale, the SG-analyzer
  satellite requirement, and the IConfigureMarten vs
  IAsyncConfigureMarten registration asymmetry. Page added to the
  VitePress sidebar.
- .nuke/build.schema.json regenerated to include the new target
  (also drops the stale TestCodeGen entry that was orphaned from
  build.cs — auto-regenerated cleanup).

Verified: smoke + 4 pin tests pass 5/5 on both net9.0 and net10.0.
./build.sh test-modular-config succeeds.

Closes #4472.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 19, 2026
Companion to the 8.0-line fix in #4496. The bug — NullReferenceException
when combining .UseOptimisticConcurrency(true) with
AllDocumentsAreMultiTenantedWithPartitioning(...) — doesn't reproduce
on master because the offending code path
(Marten/Storage/UpsertFunction.cs) was retired in #4461's closed-shape
storage rewrite. The cherry-pick of the 8.0 patch therefore omits
the UpsertFunction.cs edit (file no longer exists) and lands only
the regression test.

Test exercises the exact configuration shape from the reporter's
repro: .UseOptimisticConcurrency(true) on a document plus
AllDocumentsAreMultiTenantedWithPartitioning with two list
partitions, then applies the schema and round-trips a document
through one of the partitions. Acts as a regression-prevention
guard against any future change that re-introduces a similar
null-traversal in the partition-aware DDL generation.

Passes on net9.0 / net10.0.

Closes #4493.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 19, 2026
PR #4461 removed the JasperFx.RuntimeCompiler PackageReference and
retired the major codegen surfaces. This is the long-tail cleanup of
the leftover `using JasperFx.CodeGeneration` imports, the now-orphaned
`GenerateCode(...)` interface methods + override bodies, the vestigial
ICodeFileCollection plumbing, the [Obsolete] StoreOptions
codegen-config properties, and the dead MartenSnapshot fingerprint
feature that existed to invalidate codegen artifacts that no longer
exist.

What changed (112 files, +60 / -3387):

- 8 stale `using JasperFx.CodeGeneration` imports dropped (no actual
  type usage post-#4461).
- 3 dead interface methods removed: `IIdGeneration.GenerateCode`,
  `ISelectableColumn.GenerateCode`, plus the
  `UpsertArgument.GenerateCodeTo*` / `GenerateBulkWriterCodeAsync`
  virtuals (+ `MetadataColumn.setMemberFromReader`). Cascade-deleted
  the override bodies across 8 identity strategies, 9 upsert-argument
  derivatives, 13 metadata columns, plus DataColumn / IdColumn /
  Events/Schema/VersionColumn. Each type itself is preserved as a
  data carrier / config marker.
- 5 whole-file deletions: `Internal/CodeGeneration/MartenSnapshot.cs`,
  `MartenSnapshotInputs.cs`, `FrameCollectionExtensions.cs`,
  `StoreOptions.GeneratesCode.cs`, `Events/EventGraph.GeneratesCode.cs`.
  Removed the `MartenSnapshot.VerifyAtBoot` / `PersistFingerprint`
  calls from `DocumentStore.cs` and the two CoreTests covering them.
- ICodeFileCollection / ICodeFile implementations dropped from
  `DocumentStore`, `EventGraph`, and `StoreOptions` (carried implicitly
  through deleting the GeneratesCode partials). Removed 2
  `services.AddSingleton<ICodeFileCollection>(...)` DI registrations
  from `MartenServiceCollectionExtensions.cs`.
- StoreOptions scrubbed: `GeneratedCodeMode`, `SourceCodeWritingEnabled`,
  `GeneratedCodeOutputPath`, `AllowRuntimeCodeGeneration`,
  `SetApplicationProject`, `CreateGenerationRules`, `BuildFiles`,
  `_generatedCodeMode`, `PreferJasperFxMessage`. Test-side cleanup
  deleted dozens of `opts.GeneratedCodeMode = TypeLoadMode.X` lines.
  `ApplicationAssembly` kept — `AutoRegister` and
  `TryUseSourceGeneratedDiscovery` legitimately need it as a scan
  hint.
- `Directory.Packages.props` orphan `JasperFx.RuntimeCompiler`
  PackageVersion line removed. Comments referencing RuntimeCompiler
  scrubbed in `SecondaryStoreProxyFactory.cs`,
  `CompiledQueryHandlerRegistry.cs`,
  `DocumentStore.CompiledQueryCollection.cs`,
  `Internal/ProviderGraph.cs`.

Verification:
- `src/Marten/` is now free of `JasperFx.CodeGeneration` imports —
  `grep -rn "JasperFx\.CodeGeneration" src/Marten/` returns empty.
- Full solution builds clean (0 errors).
- CoreTests 411/412 (1 pre-existing skip), DocumentDbTests 987/988
  (1 pre-existing skip), LinqTests 1257/1258 (1 pre-existing skip).

Doc updates and follow-up issues for the recovered Docker content
(now relevant to Wolverine / JasperFx rather than Marten) ship in
follow-up commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 19, 2026
* Eliminate all remaining JasperFx.CodeGeneration usages from Marten

PR #4461 removed the JasperFx.RuntimeCompiler PackageReference and
retired the major codegen surfaces. This is the long-tail cleanup of
the leftover `using JasperFx.CodeGeneration` imports, the now-orphaned
`GenerateCode(...)` interface methods + override bodies, the vestigial
ICodeFileCollection plumbing, the [Obsolete] StoreOptions
codegen-config properties, and the dead MartenSnapshot fingerprint
feature that existed to invalidate codegen artifacts that no longer
exist.

What changed (112 files, +60 / -3387):

- 8 stale `using JasperFx.CodeGeneration` imports dropped (no actual
  type usage post-#4461).
- 3 dead interface methods removed: `IIdGeneration.GenerateCode`,
  `ISelectableColumn.GenerateCode`, plus the
  `UpsertArgument.GenerateCodeTo*` / `GenerateBulkWriterCodeAsync`
  virtuals (+ `MetadataColumn.setMemberFromReader`). Cascade-deleted
  the override bodies across 8 identity strategies, 9 upsert-argument
  derivatives, 13 metadata columns, plus DataColumn / IdColumn /
  Events/Schema/VersionColumn. Each type itself is preserved as a
  data carrier / config marker.
- 5 whole-file deletions: `Internal/CodeGeneration/MartenSnapshot.cs`,
  `MartenSnapshotInputs.cs`, `FrameCollectionExtensions.cs`,
  `StoreOptions.GeneratesCode.cs`, `Events/EventGraph.GeneratesCode.cs`.
  Removed the `MartenSnapshot.VerifyAtBoot` / `PersistFingerprint`
  calls from `DocumentStore.cs` and the two CoreTests covering them.
- ICodeFileCollection / ICodeFile implementations dropped from
  `DocumentStore`, `EventGraph`, and `StoreOptions` (carried implicitly
  through deleting the GeneratesCode partials). Removed 2
  `services.AddSingleton<ICodeFileCollection>(...)` DI registrations
  from `MartenServiceCollectionExtensions.cs`.
- StoreOptions scrubbed: `GeneratedCodeMode`, `SourceCodeWritingEnabled`,
  `GeneratedCodeOutputPath`, `AllowRuntimeCodeGeneration`,
  `SetApplicationProject`, `CreateGenerationRules`, `BuildFiles`,
  `_generatedCodeMode`, `PreferJasperFxMessage`. Test-side cleanup
  deleted dozens of `opts.GeneratedCodeMode = TypeLoadMode.X` lines.
  `ApplicationAssembly` kept — `AutoRegister` and
  `TryUseSourceGeneratedDiscovery` legitimately need it as a scan
  hint.
- `Directory.Packages.props` orphan `JasperFx.RuntimeCompiler`
  PackageVersion line removed. Comments referencing RuntimeCompiler
  scrubbed in `SecondaryStoreProxyFactory.cs`,
  `CompiledQueryHandlerRegistry.cs`,
  `DocumentStore.CompiledQueryCollection.cs`,
  `Internal/ProviderGraph.cs`.

Verification:
- `src/Marten/` is now free of `JasperFx.CodeGeneration` imports —
  `grep -rn "JasperFx\.CodeGeneration" src/Marten/` returns empty.
- Full solution builds clean (0 errors).
- CoreTests 411/412 (1 pre-existing skip), DocumentDbTests 987/988
  (1 pre-existing skip), LinqTests 1257/1258 (1 pre-existing skip).

Doc updates and follow-up issues for the recovered Docker content
(now relevant to Wolverine / JasperFx rather than Marten) ship in
follow-up commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Docs: codegen removal in Marten 9.0 + recover Docker content for sibling repos

The companion to the code cleanup. Codegen-removal-related doc pages
are slimmed to a brief "removed in 9.0, delete your Internal/Generated
folder, codegen write no longer needed for Marten" note; the rest of
the touched files are snippet refreshes from `mdsnippets` propagating
the source-side scrubs.

- docs/devops/devops.md — the application-Dockerfile section dropped
  the `RUN dotnet run -- codegen write` step + added a Marten-9.0 tip
  pointing at the new reality. The recovered Docker content (the
  pre-9.0 multi-stage Dockerfile that ran codegen-write in the build
  stage) is captured in the follow-up issues filed against the
  Wolverine and JasperFx repos for re-publication in their docs.
- docs/configuration/cli.md — the Codegen warning block reframed:
  the `codegen` family is still exposed by the shared JasperFx CLI
  (for tools like Wolverine that ship their own codegen), but
  `dotnet run -- codegen write` is no longer necessary for Marten.
- docs/configuration/aot-publishing.md — corrected the "kept as
  [Obsolete] no-ops" claim to "deleted entirely" for the codegen-
  config properties.
- docs/configuration/optimized_artifact_workflow.md — same correction;
  the `GeneratedCodeMode` line was dropped from the sample
  bootstrapping. Snippet wrappers replaced with inline code blocks
  since the two snippets (`sample_simplest_possible_setup`,
  `sample_using_optimized_artifact_workflow`) no longer have a source
  region.
- docs/migration-guide.md — the Runtime code generation removed
  section says the codegen-config knobs are deleted (not [Obsolete]);
  the Obsolete API sweep section drops the `GeneratedCodeMode`
  guidance.
- docs/schema/index.md — pulled the stale warning about
  `opts.GeneratedCodeMode = TypeLoadMode.Auto` requiring a manual
  `Internal/` delete; not applicable post-9.0.
- All other docs/**.md changes are `mdsnippets` refreshes propagated
  from the source-side scrubs in the previous commit (Startup.cs
  samples, hostbuilder snippets, ValueType / EventSourcing samples,
  etc.).

Verified: `mdsnippets` clean, `markdownlint --disable MD009` clean
across changed files, `cspell --config ./docs/cSpell.json` clean,
`vitepress build docs` exits 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix ModularConfigTests after rebase: drop opts.GeneratedCodeMode

Master merged #4495 (ModularConfigTests) after I branched, so the
agent pass didn't see this fixture's `opts.GeneratedCodeMode =
TypeLoadMode.Auto;` line. Build failed on CI for both NET10 + NET9
matrix legs. Removing the now-deleted property reference + the
matching `using JasperFx.CodeGeneration` import.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eliminate runtime code generation across Marten (compiled queries, event store default, ancillary stores, RuntimeCompiler removal)

1 participant