Skip to content
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

Pickling something through an FSX session and unpickler in an app #62

Closed
isaacabraham opened this issue Aug 27, 2015 · 11 comments
Closed

Comments

@isaacabraham
Copy link

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?

@eiriktsarpalis
Copy link
Member

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.FSharpList1[MyNamespace.MyType]' but was 'Microsoft.FSharp.Collections.FSharpList1[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
#62.

@isaacabraham
Copy link
Author

Tried resetting. By "interaction type", I'm #loading the types in to FSI - is that the problem (rather than getting them by a #r)?

@krontogiannis
Copy link
Member

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.

@isaacabraham
Copy link
Author

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.

@eiriktsarpalis
Copy link
Member

@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?

@isaacabraham
Copy link
Author

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.

@eiriktsarpalis
Copy link
Member

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.

@isaacabraham
Copy link
Author

Yeah. I was serializing data through FSI and deserializing in an application.

@adicirstei
Copy link

It would be nice though to be able to serialize/deserialize in interactive scripts.

@eiriktsarpalis
Copy link
Member

@adicirstei you should consider using Vagabond. https://mbraceproject.github.io/Vagabond

@adicirstei
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants