-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
was trying to use this library for setting up my xUnit tests and I am getting this error
Error Message:
System.TypeLoadException : Could not load type 'Microsoft.EntityFrameworkCore.Internal.ICurrentDbContext' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.16.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Stack Trace:
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeConstructorInfo.get_Signature()
at System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()
at System.Reflection.RuntimeConstructorInfo.GetParameters()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
at Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService[TService](IInfrastructure`1 accessor)
at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
at EfCore.InMemoryHelpers.InMemoryValueResetter.ResetValueGenerators(DbContext context) in C:\projects\efcore-inmemoryhelpers\src\EfCore.InMemoryHelpers\InMemoryValueResetter.cs:line 16
at EfCore.InMemoryHelpers.InMemoryContextBuilder.Build[TContext](DbContextOptionsBuilder builder, Func`2 contextConstructor, String databaseName, DatabaseReusability reuseOption) in C:\projects\efcore-inmemoryhelpers\src\EfCore.InMemoryHelpers\InMemoryContextBuilder.cs:line
62
code
namespace Timely.Core.Test
{
public class BaseTest<T>: IDisposable where T: DbContext, new()
{
protected T Context { get; set; }
public BaseTest()
{
Context = InMemoryContextBuilder.Build<T>();
Context.Database.EnsureDeleted();
Context.Database.EnsureCreated();
}
public void Dispose()
{
Context.Dispose();
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels