Skip to content

Mixed enviroment with plugins who use MediatR #372

Description

@phomberger

First I would like to thank you for your work. Blazor-State is working like a charm and makes state management super easy.
Now we have created a blazor application and integrated Blazor-State. This application is also using some custom created plugins from our company which are using MediatR for communication.
As an example it´s using a command like this:
public record UpdateSubProjectListCommand(IEnumerable<SubProjectDto> SubProjects) : IRequest;

and a handler:

 public class UpdateSubProjectListCommandHandler(IInboxRegistrationDao dao, IMapper mapper) : IRequestHandler<UpdateSubProjectListCommand>
 {
     public async Task Handle(UpdateSubProjectListCommand request, CancellationToken cancellationToken)
     {
         ...
     }
 }

Handler is called and communication with the own plugin is working. But I get a bunch of errors like this:
Exception thrown: 'System.TypeLoadException' in System.Private.CoreLib.dll ("GenericArguments[0],
'InboxRegistration.Commands.UpdateSubProjectListCommand',
on 'BlazorState.Pipeline.State.CloneStateBehavior2[TRequest,TResponse]' violates the constraint of type parameter 'TRequest'.") Exception thrown: 'System.TypeLoadException' in System.Private.CoreLib.dll ("GenericArguments[0], 'InboxRegistration.Commands.UpdateSubProjectListCommand', on 'BlazorState.Pipeline.State.CloneStateBehavior2[TRequest,TResponse]'
violates the constraint of type parameter 'TRequest'.")

Then I tried to deactivate the UseCloneStateBehavior to false, but still exceptions are thrown.
Can you please give me an advice what I can do? How can I prevent the Blazor-State clone behaviour for the other MediatR Handler which don´t implement the IAction interface?

Thanks and regards,
Peter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions