Dedup DCB LoadBoundaryFrame per aggregate type on a chain (supersedes #2970)#2977
Merged
Conversation
Two [BoundaryModel] parameters of the same type on one chain (e.g. Validate plus Handle) used to each add a LoadBoundaryFrame, emitting duplicate "var eventBoundaryOf<TAggregate> = ..." declarations and failing codegen with CS0128. Modify() now reuses an existing frame for the same aggregate type. Regression test added in MartenTests/Dcb.
The DCB LoadBoundaryFrame dedup change surfaced an IL2062 trim error at BoundaryModelAttribute.cs:51 (`aggregateType.Closes(typeof(IEventBoundary<>))`) because Wolverine.Polecat is `<IsAotCompatible>` and treats trim warnings as errors — failing the `build` and Polecat `test` CI jobs. Add the same trim/AOT suppressions the sibling Wolverine.Marten BoundaryModelAttribute.Modify already carries for the identical reflection pattern (Closes + MakeGenericType + GetProperty). These run at Dynamic-codegen time; AOT consumers pre-generate via TypeLoadMode.Static. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 1, 2026
Merged
This was referenced Jun 4, 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.
Supersedes #2970 — same dedup fix, plus the trim-analysis fix the CI build needed. Original work and authorship by @mysticmind (commits retained as-authored); this branch only adds the AOT/trim suppression on top.
Original change (from #2970, @mysticmind)
Two
[BoundaryModel]parameters of the same type on one chain (e.g.ValidateplusHandle) each added aLoadBoundaryFrame, emitting duplicatevar eventBoundaryOf<TAggregate> = ...declarations and failing codegen with CS0128.Modify()now reuses an existing frame for the same aggregate type. Regression test added inMartenTests/Dcb.CI fix added here
#2970's
buildand Polecattestjobs failed with:Wolverine.Polecatis<IsAotCompatible>and treats trim warnings as errors. TheaggregateType.Closes(typeof(IEventBoundary<>))call (and the adjacentMakeGenericType/GetProperty) trip IL2062/IL2065/IL3050 under trim analysis. The siblingWolverine.Marten/BoundaryModelAttribute.Modifyalready carries exactly these three suppressions for the identical reflection pattern; this adds the same to the Polecat attribute. The calls run at Dynamic-codegen time — AOT consumers pre-generate viaTypeLoadMode.Static.Verification
dotnet build src/Persistence/Wolverine.Polecat— clean on net9.0 and net10.0 (was the IL2062 failure).dotnet build wolverine.slnx -c Release— 0 warnings, 0 errors (matches the failingbuildjob).Close #2970 in favor of this once merged.