Open brettsam opened 7 years ago
@brettsam I just created a sample:
https://github.com/dersia/FuntionsLoggingTest
the TestPackage
Folder contains the nuget-package and the Functions folder contains the functions files
@brettsam are there any news on this one? can I help you investigating?
You may be able to move forward if you change the version to 1.1.0
.
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.0" />
</ItemGroup>
Perhaps it depends on the version that the Functions apps have built into them?
@brettsam Any reason why this issue is in this repo, rather than script or SDK?
A year later, I'm having the same issue as op. Any suggestions?
same here
Which version of the Microsoft.Extensions.Logging.Abstractions
package do you have installed?
@mnty: in my case it was 1.1.2
My problem in detail is that I have a project on which pretty much all other project depend on, including the Startup Functions project. Now this first one needs the latest version of Microsoft.Extensions.Logging.Abstractions
to use WebApi's Client
package. Thus, in order to make my Functions project depend on the first project, it has to have the latest Abstractions
, too.
The version of this package the Functions host uses in 1.1.1, so that version should be guaranteed to work.
@fabiocav -- is there any way to move this forward with direct references to a newer version?
It is related to our binding redirect issue. For more information on that, see https://github.com/Azure/azure-functions-host/issues/992.
Hi, I am using the Azure function(function app, custom code) with “FUNCTIONS_EXTENSION_VERSION=beta” and target framework “netstandard2.0”. I published the function on the azure and getting the following exception "Microsoft.Extensions.Logging.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. Could not load the specified file". I’ve checked and these files are in my bin folder. I was able to perform the local debug and integration tests.But no idea why it’s failing on the server. Believe the function load all the assemblies from my application bin folder and honour the version on the bin folder. Not from any cli context.
Any help much appreciated as I am really stuck on this.
I have the same issue on beta and the Function blade show a error dialog with the following message.
The function runtime is unable to start. System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.
I fixed my function by using Microsoft.Extensions.Logging.Abstractions (2.0.0) in my other projects since Microsoft.Azure.WebJobs (3.0.0-beta5) is using this version.
I have many libraries that is using "Microsoft.Extensions.Logging.Abstractions, Version=2.1.0.0" and those libraries are consumed by many other solutions. So it's not an easy option for me to down grade the dll version. More over we are developing all our projects using the .NET core 2.1. I've updated all the dependencies to target .NET core 2.1, still no joy :(
@larry-lau, @joseclament -- Are you targeting functions v1 or v2?
I'm getting this same error.
I'm targeting functions v1 on full framework 4.7.1 and version 2.1 of Microsoft.Extensions.Logging. This is a new project I just created this morning.
@brettsam I am targeting functions v2.
@brettsam trageting functions V2.
@brettsam , I have a function project and a web api project in the same solution, and both are calling my second project which was handling all the business logics, including Db calls. The web api part is working without any issue and only the function part is throwing the exception. Believe the azure function will load all the dlls from the bin folder while executing it and not anything from its own context. If so it may have different version of the dlls in the bin and context. I've found these issue while debugging locally while some of the dlls minor versions were different from the cli versions, so I have to manually copy my bin dlls to the cli and its started working. Please let me know how the run time on azure function will handle dlls.
Seeing the same issue related to Microsoft.Extensions.Configuration namespace. It feels like it's inheriting all the DLLs used by the SDK, rather than isolating the DLLs in the bin folder of the Azure Function. Can this be prevented, or is this expected?
I've seen this today too with this package Microsoft.AspNetCore.Authentication.JwtBearer (2.2.0) on Functions V2 (host 2.0.12175.0), and rolling that package back as it has a dependency on the abstractions lib seems to have fixed my issue.
For anyone currently still struggling with this :-
Add this to your function app's csproj file.
Then run the app and look for this error during package restore :-
error NU1605: Detected package downgrade: Microsoft.Extensions.Logging.Abstractions from 2.2.0 to 2.1.0. Reference the package directly from the project to select a different version.
The following line after that error will tell you which package is the problem.
In my case I needed to downgrade my JwtBearer package to 2.1 as that had the dependency that was breaking everything.
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.0" />
Another error that seems to potentially occur with this downgrade issue at runtime is this one.
"System.Private.CoreLib: Exception while executing function:
I've debugged using SourceLink, and the issue seems to be that the ILogger
type used by my Azure function assembly isn't the same ILogger
type instance used by the Azure functions host, as this equality evaluates to true
.
@brettsam is this still relevant?
I encountered the exact same issue today. For me it was simply, as also hinted above, that some of my referenced projects had the NuGet package for a newer version of Microsoft.Extensions.Logging.Abstractions installed.
I am facing same issue - here are more details - I have Azure function and one class library. Azure function has reference to Microsoft.Extensions.Logging.Abstraction 5.0.0 via - Microsoft.Azure.Functions.Extension package
Now I want to use logging in class library as well. So I have added nuget package Microsoft.Extensions.Logging.Abstraction 5.0.0 to my class library.
Now after this when I run the azure function - I am getting following error - Microsoft.Azure.WebJobs.Extensions.DurableTask: Value cannot be null. (Parameter 'loggerFactory'). Value cannot be null. (Parameter 'provider')
If I remove the reference from class library - then Azure functions works fine.
Can someone help me in this.?
From @dersia at #293: