© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
TYoemtais.z

❔ Weird issue with MediaR pipeline.

I have such a typical pipeline UnhandledExceptionBehaviour, which executes before executing command.

And it's works fine, for example for this kind of request:
    [HttpPost("addnewguest")]
    public async Task<ActionResult<string>> AddNewGuest(CreateGuestCommand command)
    {
        return await Mediator.Send(command);
    }
    [HttpPost("addnewguest")]
    public async Task<ActionResult<string>> AddNewGuest(CreateGuestCommand command)
    {
        return await Mediator.Send(command);
    }


But when there is no content, this pipeline is omitted. For example:
   [HttpPost("mergeguests")]
    public async Task<ActionResult> MergeGuests(MergeGuestsCommand command)
    {
        await Mediator.Send(command);

        return NoContent();
    }
   [HttpPost("mergeguests")]
    public async Task<ActionResult> MergeGuests(MergeGuestsCommand command)
    {
        await Mediator.Send(command);

        return NoContent();
    }


It is the request:
public record MergeGuestsCommand : IRequest
public record MergeGuestsCommand : IRequest


There used to be a
public record MergeGuestsCommand : IRequest<Unit>
public record MergeGuestsCommand : IRequest<Unit>
,
but I read to remove <Unit> in the new version of MediaR and it caused the code to no longer work as it used to.

Why?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Weird issue with authentication flow
C#CC# / help
9mo ago
✅ Redis | Weird Issue
C#CC# / help
14mo ago
Creating pipeline with selenium specflow
C#CC# / help
2y ago
❔ LINQ expressions with "pipeline" pattern
C#CC# / help
3y ago