Azure / Azure/azure-functions-host

File not found exception when loading assembly from function with double underscore

Open
#2,969 1 comment 0 reactions 0 assignees View on GitHub
1.x area: assembly-load bug
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

#### Repro steps

1. Create a C# function with two consecutive underscores in the name such as `HttpTriggerCSharp__3`.
2. Modify the function to load an assembly using #r such as `#r "../bin/MyLibrary.dll"`
3. Upload given library to the function app so that it should work

#### Expected behavior
Library is loaded

#### Actual
`[Error] Exception while executing function: Functions.HttpTriggerCSharp__3. mscorlib: Exception has been thrown by the target of an invocation. f-HttpTriggerCSharp__3__576737419: Could not load file or assembly`

#### Workaround
Avoid using function names with double underscores

#### Notes
This bug does not exist in functions V2.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the C# function-app case with a double underscore in the function name and an assembly referenced with #r. Compare the assembly-loading path with Functions V2 behavior; done means the library loads successfully for names such as HttpTriggerCSharp__3 without requiring the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
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.