I am using .net unity dependency injection framework within an application.
This project uses some 'third party libraries' (libraries coded by other teams in same company)
I register some 'Car' classes of my third party library this way:
unityContainer.RegisterType<ICar,Car>();
Now, people who develop the 'Car' class decide that it would be better if the constructor took a boolean inside the constructor.
When I get the new version of their library, my code breaks at runtime (I cannot detect the error in the build pipeline):
Resolving parameter \"hasRadio\" of constructor Car Resolving System.Boolean,(none)\r\n","exceptionType":"Microsoft.Practices.Unity.ResolutionFailedException"...
So my question is, how would you manage to avoid such issues ?
Is it a matter of best practices to introduce rules such as 'never use primitives in constructors' ?
Is it my test coverage that is not good enough ? For example, should I check that all classes of my unity dependency graph are instantiated with an InjectionConstructor when class constructor contains some primitive ? (I am not even sure one can do it with UnityContainer, whose Registrations field does not give back the InjectionConstructors)
Should I always instantiate classes from third party libraries explicitely (with InjectionFactory), to make sure that build pipeline fails when other team changes constructors without changing my code ? (I am not really happy with this option as it kind'of violates dependency injection principle : /)