Ends in:
0 DAY
16 HRS
1 MIN
34 SEC
Ends in:
0 D
16 H
1 M
34 S
Open Closed

error: Cannot find Permissions.cs when create new entity using abp suite #7245


User avatar
0
paykoolbackend created
  • ABP Framework version: v7.1.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Exception message and full stack trace: 2024-05-24 17:05:59.936 +08:00 [INF] 6/11 - PermissionCommand started... 2024-05-24 17:05:59.937 +08:00 [WRN] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "Cannot find Permissions.cs", "details": null, "data": {}, "validationErrors": null }

2024-05-24 17:05:59.937 +08:00 [WRN] Cannot find Permissions.cs Volo.Abp.UserFriendlyException: Cannot find Permissions.cs at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.PermissionCommand.Ney8Fsho0y() at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.PermissionCommand.u7W8hAGcWy() at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.PermissionCommand.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_method1935(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.

  • Steps to reproduce the issue: when i use abp suite to create new entity and click save and generate , it show error : Cannot find Permissions.cs i have a permission.cs call XXXpermission.cs under Project.XXX.Application.Contracts.Permissions , how can allow abp to find the permission cs to generate code to pass the step 6 generate permission code?

8 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    You can call the IPermissionDefinitionManager.GetGroupsAsync in the OnApplicationInitialization. Give it a try.

  • User Avatar
    0
    paykoolbackend created

    Hello,

    You can call the IPermissionDefinitionManager.GetGroupsAsync in the OnApplicationInitialization. Give it a try.

    thanks for your quick response , but i have tried these code var permissionManager = context.ServiceProvider.GetRequiredService<IPermissionDefinitionManager>(); var permissionGroups = permissionManager.GetGroupsAsync().Result; on OnApplicationInitialization , still show the same error when generate code

  • User Avatar
    0
    paykoolbackend created

    Hello,

    You can call the IPermissionDefinitionManager.GetGroupsAsync in the OnApplicationInitialization. Give it a try.

    for your information i use dotnet version - 7.0.409 and ABP CLI 7.1.1 and window 11 , the source code is fine with window 10 , but i don't sure if it is matter or other abp version or abp setting related. Thanks.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    Thanks for the information. And your abp suite version is also the same 7.1.1, right?

    While clicking save and generate, ensure your application is not up and running. Check-in Database whether Permission tables are present or re-run DBMigrator.

    If you still face the issue, please check the logs and share more details.

    Thanks

  • User Avatar
    0
    paykoolbackend created

    An

    yes, my abp suite version is 7.1.1, application is not up and running and Permission tables are present . Permission tables are present

    log: 2024-05-24 18:31:50.845 +08:00 [INF] 1/11 - EntityGenerateCommand started... 2024-05-24 18:31:52.544 +08:00 [INF] 1/11 - EntityGenerateCommand completed. | Duration: 1697 ms. 2024-05-24 18:31:52.546 +08:00 [INF] 2/11 - RepositoryCommand started... 2024-05-24 18:31:52.733 +08:00 [INF] 2/11 - RepositoryCommand completed. | Duration: 187 ms. 2024-05-24 18:31:52.733 +08:00 [INF] 3/11 - ManagerCommand started... 2024-05-24 18:31:52.760 +08:00 [INF] 3/11 - ManagerCommand completed. | Duration: 26 ms. 2024-05-24 18:31:52.760 +08:00 [INF] 4/11 - AppServiceCommand started... 2024-05-24 18:32:00.368 +08:00 [INF] 4/11 - AppServiceCommand completed. | Duration: 7607 ms. 2024-05-24 18:32:00.369 +08:00 [INF] 5/11 - ProxyControllerCommand started... 2024-05-24 18:32:00.393 +08:00 [INF] 5/11 - ProxyControllerCommand completed. | Duration: 24 ms. 2024-05-24 18:32:00.393 +08:00 [INF] 6/11 - PermissionCommand started... 2024-05-24 18:32:00.416 +08:00 [WRN] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "Cannot find Permissions.cs", "details": null, "data": {}, "validationErrors": null }

    2024-05-24 18:32:00.417 +08:00 [WRN] Cannot find Permissions.cs Volo.Abp.UserFriendlyException: Cannot find Permissions.cs

    i think the abp suite may find the wrong namespace when finding the Permissions.cs? thanks.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is because the abp suite could not find the Permissions.cs in your solution

    You can try add a Permissions.cs to your application contract project.

  • User Avatar
    0
    paykoolbackend created

    Hi,

    This is because the abp suite could not find the Permissions.cs in your solution

    You can try add a Permissions.cs to your application contract project.

    there is MyProjectNamePermission.cs under aspnet-core\src\PayKool.CAS.Application.Contracts\Permissions already , but still is the same error [Cannot find Permissions.cs] , will the abp suite find the wrong path ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is the logic of suite looking for <YourProjectName>Permission.cs

    It expects to find the <YourProjectName>Permission.cs class file in the directory Application.Contracts\Permissions or Application.Contracts\Authorization

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19