question-mark
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.

How to resolve service registered in IServiceCollection?

See original GitHub issue

When using ASP.NET Core and registering services in IServiceCollection from Startup.ConfigureServices method, those services then are not available in IResolverContext when I use T Service<T>().

Is this by design or a bug?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
featherbitscommented, Nov 29, 2018

On fresh project it works as expected. I will add more code to it in order to replicate setup.

1reaction
featherbitscommented, Nov 29, 2018

Could you set up a small schema first project that replicates and share that repo?

Working on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving instances with ASP.NET Core DI from within ...
The IServiceCollection interface is used for building a dependency injection container. After it's fully built, it gets composed to an ...
Read more >
Resolve Services In ASP.NET Core Startup
Several approaches to resolve registered services within the Startup class of your ASP.NET Core application.
Read more >
Dependency injection in ASP.NET Core
Inject the service into the middleware's Invoke or InvokeAsync method. Using constructor injection throws a runtime exception because it forces ...
Read more >
How to manually resolve a service registered in ...
If I register a service like so: builder.Services.AddSingleton<IMyRepository, MyRepository>();. How do I manually resolve that within another ...
Read more >
How to resolve dependencies in ASP.NET Core
Resolve dependencies using IServiceProvider ... You can use the IServiceCollection interface to create a dependency injection container. Once the ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found