-
Notifications
You must be signed in to change notification settings - Fork 1k
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
bug in F# discriminated union serialization #1126
Comments
So, what does this actually compile into? type testType1 =
string * string
type testType2 =
| V2 of testType1 Other DU's contains nested types for each entry in the DU, which allows us to do duType.GetNestedTypes() to get the possible types for the DU. So what is |
NVM, I figured it out, I submitted a PR for this here #1127 |
Sounds strange as Json.net 7.0 works well with F# types. I think this issue is not related to it. I tried to run e.g. this piece of code: [<Fact>]
let testJsonNet () =
let x = V2("hello!","world")
let strings = JsonConvert.SerializeObject x
let des = JsonConvert.DeserializeObject<testType2> strings
des
|> equals x Works fine for me. |
We are not yet on 7.0 |
Again strange.. I took your code today. Compiled. I see nuget have installed Newtonsoft.Json.7.0.1 on my PC. |
Sorry, I am wrong. Indeed it is ver 6.0. Can you please tell me what are the plans regarding the upgrade to version 7.0? |
Yes, we have talked about it, but not decided when it should be done. We need a bit of time to evaluate how it works out |
I see. Looking forward to your upgrade. Meanwhile I will serialize DUs myself using version 7.0 and try to send strings between actors. |
Im trying Json.NET right now. is there anything special one need to do when using v7 and DU's? |
[edit] I'm a donkey.. |
I was wrong, and Json.net yet again handles everything we throw at it.. |
Yes, DU are not the type in usual OO sense, but a hierarchy of classes that implement this algebraic type. |
Merged |
Hello,
I have decided to give akka.net a try and unfortunately I faced a bug in 30 minutes after my start. The following my unit test crashes on my PC with the latest source code:
Stack:
Test Outcome: Failed
Test Duration: 0:00:00.471
Result Message: System.NullReferenceException : Object reference not set to an instance of an object.
Trace:
at Akka.Serialization.NewtonSoftJsonSerializer.TranslateSurrogate(Object deserializedValue, ActorSystem system, Type type) in Akka\Serialization\NewtonSoftJsonSerializer.cs:line 132
at Akka.Serialization.NewtonSoftJsonSerializer.FromBinary(Byte[] bytes, Type type) in Akka\Serialization\NewtonSoftJsonSerializer.cs:line 114
at Akka.FSharp.Tests.ApiTests.MyTest() in Akka\src\core\Akka.FSharp.Tests\ApiTests.fs:line 76
I see other unit tests implemented to test this feature. they work ok. But they obviously dont test it thoroughly. Not sure how to fix the bug myself. I really appreciate your quick help.
Best regards,
Pavel.
The text was updated successfully, but these errors were encountered: