title: Visual Studio 2019: Error in "locals" panel during debugging - "internal error retrieving local value"
body: <h1>Original Question</h1>
  <p>(For reproduction instruction see Update II)</p>
  <p>I recently messed around with Visual Studio 2019 during a debugging session. I pinned some properties of the class &quot;SqlCommand&quot; as &quot;Favorites&quot;. Since that moment I receive an error message &quot;internal error retrieving local value&quot; in the &quot;locals&quot;.</p>
  <p>There is a &quot;refresh&quot; button on the right of the value column, and when I hit it, I get the message &quot;Internal error in the expression evaluator.&quot;</p>
  <p>Now I am not able to unpin that specific property, because the class tree can not be opened anymore.</p>
  <p>This behavior is not bound to a specific solution, I created a new demo solution where I have the exact same issue.</p>
  <p>You can see it in the below screenshot:</p>
  <p><a href="https://i.stack.imgur.com/qHijP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qHijP.png" alt="error in Locals window" /></a></p>
  <p>The <strong>main goal</strong> would be to somehow <strong>clear the information</strong> of which property of the classes are pinned in the &quot;locals&quot; window.</p>
  <p>I already tried several things to get rid of the error.</p>
  <ul>
  <li>It seams that VS is somehow storing the information about which properties are tagged, so I tried to delete the &quot;ComponentModelCache&quot; in the AppData.</li>
  <li>I reset the settings.</li>
  <li>I use the repair tool in the installer.</li>
  <li>I deleted the *.suo file, and then I deleted the whole .vs folder.</li>
  <li>I see the same issue when i start devenv in /safemode.</li>
  <li>devenv /resetuserdata did also not help</li>
  <li>I examined the activity log, but there are no clues.</li>
  <li>I changed the Target Framework of the project from 4.7.2 to 3.5</li>
  </ul>
  <p>I use Windows Server 2019 Standard, .Net Framework 4.7.2, Visual Studio 2019 16.7.6</p>
  <p>I use the following code in the demo application:</p>
  <pre><code>private static int Main(string[] args)
  {
      SqlConnection conn = new SqlConnection();
      SqlCommand cmd = new SqlCommand();
  
      return 0;
  }
  </code></pre>
  <h1>UPDATE I</h1>
  <p>This is the pinning feature i'm talking about. I show it on the example of the WorkstationId property of the SqlConnection object (because it on the SqlCommand it does not work anymore). I believe I used it on the command text and the parameters property. <a href="https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.4#pinnable-properties-164GA" rel="noreferrer">The pinnable property is a relatively new feature introduced with 16.4</a></p>
  <p><a href="https://i.stack.imgur.com/SAaiY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SAaiY.png" alt="Pinning a property" /></a></p>
  <h1>UPDATE II: Reproduction instruction</h1>
  <ol>
  <li>Make a fresh installation of Visual Studio 2019</li>
  <li>Create a new console project</li>
  <li>Use the code that I posted above in the original question</li>
  <li>Set a breakpoint after you created the Command object</li>
  <li>Debug the project [F5]</li>
  <li>Open the &quot;Locals&quot; window.</li>
  <li>Expand the cmd variable and scroll until you find the &quot;Parameters&quot; property</li>
  <li>Pin the parameters property (as described in Update I)</li>
  <li>Stop debugging</li>
  <li>Start the debugger again</li>
  <li>Open the &quot;Locals&quot; window.</li>
  <li>You see the error &quot;internal error retrieving local value&quot;</li>
  <li>Hit the &quot;Refresh&quot; icon (it's the round arrow at the right side of the value column)</li>
  <li>You see the error &quot;Internal error in the expression evaluator&quot; as described in the original question.</li>
  </ol>
  <h1>UPDATE III (More experiments that did not help)</h1>
  <ul>
  <li>I used &quot;fix installation&quot; from the VS installer.</li>
  <li>I uninstalled and reinstalled VS.</li>
  <li>I completely deleted the whole %USER%/AppData/.../VisualStudio folder</li>
  </ul>