I have a F # Azure function that doesn’t work, is bizarre, and I don’t know how to approach the fix of the problem. I have created a minimum actual case registry below. The test function is started manually and uses FSharp.Compiler.Service as a dependency, as indicated in project.json
below:
{ "frameworks": { "net46":{ "dependencies": { "FSharp.Compiler.Service": "11.0.6" } } } }
The run.fsx
file looks like this:
open System open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.Interactive.Shell let Run(input: string, log: TraceWriter) = // code here that uses FsiEvaluationSession // and runs just fine log.Info "I RAN"
So far so good. The part that illuminates me is that if I add the following function above Run
,
// same dependencies as before open Microsoft.FSharp.Compiler.Interactive.Shell let foo (longIdent:LongIdent) = // version 1 // "FOO" // version 2 // longIdent.ToString () // version 3 longIdent |> List.map string let Run(input: string, log: TraceWriter) = // same as before
Uncommenting section 1 works fine, split section 2 works fine, split section 3 makes hell break. The function compiles, but its launch raises the following exception:
Exception while executing function: Functions.fsc-1. mscorlib: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
... which puzzles me because
foo
is not even called- the signature and the second version use
LongIdent
, so this type is not the source of the problem.
Any suggestion on how to approach the problem and what the problem may be itself will be very appreciated - I don’t even know where to start, and the same code works fine in the local script.
source share