by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 13 07:17
    OmerNassie edited #254
  • May 13 07:16
    OmerNassie opened #254
  • May 06 08:41
    sm-g opened #253
  • Apr 23 11:27
    marisks commented #249
  • Apr 23 09:10
    marisks commented #249
  • Apr 22 20:39
    AaronAllBright edited #252
  • Apr 22 20:37
    AaronAllBright opened #252
  • Apr 22 19:08
    hellfirehd opened #251
  • Apr 22 17:28
    mxmissile edited #250
  • Apr 22 17:19
    mxmissile commented #250
  • Apr 22 17:18
    mxmissile opened #250
  • Apr 21 18:45
    jeremydmiller commented #249
  • Apr 21 18:45
    jeremydmiller labeled #249
  • Apr 20 17:04
    jeremydmiller commented #246
  • Apr 20 16:43
    AaronAllBright commented #246
  • Apr 20 10:58
    marisks opened #249
  • Apr 20 01:11

    jeremydmiller on v4.3

    (compare)

  • Apr 20 00:53

    jeremydmiller on master

    bumping to 4.3 (compare)

  • Apr 20 00:52

    jeremydmiller on master

    moved the SampleWorkerApp under… (compare)

  • Apr 20 00:50

    jeremydmiller on gh-pages

    Documentation Update for 4.3.0 (compare)

Jeremy D. Miller
@jeremydmiller
Implementation doesn’t matter unless it’s explicitly registered against IMyInterface
OmerNassie
@OmerNassie
Yes, It is registered against it. Event more, i can see the implementation and the interface registered:
ISubscriberService<T> TMessaging.Contracts Transient new SubscriberService`1()
Jeremy D. Miller
@jeremydmiller
That’s an open generic registration
OmerNassie
@OmerNassie
You're right, I wanted to simplify things up. Basically the IMyInterface is ISubscriberService<T>
Jeremy D. Miller
@jeremydmiller
What exactly are you asking for when it returns a null? And do you get any different behavior from Lamar’s native GetInstance<T>() or GetRequiredService<T>()?
You can’t ask for the open generic type
if that’s what you did
OmerNassie
@OmerNassie
That's what i asked for:
var subscriber = con.GetService<ISubscriberService<CompanyModel>>()
Jeremy D. Miller
@jeremydmiller
Dunno. That open generic to closed generic fallback is working in Lamar, and has been from the initial release. Are you sure you’re using the same container you did with WhatDoIHave()?
OmerNassie
@OmerNassie
When tried GetInstance method, it threw an exception that there is not registration of this service but i can see it
Its under the same method. I'm sure
The registration is For(typeof(ISubscriberService<>)).Use(typeof(SubscriberService<>)).Singleton();
Jeremy D. Miller
@jeremydmiller
Any issue with type scoping? Does the concrete class have a public or internal constructor?
OmerNassie
@OmerNassie
public constructor with no arguments
Jeremy D. Miller
@jeremydmiller
There’s something else going with registration or it’s a different container. That’s a very straightforward usage
OmerNassie
@OmerNassie
Weird, I'll dig in, thank you!
OmerNassie
@OmerNassie
Ok.. It was something simple but it returns me to the starting point. When I removed LookForRegistries method, I removed the registration rules of all the DLLs i scanned. On each DLL i got a ServiceRegistry t has its own rules. The problem is, when i get back the LookForRegistries method, the exception happens to be again..
In each of the registries I created has no registration about Entityframework or AutoMapper..
Jeremy D. Miller
@jeremydmiller
What exactly is your Scan() call? Are you using WithDefaultConventions()?
OmerNassie
@OmerNassie
Filtering assemblies' names with my prefix and yes, default conventions
Jeremy D. Miller
@jeremydmiller
Did you ever check the WhatDidIScan() to see what assemblies you’re scanning?
OmerNassie
@OmerNassie
Yes, perfectly match what i wanted
Jeremy D. Miller
@jeremydmiller
the WithDefaultConventions() would walk into whatever assembly it’s trying to scan
Do you have dependencies on anything due to EF or AutoMapper in the other assemblies?
OmerNassie
@OmerNassie
I have them installed within those other assemblies but none as dependencies
Jeremy D. Miller
@jeremydmiller
Are any of your registered services depending on EF or AutoMapper is what I meant
OmerNassie
@OmerNassie
I mean none as constructor dependency
Nope
Jeremy D. Miller
@jeremydmiller
Any setter injection going on?
OmerNassie
@OmerNassie
Yes, multiple
But again, none includes ef or auto mapper
setters for factories I've created myself
Jeremy D. Miller
@jeremydmiller
Okay, so back to the beginning, what’s giving you the bi-directional dependency problem?
OmerNassie
@OmerNassie
those types:
AutoMapper.TypePair, Microsoft.EntityFrameworkCore.Metadata.Internal.EntityType'
Jeremy D. Miller
@jeremydmiller
Can you give me the full stack trace from Lamar?
OmerNassie
@OmerNassie
at Lamar.ServiceGraph.TryToCreateMissingFamily(Type serviceType) at Lamar.ServiceGraph.addMissingFamily(Type serviceType) at Lamar.ServiceGraph.ResolveFamily(Type serviceType) at Lamar.IoC.Instances.ConstructorInstance.explainWhyConstructorCannotBeUsed(Type implementationType, ConstructorInfo constructor, ServiceGraph services) at Lamar.IoC.Instances.ConstructorInstance.DetermineConstructor(ServiceGraph services, String& message) at Lamar.ServiceGraph.CouldBuild(Type concreteType, String& message) at Lamar.ConcreteFamilyPolicy.Build(Type type, ServiceGraph serviceGraph) at Lamar.ServiceGraph.<>c__DisplayClass66_0.<TryToCreateMissingFamily>b__1(IFamilyPolicy x) at LamarCodeGeneration.Util.EnumerableExtensions.FirstValue[TItem,TReturn](IEnumerable`1 enumerable, Func`2 func) at Lamar.ServiceGraph.TryToCreateMissingFamily(Type serviceType) at Lamar.ServiceGraph.addMissingFamily(Type serviceType) at Lamar.ServiceGraph.ResolveFamily(Type serviceType) at Lamar.IoC.Instances.ConstructorInstance.explainWhyConstructorCannotBeUsed(Type implementationType, ConstructorInfo constructor, ServiceGraph services) at Lamar.IoC.Instances.ConstructorInstance.DetermineConstructor(ServiceGraph services, String& message) at Lamar.IoC.Instances.ConstructorInstance.createPlan(ServiceGraph services) at Lamar.IoC.Instances.Instance.CreatePlan(ServiceGraph services) at Lamar.ServiceGraph.planResolutionStrategies() at Lamar.ServiceGraph.buildOutMissingResolvers() at LamarCodeGeneration.Util.PerfTimer.Record(String text, Action action) at Lamar.ServiceGraph.Initialize(PerfTimer timer) at Lamar.IoC.Scope..ctor(IServiceCollection services, PerfTimer timer) at Lamar.Container..ctor(IServiceCollection services) at Lamar.LamarServiceProviderFactory.CreateServiceProvider(ServiceRegistry containerBuilder) at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at Takeaway.Examples.ServiceBus.Program.Main(String[] args) in C:\Users\omern\source\repos\Takeaway.Examples\Takeaway.Examples.ServiceBus\Program.cs:line 20
Sorry, that was from the container i created in the ConfigureContainer. Now its correct
Jeremy D. Miller
@jeremydmiller
Sorry, just the full exception is what I meant. I don’t see the actual exception text in there
OmerNassie
@OmerNassie
Detected some kind of bi-directional dependency while trying to discover and plan a missing service registration. Examining types: AutoMapper.TypePair, Microsoft.EntityFrameworkCore.Metadata.Internal.EntityType
Jeremy D. Miller
@jeremydmiller
And those are the only two types in the message?
OmerNassie
@OmerNassie
Yup
Jeremy D. Miller
@jeremydmiller
That can’t be it.
OmerNassie
@OmerNassie
Hahaha I'm saying it for 2 days now
Jeremy D. Miller
@jeremydmiller
Why are you having to use the LookForRegistries() btw?
You aren’t trying to do some kind of Onion Architecture thing, are you?
OmerNassie
@OmerNassie
I want to load the ServiceRegistries I created without directly reference and use IncludeRegistry
Jeremy D. Miller
@jeremydmiller
I think I’d tell you to switch back to IncludeRegistry, and add things one by one until you can isolate the problem. Faster cold start times, less complexity, more explicit code. I never use LookForRegistries() myself
OmerNassie
@OmerNassie
Ok.. thank you aqgain
I'm developing an infrastructure with multiple packages which I don't want my developers to reference at any project the consume it that's all
Will do what you suggested, thanks