🛠️ Visual Studio: Fix a Stale Live Unit Test Icon After a Rename
Live Unit Testing tracks which tests cover which lines by keying its coverage glyphs to a baseline snapshot captured when the session last fully analyzed the solution. Renaming a method or class updates the compiled IL immediately, but the running Live Unit Testing session keeps showing glyphs from that last baseline until its own incremental re-analysis pass catches up, and on a large solution that pass can lag well behind the editor – leaving a red or green icon next to code that no longer matches whatever was actually last run.
🔎 The Problem
Solution Explorer / editor gutter after renaming OrderValidator -> OrderGuard: OrderGuard.Validate() [grey icon - not yet re-analyzed] <- old test results for "OrderValidator.Validate" still cached <- Live Unit Testing status bar still says "Up to date" Full rebuild + LUT reset: OrderGuard.Validate() [green icon - correct, re-baselined]
✅ The Fix
- Right-click anywhere in the editor and choose Live Unit Testing > Reset to force a fresh baseline instead of waiting on the lagging incremental pass.
- Narrow Live Unit Testing’s scope (Test > Live Unit Testing > Configure) to the projects you’re actively changing, so a rename only triggers a re-baseline for a small slice of the solution instead of all of it.
- If icons still look wrong after a Reset, stop Live Unit Testing entirely and restart it – a stuck baseline occasionally survives a plain Reset but not a full stop/start cycle.
🚨 Why This Is Dangerous
Trusting a stale green icon after a rename can hide a test that no longer even compiles against the renamed member, or a red icon can make you chase a failure that was already fixed – either way you’re debugging against a snapshot instead of the code that’s actually in the editor.
A coverage glyph only means as much as its last baseline – after a rename, trust a Reset before you trust the icon.




