Environment
Template: app ABP Studio Version: 2.1.8 (fresh solution) UI Framework: blazor-server Theme: leptonx Database Provider: ef **Database Management System: **sqlserver **Multi-Tenancy: **Yes
Steps to reproduce the issue
- Create a new ABP solution using ABP Studio 2.1.8
- Open ABP Suite and create a "Book" entity with default options, generate successfully
- Create an "Author" entity with a required navigation property to Book, generate successfully
- Re-open the Author entity in ABP Suite
- Delete the Book navigation property from Author
- Click "Save and generate"
- Generation fails with "error occurred on DB migration step"
- Inspect MenuContributor.cs — file is corrupted with invalid syntax
Exception message and full stack trace
ABP Suite reports: "error occurred on DB migration step"
After generation, AbpSolution1MenuContributor.cs contains invalid C# syntax:
context.Menu.AddItem(new ApplicationMenuItem(AbpSolution1Menus.Books, l["Menu:Books"], url: "/books", icon: "fa fa-file-alt", requiredPermissionName: AbpSolution1Permissions.Books.Default)); icon: "fa fa-file-alt" , return Task.CompletedTask; }
ABP Suite appears to have partially removed the Authors menu entry but left orphaned code fragments, corrupting the file.
Expected behavior
When removing a navigation property and regenerating:
- The MenuContributor should remain valid C#
- Menu entries should be cleanly added or removed without leaving orphaned code
Actual behavior
ABP Suite corrupts the MenuContributor file when regenerating an entity after removing a navigation property, leaving invalid syntax that prevents compilation.
1 Answer(s)
-
0
Hi, I've reproduced the problem just before and will create an issue to fix it. It will be probably included in the patch release and I've refunded your question credit. In the meantime, you can manually fix the problem. Sorry for the problem and we will fix it asap.
Best regards.