skoruba / IdentityServer4.Admin

The administration for the IdentityServer4 and Asp.Net Core Identity
MIT License
3.57k stars 1.15k forks source link

Host terminated unexpectedly due to a missing method #991

Open abubkdar opened 2 years ago

abubkdar commented 2 years ago

Host terminated unexpectedly

I am trying to run it from source code using the solution file "Skoruba.IdentityServer4.Admin.sln" found on the root of the repository. I am able to build the solution successfully but unable to run application due to and unexpected error.

To Reproduce

Download source code from the repository. Compile and Run it in visual studio 2022. Source code built successfully but throws an error when trying to start web ( both Skoruba.IdentityServer4.Admin and Skoruba.IdentityServer4.Admin.Api)

Relevant parts of the log file

Host terminated unexpectedly
System.MissingMethodException: Method not found: 'System.String Microsoft.EntityFrameworkCore.RelationalEntityTypeExtensions.GetTableName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'.
   at Skoruba.IdentityServer4.Admin.EntityFramework.Helpers.DbContextHelpers.GetEntityTable[TDbContext](IServiceProvider serviceProvider, String entityTypeName)
   at Skoruba.IdentityServer4.Admin.Api.Helpers.StartupHelpers.AddIdSHealthChecks[TConfigurationDbContext,TPersistedGrantDbContext,TIdentityDbContext,TLogDbContext,TAuditLoggingDbContext,TDataProtectionDbContext](IServiceCollection services, IConfiguration configuration, AdminApiConfiguration adminApiConfiguration) in D:\Abubakar\personal\Learning\IdentityServer4.Admin-master\src\Skoruba.IdentityServer4.Admin.Api\Helpers\StartupHelpers.cs:line 267
   at Skoruba.IdentityServer4.Admin.Api.Startup.ConfigureServices(IServiceCollection services) in D:\Abubakar\personal\Learning\IdentityServer4.Admin-master\src\Skoruba.IdentityServer4.Admin.Api\Startup.cs:line 109
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Skoruba.IdentityServer4.Admin.Api.Program.Main(String[] args) in D:\Abubakar\personal\Learning\IdentityServer4.Admin-master\src\Skoruba.IdentityServer4.Admin.Api\Program.cs:line 24
DimaVorobevDeveloper commented 1 year ago

What method we should use instead of GetEntityTable ??

I think it is not an issue, I copied to local class the GetEntityTable method and use copy of GetEntityTable method instead of Skoruba.IdentityServer4.Admin.EntityFramework.Helpers.DbContextHelpers's method

and it works properly.

So, I will try to review my migrated code from net core 3.1 to 6.0 Maybe I forget update some assemblies.

Hope it help you