Hi guys !
I'm trying to use StructureMap with Visual Studio 2017 and I have an Stackoverflow exception without knowing why.
If I open the project with Visual Studio 2012 and run it... every thing is working fine !
My test project is made with .Net 4.5 and the latest structuremap version.
Here is my simple test case :
public interface IMyInterface{}
public class MyClass : IMyInterface{}
public void StructureMapTest()
{
//Using scan method
var scanContainer = new Container(_ =>
{
_.Scan(x =>
{
x.TheCallingAssembly();
x.WithDefaultConventions();
});
});
//All good class1 is my MyClass
var class1 = scanContainer.GetInstance<MyClass>();
//Boom throws the stackoverflow exception
var container = new Container(c =>
{
c.For<IMyInterface>().Use<MyClass>();
}
);
//Never goes here because of exception
var class2 = container.GetInstance<MyClass>();
}
Do you have any idea what I am missing ?