Azure / Azure/azure-functions-host
Microsoft.NET.Sdk.Functions (v1.0.33) breaks function apps that have a dependency on Microsoft.Extensions.Logging.Abstractions v2.2.0
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
After upgrading from Microsoft.NET.Sdk.Functions v1.0.31 to v1.0.33, all functions in a V1 app fail with the following error:
```
FunctionXXX: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
```
#### Investigative information
It seems that the problem is that the version of Microsoft.Extensions.Logging.Abstractions referenced by the application is no longer being loaded.
Before the package upgrade, with v1.0.31, two versions of this DLL were loaded, one from the AzureFunctionsTools directory and another from the bin directory of the app. When v1.0.33 is used, only the DLL in the AzureFunctionsTools directory is loaded.
#### Repro steps
- Create a new Functions V1 project
- Change the target framework v4.72 (not sure if this is relevant, probably not)
- Install the Microsoft.Extensions.Logging.Abstractions v2.2.0 NuGet package
- **Upgrade Microsoft.NET.Sdk.Functions to v1.0.33**
- Replace Function1 with the following:
``` C#
[FunctionName("Function1")]
public static async Task Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req)
{
// reference any data type from Microsoft.Extensions.Logging, for example:
var level = Microsoft.Extensions.Logging.LogLevel.Information;
return req.CreateResponse(HttpStatusCode.OK, "Done!");
}
```
- Run the application locally
#### Expected behavior
- Application should start normally
#### Actual behavior
- Function fails to load with the following errors:
```
[3/5/2020 6:30:59 PM] Function 'Function1.Run' failed indexing and will be disabled.
[3/5/2020 6:30:59 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
[3/5/2020 6:30:59 PM] The following 2 functions are in error:
[3/5/2020 6:30:59 PM] Function1: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
[3/5/2020 6:30:59 PM] Run: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. mscorlib: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
```
#### Known workarounds
Revert Microsoft.NET.Sdk.Functions to v1.0.31.
UPDATED: Repro steps
Contributor guide
Assessment
This issue has not been assessed yet.