Skip to content

Fix awaitable response type comparison in async pipelines#43

Merged
hasanxdev merged 2 commits intohasanxdev:mainfrom
wassim-k:fix/behavior-awaitable-mismatch
Oct 8, 2025
Merged

Fix awaitable response type comparison in async pipelines#43
hasanxdev merged 2 commits intohasanxdev:mainfrom
wassim-k:fix/behavior-awaitable-mismatch

Conversation

@wassim-k
Copy link
Contributor

@wassim-k wassim-k commented Oct 6, 2025

Hi @hasanxdev,

I noticed another minor issue where if a pipeline behavior handles Task response type, the registrator still tries to register it against a request handler with ValueTask response type and vice versa, causing an exception "parameter constraint violation"

I've also added an extra test for request handler with IAsyncEnumerable return type to achieve 100% code coverage.

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hasanxdev
Copy link
Owner

@wassim-k Thank you so much! It seems this issue exists. I’ll look into it and get back to this PR.

namespace DispatchR.TestCommon.Fixtures.SendRequest;

public class AsyncEnumerablePipelineBehavior<TRequest, TResponse>
: INonGenericInterface,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This interface was added here to achieve 100% code coverage when searching for a matching pipeline interface:

pipeline.GetInterfaces().First(inter =>
    inter.IsGenericType && // <=== This branch when `false`
    inter.GetGenericTypeDefinition() == behaviorType).GenericTypeArguments[1]

@hasanxdev
Copy link
Owner

@wassim-k Thank you for your great contributions to the development of this library.
Your changes have been merged ❤️

@hasanxdev hasanxdev merged commit d9c6ca6 into hasanxdev:main Oct 8, 2025
2 checks passed
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