Skip to content

Circular dependency in UserPropertyService breaks site spin-up completely #50

@JimKerslake

Description

@JimKerslake

UserPropertyService depends upon SiteUserManager

However SiteUserManager itself DI injects:

        private IEnumerable<IHandleUserEmailConfirmed> _emailConfirmedHandlers;
        private IEnumerable<IHandleUserEmailUpdated>   _emailUpdatedHandlers;

If you create your own event handler that seeks to implement IHandleUserEmailConfirmed (or IHandleUserEmailUpdated)
and if that event handler tries to DI inject UserPropertyService (to ask questions about user's kvp values)
then the app hangs silently on startup (runtime) presumably due to a circular dependency.

Attempts to rectify that by changing UserPropertyService to depend upon UserManager instead -
result in a bunch of even more confusing circular dependency errors throughout the application, all centered around the UserManager.

Possible remedy - another simpler DI service in cs core that answers the simple question (Get user by id) that is currently being requested of SiteUserManager.
So remove any dependency of UserPropertyService on any UserManager service.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions