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

Error when sending System.Decimal (NotImplementedException) #329

Open
esso23 opened this issue Dec 21, 2020 · 3 comments
Open

Error when sending System.Decimal (NotImplementedException) #329

esso23 opened this issue Dec 21, 2020 · 3 comments

Comments

@esso23
Copy link

esso23 commented Dec 21, 2020

Error:

WampSharp.WebSockets.ControlledBinaryWebSocketConnection`1[Newtonsoft.Json.Linq.JToken]|An error occurred while attempting to send a message to remote peer.|EXCEPTION OCCURRED:System.NotImplementedException The method or operation is not implemented. Void WriteValue(System.Decimal)

Callee looks like this:

    public interface ICallee
    {
        [WampProcedure("get_something")]
        Task<IEnumerable<SomeClassDto>> GetSomething();
    }

Class:

public class SomeClassDto
{
//...
    public decimal? WgsX { get; set; }
    public decimal? WgsY { get; set; }
//...
}

Using WampSharp.Websockets as transport & WampSharp.NewtonsoftCbor for serialization on client,

@darkl
Copy link
Member

darkl commented Dec 21, 2020

This is a bug for this library which seems not to be maintained, but maybe they accept pull requests.

Elad

@esso23
Copy link
Author

esso23 commented Dec 21, 2020

Wouldn't it be better to use a well maintained implementation like this? https://github.com/peteroupc/CBOR Seems to be much more active and maintained and is definitely not an alpha release like the library mentioned.

@darkl
Copy link
Member

darkl commented Dec 21, 2020

It's not that simple. WampSharp needs the serialization library to support partial deserialization (or "deserialization by parts"), see my comments for this issue. That's one obstacle.
The second obstacle is that if we use something that is not Newtonsoft.Json based, we'll have to implement a mechanism that serializes our objects from/to JToken and the dynamic object in the other serialization library (as the router treats it as JToken or the other dynamic object type). See for example this attempt here. I think this implementation will be very buggy. The last reason which is the main reason that WampSharp uses Newtonsoft.Json based serialization for MessagePack serialization, is that it is the easiest way to make the serialization libraries behaviors consistent with each other. For instance, one serialization library might decide that its default is to write null values, while the other might decide that the default is not to write them. Another example is that some serialization libraries might respect some attributes, while others don't.
That being said, serialization formats are pluggable using IWampBinding and you can implement a different one. But I might not want to support it myself due to the problems it might cause.

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

2 participants