JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
572 stars 119 forks source link

Detected some kind of bi-directional dependency #169

Closed blemasle closed 5 years ago

blemasle commented 5 years ago

Hello there,

I'm facing Detected some kind of bi-directional dependency while trying to discover and plan a missing service registration. Examining types: System.Uri upon Container instanciation, but can't understand why. Am I misusing Ctor usage ?

I'm using a dotnet core 2.1 console application with the latest Lamar version (3.0.3)

interface IInjectionIssue { }

    class InjectionIssue : IInjectionIssue
    {
        public InjectionIssue(Uri uri) { }
    }

    class Program
    {
        static void Main(string[] args)
        {
            IContainer container = new Container(x =>
            {
                //breaks
                x.For<IInjectionIssue>()
                    .Use<InjectionIssue>()
                    .Ctor<Uri>().Is(new Uri("http://localhost:9200"));

                //works
                x.For<IInjectionIssue>()
                    .Use(new InjectionIssue(new Uri("http://localhost:9200")));
            });
        }
    }