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

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    mel@quadsoftpa.com created

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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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>();
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.