DependencyInjection stops working when we add User Secrets (Error: "Microsoft.Extensions.DependencyInjection.Abstractions: Unable to resolve [injected service] while attempting to activate [function]) #59
I know this issue was already discussed here: https://github.com/Azure/azure-functions-dotnet-extensions/issues/45, but the issue should not have been closed. The person in that thread mentioned that they solved their problem by simply installing Microsoft.Extensions.Configuration.UserSecrets, but I personally have that package installed. As soon as I installed it, my Dependency Injection stopped working.
I created a very basic Functions app to show the problem. The function only has three installed packages. The csproj file is:
The Startup.cs file:
And the very simple function:
When I run the application (locally) I get the following error message:
Obviously, the error disappears if I remove the User Secrets package, but I need to be able to use User Secrets... There has to be a solution?
I know this issue was already discussed here: https://github.com/Azure/azure-functions-dotnet-extensions/issues/45, but the issue should not have been closed. The person in that thread mentioned that they solved their problem by simply installing Microsoft.Extensions.Configuration.UserSecrets, but I personally have that package installed. As soon as I installed it, my Dependency Injection stopped working.
I created a very basic Functions app to show the problem. The function only has three installed packages. The csproj file is:
The Startup.cs file:
And the very simple function:
When I run the application (locally) I get the following error message:
Obviously, the error disappears if I remove the User Secrets package, but I need to be able to use User Secrets... There has to be a solution?