-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
Hello,
after we updated to LightInject-NuGet v7.01 there are several registrations in the ServiceContainer that can not be resolved any more via GetInstance.
Following Exception is thrown:
System.ArgumentNullException
HResult=0x80004003
Message=Der Wert darf nicht NULL sein.
Parametername: source
Source=System.Core
StackTrace:
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at LightInject.ConstructorDependencySelector.<>c.<Execute>b__0_1(ParameterInfo p)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at LightInject.TypeConstructionInfoBuilder.GetConstructorDependencies(ConstructorInfo constructorInfo)
at LightInject.TypeConstructionInfoBuilder.Execute(Registration registration)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at LightInject.ServiceContainer.EmitNewDecoratorInstance(DecoratorRegistration decoratorRegistration, IEmitter emitter, Action`1 pushInstance)
at LightInject.ServiceContainer.EmitNewInstanceWithDecorators(ServiceRegistration serviceRegistration, IEmitter emitter)
at LightInject.ServiceContainer.<>c__DisplayClass173_0.<CreateEmitMethodWrapper>b__0(IEmitter ms)
at LightInject.ServiceContainer.CreateDynamicMethodDelegate(Action`1 serviceEmitter)
at LightInject.ServiceContainer.CreateDelegate(Type serviceType, String serviceName, Boolean throwError)
at LightInject.ServiceContainer.CreateDefaultDelegate(Type serviceType, Boolean throwError)
at LightInject.ServiceContainer.GetInstance(Type serviceType)
at LightInject.ServiceFactoryExtensions.GetInstance[TService](IServiceFactory factory)
These types are registed in den ServiceContainer as follows:
foreach (var serviceInterface in serviceType.GetInterfaces())
{
_serviceContainer.Register(serviceInterface, serviceType);
}
We did not change anything on our site. The exception is throw directly after updating the NuGet to version 7.0.1.
Attached you can find a csv snippet, with an exported type registration, from a debug session with visual studio 2022. These type registration is one of them which causes the System.ArgumentNullException, when we call GetInstance.
ServiceRegistration;ServiceRegistration.ServiceName;ServiceRegistration.Lifetime;ServiceRegistration.Value;ServiceRegistration.RegistrationOrder;ServiceRegistration.FactoryType;ServiceRegistration.IsCreatedFromWildcardService;ServiceRegistration.ServiceType;ServiceRegistration.ImplementingType;ServiceRegistration.FactoryExpression
"ServiceType: 'x2.Shared.Services.Contracts.Server.IAbrechnungServiceShared', ServiceName: '', ImplementingType: 'x2.Services.Core.Server.AbrechnungService', Lifetime: 'Transient'";"";"";"";191;Service;False;x2.Shared.Services.Contracts.Server.IAbrechnungServiceShared;x2.Services.Core.Server.AbrechnungService;""
"ServiceType: 'x2.Services.Core.Server.Contracts.IAbrechnungService', ServiceName: '', ImplementingType: 'x2.Services.Core.Server.AbrechnungService', Lifetime: 'Transient'";"";"";"";190;Service;False;x2.Services.Core.Server.Contracts.IAbrechnungService;x2.Services.Core.Server.AbrechnungService;""
Metadata
Metadata
Assignees
Labels
No labels