Efcore.pg: Method Clone in NpgsqlOptionsExtension not implemented

Created on 8 Apr 2017  路  13Comments  路  Source: npgsql/efcore.pg

I am testing AspNetCore and EFCore 1.2.0-preview libraries and want to use npgsql as the provider.
After I switched to your myget feed

<add key="NpgsqlUnstable" value="https://www.myget.org/F/npgsql-unstable/api/v3/index.json" />

everything restores and builds fine but at runtime I get the following error:

Application started. Press Ctrl+C to shut down.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL3TVFDEOLKM": An unhandled exception was thrown by the application.
System.TypeLoadException: Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Infrastructure.Internal.NpgsqlOptionsExtension' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=1.2.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.
at Microsoft.EntityFrameworkCore.NpgsqlDbContextOptionsExtensions.UseNpgsql

I noticed that you changed the class to include the Clone method 16 days ago but the newest version on myget is 1.2.0-ci-87 which does not seem to contain this. Any idea what I could do?

Most helpful comment

If I may add, using the version 2.0.0-preview2-final with the version 2.0.0 of EF Core, will get you the following error for any database interaction.

Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.

All 13 comments

Sorry for taking so long witht his.

Unfortunately the NpgsqlUnstable nuget feed doesn't contain up to date version of Npgsql EF Core - this is because there are some issues with the CI build which pushes to that feed. So you're trying to make an "old" version of the Npgsql EF Core 1.2.0 work with newer versions of EF Core, hence the mismatch.

You can clone the Npgsql repo and build yourself - it should be quite easy - and things should work better (although there may still be some sync issues from time to time). Otherwise it's good idea to stay on the stable versions, unless there's something specific you're trying to do with 1.2.0.

Let me know if it works out for you.

Ok, thanks for answering. The reason I need the new EF Core is that I want to test all this on a Raspberry PI. It looks like ARM architectures are better (only?) supported by the 2.0 versions of .NET Core.
Assuming I would build Npgsql locally. How would I reference it? Would I need a local Nuget Repo? Thanks for you help.

Even if you need to use .NET Core 2.0, that doesn't mean you need to use EF Core 1.2.0 (or 2) - you should be perfectly fine using unstable .NET Core 2.0 with a stable version of EF Core and Npgsql...

If you do decide to build locally, you can just add a plain-old direct assembly reference without any nuget (at least to test). Of course you can also set up a company nuget feed and publish to that.

Ok, thanks. I will try it that way.

Just to give a final feedback on this issue:
I used the stable versions of EF Core and Npgsql as you suggested with .NET Core 2.0. This worked perfectly. ASP.NET + Npgsql/Postgres on Linux on a Raspberry PI. Awesome!

Great to hear!

@roji any idea on when the latest version will be available on
just trying to get ahead of all the previews bits, but can't run acceptance tests without a db :/

thanks

@roji Solved my problem as well. thank you very much.

@jaredcnance if you're referring to version 2.0 of the EF Core provider, it will probably take a couple of weeks. I have been extremely busy in the past 2 months but will have lots of spare time soon.

So what's the status on this? .NET Core 2.0/.NET Standard 2.0 was released yesterday. We've tried upgrading to see what breaks and Npgsql is one of the things that's causing trouble :)

I've been running on

    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0-preview2-final" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="2.0.0-preview1" PrivateAssets="All" />

but it'd be cool to get a final release

If I may add, using the version 2.0.0-preview2-final with the version 2.0.0 of EF Core, will get you the following error for any database interaction.

Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.

FYI 2.0.0 RTM is out, this should be gone now.

Was this page helpful?
0 / 5 - 0 ratings