3
votes

Lately I've been using a larger number of smaller objects, because they are simpler and easier to reuse. Most of the time there isn't any problem injecting these objects into one another using StructureMap (great tool, btw). But occasionally, I f*** up, and I get myself a nice circular reference in the guise of a stack overflow exception(tm).

So other than going through all my recent changes since the last test run, does StructureMap provide any mechanism for debugging circular references, or is there a simple tool out there that could be useful in this situation?

Thanks everyone!

1
Did you find a good solution to this? Calling ObjectFactory.AssertConfigurationIsValid() just gives the same StackOverflowException for me. - JeremyWeir
No, there isn't a good solution to this sadly, other than just being more careful when adding new dependicies that have large dependency chains connected to them. I don't get this very often anymore, because I'm a little more strategic with my dependency chains. I try to prevent them from getting too deep, and some dependecies I know are safe because their chains won't be altered. - Mark Rogers

1 Answers

2
votes

ObjectFactory.AssertConfigurationIsValid(); will check your graph and attempt to instantiate all plugged types.