Skip to content

Conversation

@GerardSmit
Copy link
Contributor

No description provided.

@GerardSmit GerardSmit changed the title BugFix: Constraint test fix: generic constraint test Dec 17, 2025
@GerardSmit GerardSmit requested a review from Copilot December 17, 2025 13:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix generic constraint validation in the Mediator library and add support for .NET 10.0. The main changes include implementing proper generic constraint checking to ensure handlers with unsatisfied constraints are correctly skipped, optimizing handler lookup through caching, and updating target frameworks and package versions to support .NET 10.0.

Key changes:

  • Adds GenericTypeHelper class with constraint validation logic using CLR's MakeGenericType for reliable constraint checking
  • Implements caching of matching registrations to avoid repeated enumeration
  • Updates all project files to target .NET 10.0 and updates package dependencies
  • Adds comprehensive test coverage for various generic constraint scenarios

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/Mediator.DependencyInjection/Generic/Handlers/GenericTypeHelper.cs New helper class for validating generic constraints and caching registrations
src/Mediator.DependencyInjection/Generic/Handlers/GenericNotificationHandler.cs Adds constraint validation and caching to notification handler lookup
src/Mediator.DependencyInjection/Generic/Handlers/GenericRequestHandler.cs Adds constraint validation and caching to request handler lookup
src/Mediator.DependencyInjection/Generic/Handlers/GenericStreamRequestHandler.cs Adds constraint validation and caching to stream request handler lookup
src/Mediator.DependencyInjection/Generic/MediatorBuilder.NotificationHandler.cs Fixes registration logic to check handler type instead of notification type
tests/Mediator.DependencyInjection.Tests/Generics/ConstraintValidationTest.cs Comprehensive test suite for generic constraint validation across all handler types
tests/Mediator.DependencyInjection.Tests/Generics/NotificationGenericTest.cs Additional tests for generic notification handler registration
tests/Mediator.DependencyInjection.Tests/Generics/RequestGenericTest.cs Test for handler not found exception with generic type mismatch
Multiple .csproj files Updates target frameworks to include net10.0
Multiple package references Updates package versions for .NET 10.0 compatibility
Workflow files Adds .NET 10.0 SDK to CI/CD pipelines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GerardSmit GerardSmit merged commit 722fc79 into main Dec 17, 2025
8 checks passed
@GerardSmit GerardSmit deleted the fix/constraint-test branch December 17, 2025 13:48
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.

2 participants