Closed isaacabraham closed 8 years ago
Try resetting fsi. It looks like you are serializing an interaction type rather than a library type. On Thu, 27 Aug 2015 at 04:02 Isaac Abraham notifications@github.com wrote:
If I try to do the above, I get an error such as: -
Nessos.FsPickler.FsPicklerException was unhandled by user code Message: An exception of type 'Nessos.FsPickler.FsPicklerException' occurred in FsPickler.dll but was not handled in user code Additional information: Error deserializing object of type 'Microsoft.FSharp.Collections.FSharpList`1[MyNamespace.MyType]'.
Expected pickle of type 'Microsoft.FSharp.Collections.FSharpList
1[MyNamespace.MyType]' but was 'Microsoft.FSharp.Collections.FSharpList
1[FSI_0002.MyNamespace.MyType]'.Should the FSI_0002 really be there? Is there any way to stop it happening?
— Reply to this email directly or view it on GitHub https://github.com/nessos/FsPickler/issues/62.
Tried resetting. By "interaction type", I'm #load
ing the types in to FSI - is that the problem (rather than getting them by a #r
)?
Yes, you should #r
the compiled assembly that you reference in your app.
If you observe F# interactive, after running #load "foo.fs"
you will see that it prepends FSI_XXXX
in all namespaces declared in foo.fs
.
Mmmm, ok. This makes sense. It might be an idea to emit a warning if pickling a type that has FSI_ at the start - I didn't think it would matter.
@isaacabraham It's not inherently impossible to serialize FSI generated types, this is for example one of the things that Vagabond can do.
Should I close this?
Up to you. Like I said, it wasn't obvious to me that using an interaction type wouldn't work in conjunction with a compiled type. Maybe just a warning would be sufficient here or something similar.
It does work. It's just that you need to have the same type definition loaded in the remote process as well, which is not trivial to achieve normally.
Yeah. I was serializing data through FSI and deserializing in an application.
It would be nice though to be able to serialize/deserialize in interactive scripts.
@adicirstei you should consider using Vagabond. https://mbraceproject.github.io/Vagabond
@eiriktsarpalis I'll give it a try. Currently I am pretty happy with FsPickler. I'm using it to persist neural networks after the training is over. It's just for data.
If I try to do the above, I get an error such as: -
Should the
FSI_0002
really be there? Is there any way to stop it happening?