We are currently upgrading a solution from 6.x to 7.x.
Relevant package version:
I have changed no code in the solution, which was running fine before upgrading. I’m quite certain that the lifetimes are correct, but now we have a recursion-problem resulting in a stackoverflow.
I’m quite sure the problem is because of NServiceBus or the Unity-package is resolving public properties on my objects. This is something new from the previous versions I was running, so my my question is:
Is it possible to disable property buildup from the DI-container all together? My code is only using ctor-injection, so for us the best thing would be to skip this functionality.
Also, the property on the object that is resolves is an indexed property, so it makes no sense for me how this could be set, unless there are some complex functionality around named container instances.
I can code my way around this issue, but still I’m nervous we will experience problems because of this some other place in the codebase. Normally you can enable property injection in Unity by adding a DependencyAttribute to the property. But in NServiceBus it seems like all properties are scanned and resolved by default.
I’m not really looking for a way to address the buildup of this concrete object, I just want to disable property injection to avoid unforeseen problems with my solution.