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
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
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
.
When generating a page for a model with two differently named fields but pointing to the same model, the outputted generated Angular component is invalid due to duplicated lookup properties.
See below for invalid output:
export abstract class AbstractGradeAlternateDetailViewService {
protected readonly fb = inject(FormBuilder);
protected readonly track = inject(TrackByService);
public readonly proxyService = inject(GradeAlternateService);
public readonly list = inject(ListService);
public readonly getGradeLookup = this.proxyService.getGradeLookup;
// The below line is being doubled up-- either we need a way to rename the property to something different or the outputted code shouldn't duplicate it a second time
// The fix workaround now is to just manually delete the below line but this change will get overwritten if the file is ever re-generated
public readonly getGradeLookup = this.proxyService.getGradeLookup;
...
}
Cause appears to be because we have two navigation properties pointing to the same model (Grade); however, this is valid C# as one of the property names is for GradeId and the other is for ParentGradeId:
I am using the CRUD Page Generator to produce models and it appears that the generated output is expecting the proxy path for the Angular service to be under a "controllers" folder; however, they are being generated just in the root HttpApi project instead. This error sounds very similar to issue reported in 2021: https://github.com/abpframework/abp/issues/9904
// Generated path below:
import { WorkAreaService } from '../../../proxy/core/controllers/work-areas/work-area.service';
// Correct path that it should be:
import { WorkAreaService } from '../../../proxy/core/work-areas/work-area.service';
export abstract class AbstractWorkAreaViewService {
protected readonly proxyService = inject(WorkAreaService);
protected readonly confirmationService = inject(ConfirmationService);
protected readonly list = inject(ListService);
data: PagedResultDto<WorkAreaDto> = {
items: [],
totalCount: 0,
};
filters = {} as GetWorkAreasInput;
delete(record: WorkAreaDto) { ... }
hookToQuery() { ... }
clearFilters() { ... }
}
Not sure if the WorkArea should be under Core.Http > Controllers > WorkAreas
but when the CRUD generator is run (and re-run), it's placing the WorkArea controller service under Core.Http > WorkAreas
:
Hi, we're seeing the same issue as reported here for the latest version of ABP (stable and preview versions) and Angular 18: https://abp.io/support/questions/7489/Proxy-generation-gives-Error-for-type-EntityAngular
Output on generating the proxy produces an invalid volo models.ts file:
export interface AggregateRoot<TKey> extends BasicAggregateRoot<TKey> {
extraProperties: Record<string, object>;
concurrencyStamp?: string;
}
export interface BasicAggregateRoot<TKey> extends Entity<TKey> {
}
export interface Entity {
}
Error message:
Error: src/app/proxy/volo/abp/domain/entities/models.ts:7:51 - error TS2315: Type 'Entity' is not generic.
7 export interface BasicAggregateRoot<TKey> extends Entity<TKey> {
~~~~~~~~~~~~
Command run to generate proxy:
abp generate-proxy -t ng -m core -u https://localhost:44311
Is there a suggested way to handle ActionResult custom endpoints e.g. suppose I have a custom controller with a custom endpoint:
namespace Core.Models.Transmittal
{
[RemoteService(Name = "Core")]
[Area("core")]
[ControllerName("Transmittal")]
[Route("api/core/transmittals")]
public class TransmittalController : TransmittalControllerBase, ITransmittalsAppService
{
[HttpGet]
[Route("my-custom-endpoint")]
public async Task<ActionResult<PagedResultDto<string>>> GetMyCustomEndpoint() { ... }
Upon running abp generate-proxy -t ng -m core -u https://localhost:44311
the output is a separate and invalid .ts file:
mvc\models.ts (note: this is invalid Typescript output; the below file does not compile)
export interface ActionResult {
}
export interface ActionResult<TValue> {
result: ActionResult;
value: TValue;
}
export interface IActionResult {
}
And in the generated proxy output transmittal.service.ts:
this.restService.request<any, ActionResult<PagedResultDto<string>>>({
method: 'GET',
url: '/api/core/transmittals/my-custom-endpoint',
params: { },
},
{ apiName: this.apiName,...config });
The endpoint only uses ActionResult to change the status response e.g. Ok() or NoContent() or some custom status code response but the actual output should just be the PagedResultDto<string>
Is there something I'm missing here? ActionResult<T> responses are a special exception so I'm not entirely sure why the mvc\models.ts output is showing the generated output of ActionResult<TValue> with a result self-referencing itself (this is invalid Typescript generation too so the output does not compile).