You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
Hi, I found an issue that if you have for example this wrapper:
EventBus cannot find any event except EventBase.
But if you declare the method as below, everything works as should:
I spent a few hours to find a root cause. Maybe it saves time for others.
The text was updated successfully, but these errors were encountered: