aspnetcore: Method 'get_ServerSideSessions' in type 'Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext`1' from assembly 'Microsoft.AspNetCore.ApiAuthorization.IdentityServer, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Unable to load one or more of the requested types. Method ‘get_ServerSideSessions’ in type ‘Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext`1’ from assembly ‘Microsoft.AspNetCore.ApiAuthorization.IdentityServer, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ does not have an implementation.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFeatureProvider.PopulateFeature(IEnumerable1 parts, ControllerFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetControllerTypes() at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetDescriptors() at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context) at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.GetChangeToken() at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllers(IEndpointRouteBuilder endpoints)
at CleanArchitecture.Blazor.Infrastructure.Extensions.ApplicationBuilderExtensions.<>c.<UseInfrastructure>b__0_3(IEndpointRouteBuilder endpoints) in C:\Users\zhuhua\Documents\GitHub\CleanArchitectureWithBlazorServer\src\Infrastructure\Extensions\ApplicationBuilderExtensions.cs:line 41
at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
at CleanArchitecture.Blazor.Infrastructure.Extensions.ApplicationBuilderExtensions.UseInfrastructure(IApplicationBuilder app, IConfiguration config) in C:\Users\zhuhua\Documents\GitHub\CleanArchitectureWithBlazorServer\src\Infrastructure\Extensions\ApplicationBuilderExtensions.cs:line 39
at Program.<<Main>$>d__0.MoveNext() in C:\Users\zhuhua\Documents\GitHub\CleanArchitectureWithBlazorServer\src\Blazor.Server.UI\Program.cs:line 55
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
7.0
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 23 (8 by maintainers)
Having the same issue.
My scenario (that might help others find this), and reason for not being able to stay on “latest patch” of identity server (6.0.4):
Automapper 12 is “required” for .NET7 due to new APIs. https://github.com/AutoMapper/AutoMapper/issues/3988, https://github.com/dotnet/runtime/issues/69119).
Identity Server < 6.2 requires AutoMapper < 12.
Referencing Identity Server 6.2.0 explicitly resolves the AutoMapper issues.
Then I got the exception this issue refers to due Microsoft.AspNetCore.ApiAuthorization.IdentityServer 7.0.0 not supporting IS 6.2.0, and migrations cannot be built/generated.
Using @hi-diego’s workaround by duplicating
ApiAuthorizationDbContextwith the addedDbSet<ServerSideSessions>resolves the initial exception, and I can now build the new Migration.But now I’m getting same exception again this time when mapping endpoints (
endpoints.MapRazorPages();). It looks like some reflection code is finding the originalApiAuthorizationDbContextwith the older interface even though it’s not used anywhere. Anyhow, I’m stuck.@MichelJansson I have created new one #46025
I think that we are behind Duende that IPersistedGrantDbContext.ServerSideSessions property implementaion. you can see the Package References
Identity -> Microsoft.AspNetCore.ApiAuthorization.IdentityServer 7.0.0 -> Duende.IdentityServer.EntityFramework (>= 6.0.4)
and you can see on Duende.IdentityServer.EntityFramework.Interfaces.IPersistedGrantDbContext.cs Definition that DbSet<ServerSideSession> ServerSideSessions is required
Hey folks, you have an update here that includes a workaround to make it work.
The TL;DR is that this is a breaking change introduced by Identity Server in a minor release (6.1.0) that breaks our package.
Unfortunately, I do not think we can do anything out of the box since we can’t make minor version upgrades during patches, and we can’t make public API changes.
With that said, the provided workaround should unblock you. If not, please let us know.
Any news about this? This is currently blocking upgrading to NET7 for us.
hello everyone, I had the same Issue, It seems like Reflection is ussed in some part on the migration creation process so I just didn’t inherit from the API ApiAuthorizationDbContext<TUser> class, instead I recreate it as follows:
And it works , i figured out that the property ServerSideSessions was not implemented in the API ApiAuthorizationDbContext<TUser> and was required by IPersistedGrantDbContext Interface so I added it in my DbContext and It works, Is werid that If I try to inherit from ApiAuthorizationDbContext<TUser> even adding the ServerSideSessions property stilll fails.
We just need to add the
property to Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext class
PR here