Base solution for your next web application
Open Closed

Help with Circular Dependency Exception #4821


User avatar
0
vladsd created

All I did is moved SendTestEmail to UserEmailer so test email comes with body, etc.

And now I get this:

An error occurred while starting the application. CircularDependencyException: Dependency cycle has been detected when trying to resolve component 'MyApp.Authorization.Users.UserEmailer'. The resolution tree that resulted in the cycle is the following: Component 'MyApp.Authorization.Users.UserEmailer' resolved as dependency of component 'MyApp.MultiTenancy.TenantManager' resolved as dependency of component 'MyApp.Emailing.EmailTemplateProvider' resolved as dependency of component 'MyApp.Authorization.Users.UserEmailer' resolved as dependency of component 'Abp.MultiTenancy.AbpTenantManager`2[[MyApp.MultiTenancy.Tenant, MyApp.Core, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null],[MyApp.Authorization.Users.User, MyApp.Core, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null]]_1805ea27-3e70-4292-a3cf-3e176e5d35eb' resolved as dependency of component 'MyApp.MultiTenancy.TenantManager_1889fa30-a4b8-4dcc-b99a-e4ab64a3f96d' resolved as dependency of component 'MyApp.MultiTenancy.SubscriptionExpirationCheckWorker' which is the root component being resolved. Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)


3 Answer(s)
  • User Avatar
    0
    vladsd created

    Well, after thinking, about it, TenantManager has email template, and UserEmailer needs it, so I created circle myself.

    How would I break it?

  • User Avatar
    0
    vladsd created

    For anyone in the position, I end up using _tenantRepository directly instead of tenantmanager.

  • User Avatar
    0
    alper created
    Support Team

    thanks for your feedback ;)