Open Closed

ABP Suite: MenuContributor corrupted when removing navigation property from entity #10372


User avatar
0
granade created

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
  1. Create a new ABP solution using ABP Studio 2.1.8
  2. Open ABP Suite and create a "Book" entity with default options, generate successfully
  3. Create an "Author" entity with a required navigation property to Book, generate successfully
  4. Re-open the Author entity in ABP Suite
  5. Delete the Book navigation property from Author
  6. Click "Save and generate"
  7. Generation fails with "error occurred on DB migration step"
  8. 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:

  1. The MenuContributor should remain valid C#
  2. 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)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    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.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on January 30, 2026, 08:56
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.