Open Closed

Blazor Component disposed issues #575


User avatar
0
mel@quadsoftpa.com created
  • **ABP Framework version: 4.0.0-rc.3
  • UI type: MVC
  • Tiered (MVC) or Identity Server Seperated (Angular): no
  • Exception message and stack trace:

I am having all sorts of trouble with this error. Sometimes it works once, sometimes not at all

This is coming from an ABP Suite generated ApplicationService

public class CountryAppService : ApplicationService, ICountryAppService

This is being utilized by a Blazor component hosted in a razor file

<app>
    <component type="typeof(CountryManager)" render-mode="ServerPrerendered" />
</app>

I had no problems whatsoever with v3.

Let me know if you require additional information. Thank you


7 Answer(s)
  • User Avatar
    0
    mel@quadsoftpa.com created

    I have a project for you to review this. Please provide an email address .

  • User Avatar
    0
    mel@quadsoftpa.com created

    . .sending linkk with code to shiwei.liang@volosoft.com

  • User Avatar
    0
    mel@quadsoftpa.com created

    Switching

    public class CountryAppService : ApplicationService, ICountryAppService
    

    to

        public class CountryAppService : CrudAppService<Country,CountryDto, string, GetCountriesInput, CountryCreateDto, CountryUpdateDto>, ICountryAppService
    

    resolved the issue

  • User Avatar
    0
    alper created
    Support Team Director

    hi, let me reproduce this issue.

    is your primary key "string"?

    also can you share your Country.json?

  • User Avatar
    0
    mel@quadsoftpa.com created

    I'm not using your default ui generation. I'm using a razor page (Index.cshtml) with a razor component inside that

    <app>
        <component type="typeof(CountryManager)" render-mode="ServerPrerendered" />
    </app>
    

    it was running fine if I inherited from CrudAppService but now I'm getting disposal is that way as well. this may have happened because I just upgraded to RC4 (which I hoped might fix the issue)

    Would you like a project to test?

  • User Avatar
    0
    alper created
    Support Team Director

    send a copy of your project so that we'll see the issue. please clear all bin & obj folders before zipping. send to info@abp.io

  • User Avatar
    0
    mel@quadsoftpa.com created

    I don't know if this is an issue with your framework or with blazor components themselves. In the end I seem to have stable results with the following:

    Iinheriting from OwningComponentBase. Note not the generic OwningComponentBase due to the Service being disposed.

    using the following code, refreshing the services if they got disposed of.

        protected IObjectMapper ObjectMapper => _objectMapper ??= ScopedServices.GetRequiredService<IObjectMapper>();
    
        protected TService Service => _service ??= ScopedServices.GetRequiredService<TService>();
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11