divyang4481
divyang4481

Reputation: 1793

Microsoft.EntityFrameworkCore.InMemory has issue with log exception

if we use Microsoft.EntityFrameworkCore.InMemory for unit test , we are facing following exception for asp.net core 2.2

exception is as follows :

   System.TypeLoadException: Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
  Stack Trace: 
    at Logger.BeginScope[TState](TState state)
    at EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
    at InMemoryDatabase.CompileAsyncQuery[TResult](QueryModel queryModel)
    at CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
    at QueryCompiler.ExecuteAsync[TResult](Expression query)
    at IAsyncEnumerable<TResult>.GetEnumerator()
    at AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken) in Aggregate.cs line: 118

Upvotes: 2

Views: 927

Answers (1)

Edward
Edward

Reputation: 30036

Resolve issue with installing Microsoft.EntityFrameworkCore.InMemory with version 2.2.6. The Microsoft.EntityFrameworkCore.InMemory version need to keep the same with project version.

Upvotes: 3

Related Questions