I'm pretty sure it's a bug of a C# client but probably I'm missing out on something. Anyway
I'm sending an SFSObject containing some numeric values (long to be exact) from Java side to my C# client.
On the client side I want to get these values but I can't because I'm always getting this exception
InvalidCastException: Specified cast is not valid.
Sfs2X.Entities.Data.SFSObject.GetValue[T] (System.String key) (at <290a162672eb4fae90f7a112700c4182>:0)
Sfs2X.Entities.Data.SFSObject.GetLong (System.String key) (at <290a162672eb4fae90f7a112700c4182>:0)
Here's the values of the object at breakpoint.
http://prntscr.com/l0hdmj
If you look at screenshot you'll see it knows that the number is long but what it does later is wrong because it tries to cast a string value to long in a generic method like this:
Code: Select all
private T GetValue<T>(string key)
{
if (!this.dataHolder.ContainsKey(key))
return default (T);
return (T) this.dataHolder[key].Data;
}
Which, of course cannot be performed in C#. I wanted to use a standad approch and use Convert.ToInt64 on a string value, but I can't get the string value neither necause it know the value is numeric.
For now, the only solution I see is to send these values as strings from the java backend and convert them from strings on a client