Error: Cannot access a disposed of object. A common cause of this error is disposing of a context 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, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing of context instances.
Solution: Below are things, you can try to fix the problem:
This is by far the most annoying error in EF Core, when you make your function an Async and start using the Thread Tasks you are in it for a Rabbit Hole. You will chain all your function calls using Async Await. What a mess!!
Linda said:
Hey folks, listen up! DO NOT CALL _context.SaveChanges without an Wait in front of it, if you do you will see all sorts of different behaviour resulting into this error. Make sure that when you are using an Async Function directive, always chain your function call using async and await. Like Jack mentioned, this is a Rabbit hole.