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

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

Open
thatstatsguy opened this issue Oct 3, 2022 · 0 comments

Comments

@thatstatsguy
Copy link

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

The goal is to:

  • serialize this multiply by two function using the pickle method,
  • send it over the wire to an Azure function as a way to abstract this logic away from the azure function.

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!

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

1 participant