Bump JasperFx 1.28.2 to fix List<T> duplicate-field codegen (closes #3702)#4314
Merged
jeremydmiller merged 1 commit intomasterfrom Apr 29, 2026
Merged
Bump JasperFx 1.28.2 to fix List<T> duplicate-field codegen (closes #3702)#4314jeremydmiller merged 1 commit intomasterfrom
jeremydmiller merged 1 commit intomasterfrom
Conversation
…#3702) JasperFx 1.28.2 includes a fix to CodeFormatter.Write that emits safe C# for any enum value — including bit-OR'd combinations on non-[Flags] enums like Npgsql.NpgsqlDbType. Previously a member declared as [DuplicateField(DbType = NpgsqlDbType.Array | NpgsqlDbType.Text, PgType = "text[]", IndexMethod = IndexMethod.gin)] public List<string> ListOfStrings { get; set; } would generate uncompilable source like parameter0.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.-2147483629; because Enum.ToString returns the integer literal as a string for undefined enum values. The JasperFx fix emits a checked cast for those values: `((NpgsqlDbType)(-2147483629))`. The reproduction test from elexisvenator's #3702 is preserved here verbatim; the JasperFx-side fix lets it pass with no Marten code change. Closes #3702. Co-Authored-By: Ben Edwards <elexisvenator@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 30, 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.
Summary
CodeFormatter.Writefix (Emit safe C# for enum constants in CodeFormatter.Write jasperfx#197) that emits safe C# for any enum value — including bit-OR'd combinations on non-[Flags]enums likeNpgsql.NpgsqlDbType.List<T>column generates invalid code. #3702 verbatim. With the upstream fix it passes unchanged.Why this supersedes #3702
A document with
caused Marten codegen to emit:
— an
Enum.ToString()of an undefined enum value yielding an integer literal. Roslyn rejected it (CS1001 Identifier expected).#3702 patched two call sites in
UpsertArgument.cs. The root cause was actually in JasperFx'sCodeFormatter.Write, which usedvalue.GetType().FullNameInCode() + "." + value(implicitToString()) for every enum. Fixing it there handles every other call-site too — past and future.The 1.28.2 fix:
Type.Name(unchanged)[Flags]combo ⇒Type.A | Type.B((Type)(rawIntegerLiteral))Closes #3702. Anne — er, Ben Edwards (@elexisvenator) — kept as co-author on the reproduction test.
Test plan
dotnet test src/DocumentDbTests --filter Bug_PR_3702 -f net9.0passes locally🤖 Generated with Claude Code