Coder Social home page Coder Social logo

InvalidCastExceptions about easy.messagehub HOT 4 CLOSED

nimaara avatar nimaara commented on July 23, 2024
InvalidCastExceptions

from easy.messagehub.

Comments (4)

NimaAra avatar NimaAra commented on July 23, 2024

Thanks for pointing this out, this should never happen and if it does then it is indeed a problem.

The exception handling in PublishImpl is there to ensure that a thrown exception by a subscriber's handler does not mess up all the other handlers and it is not there to filter the subscribers.

Let me write some tests to try to reproduce this.

from easy.messagehub.

tebling avatar tebling commented on July 23, 2024

Thanks! I've fixed it locally by making this change in the Subscribe method, testing that msg is of type TMsg before doing the explicit cast:

                _subscriptions.Add(new Subscription(
                    token,
                    new Handler<TMsgBase>(msg => { if (msg is TMsg) handler.Handle((TMsg)msg); } )));

from easy.messagehub.

NimaAra avatar NimaAra commented on July 23, 2024

Yes you can use that as a temp fix however it is still throwing some errors. In the UsageExample tests if you subscribe to the OnError you will see the errors.

Actually you raising this issue has prompted me to re-visit some of the decisions I had made, I have now modified and improved the API slightly and also improved the way I subscribe and publish to both fix your issue as well as improving the throughput.

I am testing it at the moment and will be pushing it shortly.

from easy.messagehub.

tebling avatar tebling commented on July 23, 2024

Verified. Thanks for the quick turnaround!

from easy.messagehub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.