mbraceproject / FsPickler

A fast multi-format message serializer for .NET
http://mbraceproject.github.io/FsPickler/
MIT License
325 stars 52 forks source link

Serialising/Deserialising a function works within a unit test, but fails to deserialise when sent to azure funcion. #127

Open thatstatsguy opened 2 years ago

thatstatsguy commented 2 years ago

I'm trying to serialize a simple F# function that takes a double input and multiplies it by 2.

The goal is to:

I've created a replicable example where I use a unit test to send a request to a local Azure function with the functionality above.

Interestingly, the unpickle method works perfectly within the unit test, but fails on the azure function with the following error:

MBrace.FsPickler.FsPicklerException: Error deserializing object of type 'Microsoft.FSharp.Core.FSharpFunc`2[System.Double,System.Double]'.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'UnitTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'UnitTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, 

Another point to note, adding a reference to the unit test project fixes the issue (I'm not sure why).

Ideally one would want these to be decoupled from one another.

Thanks for any help!