efcore.pg: MusicStore 2.0 with PostgreSQL 2.0.0-preview2-final throws Clone method not found
hi @roji , we have a fork of the asp.net musicstore demo with postgresql support: https://github.com/redhat-developer/s2i-aspnet-musicstore-ex/tree/rel/2.0-example.
We’ve updated this example to use 2.0.0-preview2-final of Npgsql.EntityFrameworkCore.PostgreSQL. At application startup, we get an exception (see below).
Do you know what may be the cause of the error?
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
Creating key {c8360f4c-09fb-4080-a8c8-3df8123d4600} with creation date 2017-08-11 17:10:15Z, activation date 2017-08-11 17:10:14Z, and expiration date 2017-11-09 17:10:14Z.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {c8360f4c-09fb-4080-a8c8-3df8123d4600} may be persisted to storage in unencrypted form.
info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
Writing data to file '/opt/app-root/.aspnet/DataProtection-Keys/key-c8360f4c-09fb-4080-a8c8-3df8123d4600.xml'.
Unhandled Exception: System.AggregateException: One or more errors occurred. (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.) ---> System.TypeLoadException: 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.
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper.<>c.<.ctor>b__6_1(TypeAndMapping tam)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper..ctor(RelationalTypeMapperDependencies dependencies)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_DatabaseCreator()
at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreatedAsync(CancellationToken cancellationToken)
at MusicStore.Models.SampleData.<InitializeMusicStoreDatabaseAsync>d__3.MoveNext() in /opt/app-root/src/samples/MusicStore/Models/SampleData.cs:line 24
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at MusicStore.Startup.Configure(IApplicationBuilder app) in /opt/app-root/src/samples/MusicStore/Startup.cs:line 202
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at MusicStore.Program.Main(String[] args) in /opt/app-root/src/samples/MusicStore/Program.cs:line 61
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 23 (2 by maintainers)
Wow, it’s really nice to see so many people caring enough about Npgsql EF Core to provide manual instructions for building 😃
I just released 2.0.0 to nuget.org, so you shouldn’t need to do anything complicated anymore. Please report any issues you run into.
Hello @roji ! Simple Sample Issues223.zip
GET http://localhost:5000/api/Test
You can build it from sources by yourself if you want.
[assembly: DesignTimeProviderServices("Microsoft.EntityFrameworkCore.Design.Internal.NpgsqlDesignTimeServices")](because current attribute value in dev branch, trying to define the class that not exists)P.S. - you can use my nuget build from here. I’ve changed package version to 1.9.9, for easy-to use update when 2.0.0 comes to NuGet packages repository.
Good afternoon. When will new version of the package be available?
@roji Thank you so much!!!
For anyone looking for a temporary work around, I was able to upgrade all of my packages to 2.0 except those related to Npgsql or Entity Framework Core. Keeping those packages at the last stable release before 2.0 allows me to at least keep my project running.
Here’s an example console application that I am targeting
netcoreapp2.0but using the old1.1.1libraries for my database connections.@wonea No c# files change in that PR so I am doubtful it covers this issue.
Temp solution: Add the attachment ddl as follows
and add reference to Npgsql nugget package
Npgsql.EntityFrameworkCore.PostgreSQL.dll.zip
Same here! Just moved everything to 2.0 and got stuck on this.
Same problem here. Itching to move to NET STANDARD 2.0!
Same problem after upgrade to 2.0