Closed thinkbeforecoding closed 9 years ago
Hi, this might have something to do with the fact that Microsoft ships many of its products with older versions Json.Net. To verify that this is true, try doing the following
typeof<Newtonsoft.Json.JsonReader>.Assembly.Location
Mine turned out to be a version 4.5 tucked inside the Visual Studio installation folder. I was able to fix this by manual installing Json.NET before adding FsPickler. Let me know if that helps
Actually the error happens in a tutorial fsx project, put it works when running it with debugger... Seems is more related to assembly linking than to pickler code.
Sorry :ambulance:
This seems to be an issue with FSI. Sending an '#r' directory will not actually load the assembly at that point, so unless you explicitly reference a Json.Net object before you call anything from the pickler, the wrong assembly will be loaded.
This is strange, and extremely annoying.
It works using #I:
#I @"..\packages\Newtonsoft.Json.6.0.3\lib\net45"
I remember reading about it already.. It's better to #I all paths, the just #r assembly names...
I just hit this. If it's endemic to the system can we open a bug and while that bug is being evaluated place a note in the examples? The issue makes the examples feel broken.
This issue only affects F# interactive. I'm not sure if it qualifies as a bug, since automatic dependency resolution is really a feature. But you are right, I should update the samples to reflect the need for Json.Net to be explicitly referenced.
Much appreciated! I spend a lot of time assuring people they can be quickly successful with F# and related projects. Stuff like this is an important part of making that happen.
I made this addition http://nessos.github.io/FsPickler/tutorial.html#The-core-serialization-API
I love it
When UnPickling with JsonPickler, it throws a MissingMethodException:
Repro: