Giter VIP home page Giter VIP logo

Comments (4)

galvesribeiro avatar galvesribeiro commented on May 24, 2024

can you check if that still happen on the latest package?

from signalr.

Apollo3zehn avatar Apollo3zehn commented on May 24, 2024

It does not happen anymore for Enums (good thing!), but still for unsigned numbers. I think I found the reason, see here: https://github.com/aspnet/Extensions/issues/1701

I`ll close this issue, since it is out of the scope of this repository. Hopefully it will be fixed in the next preview :)

from signalr.

Apollo3zehn avatar Apollo3zehn commented on May 24, 2024

Ok I got a littble bit confused with MessagePack and JSON because I tried both.

For MessagePack, both, enum and uint, do not work. I guess it is because MessagePack serializes the enum in an unexpected way. The JSON string passed to the On<T1, T2, ...>() method in the HubConnection class looks like the following (content of variable payloads[0]):

MessagePack:
{"Id":1,"StringData":"Demo Data","UIntData":1,"EnumData":"Mode1"}:

vs.

JSON:
{"Id":1,"StringData":"Demo Data","UIntData":1,"EnumData":"1"}

So, with MessagePack, the EnumData property is a string instead of a number.

With JSON-only transport, enum is working but uint not. The reason seems to be in the SimpleJson serializer as written above.

I also tried with the brand new JsonSerializer in System.Text.Json.Serialization (JsonSerializer.Parse<DemoData>(jsonString);. This serialize is able to handle uint correctly, but I think it is only available in netcore3.0 apps.

In summary, I think the uint issue is not your concern, but mabye the enum issue. This is caused by combining underlying MessagePack serialization with Json.Deserialize<T>(), since both handle enums differently.

from signalr.

galvesribeiro avatar galvesribeiro commented on May 24, 2024

Please check the test project now. I've added a sample of an enum : uint that enumerate your case so it must work for you. No changes were made to the packages. Only the sample.

I'm closing the issue but feel free to ping back in case you fall in troubles.

Thanks!

from signalr.

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.