C# Mono Connector Newtonsoft.Json

2 posts / 0 new
Last post
GS
Offline
Last seen: 2 months 2 weeks ago
Joined: 03/31/2016
Posts: 23
C# Mono Connector Newtonsoft.Json

Hi,

I'm using the C# Mono Connector (https://github.com/rticommunity/rticonnextdds-connector/tree/csharp).
Its build type is .net framework 3.5 and packed in a way that the build definition is still .net framework 4 and it’s causing problems, since mono on Unity (Linux) supports .net framework 3.5 only.
I’ve passed this by replacing the standard  Newtonsoft.Json to Json.Net.Unity3D and everyhing works fine but not all the unit testing are passed, 2 tests failed (GetValidFullObjectSamples and SendAnonymousAndReceiveObjectSamples).

I'll apprecaite your input on this.

Regards,
GS

Sandra Rodriguez's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 11/24/2015
Posts: 17

Hi Gal,

We were debugging the failing tests and we know now the reason and how to fix them for this library.

For the GetValidFullObjectSample test, it seems that there is a limitation in the library that you are using and it fails to parse unsigned longs that have the most significant bit set to one. Therefore the maximum accepted number would be 0x7FFFFFFFFFFFFFFF as for a signed long. Changing the unsigned long value in the test to a valid value fixes the problem, but you have to keep that limitation in mind.

//Assert.AreEqual(0xBEEFBEEFBEEFBEEF, received.Ulong);
 Assert.AreEqual(0x7FFFFFFFFFFFFFFF, received.Ulong);

For the SendAnonymousAndReceiveObjectSample test, it seems that the library you are using returns a Dictionary, instead of a instance of the class, when we try to send an object from an anonymous class. If you access to the content of the received sample as a dictionary the test passes. You should access the information in this way if you send this kind of data.

/* Assert.AreEqual("test", received.color.Value);
Assert.AreEqual(3, received.x.Value);
Assert.AreEqual(true, received.hidden.Value);*/
Assert.AreEqual("test", received["color"].Value);
Assert.AreEqual(3, received["x"].Value);
Assert.AreEqual(true, received["hidden"].Value);

Hope this information helps. Please let us know if you have further questions.

Regards,

Sandra