Skip to content

Commit c15a065

Browse files
committed
Fix secondary services lookup
1 parent d22fe9e commit c15a065

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/Extensions.DependencyInjection/CommunityToolkit.Extensions.DependencyInjection.SourceGenerators/ServiceProviderGenerator.Execute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public static CompilationUnitSyntax GetSyntax(ServiceCollectionInfo info)
254254
{
255255
// Register the main implementation type:
256256
//
257-
// global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.<REGISTRATION_METHOD>(<PARAMETER_NAME>, typeof(<DEPENDENT_SERVICE_TYPE>), new global::System.Action<global::Microsoft.Extensions.DependencyInjection.IServiceCollection, object>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredServices<ROOT_SERVICE_TYPE>));
257+
// global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.<REGISTRATION_METHOD>(<PARAMETER_NAME>, typeof(<DEPENDENT_SERVICE_TYPE>), new global::System.Func<global::System.IServiceProvider, object>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredServices<ROOT_SERVICE_TYPE>));
258258
registrationStatements.Add(
259259
ExpressionStatement(
260260
InvocationExpression(
@@ -267,9 +267,9 @@ public static CompilationUnitSyntax GetSyntax(ServiceCollectionInfo info)
267267
Argument(TypeOfExpression(IdentifierName(dependentServiceType))),
268268
Argument(
269269
ObjectCreationExpression(
270-
GenericName("global::System.Action")
270+
GenericName("global::System.Func")
271271
.AddTypeArgumentListArguments(
272-
IdentifierName("global::Microsoft.Extensions.DependencyInjection.IServiceCollection"),
272+
IdentifierName("global::System.IServiceProvider"),
273273
PredefinedType(Token(SyntaxKind.ObjectKeyword))))
274274
.AddArgumentListArguments(Argument(
275275
MemberAccessExpression(

0 commit comments

Comments
 (0)