-
Notifications
You must be signed in to change notification settings - Fork 305
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
Fable 4.0.6 breaks reflection for single-case unions #3418
Comments
@OnurGumus Is it possible to check if both ends are using Fable 4.0.6? (I'm not saying they should, just clarifying for context). @alfonsogarciacaro Possibly somehow related to #3412 (or not, see also issue #3419). |
The other side is a giraffe server. So no Fable there. When I say it uses Fable 4.0.6, I refer to the dotnet tool. And I verified server response is correct. The interesting bit is the data I was receving is int64 and they are coming 0 instead of real value. Reverting 4.0.5 from dotnet tool fixes the problem. |
@OnurGumus The I don't suppose you can provide a snippet or sample of the server's response json? |
Then it must be the JSON deserialization, if you can provide a snippet of what that |
In my case it looks like below {"VisitorId":{"VisitorId":"tb4q8ARZSVCrFucPXchi"},"Credit":{"Credit":"+782"},"Version":{"Version":"+85"}} |
@OnurGumus the issue might be in Fable.SimpleJson which handles the deserialization business on the client side of things, used by Fable.Remoting.Client. |
Perhaps, but the fact is ,it works well with all fable but 4.06 |
@OnurGumus Is Standard Giraffe JSON serialization looks a bit different for {"text":"0x400000000000000","int64":288230376151711744} |
Before we had a toJson method in Long.js prototype (which is called if present by JSON.stringify). Fable/src/fable-library/lib/long.js Line 59 in e45b25a
Should we add it to BigInt prototype? I think it's not recommended to modify the prototype of native objects, but here it's proposed as solution. |
@alfonsogarciacaro That's already there. We just need to understand what component is used to deserialize and does it need to be updated to a new version. As described above, presumably 4.0.5 works, so it's not the bigint, it's something introduced in 4.0.6. |
I have reconfirmed, it works with 4.0.5 and gets broken with 4.0.6. It uses Fable.SimpleJson on the client to deserialize. It actually seems initial deserialization is correct. Then goes back to elmish async and I lose track. See the screenshot Though at this point it is still not converted to an int yet. |
I'm on 4.0.6 and at first glance both JSON and MsgPack serialization of longs via Remoting look OK. |
Actually I believe this issue has nothing to do with int64. I can see entire data is deserialized to empty. |
If not the initial deserialization, then what converts those fields to |
That’s something @Zaid-Ajaj can answer perhaps. |
Thanks a lot you all for the investigation! I think I know where the problem is. @OnurGumus Is the parsed type (or one of the nested values) a single-case union? |
@alfonsogarciacaro Yes. To be precise it looks as below: type VisitorId = VisitorId of string
type Credit = Credit of int64
type Version = Version of int64
type CreditData = { VisitorId: VisitorId; Credit: Credit; Version : Version }
|
@OnurGumus Can you please try with Fable 4.1.0-beta-001? |
@alfonsogarciacaro problem solved with 4.1.0-beta-001. Thanks for excellent support! |
Description
It is is hard to be a bit specific for my case because code isn't public. But I have some code using Fable.Remoting. It fetches some data from server via Fable.Remoting and Elmish commands. In 4.0.5 compiler it works fine. When I use 4.0.6 it returns all zeroes without any errors
The text was updated successfully, but these errors were encountered: