Skip to content

Commit 080a9e1

Browse files
authored
fix: Remove self-registration of IServiceProvider (#211)
This removes the self-registration of the service provider to prevent the circular reference problem when using AutoFac.
1 parent 1632865 commit 080a9e1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/KubeOps/Operator/Builder/OperatorBuilder.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ internal IOperatorBuilder AddOperatorBase(OperatorSettings settings)
162162
// Register event handler
163163
Services.AddTransient<IEventManager, EventManager>();
164164

165-
// Add the service provider (for instantiation)
166-
// and all found controller types.
165+
// Add all found controller types.
167166
Services.AddHostedService<ResourceControllerManager>();
168-
Services.TryAddSingleton(sp => sp);
169167
foreach (var (controllerType, _) in _resourceLocator.ControllerTypes)
170168
{
171169
Services.TryAddScoped(controllerType);

0 commit comments

Comments
 (0)