Open Closed

ObjectDisposedException : Disposed instance from dependency injection using ABP and DevExpress Reporting #4394


User avatar
0
Josh created
  • ABP Framework version: v7.0.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace: ObjectDisposedException: Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. ObjectDisposed_ObjectName_Name
  • Steps to reproduce the issue:
  • Followed steps as shown here along with a few changes to get it to actually work at all: [Scoped Db Context #1265](https://support.abp.io/QA/Questions/1265), [Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed. #1698](https://support.abp.io/QA/Questions/1698/Instances-cannot-be-resolved-and-nested-lifetimes-cannot-be-created-from-this-LifetimeScope-as-it-or-one-of-its-parent-scopes-has-already-been-disposed)
  • Issue occurs randomly when using the Report Viewer, along with memory constantly increasing every time a report is viewed.
  • I have made a github repo with the relevant code from a fresh project so feel free to lookover that and give me some suggestions, thanks. Github

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

    Zoom ended the meeting because it was more than 40 minutes. I will debug it locally, just wait a while

  • User Avatar
    0
    Josh created

    Oh yip, nah that's all good, feel free to try to reproduce locally otherwise let me know if you wanna try remotely again or want help to try to reproduce it on your machine etc. Appreciate they help, thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I have reproduced the problem and am checking it out.

  • User Avatar
    0
    Josh created

    Sorry about the delay, was about to get JetBrains Rider now for you was just getting home haha, but sounds like you don't need me to now, best of luck, keep me updated, if there's anything I can do to assist let me know, otherwise thank you I appreciate the help.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This works for me, Can you try that?

    [HighlightedMember]
    public virtual BookStore.Test.Test Get()
    {
        using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: false))
        {
            Thread.Sleep(3330);
            return _repo.FirstAsync().Result;
        }
    }
    
  • User Avatar
    0
    Josh created

    Hey Maliming,

    Yeah, that seems to have worked for me at this time, if I have any more issues, I will let you know. Otherwise thank you very much I really do appreciate the help :)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

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