I'm using the new event counters in EF Core 5.0. It currently lists -2 Active DbContexts.
How can this possibly be negative? What does a negative count here indicate?
[Microsoft.EntityFrameworkCore]
Active DbContexts -2
Execution Strategy Operation Failures (Count / 1 sec) 0
Execution Strategy Operation Failures (Total) 0
Optimistic Concurrency Failures (Count / 1 sec) 0
Optimistic Concurrency Failures (Total) 0
Queries (Count / 1 sec) 0
Queries (Total) 38
Query Cache Hit Rate (%) NaN
SaveChanges (Count / 1 sec) 0
SaveChanges (Total) 0
This is after identifying and fixing a DbContext leak, where the number reported was in the thousands. I do see the number tick up (to -1) when a context is created, then back down to -2 when the context is destroyed.