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.

Cannot resolve scoped service 'KubeOps.Operator.Controller.IEventQueue`1[MyOperator.Entities.V1DemoEntity]' from root provider

See original GitHub issue

Describe the bug Not able to debug the sample operator in .Net 6.0. Getting the below exception.

To Reproduce

  1. Created the sample project via template
  2. Project is targeting KubeOps 6.5.3 and .Net 6.0
  3. Did dotnet run install
  4. Did dotnet run and got the below error

Startup Leader Elector for operator "myoperator". Unhandled exception. System.InvalidOperationException: Cannot resolve scoped service 'KubeOps.Operator.Controller.IEventQueue1[MyOperator.Entities.V1DemoEntity]’ from root provider. at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(Type serviceType, IServiceScope scope, IServiceScope rootScope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at KubeOps.Operator.Builder.OperatorBuilder.<>c__DisplayClass18_0.<AddOperatorBase>b__3(ControllerRegistration r) at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at System.Collections.Generic.List1.AddRange(IEnumerable1 collection) at KubeOps.Operator.Controller.ResourceControllerManager.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at KubeOps.Operator.Commands.RunOperator.OnExecuteAsync() at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() --- End of stack trace from previous location --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
frabe1579commented, Jun 16, 2022

The latest functioning version seems to be 6.3.1

3reactions
ewassefcommented, Jun 15, 2022

Same here, not fixed with latest version on nuget as of june 15

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot resolve scoped service from root provider .Net Core 2
Another way to get the instance of scoped dependency is to inject service provider ( IServiceProvider ) into the middleware constructor, create ...
Read more >
Cannot resolve scoped service 'KubeClient.IKubeApiClient' ...
IKubeApiClient' from root provider. at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(Type ...
Read more >
.NET Core: Cannot resolve scoped service 'Microsoft ...
I was trying to create an instance of an object from a service provider to resolve any dependencies, using ActivatorUtilities.
Read more >
Cannot resolve scoped service from root provider ASP.NET ...
Issue resolution for error -Cannot resolve scoped service from root provider ASP.NET Core. Understand the lifetime of service instances is registered, ...
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