Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JimKerslake opened this issue Jan 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@JimKerslake
Copy link
Contributor

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.

@JimKerslake
Copy link
Contributor Author

@JimKerslake
Copy link
Contributor Author

Leave this one for me please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant