0
Ich verwende den In-Speicher-Anbieter in einem .Net 461-Einheitentestprojekt. Ich verwende VS 2017.System.IO.FileLoadException bei Verwendung von EntityFramework Core 2.0
var contextOptionsBuilder = new DbContextOptionsBuilder();
contextOptionsBuilder
.UseInMemoryDatabase("testmethod1");
var ctx = new ConfigStoreDbContext(contextOptionsBuilder.Options);
Die packages.config enthält das folgende Paket.
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
Hier ist der Stack-Trace.
Test Name: TestMethod1
Test Outcome: Failed
Test Duration: 0:00:01.1170206
Result StackTrace:
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState entityState, Boolean forceStateWhenUnknownKey)
at Microsoft.EntityFrameworkCore.DbContext.SetEntityState(InternalEntityEntry entry, EntityState entityState)
at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity](TEntity entity, EntityState entityState)
at Microsoft.EntityFrameworkCore.DbContext.Add[TEntity](TEntity entity)
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.Add(TEntity entity)
at Microsoft.ProjectConfig.Configuration.Sql.SqlConfigurationWriter`4.<AddOrUpdateSettingTypeImplAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.ProjectConfig.Configuration.ConfigurationWriterBase`4.<AddOrUpdateSettingTypeAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.ProjectConfig.Configuration.UnitTests.UnitTest1.<TestMethod1>d__0.MoveNext() in C:\Repos\ProjectConfig\UnitTestProject1\UnitTest1.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)
Result Message:
Test method Microsoft.ProjectConfig.Configuration.UnitTests.UnitTest1.TestMethod1 threw exception:
System.IO.FileLoadException: Could not load file or assembly 'System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)