I am trying to get the unit tests running in my .NET Core 1.0 solution. When I run an empty test it works fine. However, as soon as I try to create new instance of ApplicationDbContext the test fails with the following exception:
System.IO.FileLoadException : Could not load file or assembly 'System.Interactive.Async, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack Trace:
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddQuery(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddEntityFramework(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_0.<GetOrAdd>b__1(Int64 k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
(2 more stack trace lines from my code)
Not sure why the System.Interactive.Async is needed at all, but I added it as dependency to my Tests project. The dll does not seem to be copied to bin\Debug\netcoreapp1.0 folder on build, however. If I copy it there manually the effect it exactly the same. Any ideas what else can I do to get it working?
For me this error was being thrown because in my project.json I had correctly added:
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
to use core, but I hadn't removed this line which was further down my file between other dependencies:
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
Once I deleted that line, I got past this error.
I am using SQLite and Entity Framework Core. I was facing the below exception.
Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' or one of its dependencies
I have installed all necessary packages but it didn't solve.
There is a package named System.Interactive.Async (Ix Async) which can be installed through Nuget
Then my runtime exception was solved.
For me it was an errant line
EntityFramework.InMemory
in addition to Microsoft.EntityFrameworkCore.InMemory
in project.json
. Once I deleted, it started working
In my case problem was same as mentioned above - i found forgotten "EntityFramework.MicrosoftSqlServer
" dependency in linked project.
To investigate problem, I use my project's project.lock.json
. There was 2 packets with System.Interactive.Async.dll - Ix-Async/1.2.5 and System.Interactive.Async/3.0.0
.
Then look which packet dependent from Ix-Async
(still surfing in project.lock.json
) and found that it was EntityFramework.Core/7.0.0-rc1-final . As there was no more packets that depends on EntityFramework.Core
I realized that i have EntityFramework.Core
in some of my own dependencies (one of my project's project.json
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With