I tried to setup a .net core console application which uses EF core 2.0.0
and Redis.Core 1.0.3
(both are the current latest version).
Unfortunately if you try to put both into one application it won't even start. Even if you try to set a breakpoint right at the beginning or start debugging with Step into
or Step Over
doesn't help. All you get is this:
I think there happens some kind of type load exception or something similar. So far to reproduce the problem is quite easy with this project:
Project File (MyProject.csproj
)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis.Core" Version="1.0.3" />
</ItemGroup>
</Project>
Application (Program.cs
)
using Microsoft.Extensions.Caching.Redis;
using Microsoft.Extensions.Options;
namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
var cache = new RedisCache(Options.Create(new RedisCacheOptions()));
}
}
}
Anybody an idea or solution?
The problem is that
Microsoft.Extensions.Caching.Redis.RedisCache 1.0.3
depends on Microsoft.Extensions.Caching.Abstractions 1.0.3
Microsoft.EntityFrameworkCore 2.0.0
depends on Microsoft.Extensions.Caching.Abstractions 2.0.0
If you look at the Output Window, you will get:
TypeLoadException
: MethodGetAsync
in typeMicrosoft.Extensions.Caching.Redis.RedisCache
from assembly 'Microsoft.Extensions.Caching.Redis, Version=1.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
So: either wait until RedisCache
gets updated to 2.0.0
or use EntityFrameworkCore < 2.0.0