Start Debugging

dotnet

531 posts · Page 2 of 54

Why does EF Core forbid concurrent reads on one DbContext, even with AsNoTracking?

A read is not read-only inside a DbContext: every query mutates the shared connection, its open counter, the command and reader state, and for tracking queries the identity map. With thread-safety checks turned off on EF Core 11.0.0, parallel AsNoTracking queries on one context still failed up to 57 times in 1,000 rounds, and tracking queries left a corrupted change tracker in all but one of the rounds that finished.
Prev Next