-
Notifications
You must be signed in to change notification settings - Fork 26
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
Deserialization works in program but fails in interactive #25
Comments
I can take a look later this week. Thank you.
…On Wed, May 15, 2019, 4:47 PM Jason Gardella ***@***.***> wrote:
I'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
<https://github.com/jgardella/FSharpLint/tree/fsharpjson-bug>.
To see the issue:
1. Place a debug breakpoint here
<https://github.com/jgardella/FSharpLint/blob/master/src/FSharpLint.Core/Application/ConfigurationManager.fs#L461>.
This is where we try to parse the Configuration type
<https://github.com/jgardella/FSharpLint/blob/fsharpjson-bug/src/FSharpLint.Core/Application/ConfigurationManager.fs#L440>
.
2. Run the Lint project test
<https://github.com/jgardella/FSharpLint/blob/fsharpjson-bug/tests/FSharpLint.FunctionalTest/TestApi.fs#L61>.
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.
3. Run the FSharp.Json.Error.fsx file
<https://github.com/jgardella/FSharpLint/blob/fsharpjson-bug/tests/FSharpLint.FunctionalTest/FSharp.Json.Error.fsx>
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#25>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGYLNXDGKGKFG72SMJZSNDPVQO7PANCNFSM4HNECIEA>
.
|
Hi @vsapronov, any luck with this? |
@jgardella I was able to reproduce the issue. I can't get yet why it happens. There is one little detail: it happens even without debug mode in FSI. I keep investigating this. |
@jgardella The issue basically boils down to the fact that your These are questions I haven't answered yet:
If you can help with these, particularly (2) it would be great. |
I'm actually not really concerned with this not working in FSI (although it is strange); that's just how I was able to reproduce the issue. The actual issue which is affecting me is that I'm getting this error when I try to use the Maybe the issue is that the |
Well, please try this from you other project referencing I don't think it's related to a member. In my local testing I removed that member (was concerned about it too). My investigation shows also following: I suspect that maybe it's caused by FSharp.Core versions discrepancies. Like reflection is looking for I'm not sure how much more time I will have to investigate this. I would appreciate if you can follow the traces yourself and share your findings here. Again the main question is why |
@jgardella Now I'm pretty sure it's related to FSharp.Core versions. Here's how I diagnosed this. This is the code that I have put into FSharp.Json.Error.fsx:
The Let me know how it goes... |
If you need help to understand more why you have got this issue I can stop by some day at Hoboken. Or just setup FSharp.Json office hours for Thor team at Jet.com :) |
Thanks for looking into this! I tried the binding redirects as you suggested, but the |
There's no such thing as binding redirects for fsx files. The fsx files are compiled into separate assembly which is then executed. As a side note: please, make some more effort to investigate the issue. Simple "still failing" is not good enough. I showed you how to get what is version of FSharp.Core is being used on the type. There are more ways to see what libraries are loaded into AppDomain... This information would be helpful. |
Thanks for the info, I wasn't aware of how redirects would interact with fsx files. I'll try to make the change in the affected project and do some additional debugging there. |
Small status update: First, I think my attempt to reproduce this using I checked, and |
Any news on this? Having the same issue with F# Azure Functions (runtime 2.0) |
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? |
I could reproduce what @vincenzoml said. I had working code and then (to not expose an only internally used type) I made it private. Then the code didn't work anymore with the error like mentioned above. |
@NicoVIII and @vincenzoml What do you think could be done from library perspective? May be better exception message pointing towards real problem ( Thank you for helping to diagnose this issue. |
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'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:
parseConfig
breakpoint above, when it tries to parse the default configuration file. It should succeed.Through this I was able to confirm that the two functions seem to be receiving the same input.
The text was updated successfully, but these errors were encountered: