Open Closed

Setting Management UI - new setting group not saving in administration microservice .web project (Object reference null error) #5738


User avatar
0
fordz created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.2.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (microservices): yes/yes
  • Exception message and full stack trace: > Volo.Abp.SettingManagement.Web.dll!AspNetCoreGeneratedDocument.Pages_SettingManagement_Index.ExecuteAsync.AnonymousMethod__12_5() Line 148 C# Microsoft.AspNetCore.Razor.Runtime.dll!Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() Unknown Volo.Abp.SettingManagement.Web.dll!AspNetCoreGeneratedDocument.Pages_SettingManagement_Index.ExecuteAsync.AnonymousMethod__12_1() Line 174 C# Microsoft.AspNetCore.Razor.Runtime.dll!Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() Unknown Volo.Abp.SettingManagement.Web.dll!AspNetCoreGeneratedDocument.Pages_SettingManagement_Index.ExecuteAsync() Line 181 C# Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) Unknown Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context, bool invokeViewStarts) Unknown Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) Unknown Microsoft.AspNetCore.Mvc.ViewFeatures.dll!Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, string contentType, int? statusCode) Unknown ...
  • Steps to reproduce the issue: I have successfully extended (added new settings group ) to a layered (Bookstore) app following the instructions here: https://docs.abp.io/en/abp/latest/Modules/Setting-Management and can update the new settings fields.
  • However, we have a microservice solution and I'm trying to apply the same to the .web project of the AdministrationService microservice. I can get the new menu group to show and when clicked it will load the new settings. The issue is when clicking the 'save' button to persist the changes I get an 'object null reference' in the /Page/SettingManagement/Index.cshtml. The Model.SettingPageCreationContext object is null.
  • Not sure why it is 'reloading' the Settings Page and not calling the form post in the component default.js file.

Here is the file structure for the AdministrationService.Web project and the Default.cshtml.

Default.js

The Web (backend admin) application has been setup with "[DependsOn(... typeof(AdministrationServiceWebModule), typeof(AdministrationServiceHttpApiClientModule), ...)]" --- this is from the microservices template (default behavior).

Can I get some direction on how to proceed to solve this issue (what code I am missing). I cannot find any microservice example that extends the Settings Management module. I did find most of the patterns in the https://github.com/abpframework/abp/tree/dev/modules/setting-management/src/Volo.Abp.SettingManagement.Web project.

Thanks in advance.


10 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How can I reproduce this? Can you share a minimal project? liming.ma@volosoft.com

  • User Avatar
    0
    fordz created

    hi

    How can I reproduce this? Can you share a minimal project? liming.ma@volosoft.com

    Thanks for the quick response. Give me some time to create a sample microservice solution with this issue.

  • User Avatar
    0
    fordz created

    here is a microservices test project that will reproduce the error on the 'save' of the 'More Settings' group menu. *** REMOVED ***

  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    I have removed your link. Please don't share the commercial templates in public repositories. Set your repository to private and add @maliming as collaborator.

  • User Avatar
    0
    fordz created

    Apologies.. Have made the repo private and added @maliming as collaborator.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. I will run the app to test.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

  • User Avatar
    0
    fordz created

    Thanks for this.

    Have a follow-on question. Can I use dynamic proxy with the microservice solution or do I need to create a static proxy for the setting management update?

    currently, I using the following for the dynamic proxy and am getting the following error:

    abpQa5738Demo.administrationService.settingsManagement.setting.update(form).then(function (result) { $(document).trigger("AbpSettingSaved"); });

    How do I find the dynamic proxy method to call? I've looked at the AdministrationService Get endpoint - /api/abp/api-definition for the method and found ---- abpQa5738Demo.administrationService.settingsManagement.setting.update

    Thanks for your help.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    AbpQa5738Demo.AdministrationService.HttpApi.Client>  abp generate-proxy -t csharp -url https://localhost:44367/ --without-contracts -m administrationService
    

  • User Avatar
    0
    fordz created

    Thanks for the direction on this issue.

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