Scrub all remaining JasperFx.CodeGeneration usages from Marten#4498
Merged
Conversation
This was referenced 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) <[email protected]>
…ing 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) <[email protected]>
5572713 to
baab62f
Compare
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) <[email protected]>
baab62f to
a70c874
Compare
This was referenced May 19, 2026
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.
The follow-up to #4461 ("Removing All Runtime Compilation From Marten"). That PR retired the
JasperFx.RuntimeCompilerPackageReferenceand the major emission pipelines, but called out a remaining cleanup:This PR is that follow-up, plus the long-tail of stale
using JasperFx.CodeGenerationimports, the now-orphanedGenerateCode(...)interface methods + override bodies, the[Obsolete]StoreOptionscodegen-config properties #4461 left as no-ops, and the deadMartenSnapshotfingerprint feature that existed only to invalidate codegen artifacts that no longer exist.Summary
Code changes (commit 1): 113 files, +60 / −3387 = ~3,300 LOC net deleted.
using JasperFx.CodeGenerationimports dropped — files had no actual type usage post-Removing All Runtime Compilation From Marten. (Boom) #4461.IIdGeneration.GenerateCode,ISelectableColumn.GenerateCode, plusUpsertArgument.GenerateCodeTo*/GenerateBulkWriterCodeAsyncvirtuals (andMetadataColumn.setMemberFromReader). Cascade-deleted the override bodies across 8 identity strategies, 9 upsert-argument derivatives, 13 metadata columns, plusDataColumn/IdColumn/Events/Schema/VersionColumn. The types themselves are preserved as data carriers / config markers.Internal/CodeGeneration/MartenSnapshot.cs,MartenSnapshotInputs.cs,FrameCollectionExtensions.cs,StoreOptions.GeneratesCode.cs,Events/EventGraph.GeneratesCode.cs. RemovedMartenSnapshot.VerifyAtBoot/PersistFingerprintcalls fromDocumentStore.csand the two CoreTests covering them.ICodeFileCollection/ICodeFileimplementations dropped fromDocumentStore,EventGraph, andStoreOptions(carried implicitly through deleting the GeneratesCode partials). Removed 2services.AddSingleton<ICodeFileCollection>(...)DI registrations fromMartenServiceCollectionExtensions.cs.StoreOptionsscrubbed:GeneratedCodeMode,SourceCodeWritingEnabled,GeneratedCodeOutputPath,AllowRuntimeCodeGeneration,SetApplicationProject,CreateGenerationRules,BuildFiles,_generatedCodeMode,PreferJasperFxMessage. Test-side cleanup deleted dozens ofopts.GeneratedCodeMode = TypeLoadMode.Xlines and several test files (e.g.CoreTests/Examples/CodeGenerationOptions.cs).ApplicationAssemblykept —AutoRegisterandTryUseSourceGeneratedDiscoverylegitimately need it as a scan hint.Directory.Packages.propsorphanJasperFx.RuntimeCompilerPackageVersionremoved. Comments referencing RuntimeCompiler scrubbed inSecondaryStoreProxyFactory.cs,CompiledQueryHandlerRegistry.cs,DocumentStore.CompiledQueryCollection.cs,Internal/ProviderGraph.cs.src/Marten/is now free ofJasperFx.CodeGenerationimports —grep -rn \"JasperFx\\.CodeGeneration\" src/Marten/returns empty.Doc changes (commit 2): 28 files, +108 / −148.
docs/migration-guide.mdupdated to say the codegen-config knobs are deleted (not[Obsolete]).docs/configuration/cli.mdCodegen warning reframed:dotnet run -- codegen writeis no longer necessary for Marten; thecodegenfamily stays exposed by the shared JasperFx CLI for tools like Wolverine that ship their own codegen.docs/configuration/aot-publishing.mdanddocs/configuration/optimized_artifact_workflow.mdcorrected the "kept as[Obsolete]no-ops" claim to "deleted entirely."docs/devops/devops.mdApplication-Dockerfile section dropped theRUN dotnet run -- codegen writestep plus a Marten 9.0 tip. The recovered Docker content (the pre-9.0 multi-stage Dockerfile pattern) is captured in follow-up issues filed against Wolverine and JasperFx for re-publication in their docs.docs/schema/index.mdlost the staleopts.GeneratedCodeMode = TypeLoadMode.Autowarning.docs/**.mdchanges aremdsnippetsrefreshes propagating the source-side scrubs from commit 1 (Startup.cs samples, hostbuilder snippets, ValueType / EventSourcing samples, etc.).Test plan
CoreTests(net9.0): 411 pass, 1 skip, 0 fail.DocumentDbTests(net9.0): 987 pass, 1 skip, 0 fail.LinqTests(net9.0): 1257 pass, 1 skip, 0 fail.mdsnippetsclean.markdownlint --disable MD009clean across changed docs.cspell --config ./docs/cSpell.jsonclean.vitepress build docsexits 0.Out of scope / follow-ups filed elsewhere
codegen writecontent for Wolverine + JasperFx: filed as follow-up issues in those repos (see PR description trail).Marten.AotSmoke,CompiledQueryTests,Marten.SourceGenerator.Tests) still referenceJasperFx.RuntimeCompilerin code-comments only — left alone for a later AOT-publishing pass.MetadataColumn.GenerateCodevirtual on the base class is gone, but a couple ofMetadataColumn<T>subclasses (HeadersColumn, etc.) retaininternalEventTableColumn-style codegen overloads they were never asked about in the inventory — out of scope here.🤖 Generated with Claude Code