Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with Microsoft.Extensions.DependencyInjection v2.2.0

See original GitHub issue

This may be a duplicate of #21, although that doesn’t capture the impact.

We’ve just updated our project to .NET Core 2.2 / EF Core 2.2, which means the datalayer class library our Functions project references now has a dependency on Microsoft.Extensions.DependencyInjection >= 2.2.0

This causes the following error on startup:

[17/12/2018 14:51:49] A host error has occurred
[17/12/2018 14:51:49] Willezone.Azure.WebJobs.Extensions.DependencyInjection: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Azure.WebJobs.IWebJobsBuilder.get_Services()'.
Value cannot be null.
Parameter name: provider

This prevents the function from starting.

If I downgrade the data layer back to 2.1.x libraries, the error goes away. If I then add an explicit reference to Microsoft.Extensions.DependencyInjection v2.2.0 to the functions project, it comes back, so it looks like this is the culprit.

For reference, both the Function project and the class library it’s referencing are netstandard2.0. My local functions runtime is 2.0.12210.0, while Azure is running 2.0.12246.0 - same issue seen in both.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

StefHcommented, Dec 28, 2018

@adrianm64 Another option would be to more active manage this project + nuget. And keep the same version scheme as from Microsoft.

So make multiple versions from Willezone.Azure.WebJobs.Extensions.DependencyInjection which align with Microsoft.Azure.WebJobs:

  • 2.1.0
  • 2.2.0
  • 3.0.0
  • 3.0.1
  • 3.0.3
kensykoracommented, Aug 21, 2019

For those running into this issue, I found I was able to get past it by updating my Azure Functions Runtime that ships with VS for Mac to latest as of this posting

Azure Functions Core Tools (2.7.1575 Commit hash: b7750e771a4e56352c767dfa16413ec9c79b72ba)
Function Runtime Version: 2.0.12625.0

This SO post pointed me in the right direction:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load Microsoft.Extensions.DependencyInjection. ...
I'm getting following error when i try to load 2.2.0 version of Microsoft.Extensions.DependencyInjection.Abstractions assembly.
Read more >
issue with trying to use Microsoft.Extensions. ...
It's not that you can't use dependency injection, you just can't use the current Microsoft provided library. The library you're trying to use ......
Read more >
Use dependency injection in .NET Azure Functions
Learn how to use dependency injection for registering and using services in .NET functions.
Read more >
Microsoft.Extensions.DependencyInjection 2.0.0-preview1- ...
Version Downloads Last updated 8.0.0‑preview.7.23375.6 24,355 11 days ago 8.0.0‑preview.6.23329.7 75,902 a month ago 8.0.0‑preview.5.23280.8 89,330 2 months ago
Read more >
New dependency injection features in .NET 6
In .NET 6, you can use await using with CreateAsyncScope() and there are no problems. using Microsoft.Extensions.DependencyInjection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found