Skip to content

Generate concrete behavior registrations - #391

Closed
viceroypenguin wants to merge 1 commit into
mainfrom
codex/fix-issue-#390-with-concrete-registrations
Closed

Generate concrete behavior registrations#391
viceroypenguin wants to merge 1 commit into
mainfrom
codex/fix-issue-#390-with-concrete-registrations

Conversation

@viceroypenguin

Copy link
Copy Markdown
Member

Motivation

  • Avoid emitting open-generic DI registrations for behaviors so runtime DI (and Native AOT) won't try to construct open-generic services for value-type responses.
  • Ensure the same closed generic behavior types used when generating handler pipelines are registered in the service-collection extension.

Description

  • Build concrete, per-handler behavior registrations by evaluating each handler's RequestType/ResponseType and applicable behaviors instead of emitting an open generic typeof(Behavior<,>) registration.
  • Centralize behavior type formatting with a new helper GetBehaviorTypeName and reuse it for both handler generation and service registrations.
  • Update the service-collection template ServiceCollectionExtensions.sbntxt to register typeof({{ b.type_name }}) (closed type) instead of an open generic.
  • Remove the unused RegistrationType model property and add a new unit test BehaviorsUseConcreteRegistrations in tests/Immediate.Handlers.Tests/GeneratorTests/AddHandlersTests.cs that asserts concrete registrations are emitted for explicit and implicit (ValueTuple) responses.

Testing

  • Ran dotnet test tests/Immediate.Handlers.Tests/Immediate.Handlers.Tests.csproj -f net10.0 --no-restore and observed 151 tests passed.
  • Ran the solution test run (dotnet test Immediate.Handlers.slnx) where the tests executed for .NET 10 and .NET 11 passed (combined run covered 356 tests for available runtimes), while the overall command reported unavailable runtimes for .NET 8/.NET 9 in the environment.
  • Ran git diff --check to verify no whitespace/merge issues were introduced.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd23b05f-019b-43c8-80ed-bda758071583

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@viceroypenguin
viceroypenguin deleted the codex/fix-issue-#390-with-concrete-registrations branch August 7, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant