Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No messages received with wrapped method #14

Open
fryette opened this issue Aug 24, 2019 · 2 comments
Open

No messages received with wrapped method #14

fryette opened this issue Aug 24, 2019 · 2 comments

Comments

@fryette
Copy link

fryette commented Aug 24, 2019

Hi, I found an issue that if you have for example this wrapper:

private static readonly IEventBus EventBus;

public static void Publish(EventBase message)
{
      EventBus.Publish(message);
}

// in another class

EventBusWrapper.Publish(new Payload(payload))

EventBus cannot find any event except EventBase.

But if you declare the method as below, everything works as should:

public static void Publish<T>(T message) where T : EventBase
{
      EventBus.Publish(message);
}

I spent a few hours to find a root cause. Maybe it saves time for others.

@alessandrofrancesconi
Copy link

Got the same problem! Thanks

frostieDE added a commit to frostieDE/RedBus that referenced this issue May 5, 2020
@frostieDE
Copy link

As RedBus determines the type of the event at compile-time, the event must be casted to the desired type at compile-time which might not be possible in any project (it might fit for your project, but for mine it does not work without refactoring the whole project 😄)

I proposed a PR which determines the type of the event at runtime.

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

No branches or pull requests

3 participants