Merged
Conversation
b3e309d to
103de10
Compare
There was a problem hiding this comment.
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
GenericTypeHelperclass with constraint validation logic using CLR'sMakeGenericTypefor 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.
src/Mediator.DependencyInjection/Generic/Handlers/GenericNotificationHandler.cs
Outdated
Show resolved
Hide resolved
src/Mediator.DependencyInjection/Generic/Handlers/GenericRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/Mediator.DependencyInjection/Generic/Handlers/GenericRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/Mediator.DependencyInjection/Generic/Handlers/GenericStreamRequestHandler.cs
Outdated
Show resolved
Hide resolved
tests/Mediator.DependencyInjection.Tests/Generics/ConstraintValidationTest.cs
Show resolved
Hide resolved
tests/Mediator.DependencyInjection.Tests/Generics/ConstraintValidationTest.cs
Show resolved
Hide resolved
tests/Mediator.DependencyInjection.Tests/Generics/ConstraintValidationTest.cs
Show resolved
Hide resolved
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.
No description provided.