EF Core High Latency & Memory From Unintended Change Tracking / N+1 Queries
Loading read-only lists with tracking enabled and lazy-loading inside loops.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: EF Core High Latency & Memory From Unintended Change Tracking / N+1 Queries
Platform: DotNet
Common Root Causes:
- Loading read-only lists with tracking enabled and lazy-loading inside loops.
Interactive Diagnostic Checklist
Verified Solutions:
- Use `.AsNoTracking()`, `.Select(...)` DTO projections, or `.Include()` / `.AsSplitQuery()`.
Safe Diagnostic Command:
Enable EF Core SQL logging in Development
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Loading read-only lists with tracking enabled and lazy-loading inside loops. Recommended diagnostic: `Enable EF Core SQL logging in Development`. Remediation: Use `.AsNoTracking()`, `.Select(...)` DTO projections, or `.Include()` / `.AsSplitQuery()`.
Worked Examples
- Run `Enable EF Core SQL logging in Development` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-dotnet-efcore-n-plus-one-tracking · Independently verified: 2026-11-25