Regarding the auto-response suggestions: I checked DbContext for duplicate lines although the entire solution compiles successfully so there are no compilation issues causing it. Furthermore, I have done a full re-install of ABP Suite (both Microsoft Store version and standalone installer) so this should've cleared the internal ABP Suite cache as well.
I upgraded to ABP 9.3.0-rc.1 and then suddenly started getting this error when trying to Save and Generate existing models in my ABP solution.
What I've tried:
Any suggestions on other things to try to resolve this issue?
Error occurs shortly after Step 1 of 10 shows up:
2025-06-18 19:13:49.520 -06:00 [INF] 1/10 - EntityGenerateCommand started...
2025-06-18 19:13:51.422 -06:00 [ERR] ---------- RemoteServiceErrorInfo ----------
{
"code": null,
"message": "An internal error occurred during your request!",
"details": null,
"data": null,
"validationErrors": null
}
2025-06-18 19:13:51.426 -06:00 [ERR] startIndex ('-1') must be a non-negative value. (Parameter 'startIndex')
Actual value was -1.
System.ArgumentOutOfRangeException: startIndex ('-1') must be a non-negative value. (Parameter 'startIndex')
Actual value was -1.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex)
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.CBf4WQwZkH(Boolean , String , String )
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.gb34LXPXOW(Boolean )
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.uuX4U4GI2l()
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.ExecuteAsync(CrudPageCommandOptions options)
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.CommandManager.ExecuteAllAsync(CrudPageCommandOptions options)
at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.CrudPageGenerator.GenerateAsync(EntityModel entity, Solution solution, EntityModel masterEntity, List`1 navigationConnections)
at Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync(Guid solutionId, EntityModel entity)
at lambda_method2077(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2025-06-18 19:13:51.434 -06:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
2025-06-18 19:13:51.436 -06:00 [INF] Executed action Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync (Volo.Abp.Suite) in 3170.6099ms
2025-06-18 19:13:51.436 -06:00 [INF] Executed endpoint 'Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync (Volo.Abp.Suite)'
2025-06-18 19:13:51.436 -06:00 [INF] Request finished HTTP/1.1 POST http://localhost:3000/api/abpSuite/crudPageGenerator/e338179c-6773-451f-9cc5-31ac769167eb/save-and-generate-entity - 500 null application/json; charset=utf-8 3173.7311ms
Hi Sumeyee, I've now sent over an example to your inbox. Thanks for taking the time to review our issue.
Hi Sumeyee, I've done a switch to stable on each the main project and subprojects so that they're all using ABP Volo packages of 9.2.0
I tried deleting the schematics folder in the .suite folder in the module project, rebuilt the solution in VS as well, and then clicked "save and generate" and the same error still occurs.
The package.json of the schematics still shows up as the following though:
"name": "@volo/abp.ng.suite",
"version": "9.2.0-rc.3",
Any way to get this on 9.2.0 instead of the rc.3 version? I also updated ABP Studio from 1.0.0 to 1.0.1 which was released just today (June 13).
Alternatively, is there a way I can privately send our project to see if you can reproduce the error on your side?
Just writing to follow up on the AI response that I've already tried deleting the .suite folder and re-generated the PurchaseOrder.json from scratch. The other steps don't apply yet as the error is occurring at generation step and not within the Angular project/output itself.
I just tried paring down the PurchaseOrder.json but the generation step still fails even with a single field in it.
When I try to Save and generate the following model, the frontend Angular UI generation fails to generate/update my Angular UI. Checking the logs output shows that the step is failing due to some sort of error in the .suite\schematics program.
Version:
What I've tried:
"name": "@volo/abp.ng.suite", "version": "9.2.0-rc.3",
PurchaseOrder.json generated by ABP Studio here: https://pastebin.com/CHpftErb
2025-06-11 18:38:42.090 -06:00 [INF] 10/10 - AngularUiGenerateWithSchematicsCommand started...
2025-06-11 18:39:06.234 -06:00 [INF] Running the Angular Schematics command:
node run-schematics.mjs "C:/git/fabwerx/Fabwerx/modules/core/angular/.suite/schematics/node_modules/.bin/ng" g ".suite/schematics/collection.json:entity" module-pro Core "C:/git/fabwerx/Fabwerx/modules/core/.suite/entities/PurchaseOrder.json" "C:/git/fabwerx/Fabwerx/modules/core/angular"
2025-06-11 18:39:09.500 -06:00 [INF] Angular Schematics command failed.
C:\git\fabwerx\Fabwerx\modules\core\angular\.suite\schematics\node_modules\execa\lib\error.js:60
error = new Error(message);
^
Error: Command failed with exit code 1: .suite/schematics/node_modules/.bin/ng g .suite/schematics/collection.json:entity --template module-pro --target Core --source C:/git/fabwerx/Fabwerx/modules/core/.suite/entities/PurchaseOrder.json
[1m[31mCannot read properties of undefined (reading 'replace')[39m[22m
at makeError (C:\git\fabwerx\Fabwerx\modules\core\angular\.suite\schematics\node_modules\execa\lib\error.js:60:11)
at handlePromise (C:\git\fabwerx\Fabwerx\modules\core\angular\.suite\schematics\node_modules\execa\index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async file:///C:/git/fabwerx/Fabwerx/modules/core/angular/.suite/schematics/run-schematics.mjs:6:20 {
shortMessage: 'Command failed with exit code 1: .suite/schematics/node_modules/.bin/ng g .suite/schematics/collection.json:entity --template module-pro --target Core --source C:/git/fabwerx/Fabwerx/modules/core/.suite/entities/PurchaseOrder.json',
command: '.suite/schematics/node_modules/.bin/ng g .suite/schematics/collection.json:entity --template module-pro --target Core --source C:/git/fabwerx/Fabwerx/modules/core/.suite/entities/PurchaseOrder.json',
escapedCommand: '".suite/schematics/node_modules/.bin/ng" g ".suite/schematics/collection.json:entity" --template module-pro --target Core --source "C:/git/fabwerx/Fabwerx/modules/core/.suite/entities/PurchaseOrder.json"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: "\x1B[1m\x1B[31mCannot read properties of undefined (reading 'replace')\x1B[39m\x1B[22m",
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Node.js v22.16.0
2025-06-11 18:39:09.664 -06:00 [INF] 10/10 - AngularUiGenerateWithSchematicsCommand completed. | Duration: 27573 ms.
2025-06-11 18:39:09.664 -06:00 [INF] Entity generation completed in 37 sec.
2025-06-11 18:39:09.666 -06:00 [INF] Executing StatusCodeResult, setting HTTP status code 204
2025-06-11 18:39:09.666 -06:00 [INF] Executed action Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync (Volo.Abp.Suite) in 38039.4525ms
2025-06-11 18:39:09.666 -06:00 [INF] Executed endpoint 'Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync (Volo.Abp.Suite)'
2025-06-11 18:39:09.666 -06:00 [INF] Request finished HTTP/1.1 POST http://localhost:3000/api/abpSuite/crudPageGenerator/f7fcb191-bd0b-4ce2-bd24-dba3e4b7eb80/save-and-generate-entity - 204 null null 38043.1748ms
Thanks, that should do the trick. I had an idea that customizing one of the templates would be necessary but for some reason I couldn't seem to isolate which one to edit.
Using ABP Suite CRUD Generator, I have a model with navigation properties like so:
This produces in the DbContextModelCreatingExtensions.cs the following output:
builder.Entity<MyModel>(b =>
{
...
// optional foreign keys have DeleteBehavior.SetNull which is normally fine except when you have them pointed to the same target table multiple times like so:
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultShapesGradeId).OnDelete(DeleteBehavior.SetNull);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultPlatesGradeId).OnDelete(DeleteBehavior.SetNull);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultTubesGradeId).OnDelete(DeleteBehavior.SetNull);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultBoltsGradeId).OnDelete(DeleteBehavior.SetNull);
...
// required foreign keys have DeleteBehavior.NoAction:
b.HasOne<ContractStatus>().WithMany().IsRequired().HasForeignKey(x => x.ContractStatusId).OnDelete(DeleteBehavior.NoAction);
});
The EF Core migrations script produced though is invalid with the following error due to the fact that the Grade table is being referred in multiple FK references:
Microsoft.Data.SqlClient.SqlException (0x80131904): Introducing FOREIGN KEY constraint 'FK_AppMyModels_AppGrade_DefaultPlatesGradeId' on table 'AppMyModels' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint or index. See previous errors.
The only way to fix this is to have the DeleteBehavior.NoAction
instead of SetNull
on the 4 foreign keys to the Grade table in the above example. Changing this manually in the above file isn't ideal as it gets overwritten whenever we make a change to the model via the CRUD Generator. Is there another way to change it?
Couple things I tried:
public class CoreDbContext : AbpDbContext<CoreDbContext>, ICoreDbContext
{
...
protected override void OnModelCreating(ModelBuilder builder) {
base.OnModelCreating(builder);
builder.ConfigureCore();
// This has no effect on overriding the OnDelete behavior:
builder.Entity<MyModel>(b =>
{
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultShapesGradeId).OnDelete(DeleteBehavior.NoAction);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultPlatesGradeId).OnDelete(DeleteBehavior.NoAction);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultTubesGradeId).OnDelete(DeleteBehavior.NoAction);
b.HasOne<Grade>().WithMany().HasForeignKey(x => x.DefaultBoltsGradeId).OnDelete(DeleteBehavior.NoAction);
});
}
}
The only way that seems to also work is setting the navigation property as Required which then produces the line with DeleteBehavior.NoAction
.
Hi, I just created a project from scratch, upgraded to 9.2.0-rc.2, and then save and generated a new CRUD page with the generator (named WorkArea) and unfortunately wasn't able to reproduce the issue.
The following worked fine as expected when generated WorkArea in the MAIN project:
import { WorkAreaService } from '../../../proxy/work-areas/work-area.service';
(no controller in path)So it seems that there is something misconfigured perhaps from my older project based on an earlier 9.0.3 ABP version I think?
Workaround that seemed to work for me:
angular\.suite\schematics
from the new project to my old project and deleted the generate-proxy.json
from the src\proxy\
folder and it seems to be generating the path correctly now without the controllers
in the path.