Skip to content

Error if I query the DbSet of IdentityDbContext.UserPasskeys #64334

@luizfbicalho

Description

@luizfbicalho

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

If I create a IdentityDbContext and try to read the DBSet for the UserPasskeys I get this error

System.InvalidOperationException : Cannot create a DbSet for 'IdentityUserPasskey<int>' because this type is not included in the model for the context.

  Stack Trace: 
InternalDbSet`1.get_EntityType()
InternalDbSet`1.CheckState()
InternalDbSet`1.get_EntityQueryable()
IEnumerable<TEntity>.GetEnumerator()
List`1.ctor(IEnumerable`1 collection)
Enumerable.ToList[TSource](IEnumerable`1 source)
UnitTest1.Test1() line 17
MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

All the other entities can be read

Expected Behavior

I would expect to read the query

Steps To Reproduce

I created a test project in the https://github.com/luizfbicalho/error-passkey-aspnet-identity

tried with 3 different scenarios , one test for each, and one test that works for the others dbSets

Exceptions (if any)

System.InvalidOperationException : Cannot create a DbSet for 'IdentityUserPasskey' because this type is not included in the model for the context.

Stack Trace: 
InternalDbSet1.get_EntityType() InternalDbSet1.CheckState()
InternalDbSet1.get_EntityQueryable() IEnumerable<TEntity>.GetEnumerator() List1.ctor(IEnumerable1 collection) Enumerable.ToList[TSource](IEnumerable1 source)
UnitTest1.Test1() line 17
MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

.NET Version

.NET 10

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-identityIncludes: Identity and providers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions