You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version 1.15.1 and 1.15.2 - Could not load file or assembly Microsoft.Extensions.Options #292
Could not load file or assembly 'Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
We are using the SDK in a .NET Core 3.1 Azure Function project. On startup we get the following error message.
[2021-10-05T19:14:11.699Z] A host error has occurred during startup operation '929d6984-66be-444d-b0b2-d4645ccc7549'.
[2021-10-05T19:14:11.701Z] Function-ZipWhipEngine: Could not load file or assembly 'Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')
In order to resolve the error we have to downgrade to version 1.14.0.
…
Issue Type (Can be multiple)
Build - Cannot install or import the SDK
Performance - Performance issues
Behaviour - Functions are not working as expected (such as generate URL)
Documentation - Inconsistency between the docs and behaviour
Other (Specify)
Steps to reproduce
Simply upgrade the NuGet package and try to run the project. Error will occur during startup.
Error screenshots or Stack Trace (if applicable)
OS and Version
Linux
Windows
macOS
MultiPlatform
Versions and Libraries (fill in the version numbers)
Hi @coder-candace Could you please let me know what is the target framework set for your library Function-ZipWhipEngine (i.e. it should also be .Net Core 3.1)? The error thrown is from Microsoft.Extensions.Options which is a dependency for Microsoft.Extensions.WebEncoders (target framework .Net Core 3.1). In case, may I request a sample library that throws this exception so I could verify it further in my dev environment? Thanks.
Hi @epasos573 yes the target framework is .NET Core 3.1.
I was able to further narrow down where the problem is occurring. It's happening on this line. [assembly: FunctionsStartup(typeof(Function_ZipWhipEngine.Startup))]
If you remove that line, error goes away and project fires up as expected. Add it back and error returns. Problem is if we just remove this line then our Configure() override won't run and we can't set up required application settings.
Hi @coder-candace Thanks for the sample code and after verifying the issue, I could see that the Microsoft.Extensions.Options is having a conflict with the Microsoft.Extensions.WebEncoders on application load.
To replicate the issue, I have updated the sample code you have provided. I uninstalled CloudinaryDotNet package and installed the Microsoft.Extensions.WebEncoders package into ZipWhipEngine project . And launching the application throws the issue: Could not load file or assembly 'Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. Value cannot be null. (Parameter 'provider').
Testing the case further, I have used the Environment.CurrentDirectory instead in order to set the application base path.
@JT-Bruch The CloudinaryDotNet SDK is compatible with .Net Core 3.1, while the error reported above is linked to the other Microsoft packages used in the solution that are not yet compatible with .Net Core 3.1. And the proposed solution is to use other libraries that is fully functional with the version of .Net Framework/Core being used.
As for your case, reviewing the dependencies requirements for Microsoft.Extensions.DependencyInjection.Abstractions (see Nuget link), it is only compatible with .NETStandard 2.0.
Activity
epasos573 commentedon Oct 8, 2021
Hi @coder-candace Could you please let me know what is the target framework set for your library
Function-ZipWhipEngine(i.e. it should also be .Net Core 3.1)? The error thrown is fromMicrosoft.Extensions.Optionswhich is a dependency forMicrosoft.Extensions.WebEncoders(target framework.Net Core 3.1). In case, may I request a sample library that throws this exception so I could verify it further in my dev environment? Thanks.coder-candace commentedon Oct 12, 2021
Hi @epasos573 yes the target framework is .NET Core 3.1.
I was able to further narrow down where the problem is occurring. It's happening on this line.
[assembly: FunctionsStartup(typeof(Function_ZipWhipEngine.Startup))]If you remove that line, error goes away and project fires up as expected. Add it back and error returns. Problem is if we just remove this line then our Configure() override won't run and we can't set up required application settings.
Here is a sample project demonstrating the issue
ZipWhipEngine-Sample3.zip
epasos573 commentedon Oct 13, 2021
Hi @coder-candace Thanks for the sample code and after verifying the issue, I could see that the
Microsoft.Extensions.Optionsis having a conflict with theMicrosoft.Extensions.WebEncoderson application load.To replicate the issue, I have updated the sample code you have provided. I uninstalled
CloudinaryDotNetpackage and installed theMicrosoft.Extensions.WebEncoderspackage intoZipWhipEngineproject . And launching the application throws the issue:Could not load file or assembly 'Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. Value cannot be null. (Parameter 'provider').Testing the case further, I have used the
Environment.CurrentDirectoryinstead in order to set the application base path.See attached updated project
ZipWhipEngine_Modified.zip
:
JT-Bruch commentedon Dec 6, 2021
I also have the same issue - basic install into a .NET Core 3.1 DLL with only these dependencies.
epasos573 commentedon Dec 7, 2021
@JT-Bruch The CloudinaryDotNet SDK is compatible with
.Net Core 3.1, while the error reported above is linked to the other Microsoft packages used in the solution that are not yet compatible with.Net Core 3.1. And the proposed solution is to use other libraries that is fully functional with the version of .Net Framework/Core being used.As for your case, reviewing the dependencies requirements for
Microsoft.Extensions.DependencyInjection.Abstractions(see Nuget link), it is only compatible with.NETStandard 2.0.Please take a look and see if that helps.