problems with IConfigureOptions in aspnet core 2
maxlego opened this issue · 3 comments
Can't quite figure out why, but when i upgraded to aspnetcore 2.0 and idnetity 2, authentication options are not configured any more.
Services config lookes like this:
services
.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(o =>
{
o.LoginPath = "/login";
o.LogoutPath = "/logout";
});
But lamda is not hit.
When i dont return IServiceProvider created by WindsorRegistrationHelper everything works as expected.
I have run into the same thing with aspnet core 2.2 and the latest version of this package while trying to configure kestrel https... it's very confusing.
I figured out what this was, we were registering a collection sub resolver before calling startup which meant that the MsCompatibleCollectionResolver
was not being called. I'm not entirely sure how to fix this because the ordering of dependencies is (or can be) important for existing code.
One option would be to only reverse the dependencies for types which live in a Microsoft
namespace, this is a hack but works - but it does not deal with someone using the built in collection resolver out of the box, they would need to replace their with the right version.