Azure / Azure/azure-functions-host

System.Configuration reference causes Azure Functions CLI to fail with a precompiled F# library

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

Description

_From @panesofglass on December 28, 2017 23:27_

I'm trying to figure out the correct way to reference `System.Configuration` so that I can use `ConfigurationManager` within my precompiled function. I found `Microsoft.WindowsAzure.ConfigurationManager` seemed to work while scripting through the portal. However, when trying to build a precompiled library targeting `net462`, I had to reference the `System.Configuration` library in order to build. However, this causes the Azure Functions CLI to fail at run time as it cannot find `System.Configuration`. My last attempt was to reference the `System.Configuration.ConfigurationManager` package, based on the error. However, I either have the wrong version, or this is not intended to work, as I still see the same error.

What's the correct solution here?

```
[12/28/17 23:28:20] A ScriptHost error has occurred
[12/28/17 23:28:20] Exception while executing function: Functions.NightlyImport. Microsoft.Azure.WebJobs.Script: One or more errors occurred. (Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.). Functions: Could not load file or
assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[12/28/17 23:28:20] Exception while executing function: Functions.NightlyImport. Microsoft.Azure.WebJobs.Script: One or more errors occurred. (Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.). Functions: Could not load file or
assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[12/28/17 23:28:20]
[12/28/17 23:28:20] Exception while executing function: Functions.NightlyImport
[12/28/17 23:28:20] Exception while executing function: Functions.NightlyImport. Microsoft.Azure.WebJobs.Script: One or more errors occurred. (Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.). Functions: Could not load file or
assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[12/28/17 23:28:20] Function completed (Failure, Id=f1faa329-a998-49c7-96f4-901213a78fcc, Duration=561ms)
[12/28/17 23:28:20]
[12/28/17 23:28:20] Executed 'Functions.NightlyImport' (Failed, Id=f1faa329-a998-49c7-96f4-901213a78fcc)
[12/28/17 23:28:20] System.Private.CoreLib: Exception while executing function: Functions.NightlyImport. Microsoft.Azure.WebJobs.Script: One or more errors occurred. (Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.). Functions: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[12/28/17 23:28:20] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is 'f1faa329-a998-49c7-96f4-901213a78fcc'
[12/28/17 23:28:20] System.Private.CoreLib: Exception while executing function: Functions.NightlyImport. Microsoft.Azure.WebJobs.Script: One or more errors occurred. (Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.). Functions: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
```

_Copied from original issue: Azure/azure-functions-core-tools#342_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with a precompiled F# library targeting net462, referencing System.Configuration or System.Configuration.ConfigurationManager, and run it through the Azure Functions CLI. Trace why the CLI cannot load the referenced assembly; done when the function starts and executes without the missing-assembly error.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.