trullock / NanoIoC

A tiny IoC container that does exactly what you want. And nothing more.
4 stars 2 forks source link

Cyclic dependency can cause stack overflow #5

Open Nevett opened 7 years ago

Nevett commented 7 years ago

Ideally the following code would be detected as a cyclic dependency and immediately throw, instead it will hang and eventually stack overflow on the third line.

var container = new Container();
container.Register<SomeClass>(c => c.Resolve<SomeClass>());
container.Resolve<SomeClass>();
trullock commented 7 years ago

sneaky. send me a PR :P