aspnet/DataProtection

External DI Container issue

ipjohnson opened this issue · 7 comments

I'm having an issue with the refactoring as part of this PR

The problem is for any container that allows concrete types to be automatically resolved (most allow this to happen) the wrong constructor will chosen for KeyManagementOptionsSetup

This all stems from the issue raised here. Normally I'd just have the user work around it but with the type being internal there isn't an easy work around. I can have the person turn off automatic registration but that's a pain and really isn't going to work for certain situations.

What seems like the proper solution is to make the RegistryPolicyResolver parameter an interface rather than passing around the actual type. @davidfowl any thoughts?

This came up here #270 as well. I think we should fix it. However, we can't make any breaking changes in patches so we'd probably have to add another ctor.

/cc @muratg @Eilon @DamianEdwards

@pakrym could you please take a look to see what's the best way to fix this without a breaking change?

Actually we don't add APIs in patches either, this might need to be a 2.1 thing.

@davidfowl Yup, it's triaged in 2.1.

@muratg It might be possible to patch this since these types are internal.

Eilon commented

Which internal API is it and from where are the internal APIs called? Even in patches we are careful about changing internal APIs if they're used in other product assemblies and not just tests.

Here

internal class KeyManagementOptionsSetup : IConfigureOptions<KeyManagementOptions>