You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reloa
8000
d to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to reproduce the issue with minimal code
usingPure.DI;usingSystem.Diagnostics;varcomposition=newComposition();varservice=composition.Service;varserviceLoggerName=service.Logger.Name;varrepositoryLoggerName=service.Repository.Logger.Name;Debug.Assert(serviceLoggerName==repositoryLoggerName,"Service and Repository should share the same logger instance.");varproxyService=composition.ProxyService;varproxyServiceLoggerName=proxyService.Service.Logger.Name;repositoryLoggerName=proxyService.Service.Repository.Logger.Name;Debug.Assert(proxyServiceLoggerName==proxyServiceLoggerName);Console.ReadLine();partialclassComposition{privatevoidSetup()=>DI.Setup("Composition").Bind<Service>().To<Service>().Bind<ILogger>().As(Lifetime.Singleton).To<Logger>(ctx =>newLogger(){Name="Default"}).Bind<ILogger>("TaggedLogger").As(Lifetime.Singleton).To(ctx =>newLogger(){Name="SpecialServiceLogger"}).Bind<Func<Repository>>().To<Func<Repository>>(ctx =>{ctx.Inject<Repository>(outvarrepo);return()=>repo;}).Bind<IService>().To(ctx =>{ctx.Inject<ILogger>("TaggedLogger",outvarlogger);ctx.Override(logger);ctx.Inject<Service>(outvarservice);returnservice;}).Bind<IProxyService>().To<Proxy>().Bind().To<Repository>()// Composition root.Root<IService>("Service").Root<IProxyService>("ProxyService");}interfaceILogger{stringName{get;init;}voidLog(stringmessage);}classLogger:ILogger{publicrequiredstringName{get;init;}publicvoidLog(stringmessage){}}interfaceIRepository{ILoggerLogger{get;}}classRepository:IRepository{publicRepository(ILoggerlogger){Logger=logger;}publicILoggerLogger{get;}}interfaceIService{ILoggerLogger{get;}IRepositoryRepository{get;}}classService:IService{privatereadonlyFunc<IRepository>repositoryFactory;publicService(ILoggerlogger,Func<IRepository>repositoryFactory){Logger=logger;this.repositoryFactory=repositoryFactory;}publicIRepositoryRepository=>repositoryFactory();publicILoggerLogger{get;}}interfaceIProxyService{IServiceService{get;}}classProxy:IProxyService{publicProxy(IServiceservice){Service=service;}publicIServiceService{get;}}
Uh oh!
There was an error while loading. Please reload this page.
I am getting this error attempting to use ctx.Override()
Use of unassigned local variable 'overILoggerM06D12di1'
The text was updated successfully, but these errors were encountered: