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
[Bug]: IMessageBus Publish overload extension method not called #772
Comments
The message bus wasn't really meant for public consumption and I don't believe I'm using named messages internally. Are you using this somewhere? You should know it was marked for death since it does create a couple of hotspots internally that slow things down due to locking - namely beacons & http transfers. |
Yes I'm using it for a few messages, not extensively. Most times I'm sending some data with it and then it works fine. Now I wanted to use it without data, just as a notification, and ran into this issue. So I'm better of using Xamarin.Forms.MessagingCenter? |
No - I'll keep it if it is being used. It isn't a big chunk of code. You are definitely better off with the shiny message bus vs xf messaging center lol. The fix wasn't hard either - I just had to make sure nothing else was using those signatures. It will likely just be removed from being used in the internals of Shiny. |
That's exactly why I'm using IMessageBus instead of Xamarin.Forms.MessagingCenter ;-) Saw the fix, so I'll wait till the build is available and then use the renamed methods. Thanks for the quick fix! |
Component
Core (Settings, Startup)
What platform(s) are effected?
Steps To Reproduce
var listener = MessageBus.Listener("EventName").Subscribe(DoWork)
MessageBus.Publish("EventName")
The
DoWork
method will not be called when"EventName"
is published.Expected Behavior
When calling
MessageBus.Publish("EventName")
the Subscribe method should be called on Listeners with the same event name. This behavior only happens when the event names are equal and no other values are being passed.Actual Behavior
The
Publish(object message)
method on MessageBus is called directly without going through the extension methodPublish(this IMessageBus msgBus, string name)
. This is because methods with matching parameters on a class are executed before extension methods.Publish("EventName")
matchespublic void Publish(object message)
shiny/src/Shiny.Core/Infrastructure/MessageBus.cs
Lines 24 to 28 in 935eaec
shiny/src/Shiny.Core/IMessageBus.cs
Lines 21 to 22 in 935eaec
Exception or Log output
No exception
Code Sample
See https://dotnetfiddle.net/6knsV6 for an example of this behavior.
Code of Conduct
The text was updated successfully, but these errors were encountered: