Deserialization works in program but fails in interactive
See original GitHub issueI’ve found a strange issue where deserialization of a type works fine in my program, but fails when I run the same serialization in interactive. In interactive I get the following exception:
Couldn't parse config, error=JSON Path: . Failed to serialize, must be one of following types: record, map, array, list, tuple, union. Type is: Configuration.
I haven’t been able to create a minimal example of the issue, but I’ve made a branch on the affected project to demonstrate the issue here.
To see the issue:
- Place a debug breakpoint here. This is where we try to parse the Configuration type.
- Run the Lint project test. This will try to lint the provided project, eventually hitting the
parseConfig
breakpoint above, when it tries to parse the default configuration file. It should succeed. - Run the FSharp.Json.Error.fsx file in interactive debug. You should get the exception above, when it tries to parse the same default configuration.
Through this I was able to confirm that the two functions seem to be receiving the same input.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (2 by maintainers)
Top Results From Across the Web
Deserialization works in program but fails in interactive #25
I've found a strange issue where deserialization of a type works fine in my program, but fails when I run the same serialization...
Read more >Deserializes from file working but not blob? - ...
The problem lies when trying to deserialize an instance of the class itemSet returned in a resultSet after querying my database. The blobfile ......
Read more >Issue while using Deserialize activity - Help
The api was updated and it doesn't work anymore. (it went from ' to " ). I used to : Deserialize once, to...
Read more >Data Account Cannot Be Deserialized
The failed deserialization likely means something is up with MessageAccount . Try writing some unit tests to try deserializing it from a slice ......
Read more >JSON Deserialize (Values are not assigning)
Hey,. I am using JSON Deserialize. I just created the structure based on the output. It automatically created with the following. But the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi all, I had this issue today, and it was caused by the fact that I had made “private” the type I was trying to parse from json. Removing “private” solved the issue. So maybe the exception is caused by an accessibility problem?
If there is no way (for now?) to fix this issue, I guess a better exception message which points to the real problem would be nice. I was confused, when the thrown exception told me, that my record type is not a record type 😄