If you are upgrading to .Net 10 and use ASP.Net Identity, your Entity Framework DataContext might look like this:

public class ApplicationDbContext : IdentityDbContext
{
...

In .Net 10, changes were made to ASP.Net Identity to support WebAuthN. As a result of that, the database schema also changed.

I'm using SQLite as my database and when I tried to create a new migration it gave me this error:

Unable to create a 'DbContext' of type 'ApplicationDbContext'. The exception 'The entity type 'IdentityPasskeyData' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'.

The entity IdentityPasskeyData is not in my code base, so we can't easily change it. What we can do, is tell Entity Framework how to handle this entity. Add this code to your DbContext:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
     modelBuilder.Entity<IdentityPasskeyData>().HasNoKey();
}

Now create a migration and everything will work again.