Open Closed

Abp Suite 5.1.2 can not generate entity in module #2466


User avatar
0
LinchArnold created

Hi guys, I use abp suite 5.1.2 to create a new module, and it can not generate entity backend service.

  1. I use it to create a new module, and build the solution.
  2. Use the CRUD Page Generator to generate a new entity.
  3. It shows 'An internal error occurred during your request!' error.
  4. the console shows Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') details.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.1.2
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): N/A
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

8 Answer(s)
  • User Avatar
    0
    LinchArnold created

    Error details:

    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.CvMwA8dFmX(String  , String  , String  )
       at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.da8wKZL4Py(String  , String  , Boolean  )
       at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.dsxw7tsdx3(String  , String  , Boolean  , DatabaseProvider  )
       at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.LM8wSX1JwZ(String  , DatabaseProvider  )
       at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.wxHwpn1kEW()
       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_method2227(Closure , Object )
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(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.&lt;InvokeNextActionFilterAsync&gt;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.&lt;InvokeInnerFilterAsync&gt;g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    
  • User Avatar
    0
    LinchArnold created

    Hi, is any support here? has someone try to generate page in Module project came across same exception?

  • User Avatar
    0
    alper created
    Support Team Director

    I tried to reproduce it with the latest but couldn't reproduce. We specifically need these 1- your entity.json 2- the following information:

    • ABP Framework version:
    • UI type: Angular / MVC / Blazor
    • DB provider: EF Core / MongoDB
    • Tiered (MVC) or Identity Server Separated (Angular):
    • Steps to reproduce the issue:
  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    @LinchArnold Have you made any changes to *{You_Project_Name}DbContext.cs file after project creation? Can you share the file content?

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    Hi again @LinchArnold,

    Now I reproduced the issue, fixed it internally and added it to next patch release.

    For now, i can provide you a simple but dirty workaround if this is urgent for you:

    1. Change the name of DbContext interface file (I{Your_Project_Name}DbContext.cs) in your project to something else (example: Random_Name.cs).
    2. Generate your entity via suite.
    3. Revert the file name.
    4. Manually add the new entity to DbContext interface file. (Line to add: DbSet<{Your_Enttiy's_Name}> {Your_Entity's_Name_Plural} { get; set; })

    Be sure to rename both MongoDb & EfCore DbContext interfaces before entity generation, but do not take any action for DbContext classes.

  • User Avatar
    0
    LinchArnold created

    Hi again @LinchArnold,

    Now I reproduced the issue, fixed it internally and added it to next patch release.

    For now, i can provide you a simple but dirty workaround if this is urgent for you:

    1. Change the name of DbContext interface file (I{Your_Project_Name}DbContext.cs) in your project to something else (example: Random_Name.cs).
    2. Generate your entity via suite.
    3. Revert the file name.
    4. Manually add the new entity to DbContext interface file. (Line to add: DbSet<{Your_Enttiy's_Name}> {Your_Entity's_Name_Plural} { get; set; })

    Be sure to rename both MongoDb & EfCore DbContext interfaces before entity generation, but do not take any action for DbContext classes.

    Hi, thanks for your reply, I'll take the steps you provide to avoid the exceptions. Best regards.

  • User Avatar
    0
    LinchArnold created

    I tried to reproduce it with the latest but couldn't reproduce. We specifically need these
    1- your entity.json
    2- the following information:

    • ABP Framework version:
    • UI type: Angular / MVC / Blazor
    • DB provider: EF Core / MongoDB
    • Tiered (MVC) or Identity Server Separated (Angular):
    • Steps to reproduce the issue:

    Hi, I am preparing a new Module project and try to reproduce it and share the project to github. But @yekalkan has reproduced the problem.

  • User Avatar
    0
    alper created
    Support Team Director

    ok thanks @yekalkan. already fixed and will be delivered in the next patch release. probably in a week or 10 days.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11