Fix strong-typed saga ID causing CS0246 code generation error#2481
Merged
jeremydmiller merged 2 commits intomainfrom Apr 9, 2026
Merged
Fix strong-typed saga ID causing CS0246 code generation error#2481jeremydmiller merged 2 commits intomainfrom
jeremydmiller merged 2 commits intomainfrom
Conversation
Replace culture-sensitive ToLower() with ToLowerInvariant() in all SQL identifier normalization paths. In Turkish locale, 'I'.ToLower() produces dotless 'ı' instead of 'i', corrupting SQL names such as queue/table identifiers used in envelope storage. Affects SqlServerTransport, PostgresqlTransport, MySqlTransport, SqliteTransport, and SagaTableDefinition. Adds a regression test that verifies SanitizeIdentifier behaves correctly under tr-TR culture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`PullSagaIdFromEnvelopeFrame` used `NameInCode()` (bare type name) when emitting `TryParse` calls for non-Guid saga ID types. For strong-typed identifiers in a custom namespace this produced unresolvable type references (CS0103/CS0246) in the generated handler code. Changed to `FullNameInCode()` so the fully qualified type name is always emitted, matching the approach already used in `PullSagaIdFromMessageFrame` for its strong-typed-ID path. Added a regression test (`Bug_2465_strong_typed_id_saga_codegen`) that uses a `record struct StrongSagaId(Guid)` with a `TryParse` method and verifies that the host starts (code generation succeeds) and that messages routed through the envelope path are handled correctly. Also added a "Strong-Typed Identifiers" documentation section in sagas.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 11, 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
Fixes #2465 — using a saga with a strong-typed ID type (e.g. a
record structwrappingGuid) causedCS0103/CS0246compilation errors in the generated handler code.PullSagaIdFromEnvelopeFramecalledNameInCode()(bare type name, e.g.MessageId) instead ofFullNameInCode()(fully qualified, e.g.My.App.MessageId) when emittingTryParsecalls for non-Guidsaga ID types. When the generated code ran in a context that didn't import the saga ID's namespace the type couldn't be resolved.PullSagaIdFromEnvelopeFrame.GenerateCode—NameInCode()→FullNameInCode(), consistent with howPullSagaIdFromMessageFrame.generateStrongTypedIdCodealready handles this.Changes
src/Wolverine/Persistence/Sagas/PullSagaIdFromEnvelopeFrame.cs— the fixsrc/Testing/CoreTests/Bugs/Bug_2465_strong_typed_id_saga_codegen.cs— regression test with arecord struct StrongSagaId(Guid)saga; covers host startup (code gen) and the envelope-path message routingdocs/guide/durability/sagas.md— new "Strong-Typed Identifiers" section documenting theTryParserequirement and usage patternTest plan
Bug_2465_strong_typed_id_saga_codegen.host_starts_successfully_with_strong_typed_saga_id— host startup with strong-typed saga ID succeeds (code gen OK)Bug_2465_strong_typed_id_saga_codegen.can_start_saga_with_strong_typed_id— saga is created and persisted correctlyBug_2465_strong_typed_id_saga_codegen.handle_message_via_envelope_saga_id_path— message with no saga ID field is routed viaPullSagaIdFromEnvelopeFrame(the fixed code path)🤖 Generated with Claude Code