Skip to content

Fix F# record projection casing in GroupJoin/SelectMany#4196

Merged
jeremydmiller merged 1 commit intomasterfrom
fix/4182-fsharp-option-linq
Mar 23, 2026
Merged

Fix F# record projection casing in GroupJoin/SelectMany#4196
jeremydmiller merged 1 commit intomasterfrom
fix/4182-fsharp-option-linq

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

  • Fixes F# Record Projections in GroupJoin/SelectMany Fail Due to Constructor Parameter Casing Mismatch #4182 - F# record projections in GroupJoin/SelectMany fail with STJ due to constructor parameter casing mismatch
  • F# records have camelCase constructor parameters (userId, firstName) but PascalCase properties (UserId, FirstName). Marten's SelectParser and JoinSelectParser used constructor param names for jsonb_build_object keys, producing JSON like {"userId": ...} that STJ's F# record converter can't deserialize (expects {"UserId": ...})
  • Added SelectParser.ResolveFieldName() that prefers NewExpression.Members when available (C# anonymous types), then falls back to matching properties by position for F# records
  • Applied the fix to both SelectParser.VisitNew() and JoinSelectParser.VisitNew()

Test plan

  • Added Bug_4182_fsharp_record_projection_casing with both STJ and Newtonsoft tests
  • Full LinqTests suite: 1245 passed, 1 skipped, 1 flaky failure (unrelated BulkLoader connection issue that passes in isolation)
  • CI should validate full test matrix

🤖 Generated with Claude Code

F# records have camelCase constructor parameters but PascalCase properties.
SelectParser and JoinSelectParser used constructor parameter names for
jsonb_build_object keys, causing STJ deserialization to fail for F# records.

Now prefers NewExpression.Members when available, then falls back to matching
properties by position for types like F# records where param/property names
differ only in casing.

Co-Authored-By: Claude Opus 4.6 (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.

F# Record Projections in GroupJoin/SelectMany Fail Due to Constructor Parameter Casing Mismatch

1 participant