Azure / Azure/azure-functions-host

Using version of FSharp.Compiler.Service higher than 9.0.1 causes exception

Open
#1,336 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

Using a version of FSharp.Compiler.Service (FCS) higher than 9.0.1 in an Azure Function potentially causes runtime exceptions, because the Azure WebJobs SDK relies on FCS 9.0.1. Compilation succeeds, but version 9.0.1 is loaded at runtime instead of 11.0.6, which causes crashes when using functionality available in 11.0.6 but not in 9.0.1.

#### Repro steps

1. Create an F# Azure Function with manual trigger (or any other).
2. Add a dependency to FSharp.Compiler.Service via project.json, latest version.
```
{
"frameworks": {
"net46":{
"dependencies": {
"FSharp.Compiler.Service": "11.0.6"
}
}
}
}
```
3. In the code, use any feature present in FSC 11.0.6 but not in FSC 9.0.1 (see http://stackoverflow.com/q/42755884/114519 for an example)
4. Save: compilation succeeds
5. Run: exception is triggered, such as:

```
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.
```

#### Expected behavior

Compilation error.

#### Actual behavior

Successful compilation but runtime exception.

#### Known workarounds

Reverting to FSC 9.0.1

#### Related information

The following answer on StackOverflow describes the issue in more detail, with related information:
http://stackoverflow.com/a/42894076/114519

* Programming language used: F#
* Links to source: https://github.com/mathias-brandewinder/fsibot-serverless/tree/98d5dc40226358c6e44b73a796197c01eb7658d1/process-mention

I can provide a smaller repro, if needed.

Contributor guide

Open the contributing guide

Research direction

Start with the project.json dependency declaration and the process-mention source linked in the issue, then reproduce the F# Azure Function using FSharp.Compiler.Service 11.0.6. Trace why compilation succeeds while version 9.0.1 is loaded at runtime; done means the incompatible dependency is reported during compilation instead of causing a runtime exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, fsharp
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.