Jack Fox
Jack Fox

Reputation: 945

Compiled Azure function, FunctionInvocationException: Method not found

My compiled Azure function is not finding a method in a DLL called by a DLL my function calls.

Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.CompiledTrigger 
    ---> System.AggregateException : One or more errors occurred. 
    ---> Method not found: 'Void MBrace.FsPickler.BinarySerializer..ctor(Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<MBrace.FsPickler.ITypeNameConverter>, Microsoft.FSharp.Core.FSharpOption`1<MBrace.FsPickler.IPicklerResolver>)'.

   at Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetTaskResult(Task task) 
   at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 453

   at Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.<>c.<InvokeCore>b__26_0(Task t) 
   at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 276

   at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()

   at System.Threading.Tasks.Task.Execute()

   ...

All the necessary DLLs are present. The method exists. And I added an open statement for the sub DLL as well.

The code:

module Trigger

open System
open Microsoft.Azure.WebJobs
open Microsoft.Azure.WebJobs.Host
open Microsoft.Azure.WebJobs.Extensions
open PSlogger             //this DLL is called            
open MBrace.FsPickler     //which calls this DLL


let logMessage (initLog : CountingLog) connString curretnProcess message addlInfo  =

    // fails inside this call, whether I use the async or non-async function
    //IO.insertAsync connString {initLog.Log with 
    IO.insert connString {initLog.Log with 
                                UtcTime = DateTime.UtcNow;
                                Process = curretnProcess
                                Message = message
                                StringInfo = addlInfo
                                } "MyLogPrefix"

let Run(myTimer: TimerInfo, log: TraceWriter ) =
    async {
        ...

        logMessage logger connString None "starting run" None |> ignore

        ...

    } |> Async.StartAsTask

Upvotes: 2

Views: 518

Answers (2)

Jack Fox
Jack Fox

Reputation: 945

The problem is Azure functions cannot support the FsPickler.dll, either because the DLL is built for .NET Framework 4.5, or because System.Tuple has changed underneath FsPickler. See discussion here

Upvotes: 1

Isaac Abraham
Isaac Abraham

Reputation: 3502

Hmmm. This does seem very much like there's a deployment issue in that the MBrace.FsPickler assembly isn't available. I know you it in the post, but are you 100% sure that the assembly is in the same folder as the function assembly?

Does it run locally on the Functions runtime / debugger? What version of F# are you running?

Upvotes: 1

Related Questions