Dependency injection with Unity - issue/breaking change when upgrading from 6.x to 7.x

Hi Harald

I try to reproduce the problem but couldn’t. I did a minimalistic repro attempt by switch our Unity Sample to the same version as you have and then adding an another service that should be property injected. Unfortunately I had no success.

See the commit Repro unity by danielmarbach · Pull Request #4644 · Particular/docs.particular.net · GitHub

Is there anything I’m missing?

In case it is really the property injection container extension that is causing this problem it is possible with a little bit of hackery to disable it as show in

       var extensionsField = typeof(UnityContainer).GetField("_extensions", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
        var extensions = (List<IUnityContainerExtensionConfigurator>)extensionsField.GetValue(container);
        foreach (var extension in extensions.ToList())
        {
            if (extension.GetType().FullName == "NServiceBus.Unity.PropertyInjectionContainerExtension")
            {
                extensions.Remove(extension);
                break;
            }
        }

Unfortunately you have to use reflection because Unity only allows to add extensions and not remove them as far as I know.

Regards
Daniel