-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Lazy loader throwing invalid operation exceptions #32390
Labels
area-dbcontext
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
Milestone
Comments
This issue is lacking enough information for us to be able to fully understand what is happening. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate. |
@ajcvickers Places to check:
|
ajcvickers
added a commit
that referenced
this issue
Dec 5, 2023
Fixes #32390 Since the DbContext is not thread-safe, lazy-loading proxies cannot be used from multiple threads _when loading is happening_. However, it is a common pattern to pass proxies to other parts of the application after the navigations have been loaded. At this time, accesses should be thread-safe. We broke this in 8.
ajcvickers
added a commit
that referenced
this issue
Dec 7, 2023
Fixes #32390 Since the DbContext is not thread-safe, lazy-loading proxies cannot be used from multiple threads _when loading is happening_. However, it is a common pattern to pass proxies to other parts of the application after the navigations have been loaded. At this time, accesses should be thread-safe. We broke this in 8.
ajcvickers
added a commit
that referenced
this issue
Dec 7, 2023
Fixes #32390 Since the DbContext is not thread-safe, lazy-loading proxies cannot be used from multiple threads _when loading is happening_. However, it is a common pattern to pass proxies to other parts of the application after the navigations have been loaded. At this time, accesses should be thread-safe. We broke this in 8.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-dbcontext
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
File a bug
Include your code
Assuming it's because of concurrent access to memory cached entities after they have been loaded and the DbContext has already been disposed.
Reproduction repository: https://github.com/MoazAlkharfan/efcore-issue-32390
Places to check:
TagsCacheService
fetch data from dbProgram
mapped/
endpointServerRequest
do get requests on the/
endpointInclude stack traces
For the first:
efcore/src/EFCore/Infrastructure/Internal/LazyLoader.cs
Lines 181 to 183 in 141740f
efcore/src/EFCore/Infrastructure/Internal/LazyLoader.cs
Lines 185 to 195 in 141740f
For the second:
Include provider and version information
EF Core version: 8.0
Database provider: (Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (.NET 8.0)
Operating system: Windows/Linux
IDE: (Visual Studio 2022 17.9)
The text was updated successfully, but these errors were encountered: