Starts in:
0 DAY
0 HR
40 MIN
52 SEC
Starts in:
0 D
0 H
40 M
52 S
Open Closed

Backend code style seems to affect GRUD generation #1285


User avatar
0
LW created
  • ABP Framework version: v4.3.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: [11:12:39 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }

[11:12:39 ERR] Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') at System.Globalization.CompareInfo.IndexOf(String source, String value, Int32 startIndex, Int32 count, CompareOptions options) at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType) at System.String.IndexOf(String value, Int32 startIndex, StringComparison comparisonType) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.GemUnTEg8C(String , String , String ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.SmPUPD5FVI(String , String , Boolean ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.ry8UalTMOS(String , String , Boolean , DatabaseProvider ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.yQaUMqY0OU(String , DatabaseProvider ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.REPUDgh9L9() 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) at Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync(Guid solutionId, EntityModel entity) at lambda_method2068(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.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.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)


Hello, for some reason our code style changes to the backend code broke the CRUD page generation. I Checked the commit that broke it and it contained basically only indendation style changes. I don't understand how code style changes could affect the generation tool. I tried reverting some of the change that seemed most relevant to this with no effect. How could I try to solve this issue?

5 Answer(s)
  • User Avatar
    0
    LW created

    Hello, I narrowed this down to "Tabify" changes in the DbContext file located in EntityFrameworkCore-project. If I do indentation with spaces, the generation works. I can get the generation to go through if I indent the public "DbSet<AppUser> Users { get; set; }" line with spaces and other lines with tabs. Knowing this, we can work around this, but it would be interesting to know why this happens and what would be the correct way to handle this.

  • User Avatar
    0
    alper created
    Support Team Director

    Hi,

    Suite finds the location of the code class via RegEx expressions. And some of them are precisely fine-tuned to inject the code to the right place. If I see your DbContext.cs file I can understand the reason.

  • User Avatar
    0
    LW created

    Hi, I see and thank you for your answer. Since we are just starting the project, the DbContext.cs file is what comes out of the project generation and only the style changes were made to it. No entities were generated yet.

    I also came up with another problem with the GRUD geneation: I generated the solution with a name "ABC". This ABC represents context of the whole solution. Inside this I whould like to change the projects' names (other that Host and DBMigrator) to better describe our core context so our project structure would look like this: ABC.DbMigrator ABC.HttpApi.Host ABC.IdentityServer ABC.CoreContextName.Application ABC.CoreContextName.Application.Contracts ABC.CoreContextName.Domain ABC.CoreContextName.Domain.Shared ... and so on After this chage the generation stopped working. What would be the suggested solution to this problem or is there any at the moment?

  • User Avatar
    0
    alper created
    Support Team Director

    I have not tested Suite when project names are changed, because it assumes that ABP project names and directory names will not change. but you can try this; your project structure is saved to %UserProfile%\.abp\suite\appsettings.json. you can edit this file according to your new changes

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06