Skip to content

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

@thatstatsguy

Description

@thatstatsguy

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions