Hat AutoFAC Einschränkungen, wie viele Komponenten registriert werden können?C#

Ein Treffpunkt für C#-Programmierer
Guest
 Hat AutoFAC Einschränkungen, wie viele Komponenten registriert werden können?

Post by Guest »

Wir haben eine große Lösung mit 24 Projekten, die AutoFAC (v3.5.2) und weitgehend Konstruktor DI zum Bau aller unserer Dienste verwenden. Ich habe eine Grenze erreicht. Ich habe kürzlich ein paar weitere Konstruktor -Dis in einem vorhandenen Dienst hinzugefügt, und wenn ich das Projekt lade und ausführe, erhalte ich jetzt eine OutofMemoryException. Wenn ich diese neuen DIS in diesem Service entferne, wird das Projekt erneut geladen. Die Frage ist, hat AutoFAC diese Art von Grenze? Wenn nicht, was könnte dies ausführen, um die MemoryException auszuschöpfen?

Code: Select all

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
Autofac.Core.Activators.Reflection.AutowiringParameter.CanSupplyValue(ParameterInfo pi, IComponentContext context, Func`1& valueProvider) +246
Autofac.Core.Activators.Reflection.ConstructorParameterBinding..ctor(ConstructorInfo ci, IEnumerable`1 availableParameters, IComponentContext context) +435
Autofac.Core.Activators.Reflection.c__DisplayClass13_0.b__0(ConstructorInfo ci) +67
System.Linq.WhereSelectArrayIterator`2.MoveNext() +58
System.Linq.WhereEnumerableIterator`1.MoveNext() +174
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +135
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +79
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +518
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException:
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator),
Services = [MyCoolApp.Domain.IUserRetriever],
Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Registration.c__DisplayClass2_0.b__2(IComponentContext c, IEnumerable`1 p) +57
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +188
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Activators.Reflection.c__DisplayClass0_0.b__0() +82
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +328
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +622
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details.  Registration: Activator = UserService (ReflectionActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Registration.c__DisplayClass2_0.b__2(IComponentContext c, IEnumerable`1 p) +57
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +188
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserService (DelegateActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserService (ReflectionActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Activators.Reflection.c__DisplayClass0_0.b__0() +82
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +328
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +622
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124
...
< /code>
Die vollständige Stapelverfolgung ist zu groß, um auf dem Stapelüberlauf zu posten, aber Sie können die vollständige Stapelverfolgung hier. < /p>
Wir haben einige tiefe Ketten der Abhängigkeit, aber nicht kreisförmig. Jedes Mal, wenn wir die App laden, folgt der Fehler einer anderen Abhängigkeitskette in den Fehlermeldungen.  Hier ist eine Kette als Beispiel: < /p>
RelatedEntityResolver   -> IPermissionService
RoleResolver            -> IRelatedEntityResolver
-> IPermissionService
UserRetriever           -> IRelatedEntityResolver
-> IRoleResolver
-> IPermissionService
UserService             -> IUserRetriever
RoleService             -> IPermissionService
-> IRoleResolver
-> IRelatedEntityResolver
-> IUserRetriever
-> IUserService
TeamFactory             -> IPermissionService
-> IRoleService
TeamInstanceForCompetitionCreator   -> ITeamFactory
CommandDispatcher       ->    ICommandHandler/ITeamInstanceForCompetitionCreator
CreateAgreement         -> ICommandDispatcher

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post