New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect "ObjectDisposedException" on accessing DbContext when using async methods #33672
Comments
@touchofevil-dev any chance you could submit an actual project showing the exception occuring? It's always difficult to reconstruct the exact error case from a series of snippets and text instructions. |
@roji I have update with an example of same. Hope that helps? |
Currently there's an incorrect exception message shown when accessing context generated form async methods. Code attached
EFMessageIssue.zip
How I stumbled upon this
The initial error message is quite confusing as it took a lot of time to figure out what the exact cause was. Even the synchronous approach was reached by trying to cancel out any missing async/awaits thought it was a straight forward call. This should be improved to give out appropriate message even for async methods like we do for sync methods.
Include provider and version information
EF Core version: 8.0.4
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: Win 11
IDE: Visual Studio 2022 17.9.6
The text was updated successfully, but these errors were encountered: