Skip to content

fix(sourcegen): dedupe overridden required members in evolver constru…#429

Merged
jeremydmiller merged 1 commit into
JasperFx:mainfrom
Blackclaws:fix/issue-428
Jun 9, 2026
Merged

fix(sourcegen): dedupe overridden required members in evolver constru…#429
jeremydmiller merged 1 commit into
JasperFx:mainfrom
Blackclaws:fix/issue-428

Conversation

@Blackclaws

Copy link
Copy Markdown
Contributor

BuildAggregateConstructorExpression walked the inheritance chain and collected every required member by name with no dedup, so an override required (or new-shadowed required) property was added once for the base declaration and once for the derived override. The emitted object initializer then read
new T { Prop = default!, Prop = default! }, failing to compile with CS1912 (duplicate member initialization) and breaking the whole consuming assembly's build.

Dedupe by name with a HashSet; the walk runs most-derived -> base so the first sighting wins.

Closes #428

…ction

BuildAggregateConstructorExpression walked the inheritance chain and
collected every required member by name with no dedup, so an
`override required` (or `new`-shadowed required) property was added once
for the base declaration and once for the derived override. The emitted
object initializer then read
`new T { Prop = default!, Prop = default! }`, failing to compile with
CS1912 (duplicate member initialization) and breaking the whole consuming
assembly's build.

Dedupe by name with a HashSet; the walk runs most-derived -> base so the
first sighting wins.

Closes JasperFx#428

Co-Authored-By: Claude <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 2a1ee19 into JasperFx:main Jun 9, 2026
1 check passed
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.

Source generator emits duplicate required-member initializer (CS1912) for overridden virtual required property

2 participants