From 7e4f04d0b7f6d97c2a2cecfcc8ca6de63bed30f7 Mon Sep 17 00:00:00 2001 From: Oleksandr Tolstikov Date: Tue, 14 Sep 2021 10:13:06 +0300 Subject: [PATCH] - cleanup --- src/Scrutor/ServiceCollectionExtensions.Decoration.cs | 2 +- test/Scrutor.Tests/DecorationTests.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Scrutor/ServiceCollectionExtensions.Decoration.cs b/src/Scrutor/ServiceCollectionExtensions.Decoration.cs index a1d8c0a7..e38ed043 100644 --- a/src/Scrutor/ServiceCollectionExtensions.Decoration.cs +++ b/src/Scrutor/ServiceCollectionExtensions.Decoration.cs @@ -346,7 +346,7 @@ private static object GetInstance(this IServiceProvider provider, ServiceDescrip if (implementationType != null) { if (implementationType != descriptor.ServiceType) - return provider.GetServiceOrCreateInstance(descriptor.ImplementationType); + return provider.GetServiceOrCreateInstance(implementationType); // Since implementationType is equal to ServiceType we need explicitly create an implementation type through reflections in order to avoid infinite recursion. // Should not cause issue with singletons, since singleton will be a decorator and after this fact we can don't care about lifecycle of decorable service (for sure, if IDisposable of decorator disposes underlying type:)) diff --git a/test/Scrutor.Tests/DecorationTests.cs b/test/Scrutor.Tests/DecorationTests.cs index ff70d564..e30b7242 100644 --- a/test/Scrutor.Tests/DecorationTests.cs +++ b/test/Scrutor.Tests/DecorationTests.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection; using Xunit; using System.Linq; -using static Scrutor.Tests.DecorationTests; namespace Scrutor.Tests {