You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I struggle understand the reason throwing this exception in my project. I searched all over the internet what can cause it while EntityFrameworkCore and AutoMapper are installed and using the AssembliesFromApplicationBaseDirectory() method when scanning for registries.
The full exception message: 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
publicoverridevoidConfigureContainer(ServiceRegistryregistry){registry.For<IConfiguration>().Use(Configuration).Singleton();registry.Scan(
c =>{c.WithDefaultConventions();c.AssembliesFromApplicationBaseDirectory();c.LookForRegistries();});}
.Net Core 3.1
The text was updated successfully, but these errors were encountered:
OmerNassie
changed the title
bi-directional dependency while EntityFrameworkCode and AutoMapper are installed
bi-directional dependency while EntityFrameworkCore and AutoMapper are installed
May 13, 2020
That's not the full stack trace. Lamar tries to give you the whole path of how you made the circle.
And I very strongly recommend against this usage here:
public override void ConfigureContainer(ServiceRegistry registry)
{
registry.For<IConfiguration>().Use(Configuration).Singleton();
registry.Scan(
c =>
{
c.WithDefaultConventions();
c.AssembliesFromApplicationBaseDirectory();
c.LookForRegistries();
});
}
That's going to give you oodles of registrations you don't need. Use some kind of allow list to limit the assemblies you're scanning, and that might very well make this problem go away
I struggle understand the reason throwing this exception in my project. I searched all over the internet what can cause it while EntityFrameworkCore and AutoMapper are installed and using the
AssembliesFromApplicationBaseDirectory()
method when scanning for registries.The full exception message:
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
The project's dependencies:
my configure container method:
.Net Core 3.1
The text was updated successfully, but these errors were encountered: