0
zhongfang created
[04:17:50 INF] Creating initial migration...
[04:17:51 INF] Creating initial migrations...
[04:18:00 ERR] Creating initial migrations process is failed! Details:
Build started...
Build succeeded.
Unable to create a 'DbContext' of type 'BlazorOneDbContext'. The exception 'The property 'IdentityPasskeyData.Transports' could not be mapped because it is of type 'string[]', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
[04:18:00 ERR] Migrations failed! A migration command didn't run successfully.
System.Exception: Migrations failed! A migration command didn't run successfully.
at async Task Volo.Abp.Cli.Commands.CreateMigrationAndRunMigratorCommand.ExecuteAsync(CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(CommandLineArgs commandLineArgs)
at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args)
Unhandled exception. System.Exception: Migrations failed! A migration command didn't run successfully.
at Volo.Abp.Cli.Commands.CreateMigrationAndRunMigratorCommand.ExecuteAsync(CommandLineArgs commandLineArgs)
at Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(CommandLineArgs commandLineArgs)
at Volo.Abp.Studio.Cli.StudioCliService.RunAsync(String[] args)
at Volo.Abp.Studio.Cli.StudioCliService.RunAsync(String[] args)
at Volo.Abp.Studio.Cli.StudioCliService.RunAsync(String[] args)
at Volo.Abp.Studio.Cli.StudioCliService.RunAsync(String[] args)
at Volo.Abp.Studio.Cli.Program.nhO5N0yAR(Object )
at Volo.Abp.Studio.Cli.Program.<Main>(String[] args)
- Steps to reproduce the issue:
- Start ABP Studio
- Update to newest version
- Create New Solution
- Run DBMigrator
1 Answer(s)
-
0
- This failure happens before ABP DbMigrator can run, while EF Core is trying to create your
BlazorOneDbContextat design-time to generate the initial migration. - The root cause is in the exception text: EF Core can’t map
IdentityPasskeyData.Transportsbecause it is astring[]. Relational EF Core providers (including MySQL) can’t map array primitives by default, so migration scaffolding fails.
Fix (recommended): upgrade ABP packages to a version that includes the fix
This issue is related to the newly introduced passkey entities in ABP 10.1.x. Update your solution to the latest patch of the ABP 10.1 line (or newer) and re-run migrations.
- Update all
Volo.Abp.*packages to the latest stable version compatible with your stack. dotnet restore- Re-run DBMigrator / “Create initial migrations”.
Workaround (if you must stay on 10.1.1): ignore/map the property in your DbContext model
Until you can upgrade, you can prevent EF Core from trying to map the array property by ignoring it in
OnModelCreating(or mapping it using a value converter to JSON/text).Ignore example (quickest to unblock migrations):
protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity<IdentityPasskey>(b => { b.OwnsOne(x => x.PasskeyData, pb => { pb.Ignore(x => x.Transports); }); }); }Note: Ignoring means
Transportswon’t be stored in the database. If you need it persisted, use a converter (e.g., JSON serialization into alongtext/textcolumn) instead.
Sources (validated):
- https://abp.io/docs/10.1/release-info/migration-guides/abp-10-1
- https://go.microsoft.com/fwlink/?linkid=851728
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
- This failure happens before ABP DbMigrator can run, while EF Core is trying to create your