Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method 'get_LockReleaseBehavior' in type 'Pomelo.EntityFrameworkCore.MySql.Migrations.Internal.MySqlHistoryRepository' from assembly 'Pomelo.EntityFrameworkCore.MySql, Version=9.0.0.0, Culture=neutral, PublicKeyToken=2cc498582444921b' does not have an implementation. #1944

Closed
fairok opened this issue Nov 13, 2024 · 11 comments

Comments

@fairok
Copy link

fairok commented Nov 13, 2024

Steps to reproduce

Ideally include a complete code listing that we can run to reproduce the issue.
Alternatively, you can provide a project/solution that we can run.

The issue

Describe what is not working as expected.

If you are seeing an exception, include the full exceptions details (message and stack trace).

Exception message:
Method 'get_LockReleaseBehavior' in type 'Pomelo.EntityFrameworkCore.MySql.Migrations.Internal.MySqlHistoryRepository' from assembly 'Pomelo.EntityFrameworkCore.MySql, Version=9.0.0.0, Culture=neutral, PublicKeyToken=2cc498582444921b' does not have an implementation.

Stack trace:
   在 Microsoft.Extensions.DependencyInjection.MySqlServiceCollectionExtensions.AddEntityFrameworkMySql(IServiceCollection serviceCollection)
   在 Pomelo.EntityFrameworkCore.MySql.Infrastructure.Internal.MySqlOptionsExtension.ApplyServices(IServiceCollection services)
   在 Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
   在 Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<GetOrAdd>g__BuildServiceProvider|4_1(IDbContextOptions _, ValueTuple`2 arguments)
   在 Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c.<GetOrAdd>b__4_0(IDbContextOptions contextOptions, ValueTuple`2 tuples)
   在 System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
   在 Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
   在 Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
   在 Maoxing.Campaign.Store.MySql.MySqlContext..ctor(DbContextOptions`1 options) 在 D:\Work\Dev\Code\git_Maoxing.Campaign\04_Code\01_Master\Maoxing.Campaign\Maoxing.Campaign.Store.MySql\MySqlContext.cs 中: 第 10 行
   在 Microsoft.EntityFrameworkCore.Internal.DbContextPool`1.Rent()
   在 Microsoft.EntityFrameworkCore.Internal.DbContextLease..ctor(IDbContextPool contextPool, Boolean standalone)
   在 Microsoft.EntityFrameworkCore.Internal.ScopedDbContextLease`1..ctor(IDbContextPool`1 contextPool)
   在 System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   在 System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   在 Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   在 Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   在 Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__5`2.<AddDbContextPool>b__5_0(IServiceProvider sp)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   在 Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   在 Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
   在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

Further technical details

MySQL version: 8.0
Operating system: Win11
Pomelo.EntityFrameworkCore.MySql version: 9.0.0-preview1
Microsoft.AspNetCore.App version: 9.0

Other details about my project setup:

@srad
Copy link

srad commented Nov 13, 2024

Same as last comment with general access to the database with EF Core 9.0, Pomelo 9.0.0-preview.1 and MySql 8.4:

System.TypeLoadException: Method 'get_LockReleaseBehavior' in type 'Pomelo.EntityFrameworkCore.MySql.Migrations.Internal.MySqlHistoryRepository' from assembly 'Pomelo.EntityFrameworkCore.MySql, Version=9.0.0.0, Culture=neutral, PublicKeyToken=2cc498582444921b' does not have an implementation.
   at Microsoft.Extensions.DependencyInjection.MySqlServiceCollectionExtensions.AddEntityFrameworkMySql(IServiceCollection serviceCollection)
   at Pomelo.EntityFrameworkCore.MySql.Infrastructure.Internal.MySqlOptionsExtension.ApplyServices(IServiceCollection services)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<GetOrAdd>g__BuildServiceProvider|4_1(IDbContextOptions _, ValueTuple`2 arguments)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c.<GetOrAdd>b__4_0(IDbContextOptions contextOptions, ValueTuple`2 tuples)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
   at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserContext`5..ctor(DbContextOptions options)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext`8..ctor(DbContextOptions options)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext`3..ctor(DbContextOptions options)
   at ....ApplicationDbContext..ctor(DbContextOptions`1 options) in C:\...\ApplicationDbContext.cs:line 25
   at InvokeStub_ApplicationDbContext..ctor(Object, Span`1)

@roji
Copy link

roji commented Nov 13, 2024

You are attempting to mix 9.0.0 EF with a non-9.0.0 version of the MySQL provider, that won't work. You'll have to wait for the 9.0.0 GA version of the MySQL provider.

@DLozanoNavas
Copy link

@roji Is there an ETA for the GA version?

@roji
Copy link

roji commented Nov 13, 2024

I'm not the maintainer of this provider; but note that this is an open-source project maintained by contributors - you'll likely have to be a bit patient.

@lauxjpn
Copy link
Collaborator

lauxjpn commented Nov 13, 2024

@DLozanoNavas For updates on our EF Core 9 support, follow #1841.

@MarkCiliaVincenti
Copy link

Note that whilst using MySql.EntityFrameworkCore 9.0.0-preview instead of Pomelo.EntityFrameworkCore.MySql, I got a very similar error:

Method 'get_LockReleaseBehavior' in type 'MySql.EntityFrameworkCore.Migrations.Internal.MySQLHistoryRepository' from assembly 'MySql.EntityFrameworkCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.

@lauxjpn
Copy link
Collaborator

lauxjpn commented Dec 8, 2024

There is now a EF Core 9.0.x compatible prerelease version available in our nightly build feeds.

@MarkCiliaVincenti
Copy link

I confirm! I went live with EFCore 9.0 and MySQL with this.

Thanks @lauxjpn!

Word of note for everyone: Visual Studio sorts prerelease releases by type. So it thinks that 9.0.0-preview.2.ci.20240426151710 is the latest prerelease version. You need to scroll down and look for 9.0.0-alpha.1.ci.20241207210245 in order to update to the latest version.

@CliffConway
Copy link

I have update to "Pomelo.EntityFrameworkCore.MySql -Version 9.0.0-alpha.1.ci.20241207210245" but still getting the error as jhouzvicka mentioned above:-
System.TypeLoadException: 'Method 'get_LockReleaseBehavior' in type 'Pomelo.EntityFrameworkCore.MySql.Migrations.Internal.MySqlHistoryRepository' from assembly 'Pomelo.EntityFrameworkCore.MySql, Version=9.0.0.0, Culture=neutral, PublicKeyToken=2cc498582444921b' does not have an implementation.'

@CliffConway
Copy link

I perform the following
Install-Package Pomelo.EntityFrameworkCore.MySql -Version 9.0.0-alpha.1.ci.20241207210245
And the output reads
Successfully installed 'Pomelo.EntityFrameworkCore.MySql 9.0.0-preview.1' to EDWDataLibrary

Should i read "9.0.0-preview.1 ?

my csproj file read

Yours confused ;-)

@lauxjpn
Copy link
Collaborator

lauxjpn commented Dec 16, 2024

@CliffConway We have released an official prerelease version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants